Skip to content

Commit 03e683e

Browse files
committed
fix: Disable CommonSubexprEliminate optimizer
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
1 parent 3171c65 commit 03e683e

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

datafusion/core/src/execution/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ use crate::logical_plan::{
6565
CreateMemoryTable, DropTable, FunctionRegistry, LogicalPlan, LogicalPlanBuilder,
6666
UNNAMED_TABLE,
6767
};
68-
use crate::optimizer::common_subexpr_eliminate::CommonSubexprEliminate;
6968
use crate::optimizer::filter_push_down::FilterPushDown;
7069
use crate::optimizer::limit_push_down::LimitPushDown;
7170
use crate::optimizer::optimizer::{OptimizerConfig, OptimizerRule};
@@ -1149,7 +1148,9 @@ impl SessionState {
11491148
// of applying other optimizations
11501149
Arc::new(SimplifyExpressions::new()),
11511150
Arc::new(EliminateFilter::new()),
1152-
Arc::new(CommonSubexprEliminate::new()),
1151+
// NOTE(cubesql): disabled as it causes issues with some queries
1152+
// with complex filters and subqueries
1153+
//Arc::new(CommonSubexprEliminate::new()),
11531154
Arc::new(EliminateLimit::new()),
11541155
Arc::new(ProjectionDropOut::new()),
11551156
Arc::new(ProjectionPushDown::new()),

datafusion/core/tests/sql/window.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ async fn window_partition_by_order_by() -> Result<()> {
283283
.await?;
284284

285285
let expected = vec![
286-
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
287-
"| c1 | c2 | ROW_NUMBER() | FIRST_VALUE(test.c2 + test.c1) | LAST_VALUE(test.c2 + test.c1) | NTH_VALUE(test.c2 + test.c1,Int64(1)) | SUM(test.c2) | COUNT(test.c2) | MAX(test.c2) | MIN(test.c2) | AVG(test.c2) |",
288-
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
289-
"| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |",
290-
"| 0 | 2 | 1 | 2 | 2 | 2 | 2 | 1 | 2 | 2 | 2 |",
291-
"| 0 | 3 | 1 | 3 | 3 | 3 | 3 | 1 | 3 | 3 | 3 |",
292-
"| 0 | 4 | 1 | 4 | 4 | 4 | 4 | 1 | 4 | 4 | 4 |",
293-
"| 0 | 5 | 1 | 5 | 5 | 5 | 5 | 1 | 5 | 5 | 5 |",
294-
"+----+----+--------------+--------------------------------+-------------------------------+---------------------------------------+--------------+----------------+--------------+--------------+--------------+",
286+
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
287+
"| c1 | c2 | ROW_NUMBER() | FIRST_VALUE(test.c2 Plus test.c1) | LAST_VALUE(test.c2 Plus test.c1) | NTH_VALUE(test.c2 Plus test.c1,Int64(1)) | SUM(test.c2) | COUNT(test.c2) | MAX(test.c2) | MIN(test.c2) | AVG(test.c2) |",
288+
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
289+
"| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |",
290+
"| 0 | 2 | 1 | 2 | 2 | 2 | 2 | 1 | 2 | 2 | 2 |",
291+
"| 0 | 3 | 1 | 3 | 3 | 3 | 3 | 1 | 3 | 3 | 3 |",
292+
"| 0 | 4 | 1 | 4 | 4 | 4 | 4 | 1 | 4 | 4 | 4 |",
293+
"| 0 | 5 | 1 | 5 | 5 | 5 | 5 | 1 | 5 | 5 | 5 |",
294+
"+----+----+--------------+-----------------------------------+----------------------------------+------------------------------------------+--------------+----------------+--------------+--------------+--------------+",
295295
];
296296

297297
// window function shall respect ordering

0 commit comments

Comments
 (0)