Skip to content

Commit ace656a

Browse files
committed
update tests
1 parent 32a3939 commit ace656a

File tree

13 files changed

+744
-744
lines changed

13 files changed

+744
-744
lines changed

datafusion/core/tests/dataframe/dataframe_functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,8 @@ async fn test_count_wildcard() -> Result<()> {
13101310
@r"
13111311
Sort: count(*) ASC NULLS LAST [count(*):Int64]
13121312
Projection: count(*) [count(*):Int64]
1313-
Aggregate: groupBy=[[test.b]], aggr=[[count(Int64(1)) AS count(*)]] [b:UInt32, count(*):Int64]
1314-
TableScan: test [a:UInt32, b:UInt32, c:UInt32]
1313+
Aggregate: groupBy=[[test.b]], aggr=[[count(Int64(1)) AS count(*)]] [test.b:UInt32, count(*):Int64]
1314+
TableScan: test [test.a:UInt32, test.b:UInt32, test.c:UInt32]
13151315
");
13161316

13171317
Ok(())

datafusion/core/tests/dataframe/mod.rs

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ async fn with_column_renamed_join() -> Result<()> {
18631863
assert_snapshot!(
18641864
df_renamed.logical_plan(),
18651865
@r"
1866-
Projection: t1.c1 AS AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3
1866+
Projection: t1.c1 AS t1.AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3
18671867
Limit: skip=0, fetch=1
18681868
Sort: t1.c1 ASC NULLS FIRST, t1.c2 ASC NULLS FIRST, t1.c3 ASC NULLS FIRST, t2.c1 ASC NULLS FIRST, t2.c2 ASC NULLS FIRST, t2.c3 ASC NULLS FIRST
18691869
Inner Join: t1.c1 = t2.c1
@@ -1878,15 +1878,15 @@ async fn with_column_renamed_join() -> Result<()> {
18781878

18791879
assert_snapshot!(
18801880
df_renamed.clone().into_optimized_plan().unwrap(),
1881-
@r###"
1882-
Projection: t1.c1 AS AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3
1881+
@r"
1882+
Projection: t1.c1 AS t1.AAA, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3
18831883
Sort: t1.c1 ASC NULLS FIRST, t1.c2 ASC NULLS FIRST, t1.c3 ASC NULLS FIRST, t2.c1 ASC NULLS FIRST, t2.c2 ASC NULLS FIRST, t2.c3 ASC NULLS FIRST, fetch=1
18841884
Inner Join: t1.c1 = t2.c1
18851885
SubqueryAlias: t1
18861886
TableScan: aggregate_test_100 projection=[c1, c2, c3]
18871887
SubqueryAlias: t2
18881888
TableScan: aggregate_test_100 projection=[c1, c2, c3]
1889-
"###
1889+
"
18901890
);
18911891

18921892
let df_results = df_renamed.collect().await?;
@@ -3606,12 +3606,12 @@ async fn join_with_alias_filter() -> Result<()> {
36063606
let actual = formatted.trim();
36073607
assert_snapshot!(
36083608
actual,
3609-
@r###"
3610-
Projection: t1.a, t2.a, t1.b, t1.c, t2.b, t2.c [a:UInt32, a:UInt32, b:Utf8, c:Int32, b:Utf8, c:Int32]
3611-
Inner Join: t1.a + UInt32(3) = t2.a + UInt32(1) [a:UInt32, b:Utf8, c:Int32, a:UInt32, b:Utf8, c:Int32]
3612-
TableScan: t1 projection=[a, b, c] [a:UInt32, b:Utf8, c:Int32]
3613-
TableScan: t2 projection=[a, b, c] [a:UInt32, b:Utf8, c:Int32]
3614-
"###
3609+
@r"
3610+
Projection: t1.a, t2.a, t1.b, t1.c, t2.b, t2.c [t1.a:UInt32, t2.a:UInt32, t1.b:Utf8, t1.c:Int32, t2.b:Utf8, t2.c:Int32]
3611+
Inner Join: t1.a + UInt32(3) = t2.a + UInt32(1) [t1.a:UInt32, t1.b:Utf8, t1.c:Int32, t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3612+
TableScan: t1 projection=[a, b, c] [t1.a:UInt32, t1.b:Utf8, t1.c:Int32]
3613+
TableScan: t2 projection=[a, b, c] [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3614+
"
36153615
);
36163616

36173617
let results = df.collect().await?;
@@ -3651,14 +3651,14 @@ async fn right_semi_with_alias_filter() -> Result<()> {
36513651
let actual = formatted.trim();
36523652
assert_snapshot!(
36533653
actual,
3654-
@r###"
3655-
RightSemi Join: t1.a = t2.a [a:UInt32, b:Utf8, c:Int32]
3656-
Projection: t1.a [a:UInt32]
3657-
Filter: t1.c > Int32(1) [a:UInt32, c:Int32]
3658-
TableScan: t1 projection=[a, c] [a:UInt32, c:Int32]
3659-
Filter: t2.c > Int32(1) [a:UInt32, b:Utf8, c:Int32]
3660-
TableScan: t2 projection=[a, b, c] [a:UInt32, b:Utf8, c:Int32]
3661-
"###
3654+
@r"
3655+
RightSemi Join: t1.a = t2.a [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3656+
Projection: t1.a [t1.a:UInt32]
3657+
Filter: t1.c > Int32(1) [t1.a:UInt32, t1.c:Int32]
3658+
TableScan: t1 projection=[a, c] [t1.a:UInt32, t1.c:Int32]
3659+
Filter: t2.c > Int32(1) [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3660+
TableScan: t2 projection=[a, b, c] [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3661+
"
36623662
);
36633663

36643664
let results = df.collect().await?;
@@ -3698,13 +3698,13 @@ async fn right_anti_filter_push_down() -> Result<()> {
36983698
let actual = formatted.trim();
36993699
assert_snapshot!(
37003700
actual,
3701-
@r###"
3702-
RightAnti Join: t1.a = t2.a Filter: t2.c > Int32(1) [a:UInt32, b:Utf8, c:Int32]
3703-
Projection: t1.a [a:UInt32]
3704-
Filter: t1.c > Int32(1) [a:UInt32, c:Int32]
3705-
TableScan: t1 projection=[a, c] [a:UInt32, c:Int32]
3706-
TableScan: t2 projection=[a, b, c] [a:UInt32, b:Utf8, c:Int32]
3707-
"###
3701+
@r"
3702+
RightAnti Join: t1.a = t2.a Filter: t2.c > Int32(1) [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3703+
Projection: t1.a [t1.a:UInt32]
3704+
Filter: t1.c > Int32(1) [t1.a:UInt32, t1.c:Int32]
3705+
TableScan: t1 projection=[a, c] [t1.a:UInt32, t1.c:Int32]
3706+
TableScan: t2 projection=[a, b, c] [t2.a:UInt32, t2.b:Utf8, t2.c:Int32]
3707+
"
37083708
);
37093709

37103710
let results = df.collect().await?;
@@ -4382,12 +4382,12 @@ async fn unnest_with_redundant_columns() -> Result<()> {
43824382
let actual = formatted.trim();
43834383
assert_snapshot!(
43844384
actual,
4385-
@r###"
4386-
Projection: shapes.shape_id [shape_id:UInt32]
4387-
Unnest: lists[shape_id2|depth=1] structs[] [shape_id:UInt32, shape_id2:UInt32;N]
4388-
Aggregate: groupBy=[[shapes.shape_id]], aggr=[[array_agg(shapes.shape_id) AS shape_id2]] [shape_id:UInt32, shape_id2:List(Field { name: "item", data_type: UInt32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} });N]
4389-
TableScan: shapes projection=[shape_id] [shape_id:UInt32]
4390-
"###
4385+
@r#"
4386+
Projection: shapes.shape_id [shapes.shape_id:UInt32]
4387+
Unnest: lists[shape_id2|depth=1] structs[] [shapes.shape_id:UInt32, shape_id2:UInt32;N]
4388+
Aggregate: groupBy=[[shapes.shape_id]], aggr=[[array_agg(shapes.shape_id) AS shape_id2]] [shapes.shape_id:UInt32, shape_id2:List(Field { name: "item", data_type: UInt32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} });N]
4389+
TableScan: shapes projection=[shape_id] [shapes.shape_id:UInt32]
4390+
"#
43914391
);
43924392

43934393
let results = df.collect().await?;
@@ -5748,11 +5748,11 @@ async fn test_alias() -> Result<()> {
57485748
.into_unoptimized_plan()
57495749
.display_indent_schema()
57505750
.to_string();
5751-
assert_snapshot!(plan, @r###"
5752-
SubqueryAlias: table_alias [a:Utf8, b:Int32, one:Int32]
5753-
Projection: test.a, test.b, Int32(1) AS one [a:Utf8, b:Int32, one:Int32]
5754-
TableScan: test [a:Utf8, b:Int32]
5755-
"###);
5751+
assert_snapshot!(plan, @r"
5752+
SubqueryAlias: table_alias [table_alias.a:Utf8, table_alias.b:Int32, table_alias.one:Int32]
5753+
Projection: test.a, test.b, Int32(1) AS one [test.a:Utf8, test.b:Int32, one:Int32]
5754+
TableScan: test [test.a:Utf8, test.b:Int32]
5755+
");
57565756

57575757
// Select over the aliased DataFrame
57585758
let df = df.select(vec![
@@ -5822,10 +5822,10 @@ async fn test_alias_empty() -> Result<()> {
58225822
.into_unoptimized_plan()
58235823
.display_indent_schema()
58245824
.to_string();
5825-
assert_snapshot!(plan, @r###"
5826-
SubqueryAlias: [a:Utf8, b:Int32]
5827-
TableScan: test [a:Utf8, b:Int32]
5828-
"###);
5825+
assert_snapshot!(plan, @r"
5826+
SubqueryAlias: [.a:Utf8, .b:Int32]
5827+
TableScan: test [test.a:Utf8, test.b:Int32]
5828+
");
58295829

58305830
assert_snapshot!(
58315831
batches_to_sort_string(&df.select(vec![col("a"), col("b")])?.collect().await.unwrap()),
@@ -5857,12 +5857,12 @@ async fn test_alias_nested() -> Result<()> {
58575857
.into_optimized_plan()?
58585858
.display_indent_schema()
58595859
.to_string();
5860-
assert_snapshot!(plan, @r###"
5861-
SubqueryAlias: alias2 [a:Utf8, b:Int32, one:Int32]
5862-
SubqueryAlias: alias1 [a:Utf8, b:Int32, one:Int32]
5863-
Projection: test.a, test.b, Int32(1) AS one [a:Utf8, b:Int32, one:Int32]
5864-
TableScan: test projection=[a, b] [a:Utf8, b:Int32]
5865-
"###);
5860+
assert_snapshot!(plan, @r"
5861+
SubqueryAlias: alias2 [alias2.a:Utf8, alias2.b:Int32, alias2.one:Int32]
5862+
SubqueryAlias: alias1 [alias1.a:Utf8, alias1.b:Int32, alias1.one:Int32]
5863+
Projection: test.a, test.b, Int32(1) AS one [test.a:Utf8, test.b:Int32, one:Int32]
5864+
TableScan: test projection=[a, b] [test.a:Utf8, test.b:Int32]
5865+
");
58665866

58675867
// Select over the aliased DataFrame
58685868
let select1 = df

datafusion/core/tests/sql/explain_analyze.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ async fn csv_explain_plans() {
182182
actual,
183183
@r"
184184
Explain [plan_type:Utf8, plan:Utf8]
185-
Projection: aggregate_test_100.c1 [c1:Utf8View]
186-
Filter: aggregate_test_100.c2 > Int64(10) [c1:Utf8View, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8View]
187-
TableScan: aggregate_test_100 [c1:Utf8View, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8View]
185+
Projection: aggregate_test_100.c1 [aggregate_test_100.c1:Utf8View]
186+
Filter: aggregate_test_100.c2 > Int64(10) [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8, aggregate_test_100.c3:Int16, aggregate_test_100.c4:Int16, aggregate_test_100.c5:Int32, aggregate_test_100.c6:Int64, aggregate_test_100.c7:Int16, aggregate_test_100.c8:Int32, aggregate_test_100.c9:UInt32, aggregate_test_100.c10:UInt64, aggregate_test_100.c11:Float32, aggregate_test_100.c12:Float64, aggregate_test_100.c13:Utf8View]
187+
TableScan: aggregate_test_100 [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8, aggregate_test_100.c3:Int16, aggregate_test_100.c4:Int16, aggregate_test_100.c5:Int32, aggregate_test_100.c6:Int64, aggregate_test_100.c7:Int16, aggregate_test_100.c8:Int32, aggregate_test_100.c9:UInt32, aggregate_test_100.c10:UInt64, aggregate_test_100.c11:Float32, aggregate_test_100.c12:Float64, aggregate_test_100.c13:Utf8View]
188188
"
189189
);
190190
//
@@ -253,9 +253,9 @@ async fn csv_explain_plans() {
253253
actual,
254254
@r"
255255
Explain [plan_type:Utf8, plan:Utf8]
256-
Projection: aggregate_test_100.c1 [c1:Utf8View]
257-
Filter: aggregate_test_100.c2 > Int8(10) [c1:Utf8View, c2:Int8]
258-
TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [c1:Utf8View, c2:Int8]
256+
Projection: aggregate_test_100.c1 [aggregate_test_100.c1:Utf8View]
257+
Filter: aggregate_test_100.c2 > Int8(10) [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8]
258+
TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8]
259259
"
260260
);
261261
//
@@ -399,9 +399,9 @@ async fn csv_explain_verbose_plans() {
399399
actual,
400400
@r"
401401
Explain [plan_type:Utf8, plan:Utf8]
402-
Projection: aggregate_test_100.c1 [c1:Utf8View]
403-
Filter: aggregate_test_100.c2 > Int64(10) [c1:Utf8View, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8View]
404-
TableScan: aggregate_test_100 [c1:Utf8View, c2:Int8, c3:Int16, c4:Int16, c5:Int32, c6:Int64, c7:Int16, c8:Int32, c9:UInt32, c10:UInt64, c11:Float32, c12:Float64, c13:Utf8View]
402+
Projection: aggregate_test_100.c1 [aggregate_test_100.c1:Utf8View]
403+
Filter: aggregate_test_100.c2 > Int64(10) [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8, aggregate_test_100.c3:Int16, aggregate_test_100.c4:Int16, aggregate_test_100.c5:Int32, aggregate_test_100.c6:Int64, aggregate_test_100.c7:Int16, aggregate_test_100.c8:Int32, aggregate_test_100.c9:UInt32, aggregate_test_100.c10:UInt64, aggregate_test_100.c11:Float32, aggregate_test_100.c12:Float64, aggregate_test_100.c13:Utf8View]
404+
TableScan: aggregate_test_100 [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8, aggregate_test_100.c3:Int16, aggregate_test_100.c4:Int16, aggregate_test_100.c5:Int32, aggregate_test_100.c6:Int64, aggregate_test_100.c7:Int16, aggregate_test_100.c8:Int32, aggregate_test_100.c9:UInt32, aggregate_test_100.c10:UInt64, aggregate_test_100.c11:Float32, aggregate_test_100.c12:Float64, aggregate_test_100.c13:Utf8View]
405405
"
406406
);
407407
//
@@ -470,9 +470,9 @@ async fn csv_explain_verbose_plans() {
470470
actual,
471471
@r"
472472
Explain [plan_type:Utf8, plan:Utf8]
473-
Projection: aggregate_test_100.c1 [c1:Utf8View]
474-
Filter: aggregate_test_100.c2 > Int8(10) [c1:Utf8View, c2:Int8]
475-
TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [c1:Utf8View, c2:Int8]
473+
Projection: aggregate_test_100.c1 [aggregate_test_100.c1:Utf8View]
474+
Filter: aggregate_test_100.c2 > Int8(10) [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8]
475+
TableScan: aggregate_test_100 projection=[c1, c2], partial_filters=[aggregate_test_100.c2 > Int8(10)] [aggregate_test_100.c1:Utf8View, aggregate_test_100.c2:Int8]
476476
"
477477
);
478478
//

datafusion/expr/src/logical_plan/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'n> TreeNodeVisitor<'n> for IndentVisitor<'_, '_> {
7272
write!(self.f, "{:indent$}", "", indent = self.indent * 2)?;
7373
write!(self.f, "{}", plan.display())?;
7474
if self.with_schema {
75-
write!(self.f, " {}", display_df_schema(&plan.schema().as_ref()))?;
75+
write!(self.f, " {}", display_df_schema(plan.schema().as_ref()))?;
7676
}
7777

7878
self.indent += 1;

datafusion/expr/src/logical_plan/plan.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,8 +1595,8 @@ impl LogicalPlan {
15951595
/// // Format using display_indent_schema
15961596
/// let display_string = format!("{}", plan.display_indent_schema());
15971597
///
1598-
/// assert_eq!("Filter: t1.id = Int32(5) [id:Int32]\
1599-
/// \n TableScan: t1 [id:Int32]",
1598+
/// assert_eq!("Filter: t1.id = Int32(5) [t1.id:Int32]\
1599+
/// \n TableScan: t1 [t1.id:Int32]",
16001600
/// display_string);
16011601
/// ```
16021602
pub fn display_indent_schema(&self) -> impl Display + '_ {
@@ -4270,11 +4270,11 @@ mod tests {
42704270
let plan = display_plan()?;
42714271

42724272
assert_snapshot!(plan.display_indent_schema(), @r"
4273-
Projection: employee_csv.id [id:Int32]
4274-
Filter: employee_csv.state IN (<subquery>) [id:Int32, state:Utf8]
4275-
Subquery: [state:Utf8]
4276-
TableScan: employee_csv projection=[state] [state:Utf8]
4277-
TableScan: employee_csv projection=[id, state] [id:Int32, state:Utf8]
4273+
Projection: employee_csv.id [employee_csv.id:Int32]
4274+
Filter: employee_csv.state IN (<subquery>) [employee_csv.id:Int32, employee_csv.state:Utf8]
4275+
Subquery: [employee_csv.state:Utf8]
4276+
TableScan: employee_csv projection=[state] [employee_csv.state:Utf8]
4277+
TableScan: employee_csv projection=[id, state] [employee_csv.id:Int32, employee_csv.state:Utf8]
42784278
");
42794279
Ok(())
42804280
}

0 commit comments

Comments
 (0)