@@ -2486,7 +2486,7 @@ mod tests {
24862486 // the cast here is implicit so has CastOptions with safe=true
24872487 let expected = r#"BinaryExpr { left: Column { name: "c7", index: 2 }, op: Lt, right: Literal { value: Int64(5), field: Field { name: "lit", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, fail_on_overflow: false }"# ;
24882488
2489- assert ! ( format!( "{exec_plan:?}" ) . contains ( expected) ) ;
2489+ assert_contains ! ( format!( "{exec_plan:?}" ) , expected) ;
24902490 Ok ( ( ) )
24912491 }
24922492
@@ -2510,9 +2510,7 @@ mod tests {
25102510 & session_state,
25112511 ) ;
25122512
2513- let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL), field: Field { name: "lit", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c1"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c2"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c3")], groups: [[false, false, false], [true, false, false], [false, true, false], [false, false, true], [true, true, false], [true, false, true], [false, true, true], [true, true, true]] })"# ;
2514-
2515- assert_eq ! ( format!( "{cube:?}" ) , expected) ;
2513+ insta:: assert_snapshot!( format!( "{cube:?}" ) , @r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL), field: Field { name: "lit", data_type: Utf8, nullable: true } }, "c1"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true } }, "c2"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true } }, "c3")], groups: [[false, false, false], [true, false, false], [false, true, false], [false, false, true], [true, true, false], [true, false, true], [false, true, true], [true, true, true]] })"# ) ;
25162514
25172515 Ok ( ( ) )
25182516 }
@@ -2537,9 +2535,7 @@ mod tests {
25372535 & session_state,
25382536 ) ;
25392537
2540- let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL), field: Field { name: "lit", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c1"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c2"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }, "c3")], groups: [[true, true, true], [false, true, true], [false, false, true], [false, false, false]] })"# ;
2541-
2542- assert_eq ! ( format!( "{rollup:?}" ) , expected) ;
2538+ insta:: assert_snapshot!( format!( "{rollup:?}" ) , @r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL), field: Field { name: "lit", data_type: Utf8, nullable: true } }, "c1"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true } }, "c2"), (Literal { value: Int64(NULL), field: Field { name: "lit", data_type: Int64, nullable: true } }, "c3")], groups: [[true, true, true], [false, true, true], [false, false, true], [false, false, false]] })"# ) ;
25432539
25442540 Ok ( ( ) )
25452541 }
@@ -2677,35 +2673,12 @@ mod tests {
26772673 let logical_plan = LogicalPlan :: Extension ( Extension {
26782674 node : Arc :: new ( NoOpExtensionNode :: default ( ) ) ,
26792675 } ) ;
2680- let plan = planner
2676+ let e = planner
26812677 . create_physical_plan ( & logical_plan, & session_state)
2682- . await ;
2678+ . await
2679+ . expect_err ( "planning error" ) ;
26832680
2684- let expected_error: & str = "Error during planning: \
2685- Extension planner for NoOp created an ExecutionPlan with mismatched schema. \
2686- LogicalPlan schema: \
2687- DFSchema { inner: Schema { fields: \
2688- [Field { name: \" a\" , \
2689- data_type: Int32, \
2690- nullable: false, \
2691- dict_id: 0, \
2692- dict_is_ordered: false, metadata: {} }], \
2693- metadata: {} }, field_qualifiers: [None], \
2694- functional_dependencies: FunctionalDependencies { deps: [] } }, \
2695- ExecutionPlan schema: Schema { fields: \
2696- [Field { name: \" b\" , \
2697- data_type: Int32, \
2698- nullable: false, \
2699- dict_id: 0, \
2700- dict_is_ordered: false, metadata: {} }], \
2701- metadata: {} }";
2702- match plan {
2703- Ok ( _) => panic ! ( "Expected planning failure" ) ,
2704- Err ( e) => assert ! (
2705- e. to_string( ) . contains( expected_error) ,
2706- "Error '{e}' did not contain expected error '{expected_error}'"
2707- ) ,
2708- }
2681+ insta:: assert_snapshot!( e, @r#"Error during planning: Extension planner for NoOp created an ExecutionPlan with mismatched schema. LogicalPlan schema: DFSchema { inner: Schema { fields: [Field { name: "a", data_type: Int32 }], metadata: {} }, field_qualifiers: [None], functional_dependencies: FunctionalDependencies { deps: [] } }, ExecutionPlan schema: Schema { fields: [Field { name: "b", data_type: Int32 }], metadata: {} }"# ) ;
27092682 }
27102683
27112684 #[ tokio:: test]
@@ -2721,10 +2694,9 @@ mod tests {
27212694 let execution_plan = plan ( & logical_plan) . await ?;
27222695 // verify that the plan correctly adds cast from Int64(1) to Utf8, and the const will be evaluated.
27232696
2724- let expected = "expr: [ProjectionExpr { expr: BinaryExpr { left: BinaryExpr { left: Column { name: \ " c1\ " , index: 0 }, op: Eq, right: Literal { value: Utf8(\" a \ " ), field: Field { name: \ " lit\ " , data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: { } } } , fail_on_overflow: false }, op: Or, right: BinaryExpr { left: Column { name: \" c1 \" , index: 0 }, op: Eq, right: Literal { value: Utf8( \" 1 \" ), field: Field { name: \" lit \" , data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, fail_on_overflow: false }, fail_on_overflow: false }" ;
2697+ let expected = r# "expr: [ProjectionExpr { expr: BinaryExpr { left: BinaryExpr { left: Column { name: "c1", index: 0 }, op: Eq, right: Literal { value: Utf8("a "), field: Field { name: "lit", data_type: Utf8 } }, fail_on_overflow: false"# ;
27252698
2726- let actual = format ! ( "{execution_plan:?}" ) ;
2727- assert ! ( actual. contains( expected) , "{}" , actual) ;
2699+ assert_contains ! ( format!( "{execution_plan:?}" ) , expected) ;
27282700
27292701 Ok ( ( ) )
27302702 }
@@ -2744,7 +2716,7 @@ mod tests {
27442716
27452717 assert_contains ! (
27462718 & e,
2747- r#"Error during planning: Can not find compatible types to compare Boolean with [Struct(foo Boolean), Utf8]"#
2719+ r#"Error during planning: Can not find compatible types to compare Boolean with [Struct(" foo": Boolean), Utf8]"#
27482720 ) ;
27492721
27502722 Ok ( ( ) )
0 commit comments