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

test: reproduce hash join planning issue #266

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions optd-sqlplannertest/tests/joins/join_enumerate.planner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,35 @@ select * from t2, t1, t3 where t1v1 = t2v1 and t1v2 = t3v2;
*/

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

/*
(Join t2 (Join t1 t3))
(Join t2 (Join t3 t1))
(Join t3 (Join t1 t2))
(Join t3 (Join t2 t1))
(Join (Join t1 t2) t3)
(Join (Join t1 t3) t2)
(Join (Join t2 t1) t3)
(Join (Join t3 t1) t2)

(Join t2 (Join t1 t3))
(Join t2 (Join t3 t1))
(Join t3 (Join t1 t2))
(Join t3 (Join t2 t1))
(Join (Join t1 t2) t3)
(Join (Join t1 t3) t2)
(Join (Join t2 t1) t3)
(Join (Join t3 t1) t2)

(Join t1 (Join t2 t3))
(Join (Join t2 t3) t1)

(Join t1 (Join t2 t3))
(Join (Join t2 t3) t1)

LogicalProjection { exprs: [ #0, #1, #2, #3, #4, #5 ] }
└── LogicalFilter
├── cond:And
│ ├── Eq
│ │ ├── #0
│ │ └── #2
│ └── Eq
│ ├── #1
│ └── #4
└── LogicalJoin { join_type: Cross, cond: true }
├── LogicalScan { table: t1 }
└── LogicalProjection { exprs: [ #0, #1, #2, #3 ] }
└── LogicalJoin { join_type: Cross, cond: true }
├── LogicalScan { table: t2 }
└── LogicalScan { table: t3 }
PhysicalHashJoin { join_type: Inner, left_keys: [ #0, #1 ], right_keys: [ #0, #2 ] }
├── PhysicalScan { table: t1 }
└── PhysicalNestedLoopJoin { join_type: Cross, cond: true }
├── PhysicalScan { table: t2 }
└── PhysicalScan { table: t3 }
0 0 0 200 0 300
1 1 1 201 1 301
2 2 2 202 2 302
Expand Down
4 changes: 2 additions & 2 deletions optd-sqlplannertest/tests/joins/join_enumerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
- explain:logical_join_orders
- execute
- sql: |
select * from t1, t2, t3 where t1v1 = t2v1 and t1v2 = t3v2;
select * from t1, (select * from t2, t3) where t1v1 = t2v1 and t1v2 = t3v2;
desc: Test whether the optimizer enumerates all 3-join orders. (It don't currently)
tasks:
- explain[disable_pruning]:logical_join_orders
- explain:logical_join_orders
- explain:logical_join_orders,logical_optd,physical_optd
- execute
Loading