Skip to content

Commit b57eee1

Browse files
committed
fix typos
1 parent 87d5ce8 commit b57eee1

6 files changed

Lines changed: 25 additions & 28 deletions

File tree

datafusion/expr-common/src/placement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub enum ExpressionPlacement {
6161
/// leaf-pushable expression, then it would return this variant.
6262
/// Then `other_leaf_function(get_field(...), 42)` could also be classified as
6363
/// leaf-pushable using the knowledge that `get_field(...)` is leaf-pushable.
64-
PlaceAtLeafs,
64+
PlaceAtLeaves,
6565
/// Argument is a complex expression that should be placed at root nodes.
6666
/// For example, `min(col1 + col2)` is not leaf-pushable because it requires per-row computation.
6767
PlaceAtRoot,

datafusion/expr/src/udf.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ impl ScalarUDF {
133133
/// as further up the tree so that it can be run after filtering, sorting, etc.
134134
///
135135
/// See [`ScalarUDFImpl::placement`] for more details.
136-
pub fn placement(
137-
&self,
138-
args: &[ExpressionPlacement],
139-
) -> ExpressionPlacement {
136+
pub fn placement(&self, args: &[ExpressionPlacement]) -> ExpressionPlacement {
140137
self.inner.placement(args)
141138
}
142139

datafusion/functions/src/core/getfield.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,18 @@ impl ScalarUDFImpl for GetFieldFunc {
502502

503503
fn placement(&self, args: &[ExpressionPlacement]) -> ExpressionPlacement {
504504
// get_field is leaf-pushable if:
505-
// 1. The struct/map argument is a Column or PlaceAtLeafs (not Literal or PlaceAtRoot)
505+
// 1. The struct/map argument is a Column or PlaceAtLeaves (not Literal or PlaceAtRoot)
506506
// 2. All key arguments are literals (static field access, not dynamic per-row lookup)
507507
//
508508
// Literal base is not considered leaf-pushable because it would be constant-folded anyway.
509509
if args.is_empty() {
510510
return ExpressionPlacement::PlaceAtRoot;
511511
}
512512

513-
// Check if the base (struct/map) argument is Column or PlaceAtLeafs
513+
// Check if the base (struct/map) argument is Column or PlaceAtLeaves
514514
if !matches!(
515515
args[0],
516-
ExpressionPlacement::Column | ExpressionPlacement::PlaceAtLeafs
516+
ExpressionPlacement::Column | ExpressionPlacement::PlaceAtLeaves
517517
) {
518518
return ExpressionPlacement::PlaceAtRoot;
519519
}
@@ -525,7 +525,7 @@ impl ScalarUDFImpl for GetFieldFunc {
525525
.all(|a| *a == ExpressionPlacement::Literal);
526526

527527
if keys_literal {
528-
ExpressionPlacement::PlaceAtLeafs
528+
ExpressionPlacement::PlaceAtLeaves
529529
} else {
530530
ExpressionPlacement::PlaceAtRoot
531531
}
@@ -580,22 +580,22 @@ mod tests {
580580

581581
// get_field(col, 'literal') -> leaf-pushable (static field access)
582582
let args = vec![ExpressionPlacement::Column, ExpressionPlacement::Literal];
583-
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeafs);
583+
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeaves);
584584

585585
// get_field(col, 'a', 'b') -> leaf-pushable (nested static field access)
586586
let args = vec![
587587
ExpressionPlacement::Column,
588588
ExpressionPlacement::Literal,
589589
ExpressionPlacement::Literal,
590590
];
591-
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeafs);
591+
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeaves);
592592

593-
// get_field(get_field(col, 'a'), 'b') represented as PlaceAtLeafs for base
593+
// get_field(get_field(col, 'a'), 'b') represented as PlaceAtLeaves for base
594594
let args = vec![
595-
ExpressionPlacement::PlaceAtLeafs,
595+
ExpressionPlacement::PlaceAtLeaves,
596596
ExpressionPlacement::Literal,
597597
];
598-
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeafs);
598+
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeaves);
599599
}
600600

601601
#[test]
@@ -641,9 +641,9 @@ mod tests {
641641
// Empty args -> NOT leaf-pushable
642642
assert_eq!(func.placement(&[]), ExpressionPlacement::PlaceAtRoot);
643643

644-
// Just base, no key -> PlaceAtLeafs (not a valid call but should handle gracefully)
644+
// Just base, no key -> PlaceAtLeaves (not a valid call but should handle gracefully)
645645
let args = vec![ExpressionPlacement::Column];
646-
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeafs);
646+
assert_eq!(func.placement(&args), ExpressionPlacement::PlaceAtLeaves);
647647

648648
// Literal base with literal key -> NOT leaf-pushable (would be constant-folded)
649649
let args = vec![ExpressionPlacement::Literal, ExpressionPlacement::Literal];

