From a02297b8b0ec777412852b91bcac45571e2130f7 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 14:03:26 +0800 Subject: [PATCH 1/9] chore(planner): improve physical join --- .../src/executor/physical_plans/physical_join.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/query/sql/src/executor/physical_plans/physical_join.rs b/src/query/sql/src/executor/physical_plans/physical_join.rs index 9ef68c7a5301..1e703b76e3f2 100644 --- a/src/query/sql/src/executor/physical_plans/physical_join.rs +++ b/src/query/sql/src/executor/physical_plans/physical_join.rs @@ -46,8 +46,17 @@ pub fn physical_join(join: &Join, s_expr: &SExpr) -> Result { return Ok(PhysicalJoinType::Hash); } - let left_prop = RelExpr::with_s_expr(s_expr.child(1)?).derive_relational_prop()?; - let right_prop = RelExpr::with_s_expr(s_expr.child(0)?).derive_relational_prop()?; + let left_rel_expr = RelExpr::with_s_expr(s_expr.child(0)?); + let right_rel_expr = RelExpr::with_s_expr(s_expr.child(1)?); + if left_rel_expr.derive_cardinality()?.cardinality <= 1.0 + || right_rel_expr.derive_cardinality()?.cardinality <= 1.0 + { + // If the cardinality is less than or equal to 1, We use CROSS JOIN + FILTER instead of MERGE JOIN. + return Ok(PhysicalJoinType::Hash); + } + + let left_prop = left_rel_expr.derive_relational_prop()?; + let right_prop = right_rel_expr.derive_relational_prop()?; let mut range_conditions = vec![]; let mut other_conditions = vec![]; for condition in join.non_equi_conditions.iter() { From efab4ae5b275d2fb704f62adf028e51bd1e0dce5 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 14:03:37 +0800 Subject: [PATCH 2/9] chore(test): add sqllogictest --- .../suites/mode/standalone/explain/join.test | 44 +++++++++++++++++++ .../mode/standalone/explain_native/join.test | 44 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/tests/sqllogictests/suites/mode/standalone/explain/join.test b/tests/sqllogictests/suites/mode/standalone/explain/join.test index 924a5e633db7..7e3386512f56 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/join.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/join.test @@ -940,3 +940,47 @@ EvalScalar statement ok drop table t1; + +statement ok +CREATE OR REPLACE TABLE t1(a INT); + +statement ok +CREATE OR REPLACE TABLE t2(a INT); + +statement ok +INSERT INTO t1 VALUES(1), (2), (3), (4); + +statement ok +INSERT INTO t2 VALUES(1); + +query T +EXPLAIN SELECT * FROM t1 WHERE a >= (SELECT MAX(a) FROM t2); +---- +HashJoin +├── output columns: [t1.a (#0)] +├── join type: INNER +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) >= CAST(scalar_subquery_2 (#2) AS Int32 NULL)] +├── estimated rows: 4.00 +├── EvalScalar(Build) +│ ├── output columns: [MAX(a) (#2)] +│ ├── expressions: [1] +│ ├── estimated rows: 1.00 +│ └── DummyTableScan +└── TableScan(Probe) + ├── table: default.default.t1 + ├── output columns: [a (#0)] + ├── read rows: 4 + ├── read size: < 1 KiB + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── pruning stats: [segments: , blocks: ] + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 4.00 + +statement ok +DROP TABLE t1; + +statement ok +DROP TABLE t2; diff --git a/tests/sqllogictests/suites/mode/standalone/explain_native/join.test b/tests/sqllogictests/suites/mode/standalone/explain_native/join.test index 223721f153ff..8cd00b0d7dc8 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain_native/join.test +++ b/tests/sqllogictests/suites/mode/standalone/explain_native/join.test @@ -634,3 +634,47 @@ set enable_cbo = 1 statement ok drop table t1 + +statement ok +CREATE OR REPLACE TABLE t1(a INT); + +statement ok +CREATE OR REPLACE TABLE t2(a INT); + +statement ok +INSERT INTO t1 VALUES(1), (2), (3), (4); + +statement ok +INSERT INTO t2 VALUES(1); + +query T +EXPLAIN SELECT * FROM t1 WHERE a >= (SELECT MAX(a) FROM t2); +---- +HashJoin +├── output columns: [t1.a (#0)] +├── join type: INNER +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) >= CAST(scalar_subquery_2 (#2) AS Int32 NULL)] +├── estimated rows: 4.00 +├── EvalScalar(Build) +│ ├── output columns: [MAX(a) (#2)] +│ ├── expressions: [1] +│ ├── estimated rows: 1.00 +│ └── DummyTableScan +└── TableScan(Probe) + ├── table: default.default.t1 + ├── output columns: [a (#0)] + ├── read rows: 4 + ├── read size: < 1 KiB + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── pruning stats: [segments: , blocks: ] + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 4.00 + +statement ok +DROP TABLE t1; + +statement ok +DROP TABLE t2; From 874fc79b7fdde01232e861438cd2a23b9a91e819 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 14:06:38 +0800 Subject: [PATCH 3/9] chore(code): refine comments. --- src/query/sql/src/executor/physical_plans/physical_join.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/query/sql/src/executor/physical_plans/physical_join.rs b/src/query/sql/src/executor/physical_plans/physical_join.rs index 1e703b76e3f2..815e4a0a9223 100644 --- a/src/query/sql/src/executor/physical_plans/physical_join.rs +++ b/src/query/sql/src/executor/physical_plans/physical_join.rs @@ -51,7 +51,7 @@ pub fn physical_join(join: &Join, s_expr: &SExpr) -> Result { if left_rel_expr.derive_cardinality()?.cardinality <= 1.0 || right_rel_expr.derive_cardinality()?.cardinality <= 1.0 { - // If the cardinality is less than or equal to 1, We use CROSS JOIN + FILTER instead of MERGE JOIN. + // If the cardinality is less than or equal to 1, we use CROSS JOIN + FILTER instead of MERGE JOIN. return Ok(PhysicalJoinType::Hash); } From 830da214490ed19d94953f2842ea96deae2cafa3 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 14:56:29 +0800 Subject: [PATCH 4/9] chore(test): update sqllogictest --- .../mode/standalone/explain/infer_filter.test | 26 ++++++++++--------- .../explain_native/infer_filter.test | 26 ++++++++++--------- .../sqllogictests/suites/tpch/join_order.test | 12 ++++----- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test b/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test index 9b379ba627c2..820f59100260 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test @@ -609,13 +609,14 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t2.a > 10; ---- -MergeJoin -├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] +HashJoin +├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] ├── join type: INNER -├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] -├── other conditions: [] +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) > t2.a (#2)] ├── estimated rows: 0.00 -├── Filter(Left) +├── Filter(Build) │ ├── output columns: [t2.a (#2), t2.b (#3)] │ ├── filters: [t2.a (#2) > 10] │ ├── estimated rows: 0.00 @@ -628,7 +629,7 @@ MergeJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [t2.a (#2) > 10], limit: NONE] │ └── estimated rows: 0.00 -└── Filter(Right) +└── Filter(Probe) ├── output columns: [t1.a (#0), t1.b (#1)] ├── filters: [t1.a (#0) > 5] ├── estimated rows: 0.00 @@ -646,13 +647,14 @@ MergeJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t1.a > 10; ---- -MergeJoin -├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] +HashJoin +├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] ├── join type: INNER -├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] -├── other conditions: [] +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) > t2.a (#2)] ├── estimated rows: 0.00 -├── TableScan(Left) +├── TableScan(Build) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -661,7 +663,7 @@ MergeJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [], limit: NONE] │ └── estimated rows: 0.00 -└── Filter(Right) +└── Filter(Probe) ├── output columns: [t1.a (#0), t1.b (#1)] ├── filters: [t1.a (#0) > 10] ├── estimated rows: 0.00 diff --git a/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test b/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test index 3c86a2b9fe63..760d9e0f8c83 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test +++ b/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test @@ -489,13 +489,14 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t2.a > 10; ---- -MergeJoin -├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] +HashJoin +├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] ├── join type: INNER -├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] -├── other conditions: [] +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) > t2.a (#2)] ├── estimated rows: 0.00 -├── TableScan(Left) +├── TableScan(Build) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -504,7 +505,7 @@ MergeJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [t2.a (#2) > 10], limit: NONE] │ └── estimated rows: 0.00 -└── TableScan(Right) +└── TableScan(Probe) ├── table: default.default.t1 ├── output columns: [a (#0), b (#1)] ├── read rows: 0 @@ -518,13 +519,14 @@ MergeJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t1.a > 10; ---- -MergeJoin -├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] +HashJoin +├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] ├── join type: INNER -├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] -├── other conditions: [] +├── build keys: [] +├── probe keys: [] +├── filters: [t1.a (#0) > t2.a (#2)] ├── estimated rows: 0.00 -├── TableScan(Left) +├── TableScan(Build) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -533,7 +535,7 @@ MergeJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [], limit: NONE] │ └── estimated rows: 0.00 -└── TableScan(Right) +└── TableScan(Probe) ├── table: default.default.t1 ├── output columns: [a (#0), b (#1)] ├── read rows: 0 diff --git a/tests/sqllogictests/suites/tpch/join_order.test b/tests/sqllogictests/suites/tpch/join_order.test index 44669fc4e3bb..260dc8daf55b 100644 --- a/tests/sqllogictests/suites/tpch/join_order.test +++ b/tests/sqllogictests/suites/tpch/join_order.test @@ -532,8 +532,8 @@ group by order by value desc limit 100; ---- -RangeJoin: INNER -├── Left +HashJoin: INNER +├── Build │ └── HashJoin: INNER │ ├── Build │ │ └── HashJoin: INNER @@ -543,7 +543,7 @@ RangeJoin: INNER │ │ └── Scan: default.tpch_test.supplier (#4) (read rows: 1000) │ └── Probe │ └── Scan: default.tpch_test.partsupp (#3) (read rows: 80000) -└── Right +└── Probe └── HashJoin: INNER ├── Build │ └── HashJoin: INNER @@ -1104,10 +1104,10 @@ order by ---- HashJoin: RIGHT ANTI ├── Build -│ └── RangeJoin: INNER -│ ├── Left +│ └── HashJoin: INNER +│ ├── Build │ │ └── Scan: default.tpch_test.customer (#1) (read rows: 15000) -│ └── Right +│ └── Probe │ └── Scan: default.tpch_test.customer (#0) (read rows: 15000) └── Probe └── Scan: default.tpch_test.orders (#2) (read rows: 150000) From e760fb1369900ee14219d624d99785030cbdb039 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 16:01:59 +0800 Subject: [PATCH 5/9] chore(test): test iceberg --- .../suites/tpch_iceberg/queries.test | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/sqllogictests/suites/tpch_iceberg/queries.test b/tests/sqllogictests/suites/tpch_iceberg/queries.test index bf656f0bbe1a..ed8cfabaf568 100644 --- a/tests/sqllogictests/suites/tpch_iceberg/queries.test +++ b/tests/sqllogictests/suites/tpch_iceberg/queries.test @@ -412,6 +412,37 @@ order by 2455 Customer#000002455 481592.405 2070.99 GERMANY RVn1ZSRtLqPlJLIZxvpmsbgC02 17-946-225-9977 al asymptotes. finally ironic accounts cajole furiously. permanently unusual theodolites aro 12106 Customer#000012106 479414.213 5342.11 UNITED STATES wth3twOmu6vy 34-905-346-4472 ly after the blithely regular foxes. accounts haggle carefully alongside of the blithely even ideas. +query I +explain analyze select + ps_partkey, + sum(ps_supplycost * ps_availqty) as value +from + ctl.tpch.partsupp, + ctl.tpch.supplier, + ctl.tpch.nation +where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'GERMANY' +group by + ps_partkey having + sum(ps_supplycost * ps_availqty) > ( + select + sum(ps_supplycost * ps_availqty) * 0.000002 + from + ctl.tpch.partsupp, + ctl.tpch.supplier, + ctl.tpch.nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'GERMANY' + ) +order by + value desc limit 100; +---- +1 + # Q11 query I select From 2deb8b769490a1ebf2589d39071170e9fc915a10 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 16:46:01 +0800 Subject: [PATCH 6/9] chore(test): test iceberg --- .../hash_join/probe_join/inner_join.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs b/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs index 51bcbbbb4cc6..b4e675f20278 100644 --- a/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs +++ b/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs @@ -90,9 +90,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE && match_count > 1 { - return Err(ErrorCode::Internal( - "Scalar subquery can't return more than one row", - )); + // return Err(ErrorCode::Internal( + // "Scalar subquery can't return more than one row", + // )); } // Fill `probe_indexes`. @@ -128,9 +128,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE && match_count > 1 { - return Err(ErrorCode::Internal( - "Scalar subquery can't return more than one row", - )); + // return Err(ErrorCode::Internal( + // "Scalar subquery can't return more than one row", + // )); } // Fill `probe_indexes`. @@ -281,9 +281,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE { - return Err(ErrorCode::Internal( - "Scalar subquery can't return more than one row", - )); + // return Err(ErrorCode::Internal( + // "Scalar subquery can't return more than one row", + // )); } for i in 0..match_count { @@ -310,9 +310,9 @@ impl HashJoinProbeState { next_idx += 1; } else { if FROM_LEFT_SINGLE { - return Err(ErrorCode::Internal( - "Scalar subquery can't return more than one row", - )); + // return Err(ErrorCode::Internal( + // "Scalar subquery can't return more than one row", + // )); } pointers[key_idx] = next_matched_ptr; } From 71237b1d640943be1e657cf039749ce42642d73c Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 17:30:15 +0800 Subject: [PATCH 7/9] chore(planner): fix join type --- .../hash_join/probe_join/inner_join.rs | 24 +++++++++---------- .../executor/physical_plans/physical_join.rs | 12 ++++++---- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs b/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs index b4e675f20278..51bcbbbb4cc6 100644 --- a/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs +++ b/src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs @@ -90,9 +90,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE && match_count > 1 { - // return Err(ErrorCode::Internal( - // "Scalar subquery can't return more than one row", - // )); + return Err(ErrorCode::Internal( + "Scalar subquery can't return more than one row", + )); } // Fill `probe_indexes`. @@ -128,9 +128,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE && match_count > 1 { - // return Err(ErrorCode::Internal( - // "Scalar subquery can't return more than one row", - // )); + return Err(ErrorCode::Internal( + "Scalar subquery can't return more than one row", + )); } // Fill `probe_indexes`. @@ -281,9 +281,9 @@ impl HashJoinProbeState { } if FROM_LEFT_SINGLE { - // return Err(ErrorCode::Internal( - // "Scalar subquery can't return more than one row", - // )); + return Err(ErrorCode::Internal( + "Scalar subquery can't return more than one row", + )); } for i in 0..match_count { @@ -310,9 +310,9 @@ impl HashJoinProbeState { next_idx += 1; } else { if FROM_LEFT_SINGLE { - // return Err(ErrorCode::Internal( - // "Scalar subquery can't return more than one row", - // )); + return Err(ErrorCode::Internal( + "Scalar subquery can't return more than one row", + )); } pointers[key_idx] = next_matched_ptr; } diff --git a/src/query/sql/src/executor/physical_plans/physical_join.rs b/src/query/sql/src/executor/physical_plans/physical_join.rs index 815e4a0a9223..f8676ca91e36 100644 --- a/src/query/sql/src/executor/physical_plans/physical_join.rs +++ b/src/query/sql/src/executor/physical_plans/physical_join.rs @@ -48,10 +48,14 @@ pub fn physical_join(join: &Join, s_expr: &SExpr) -> Result { let left_rel_expr = RelExpr::with_s_expr(s_expr.child(0)?); let right_rel_expr = RelExpr::with_s_expr(s_expr.child(1)?); - if left_rel_expr.derive_cardinality()?.cardinality <= 1.0 - || right_rel_expr.derive_cardinality()?.cardinality <= 1.0 - { - // If the cardinality is less than or equal to 1, we use CROSS JOIN + FILTER instead of MERGE JOIN. + if matches!( + right_rel_expr + .derive_cardinality()? + .statistics + .precise_cardinality, + Some(1) + ) { + // If the output rows of build side is equal to 1, we use CROSS JOIN + FILTER instead of MERGE JOIN. return Ok(PhysicalJoinType::Hash); } From 960b4aa47d052fb0b6031f2286d2f90a9ad2378f Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 17:30:27 +0800 Subject: [PATCH 8/9] chore(test): update sqllogictest --- .../suites/tpch_iceberg/queries.test | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/tests/sqllogictests/suites/tpch_iceberg/queries.test b/tests/sqllogictests/suites/tpch_iceberg/queries.test index ed8cfabaf568..bf656f0bbe1a 100644 --- a/tests/sqllogictests/suites/tpch_iceberg/queries.test +++ b/tests/sqllogictests/suites/tpch_iceberg/queries.test @@ -412,37 +412,6 @@ order by 2455 Customer#000002455 481592.405 2070.99 GERMANY RVn1ZSRtLqPlJLIZxvpmsbgC02 17-946-225-9977 al asymptotes. finally ironic accounts cajole furiously. permanently unusual theodolites aro 12106 Customer#000012106 479414.213 5342.11 UNITED STATES wth3twOmu6vy 34-905-346-4472 ly after the blithely regular foxes. accounts haggle carefully alongside of the blithely even ideas. -query I -explain analyze select - ps_partkey, - sum(ps_supplycost * ps_availqty) as value -from - ctl.tpch.partsupp, - ctl.tpch.supplier, - ctl.tpch.nation -where - ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' -group by - ps_partkey having - sum(ps_supplycost * ps_availqty) > ( - select - sum(ps_supplycost * ps_availqty) * 0.000002 - from - ctl.tpch.partsupp, - ctl.tpch.supplier, - ctl.tpch.nation - where - ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' - ) -order by - value desc limit 100; ----- -1 - # Q11 query I select From 7e25a54ab8cc7a4c6c876bbde59c26356539d325 Mon Sep 17 00:00:00 2001 From: Dousir9 <736191200@qq.com> Date: Thu, 28 Nov 2024 18:03:14 +0800 Subject: [PATCH 9/9] chore(test): update sqllogictest --- .../mode/standalone/explain/infer_filter.test | 26 +++++++++---------- .../explain_native/infer_filter.test | 26 +++++++++---------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test b/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test index 820f59100260..9b379ba627c2 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/infer_filter.test @@ -609,14 +609,13 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t2.a > 10; ---- -HashJoin -├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] +MergeJoin +├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] ├── join type: INNER -├── build keys: [] -├── probe keys: [] -├── filters: [t1.a (#0) > t2.a (#2)] +├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] +├── other conditions: [] ├── estimated rows: 0.00 -├── Filter(Build) +├── Filter(Left) │ ├── output columns: [t2.a (#2), t2.b (#3)] │ ├── filters: [t2.a (#2) > 10] │ ├── estimated rows: 0.00 @@ -629,7 +628,7 @@ HashJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [t2.a (#2) > 10], limit: NONE] │ └── estimated rows: 0.00 -└── Filter(Probe) +└── Filter(Right) ├── output columns: [t1.a (#0), t1.b (#1)] ├── filters: [t1.a (#0) > 5] ├── estimated rows: 0.00 @@ -647,14 +646,13 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t1.a > 10; ---- -HashJoin -├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] +MergeJoin +├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] ├── join type: INNER -├── build keys: [] -├── probe keys: [] -├── filters: [t1.a (#0) > t2.a (#2)] +├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] +├── other conditions: [] ├── estimated rows: 0.00 -├── TableScan(Build) +├── TableScan(Left) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -663,7 +661,7 @@ HashJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [], limit: NONE] │ └── estimated rows: 0.00 -└── Filter(Probe) +└── Filter(Right) ├── output columns: [t1.a (#0), t1.b (#1)] ├── filters: [t1.a (#0) > 10] ├── estimated rows: 0.00 diff --git a/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test b/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test index 760d9e0f8c83..3c86a2b9fe63 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test +++ b/tests/sqllogictests/suites/mode/standalone/explain_native/infer_filter.test @@ -489,14 +489,13 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t2.a > 10; ---- -HashJoin -├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] +MergeJoin +├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] ├── join type: INNER -├── build keys: [] -├── probe keys: [] -├── filters: [t1.a (#0) > t2.a (#2)] +├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] +├── other conditions: [] ├── estimated rows: 0.00 -├── TableScan(Build) +├── TableScan(Left) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -505,7 +504,7 @@ HashJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [t2.a (#2) > 10], limit: NONE] │ └── estimated rows: 0.00 -└── TableScan(Probe) +└── TableScan(Right) ├── table: default.default.t1 ├── output columns: [a (#0), b (#1)] ├── read rows: 0 @@ -519,14 +518,13 @@ HashJoin query T explain select * from t1, t2 where t1.a > t2.a and t1.a > 5 and t1.a > 10; ---- -HashJoin -├── output columns: [t1.a (#0), t1.b (#1), t2.a (#2), t2.b (#3)] +MergeJoin +├── output columns: [t2.a (#2), t2.b (#3), t1.a (#0), t1.b (#1)] ├── join type: INNER -├── build keys: [] -├── probe keys: [] -├── filters: [t1.a (#0) > t2.a (#2)] +├── range join conditions: [t2.a (#2) "lt" t1.a (#0)] +├── other conditions: [] ├── estimated rows: 0.00 -├── TableScan(Build) +├── TableScan(Left) │ ├── table: default.default.t2 │ ├── output columns: [a (#2), b (#3)] │ ├── read rows: 0 @@ -535,7 +533,7 @@ HashJoin │ ├── partitions scanned: 0 │ ├── push downs: [filters: [], limit: NONE] │ └── estimated rows: 0.00 -└── TableScan(Probe) +└── TableScan(Right) ├── table: default.default.t1 ├── output columns: [a (#0), b (#1)] ├── read rows: 0