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

Commit f4b62f3

Browse files
authored
fix(tests): avoid using df logical optimizer as possible (#240)
There was a time that the optd optimizer itself does not handle a lot of queries and we have to rely on the datafusion logical optimizer. Now we have our own logical optimizer and we can drop `use_df_logical` in a lot of places. The exceptions are TPC-H queries, where we still need to finish the subquery unnesting work before fully opt-in optd logical optimizer. Signed-off-by: Alex Chi <[email protected]>
1 parent 175ebaf commit f4b62f3

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

optd-datafusion-bridge/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl OptdQueryPlanner {
118118
if let LogicalPlan::Dml(_) | LogicalPlan::Ddl(_) | LogicalPlan::EmptyRelation(_) =
119119
logical_plan
120120
{
121+
// Fallback to the datafusion planner for DML/DDL operations. optd cannot handle this.
121122
let planner = DefaultPhysicalPlanner::default();
122123
return Ok(planner
123124
.create_physical_plan(logical_plan, session_state)

optd-sqlplannertest/tests/basic/constant_predicate.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
create table t1(t1v1 int, t1v2 int);
33
insert into t1 values (0, 0), (1, 1), (2, 2);
44
tasks:
5-
- execute[use_df_logical]
5+
- execute
66
- sql: |
77
select * from t1 where t1v1 = 0;
88
desc: Test whether the optimizer handles integer equality predicates correctly.
99
tasks:
10-
- execute[use_df_logical]
10+
- execute
1111
- sql: |
1212
select * from t1 where t1v1 = 0 and t1v2 = 1;
1313
desc: Test whether the optimizer handles multiple integer equality predicates correctly.
1414
tasks:
15-
- execute[use_df_logical]
15+
- execute
1616
- sql: |
1717
select * from t1 where t1v1 = 0 and t1v2 != 1;
1818
desc: Test whether the optimizer handles multiple integer inequality predicates correctly.
1919
tasks:
20-
- execute[use_df_logical]
20+
- execute

optd-sqlplannertest/tests/pushdowns/fliter_transpose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
insert into t1 values (0, 0), (1, 1), (2, 2);
55
insert into t2 values (0, 200), (1, 201), (2, 202);
66
tasks:
7-
- execute[use_df_logical]
7+
- execute
88
- sql: |
99
SELECT t1.t1v1, t1.t1v2, t2.t2v3
1010
FROM t1, t2

optd-sqlplannertest/tests/subqueries/subquery_unnesting.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
create table t2(t2v1 int, t2v3 int);
44
create table t3(t3v2 int, t3v4 int);
55
tasks:
6-
- execute[use_df_logical]
6+
- execute
77
# - sql: |
88
# select * from t1 where t1v1 in (select t2v1 from t2);
99
# desc: Test whether the optimizer can unnest "in" subqueries. -- failing with unsupported expression

0 commit comments

Comments
 (0)