datafusion/physical-expr-common/src/physical_expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,13 @@ pub trait PhysicalExpr: Any + Send + Sync + Display + Debug + DynEq + DynHash {
437437
/// Leaf-pushable expressions include:
438438
/// - Column references (`ExpressionPlacement::Column`)
439439
/// - Literal values (`ExpressionPlacement::Literal`)
440-
/// - Struct field access via `get_field` (`ExpressionPlacement::PlaceAtLeafs`)
440+
/// - Struct field access via `get_field` (`ExpressionPlacement::PlaceAtLeaves`)
441441
/// - Nested combinations of field accessors (e.g., `col['a']['b']`)
442442
///
443443
/// This is used to identify expressions that are cheap to duplicate or
444444
/// don't benefit from caching/partitioning optimizations.
445445
///
446-
/// **Performance note**: Expressions marked as `PlaceAtLeafs` may be pushed
446+
/// **Performance note**: Expressions marked as `PlaceAtLeaves` may be pushed
447447
/// below filters during optimization. If an expression does per-row work,
448448
/// marking it leaf-pushable may slow things down by causing evaluation on more rows.
449449
fn placement(&self) -> ExpressionPlacement {

datafusion/physical-optimizer/src/projection_pushdown.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ fn try_split_projection(
132132
}
133133

134134
// Only extract from root-level expressions. If the entire expression is
135-
// already PlaceAtLeafs (like `get_field(col, 'foo')`), it can be pushed as-is.
135+
// already PlaceAtLeaves (like `get_field(col, 'foo')`), it can be pushed as-is.
136136
// We only need to split when there's a root expression with leaf-pushable
137137
// sub-expressions (like `get_field(col, 'foo') + 1`).
138138
if matches!(
139139
proj_expr.expr.placement(),
140-
ExpressionPlacement::PlaceAtLeafs
140+
ExpressionPlacement::PlaceAtLeaves
141141
) {
142142
outer_exprs.push(proj_expr.clone());
143143
continue;
@@ -180,7 +180,7 @@ fn try_split_projection(
180180
/// Extracts beneficial leaf-pushable sub-expressions from larger expressions.
181181
///
182182
/// Similar to `JoinFilterRewriter`, this struct walks expression trees top-down
183-
/// and extracts sub-expressions where `placement() == ExpressionPlacement::PlaceAtLeafs`
183+
/// and extracts sub-expressions where `placement() == ExpressionPlacement::PlaceAtLeaves`
184184
/// (beneficial leaf-pushable expressions like field accessors).
185185
///
186186
/// The extracted expressions are replaced with column references pointing to
@@ -212,7 +212,7 @@ impl<'a> LeafExpressionExtractor<'a> {
212212
/// sub-expressions with column references to the inner projection.
213213
fn extract(&mut self, expr: Arc<dyn PhysicalExpr>) -> Result<Arc<dyn PhysicalExpr>> {
214214
// Top-down: check self first, then recurse to children
215-
if matches!(expr.placement(), ExpressionPlacement::PlaceAtLeafs) {
215+
if matches!(expr.placement(), ExpressionPlacement::PlaceAtLeaves) {
216216
// Extract this entire sub-tree
217217
return Ok(self.add_extracted_expr(expr));
218218
}

datafusion/physical-plan/src/projection.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ impl ProjectionExec {
254254
///
255255
/// This is true when:
256256
/// - The projection narrows the schema (drops columns) - saves memory, OR
257-
/// - Any expression is PlaceAtLeafs (like get_field) - beneficial computation pushdown
257+
/// - Any expression is PlaceAtLeaves (like get_field) - beneficial computation pushdown
258258
///
259259
/// Pure Column references that don't narrow the schema are NOT beneficial to push,
260260
/// as they just rearrange the plan without any gain.
261261
///
262262
/// Note: Projections are split by `try_split_projection` before reaching this function,
263-
/// so if any expression is PlaceAtLeafs, all expressions should be leaf-pushable.
263+
/// so if any expression is PlaceAtLeaves, all expressions should be leaf-pushable.
264264
pub fn is_leaf_pushable_or_narrows_schema(&self) -> bool {
265265
let all_columns = self
266266
.expr()
@@ -272,7 +272,7 @@ impl ProjectionExec {
272272
let has_leaf_expressions = self
273273
.expr()
274274
.iter()
275-
.any(|p| matches!(p.expr.placement(), ExpressionPlacement::PlaceAtLeafs));
275+
.any(|p| matches!(p.expr.placement(), ExpressionPlacement::PlaceAtLeaves));
276276

277277
let has_root_expressions = self.expr().iter().any(|p| {
278278
matches!(
@@ -1152,14 +1152,14 @@ fn try_unifying_projections(
11521152
// Don't merge if:
11531153
// 1. A non-trivial expression is referenced more than once (caching benefit)
11541154
// See discussion in: https://github.com/apache/datafusion/issues/8296
1155-
// 2. The child projection has PlaceAtLeafs (like get_field) that should be pushed
1155+
// 2. The child projection has PlaceAtLeaves (like get_field) that should be pushed
11561156
// down to the data source separately
11571157
for (column, count) in column_ref_map.iter() {
11581158
let placement = child.expr()[column.index()].expr.placement();
11591159
// Don't merge if multi-referenced root level (caching)
11601160
if (*count > 1 && matches!(placement, ExpressionPlacement::PlaceAtRoot))
1161-
// Don't merge if child has PlaceAtLeafs (should push to source)
1162-
|| matches!(placement, ExpressionPlacement::PlaceAtLeafs)
1161+
// Don't merge if child has PlaceAtLeaves (should push to source)
1162+
|| matches!(placement, ExpressionPlacement::PlaceAtLeaves)
11631163
{
11641164
return Ok(None);
11651165
}

0 commit comments

Comments
 (0)