Skip to content
Merged
Show file tree
Hide file tree
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
66 changes: 32 additions & 34 deletions datafusion-cli/src/print_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ mod tests {
.with_schema(three_column_schema())
.with_batches(vec![])
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+---+---+
| a | b | c |
+---+---+---+
+---+---+---+
"#);
");
}

#[test]
Expand All @@ -262,11 +262,11 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::No)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
1,4,7
2,5,8
3,6,9
"#);
");
}

#[test]
Expand All @@ -276,12 +276,12 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Yes)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
a,b,c
1,4,7
2,5,8
3,6,9
"#);
");
}

#[test]
Expand All @@ -291,10 +291,10 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::No)
.run();
assert_snapshot!(output, @"
1\t4\t7
2\t5\t8
3\t6\t9
assert_snapshot!(output, @r"
1 4 7
2 5 8
3 6 9
")
}

Expand All @@ -305,11 +305,11 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Yes)
.run();
assert_snapshot!(output, @"
a\tb\tc
1\t4\t7
2\t5\t8
3\t6\t9
assert_snapshot!(output, @r"
a b c
1 4 7
2 5 8
3 6 9
");
}

Expand All @@ -320,15 +320,15 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Ignored)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+---+---+
| a | b | c |
+---+---+---+
| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
+---+---+---+
"#);
");
}
#[test]
fn print_json() {
Expand All @@ -337,9 +337,7 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Ignored)
.run();
assert_snapshot!(output, @r#"
[{"a":1,"b":4,"c":7},{"a":2,"b":5,"c":8},{"a":3,"b":6,"c":9}]
"#);
assert_snapshot!(output, @r#"[{"a":1,"b":4,"c":7},{"a":2,"b":5,"c":8},{"a":3,"b":6,"c":9}]"#);
}

#[test]
Expand All @@ -363,11 +361,11 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::No)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
1,4,7
2,5,8
3,6,9
"#);
");
}
#[test]
fn print_automatic_with_header() {
Expand All @@ -376,12 +374,12 @@ mod tests {
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Yes)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
a,b,c
1,4,7
2,5,8
3,6,9
"#);
");
}

#[test]
Expand All @@ -396,15 +394,15 @@ mod tests {
.with_maxrows(max_rows)
.run();
allow_duplicates! {
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
"#);
");
}
}
}
Expand All @@ -416,7 +414,7 @@ mod tests {
.with_batches(vec![one_column_batch()])
.with_maxrows(MaxRows::Limited(1))
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+
| a |
+---+
Expand All @@ -425,7 +423,7 @@ mod tests {
| . |
| . |
+---+
"#);
");
}

#[test]
Expand All @@ -439,7 +437,7 @@ mod tests {
])
.with_maxrows(MaxRows::Limited(5))
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+
| a |
+---+
Expand All @@ -452,7 +450,7 @@ mod tests {
| . |
| . |
+---+
"#);
");
}

#[test]
Expand All @@ -464,15 +462,15 @@ mod tests {
.with_format(PrintFormat::Table)
.with_batches(vec![empty_batch.clone(), batch, empty_batch])
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+
"#);
");
}

#[test]
Expand All @@ -486,12 +484,12 @@ mod tests {
.with_batches(vec![empty_batch])
.with_header(WithHeader::Yes)
.run();
assert_snapshot!(output, @r#"
assert_snapshot!(output, @r"
+---+
| a |
+---+
+---+
"#);
");

// No output for empty batch when schema contains no columns
let empty_batch = RecordBatch::new_empty(Arc::new(Schema::empty()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ info:
- EXPLAIN SELECT 123
env:
DATAFUSION_EXPLAIN_FORMAT: pgjson
snapshot_kind: text
---
success: true
exit_code: 0
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@automatic.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@csv.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is curious / a surprising change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code probably got refactored at some point but the snapshots weren't updated

info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@json.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@nd-json.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@table.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_format@tsv.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ info:
args:
- "--command"
- EXPLAIN SELECT 123
snapshot_kind: text
---
success: true
exit_code: 0
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/tests/snapshots/cli_quick_test@files.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: tests/cli_integration.rs
source: datafusion-cli/tests/cli_integration.rs
info:
program: datafusion-cli
args:
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ mod tests {
fn test_print_schema_empty() {
let schema = DFSchema::empty();
let output = schema.tree_string();
insta::assert_snapshot!(output, @r###"root"###);
insta::assert_snapshot!(output, @"root");
}

#[test]
Expand Down
28 changes: 14 additions & 14 deletions datafusion/core/src/datasource/file_format/avro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@ mod tests {
let batches = collect(exec, task_ctx).await?;
assert_eq!(batches.len(), 1);

assert_snapshot!(batches_to_string(&batches),@r###"
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
| id | bool_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | date_string_col | string_col | timestamp_col |
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
| 4 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30332f30312f3039 | 30 | 2009-03-01T00:00:00 |
| 5 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30332f30312f3039 | 31 | 2009-03-01T00:01:00 |
| 6 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30342f30312f3039 | 30 | 2009-04-01T00:00:00 |
| 7 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30342f30312f3039 | 31 | 2009-04-01T00:01:00 |
| 2 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30322f30312f3039 | 30 | 2009-02-01T00:00:00 |
| 3 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30322f30312f3039 | 31 | 2009-02-01T00:01:00 |
| 0 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30312f30312f3039 | 30 | 2009-01-01T00:00:00 |
| 1 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30312f30312f3039 | 31 | 2009-01-01T00:01:00 |
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
"###);
assert_snapshot!(batches_to_string(&batches),@r"
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
| id | bool_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | date_string_col | string_col | timestamp_col |
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
| 4 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30332f30312f3039 | 30 | 2009-03-01T00:00:00 |
| 5 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30332f30312f3039 | 31 | 2009-03-01T00:01:00 |
| 6 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30342f30312f3039 | 30 | 2009-04-01T00:00:00 |
| 7 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30342f30312f3039 | 31 | 2009-04-01T00:01:00 |
| 2 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30322f30312f3039 | 30 | 2009-02-01T00:00:00 |
| 3 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30322f30312f3039 | 31 | 2009-02-01T00:01:00 |
| 0 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30312f30312f3039 | 30 | 2009-01-01T00:00:00 |
| 1 | false | 1 | 1 | 1 | 10 | 1.1 | 10.1 | 30312f30312f3039 | 31 | 2009-01-01T00:01:00 |
+----+----------+-------------+--------------+---------+------------+-----------+------------+------------------+------------+---------------------+
");
Ok(())
}

Expand Down
Loading
Loading