You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Test that we can rewrite a predicate on existing fields
609
618
let predicate = Arc::new(BinaryExpr::new(
610
-
col("user_info",&logical_schema)?,
619
+
col("user_info",&logical_schema).unwrap(),
611
620
Operator::IsNotDistinctFrom,
612
621
expressions::lit(ScalarValue::Null),
613
622
))asArc<dynPhysicalExpr>;
614
623
615
-
let rewritten_predicate = rewriter.rewrite(predicate)?;
616
-
assert!(rewritten_predicate
617
-
.as_any()
618
-
.downcast_ref::<BinaryExpr>()
619
-
.is_some());
624
+
// Capture input predicate
625
+
insta::assert_snapshot!(expression_to_sql(&predicate), @"user_info IS NOT DISTINCT FROM NULL");
620
626
621
-
Ok(())
627
+
let rewritten_predicate = rewriter.rewrite(predicate).unwrap();
628
+
629
+
// Capture output predicate
630
+
insta::assert_snapshot!(expression_to_sql(&rewritten_predicate), @"struct(get_field(user_info, id), get_field(user_info, name), NULL) IS NOT DISTINCT FROM NULL");
622
631
}
623
632
624
633
/// Test end-to-end struct evolution with field type changes
let result = rewriter.rewrite(column_expr).unwrap();
676
+
677
+
// Capture output expression
678
+
insta::assert_snapshot!(expression_to_sql(&result), @"struct(CAST(get_field(event_data, timestamp) AS Timestamp(Millisecond, None)), CAST(get_field(event_data, count) AS Int64))");
671
679
}
672
680
673
681
/// Test end-to-end struct evolution with nested structs
let physical_schema = Schema::new(vec![Field::new(
885
901
"event",
@@ -926,19 +942,17 @@ mod tests {
926
942
927
943
// Create a complex predicate that references the struct
928
944
let predicate = Arc::new(BinaryExpr::new(
929
-
col("event",&logical_schema)?,
945
+
col("event",&logical_schema).unwrap(),
930
946
Operator::IsNotDistinctFrom,
931
947
expressions::lit(ScalarValue::Null),
932
948
))asArc<dynPhysicalExpr>;
933
949
934
-
let rewritten_predicate = rewriter.rewrite(predicate)?;
950
+
// Capture input expression
951
+
insta::assert_snapshot!(expression_to_sql(&predicate), @"event IS NOT DISTINCT FROM NULL");
935
952
936
-
// The predicate should be successfully rewritten
937
-
assert!(rewritten_predicate
938
-
.as_any()
939
-
.downcast_ref::<BinaryExpr>()
940
-
.is_some());
953
+
let rewritten_predicate = rewriter.rewrite(predicate).unwrap();
941
954
942
-
Ok(())
955
+
// Capture output expression
956
+
insta::assert_snapshot!(expression_to_sql(&rewritten_predicate), @"struct(get_field(event, type), struct(CAST(get_field(get_field(event, data), count) AS Int64), NULL)) IS NOT DISTINCT FROM NULL");
0 commit comments