Skip to content

Commit 5a247d3

Browse files
authored
perf: Split projections with expressions that need granular batching (#4329)
1 parent cce0e8c commit 5a247d3

File tree

4 files changed

+413
-1
lines changed

4 files changed

+413
-1
lines changed

src/daft-logical-plan/src/builder/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ impl LogicalPlanBuilder {
776776
|builder| builder.reorder_joins(),
777777
)
778778
.simplify_expressions()
779+
.split_granular_projections()
779780
.build();
780781

781782
let optimized_plan = optimizer.optimize(
@@ -830,6 +831,7 @@ impl LogicalPlanBuilder {
830831
|builder| builder.reorder_joins(),
831832
)
832833
.simplify_expressions()
834+
.split_granular_projections()
833835
.build();
834836

835837
let optimized_plan = optimizer.optimize(

src/daft-logical-plan/src/optimization/optimizer.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::{
1111
MaterializeScans, OptimizerRule, PushDownAntiSemiJoin, PushDownFilter,
1212
PushDownJoinPredicate, PushDownLimit, PushDownProjection, ReorderJoins,
1313
SimplifyExpressionsRule, SimplifyNullFilteredJoin, SplitActorPoolProjects,
14-
UnnestPredicateSubquery, UnnestScalarSubquery,
14+
SplitGranularProjection, UnnestPredicateSubquery, UnnestScalarSubquery,
1515
},
1616
};
1717
use crate::LogicalPlan;
@@ -208,6 +208,14 @@ impl OptimizerBuilder {
208208
self
209209
}
210210

211+
pub fn split_granular_projections(mut self) -> Self {
212+
self.rule_batches.push(RuleBatch::new(
213+
vec![Box::new(SplitGranularProjection::new())],
214+
RuleExecutionStrategy::Once,
215+
));
216+
self
217+
}
218+
211219
pub fn with_optimizer_config(mut self, config: OptimizerConfig) -> Self {
212220
self.config = config;
213221
self

0 commit comments

Comments
 (0)