Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 9dfc530

Browse files
committed
test: reproduce hash join planning issue (#265)
Signed-off-by: Alex Chi Z <[email protected]>
1 parent fa6817c commit 9dfc530

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

optd-sqlplannertest/tests/joins/join_enumerate.planner.sql

+27-19
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,35 @@ select * from t2, t1, t3 where t1v1 = t2v1 and t1v2 = t3v2;
8282
*/
8383

8484
-- Test whether the optimizer enumerates all 3-join orders. (It don't currently)
85-
select * from t1, t2, t3 where t1v1 = t2v1 and t1v2 = t3v2;
85+
select * from t1, (select * from t2, t3) where t1v1 = t2v1 and t1v2 = t3v2;
8686

8787
/*
88-
(Join t2 (Join t1 t3))
89-
(Join t2 (Join t3 t1))
90-
(Join t3 (Join t1 t2))
91-
(Join t3 (Join t2 t1))
92-
(Join (Join t1 t2) t3)
93-
(Join (Join t1 t3) t2)
94-
(Join (Join t2 t1) t3)
95-
(Join (Join t3 t1) t2)
96-
97-
(Join t2 (Join t1 t3))
98-
(Join t2 (Join t3 t1))
99-
(Join t3 (Join t1 t2))
100-
(Join t3 (Join t2 t1))
101-
(Join (Join t1 t2) t3)
102-
(Join (Join t1 t3) t2)
103-
(Join (Join t2 t1) t3)
104-
(Join (Join t3 t1) t2)
105-
88+
(Join t1 (Join t2 t3))
89+
(Join (Join t2 t3) t1)
90+
91+
(Join t1 (Join t2 t3))
92+
(Join (Join t2 t3) t1)
93+
94+
LogicalProjection { exprs: [ #0, #1, #2, #3, #4, #5 ] }
95+
└── LogicalFilter
96+
├── cond:And
97+
│ ├── Eq
98+
│ │ ├── #0
99+
│ │ └── #2
100+
│ └── Eq
101+
│ ├── #1
102+
│ └── #4
103+
└── LogicalJoin { join_type: Cross, cond: true }
104+
├── LogicalScan { table: t1 }
105+
└── LogicalProjection { exprs: [ #0, #1, #2, #3 ] }
106+
└── LogicalJoin { join_type: Cross, cond: true }
107+
├── LogicalScan { table: t2 }
108+
└── LogicalScan { table: t3 }
109+
PhysicalHashJoin { join_type: Inner, left_keys: [ #0, #1 ], right_keys: [ #0, #2 ] }
110+
├── PhysicalScan { table: t1 }
111+
└── PhysicalNestedLoopJoin { join_type: Cross, cond: true }
112+
├── PhysicalScan { table: t2 }
113+
└── PhysicalScan { table: t3 }
106114
0 0 0 200 0 300
107115
1 1 1 201 1 301
108116
2 2 2 202 2 302

optd-sqlplannertest/tests/joins/join_enumerate.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
- explain:logical_join_orders
3030
- execute
3131
- sql: |
32-
select * from t1, t2, t3 where t1v1 = t2v1 and t1v2 = t3v2;
32+
select * from t1, (select * from t2, t3) where t1v1 = t2v1 and t1v2 = t3v2;
3333
desc: Test whether the optimizer enumerates all 3-join orders. (It don't currently)
3434
tasks:
3535
- explain[disable_pruning]:logical_join_orders
36-
- explain:logical_join_orders
36+
- explain:logical_join_orders,logical_optd,physical_optd
3737
- execute

0 commit comments

Comments
 (0)