@@ -139,11 +139,14 @@ fn sexpr_to_string(s_expr: &SExpr) -> String {
139
139
}
140
140
RelOperator :: Join ( join) => {
141
141
let join_type = match join. join_type {
142
- JoinType :: Inner => "Inner" ,
143
- JoinType :: Left => "Left" ,
144
- JoinType :: Right => "Right" ,
142
+ JoinType :: Inner ( false ) => "Inner" ,
143
+ JoinType :: Inner ( true ) => "InnerAny" ,
144
+ JoinType :: Left ( false ) => "Left" ,
145
+ JoinType :: Left ( true ) => "LeftAny" ,
146
+ JoinType :: Right ( false ) => "Right" ,
147
+ JoinType :: Right ( true ) => "RightAny" ,
145
148
JoinType :: Full => "Full" ,
146
- JoinType :: Cross => "Cross" ,
149
+ JoinType :: Cross ( _ ) => "Cross" ,
147
150
JoinType :: LeftSemi => "LeftSemi" ,
148
151
JoinType :: RightSemi => "RightSemi" ,
149
152
JoinType :: LeftAnti => "LeftAnti" ,
@@ -288,7 +291,7 @@ fn run_join_filter_test(test_case: &JoinFilterTestCase, metadata: &MetadataRef)
288
291
println ! ( "Actual after pattern:\n {}" , normalized_after) ;
289
292
290
293
// Special handling for RIGHT JOIN which might be converted to INNER JOIN
291
- if test_case. join_type == JoinType :: Right {
294
+ if matches ! ( test_case. join_type, JoinType :: Right ( _ ) ) {
292
295
// Check if filter was pushed down correctly even if join type changed
293
296
let expected_filter_pushed =
294
297
normalized_after_expected. contains ( "Filter" ) && normalized_after. contains ( "Filter" ) ;
@@ -420,7 +423,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
420
423
description: "Tests that a filter on the right table join key converts LEFT JOIN to INNER JOIN" ,
421
424
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id > 10" ,
422
425
filter_expr: right_id_filter. clone( ) ,
423
- join_type: JoinType :: Left ,
426
+ join_type: JoinType :: Left ( false ) ,
424
427
before_pattern: r#"
425
428
Filter [t2.id > 10]
426
429
Left Join [t1.id = t2.id]
@@ -441,7 +444,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
441
444
description: "Tests that a complex filter with multiple conditions is handled correctly" ,
442
445
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id > 10 AND t2.value < 100" ,
443
446
filter_expr: right_combined_filter. clone( ) ,
444
- join_type: JoinType :: Left ,
447
+ join_type: JoinType :: Left ( false ) ,
445
448
before_pattern: r#"
446
449
Filter [and(t2.id > 10, t2.value < 100)]
447
450
Left Join [t1.id = t2.id]
@@ -461,7 +464,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
461
464
description: "Tests that a filter on a non-join column of the right table converts LEFT JOIN to INNER JOIN" ,
462
465
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.value < 100" ,
463
466
filter_expr: right_value_filter. clone( ) ,
464
- join_type: JoinType :: Left ,
467
+ join_type: JoinType :: Left ( false ) ,
465
468
before_pattern: r#"
466
469
Filter [t2.value < 100]
467
470
Left Join [t1.id = t2.id]
@@ -481,7 +484,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
481
484
description: "Tests that an IS NULL filter on the right table is handled correctly in LEFT JOIN" ,
482
485
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL" ,
483
486
filter_expr: is_null_filter. clone( ) ,
484
- join_type: JoinType :: Left ,
487
+ join_type: JoinType :: Left ( false ) ,
485
488
before_pattern: r#"
486
489
Filter [t2.id = Null]
487
490
Left Join [t1.id = t2.id]
@@ -502,7 +505,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
502
505
description: "Tests that an IS NOT NULL filter on the right table converts LEFT JOIN to INNER JOIN" ,
503
506
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NOT NULL" ,
504
507
filter_expr: is_not_null_filter. clone( ) ,
505
- join_type: JoinType :: Left ,
508
+ join_type: JoinType :: Left ( false ) ,
506
509
before_pattern: r#"
507
510
Filter [noteq(t2.id, Null)]
508
511
Left Join [t1.id = t2.id]
@@ -523,7 +526,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
523
526
description: "Tests a complex OR filter with multiple conditions on the right table (TPC-DS query 13 pattern)" ,
524
527
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE (t2.id > 10 AND t2.value < 50) OR (t2.id > 20 AND t2.qty < 100)" ,
525
528
filter_expr: complex_or_filter. clone( ) ,
526
- join_type: JoinType :: Left ,
529
+ join_type: JoinType :: Left ( false ) ,
527
530
before_pattern: r#"
528
531
Filter [or(and(t2.id > 10, t2.value < 50), and(t2.id > 20, t2.qty < 100))]
529
532
Left Join [t1.id = t2.id]
@@ -544,7 +547,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
544
547
description: "Tests a complex filter with AND-OR conditions including a date filter (TPC-DS query 72 pattern)" ,
545
548
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE ((t2.id > 10 AND t2.value < 50) OR (t2.id > 20 AND t2.qty < 100)) AND t2.date > 200" ,
546
549
filter_expr: complex_and_or_filter. clone( ) ,
547
- join_type: JoinType :: Left ,
550
+ join_type: JoinType :: Left ( false ) ,
548
551
before_pattern: r#"
549
552
Filter [and(or(and(t2.id > 10, t2.value < 50), and(t2.id > 20, t2.qty < 100)), t2.date > 200)]
550
553
Left Join [t1.id = t2.id]
@@ -564,7 +567,7 @@ fn test_push_down_filter_left_join() -> Result<()> {
564
567
description: "Tests a filter with an IF function (similar to CASE expression in TPC-DS query 72 pattern)" ,
565
568
sql_example: "SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE IF(t2.id = 10, 1, 0) > 0" ,
566
569
filter_expr: case_filter. clone( ) ,
567
- join_type: JoinType :: Left ,
570
+ join_type: JoinType :: Left ( false ) ,
568
571
before_pattern: r#"
569
572
Filter [if(t2.id = 10, 1, 0) > 0]
570
573
Left Join [t1.id = t2.id]
@@ -689,7 +692,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
689
692
description: "Tests that a filter on the left table is pushed down in RIGHT JOIN" ,
690
693
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE t1.a > 10" ,
691
694
filter_expr: left_a_filter. clone( ) ,
692
- join_type: JoinType :: Right ,
695
+ join_type: JoinType :: Right ( false ) ,
693
696
before_pattern: r#"
694
697
Filter [t1.a > 10]
695
698
Right Join [t1.id = t2.id]
@@ -709,7 +712,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
709
712
description: "Tests that a complex filter with multiple conditions on left table is handled correctly" ,
710
713
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE t1.a > 10 AND t1.value < 100" ,
711
714
filter_expr: left_combined_filter. clone( ) ,
712
- join_type: JoinType :: Right ,
715
+ join_type: JoinType :: Right ( false ) ,
713
716
before_pattern: r#"
714
717
Filter [and(t1.a > 10, t1.value < 100)]
715
718
Right Join [t1.id = t2.id]
@@ -729,7 +732,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
729
732
description: "Tests that an IS NULL filter on the left table is handled correctly in RIGHT JOIN" ,
730
733
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE t1.a IS NULL" ,
731
734
filter_expr: is_null_filter. clone( ) ,
732
- join_type: JoinType :: Right ,
735
+ join_type: JoinType :: Right ( false ) ,
733
736
before_pattern: r#"
734
737
Filter [t1.a = Null]
735
738
Right Join [t1.id = t2.id]
@@ -749,7 +752,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
749
752
description: "Tests that an IS NOT NULL filter on the left table is handled correctly in RIGHT JOIN" ,
750
753
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE t1.a IS NOT NULL" ,
751
754
filter_expr: is_not_null_filter. clone( ) ,
752
- join_type: JoinType :: Right ,
755
+ join_type: JoinType :: Right ( false ) ,
753
756
before_pattern: r#"
754
757
Filter [noteq(t1.a, Null)]
755
758
Right Join [t1.id = t2.id]
@@ -769,7 +772,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
769
772
description: "Tests a complex OR filter with multiple conditions on the left table" ,
770
773
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE (t1.a > 10 AND t1.value < 50) OR (t1.a > 20 AND t1.qty < 100)" ,
771
774
filter_expr: complex_or_filter. clone( ) ,
772
- join_type: JoinType :: Right ,
775
+ join_type: JoinType :: Right ( false ) ,
773
776
before_pattern: r#"
774
777
Filter [or(and(t1.a > 10, t1.value < 50), and(t1.a > 20, t1.qty < 100))]
775
778
Right Join [t1.id = t2.id]
@@ -790,7 +793,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
790
793
description: "Tests a complex filter with AND-OR conditions including a date filter on left table" ,
791
794
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE ((t1.a > 10 AND t1.value < 50) OR (t1.a > 20 AND t1.qty < 100)) AND t1.date > 200" ,
792
795
filter_expr: complex_and_or_filter. clone( ) ,
793
- join_type: JoinType :: Right ,
796
+ join_type: JoinType :: Right ( false ) ,
794
797
before_pattern: r#"
795
798
Filter [and(or(and(t1.a > 10, t1.value < 50), and(t1.a > 20, t1.qty < 100)), t1.date > 200)]
796
799
Right Join [t1.id = t2.id]
@@ -810,7 +813,7 @@ fn test_push_down_filter_right_join() -> Result<()> {
810
813
description: "Tests a filter with an IF function on left table" ,
811
814
sql_example: "SELECT * FROM t1 RIGHT JOIN t2 ON t1.id = t2.id WHERE IF(t1.a = 10, 1, 0) > 0" ,
812
815
filter_expr: case_filter. clone( ) ,
813
- join_type: JoinType :: Right ,
816
+ join_type: JoinType :: Right ( false ) ,
814
817
before_pattern: r#"
815
818
Filter [if(t1.a = 10, 1, 0) > 0]
816
819
Right Join [t1.id = t2.id]
@@ -1158,7 +1161,12 @@ fn test_push_down_complex_or_expressions() -> Result<()> {
1158
1161
1159
1162
// Create join
1160
1163
// SQL: FROM t1 INNER JOIN t2 ON t1.id = t2.id
1161
- let join = builder. join ( left_scan, right_scan, vec ! [ join_condition] , JoinType :: Inner ) ;
1164
+ let join = builder. join (
1165
+ left_scan,
1166
+ right_scan,
1167
+ vec ! [ join_condition] ,
1168
+ JoinType :: Inner ( false ) ,
1169
+ ) ;
1162
1170
1163
1171
// Create filter
1164
1172
// SQL: SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id
0 commit comments