Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ impl DFSchema {
.zip(self.inner.fields().iter())
.map(|(qualifier, field)| (qualifier.as_ref(), field))
}
/// Print schema in tree format
/// Returns a tree-like string representation of the schema.
///
/// This method formats the schema
/// with a tree-like structure showing field names, types, and nullability.
Expand All @@ -896,12 +896,12 @@ impl DFSchema {
/// HashMap::new()
/// ).unwrap();
///
/// assert_eq!(schema.print_schema_tree().to_string(),
/// assert_eq!(schema.tree_string().to_string(),
/// r#"root
/// |-- id: int32 (nullable = false)
/// |-- name: utf8 (nullable = true)"#);
/// ```
pub fn print_schema_tree(&self) -> impl Display + '_ {
pub fn tree_string(&self) -> impl Display + '_ {
let mut result = String::from("root\n");

for (qualifier, field) in self.iter() {
Expand Down Expand Up @@ -1982,7 +1982,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand All @@ -2004,7 +2004,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down Expand Up @@ -2042,7 +2042,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();
insta::assert_snapshot!(output, @r"
root
|-- id: int32 (nullable = false)
Expand All @@ -2058,7 +2058,7 @@ mod tests {
#[test]
fn test_print_schema_empty() {
let schema = DFSchema::empty();
let output = schema.print_schema_tree();
let output = schema.tree_string();
insta::assert_snapshot!(output, @r###"root"###);
}

Expand Down Expand Up @@ -2131,7 +2131,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down Expand Up @@ -2174,7 +2174,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down Expand Up @@ -2213,7 +2213,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down Expand Up @@ -2355,7 +2355,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down Expand Up @@ -2430,7 +2430,7 @@ mod tests {
)
.unwrap();

let output = schema.print_schema_tree();
let output = schema.tree_string();

insta::assert_snapshot!(output, @r"
root
Expand Down