Skip to content

Commit d844b2d

Browse files
committed
rename LambdaColumn to LambdaVariable
1 parent b18d214 commit d844b2d

17 files changed

Lines changed: 65 additions & 65 deletions

File tree

datafusion/catalog-listing/src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn expr_applicable_for_cols(col_names: &[&str], expr: &Expr) -> bool {
8888
| Expr::GroupingSet(_)
8989
| Expr::Case(_)
9090
| Expr::Lambda(_)
91-
| Expr::LambdaColumn(_) => Ok(TreeNodeRecursion::Continue),
91+
| Expr::LambdaVariable(_) => Ok(TreeNodeRecursion::Continue),
9292

9393
Expr::ScalarFunction(scalar_function) => {
9494
match scalar_function.func.signature().volatility {

datafusion/expr/src/expr.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,17 @@ pub enum Expr {
400400
Unnest(Unnest),
401401
/// Lambda expression
402402
Lambda(Lambda),
403-
LambdaColumn(LambdaColumn),
403+
LambdaVariable(LambdaVariable),
404404
}
405405

406406
#[derive(Clone, PartialEq, PartialOrd, Eq, Debug, Hash)]
407-
pub struct LambdaColumn {
407+
pub struct LambdaVariable {
408408
pub name: String,
409409
pub field: FieldRef,
410410
pub spans: Spans,
411411
}
412412

413-
impl LambdaColumn {
413+
impl LambdaVariable {
414414
pub fn new(name: String, field: FieldRef) -> Self {
415415
Self {
416416
name,
@@ -1567,7 +1567,7 @@ impl Expr {
15671567
Expr::Wildcard { .. } => "Wildcard",
15681568
Expr::Unnest { .. } => "Unnest",
15691569
Expr::Lambda { .. } => "Lambda",
1570-
Expr::LambdaColumn { .. } => "LambdaColumn",
1570+
Expr::LambdaVariable { .. } => "LambdaVariable",
15711571
}
15721572
}
15731573

@@ -2123,7 +2123,7 @@ impl Expr {
21232123
| Expr::Literal(..)
21242124
| Expr::Placeholder(..)
21252125
| Expr::Lambda(..)
2126-
| Expr::LambdaColumn(..) => false,
2126+
| Expr::LambdaVariable(..) => false,
21272127
}
21282128
}
21292129

@@ -2722,7 +2722,7 @@ impl HashNode for Expr {
27222722
Expr::Lambda(Lambda { params, body: _ }) => {
27232723
params.hash(state);
27242724
}
2725-
Expr::LambdaColumn(LambdaColumn {
2725+
Expr::LambdaVariable(LambdaVariable {
27262726
name,
27272727
field,
27282728
spans: _,
@@ -3046,7 +3046,7 @@ impl Display for SchemaDisplay<'_> {
30463046
Expr::Lambda(Lambda { params, body }) => {
30473047
write!(f, "({}) -> {body}", display_comma_separated(params))
30483048
}
3049-
Expr::LambdaColumn(c) => {
3049+
Expr::LambdaVariable(c) => {
30503050
write!(f, "{}", c.name)
30513051
}
30523052
}
@@ -3542,7 +3542,7 @@ impl Display for Expr {
35423542
Expr::Lambda(Lambda { params, body }) => {
35433543
write!(f, "({}) -> {body}", params.join(", "))
35443544
}
3545-
Expr::LambdaColumn(c) => {
3545+
Expr::LambdaVariable(c) => {
35463546
write!(f, "{}", c.name)
35473547
}
35483548
}

datafusion/expr/src/expr_schema.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::expr::{
2121
InSubquery, Lambda, Placeholder, ScalarFunction, TryCast, Unnest, WindowFunction,
2222
WindowFunctionParams,
2323
};
24-
use crate::expr::{FieldMetadata, LambdaColumn};
24+
use crate::expr::{FieldMetadata, LambdaVariable};
2525
use crate::type_coercion::functions::{
2626
fields_with_aggregate_udf, fields_with_window_udf,
2727
};
@@ -235,7 +235,7 @@ impl ExprSchemable for Expr {
235235
Ok(DataType::Null)
236236
}
237237
Expr::Lambda(Lambda { params: _, body }) => body.get_type(schema),
238-
Expr::LambdaColumn(LambdaColumn { name: _, field, .. }) => {
238+
Expr::LambdaVariable(LambdaVariable { name: _, field, .. }) => {
239239
Ok(field.data_type().clone())
240240
}
241241
}
@@ -357,7 +357,7 @@ impl ExprSchemable for Expr {
357357
Ok(true)
358358
}
359359
Expr::Lambda(l) => l.body.nullable(input_schema),
360-
Expr::LambdaColumn(c) => Ok(c.field.is_nullable()),
360+
Expr::LambdaVariable(c) => Ok(c.field.is_nullable()),
361361
}
362362
}
363363

@@ -625,7 +625,7 @@ impl ExprSchemable for Expr {
625625
self.get_type(schema)?,
626626
self.nullable(schema)?,
627627
))),
628-
Expr::LambdaColumn(c) => Ok(Arc::clone(&c.field)),
628+
Expr::LambdaVariable(c) => Ok(Arc::clone(&c.field)),
629629
}?;
630630

631631
Ok((

datafusion/expr/src/tree_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl TreeNode for Expr {
8181
| Expr::ScalarSubquery(_)
8282
| Expr::Wildcard { .. }
8383
| Expr::Placeholder(_)
84-
| Expr::LambdaColumn(_) => Ok(TreeNodeRecursion::Continue),
84+
| Expr::LambdaVariable(_) => Ok(TreeNodeRecursion::Continue),
8585
Expr::BinaryExpr(BinaryExpr { left, right, .. }) => {
8686
(left, right).apply_ref_elements(f)
8787
}
@@ -133,7 +133,7 @@ impl TreeNode for Expr {
133133
| Expr::ScalarSubquery(_)
134134
| Expr::ScalarVariable(_, _)
135135
| Expr::Literal(_, _)
136-
| Expr::LambdaColumn(_) => Transformed::no(self),
136+
| Expr::LambdaVariable(_) => Transformed::no(self),
137137
Expr::Unnest(Unnest { expr, .. }) => expr
138138
.map_elements(f)?
139139
.update_data(|expr| Expr::Unnest(Unnest { expr })),

datafusion/expr/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub fn expr_to_columns(expr: &Expr, accum: &mut HashSet<Column>) -> Result<()> {
309309
| Expr::Placeholder(_)
310310
| Expr::OuterReferenceColumn { .. }
311311
| Expr::Lambda(_)
312-
| Expr::LambdaColumn(_) => {}
312+
| Expr::LambdaVariable(_) => {}
313313
}
314314
Ok(TreeNodeRecursion::Continue)
315315
})

datafusion/functions-nested/src/array_transform.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use datafusion_expr::{
3333
ValueOrLambda, ValueOrLambdaField, ValueOrLambdaParameter, Volatility,
3434
};
3535
use datafusion_macros::user_doc;
36-
use datafusion_physical_expr::expressions::{LambdaColumn, LambdaExpr};
36+
use datafusion_physical_expr::expressions::{LambdaVariable, LambdaExpr};
3737
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
3838
use std::{any::Any, sync::Arc};
3939

@@ -173,7 +173,7 @@ impl ScalarUDFImpl for ArrayTransform {
173173
let values_param = || Ok(Arc::clone(list_values));
174174
let indices_param = || elements_indices(&list_array);
175175

176-
let binded_body = bind_lambda_columns(
176+
let binded_body = bind_lambda_variables(
177177
Arc::clone(&lambda.body),
178178
&lambda.params,
179179
&[&values_param, &indices_param],
@@ -275,7 +275,7 @@ impl ScalarUDFImpl for ArrayTransform {
275275
}
276276
}
277277

278-
fn bind_lambda_columns(
278+
fn bind_lambda_variables(
279279
expr: Arc<dyn PhysicalExpr>,
280280
params: &[FieldRef],
281281
args: &[&dyn Fn() -> Result<ArrayRef>],
@@ -284,28 +284,28 @@ fn bind_lambda_columns(
284284
.map(|(param, arg)| Ok((param.name().as_str(), (arg()?, 0))))
285285
.collect::<Result<HashMap<_, _>>>()?;
286286

287-
expr.rewrite(&mut BindLambdaColumn::new(columns)).data()
287+
expr.rewrite(&mut BindLambdaVariable::new(columns)).data()
288288
}
289289

290-
struct BindLambdaColumn<'a> {
290+
struct BindLambdaVariable<'a> {
291291
columns: HashMap<&'a str, (ArrayRef, usize)>,
292292
}
293293

294-
impl<'a> BindLambdaColumn<'a> {
294+
impl<'a> BindLambdaVariable<'a> {
295295
fn new(columns: HashMap<&'a str, (ArrayRef, usize)>) -> Self {
296296
Self { columns }
297297
}
298298
}
299299

300-
impl TreeNodeRewriter for BindLambdaColumn<'_> {
300+
impl TreeNodeRewriter for BindLambdaVariable<'_> {
301301
type Node = Arc<dyn PhysicalExpr>;
302302

303303
fn f_down(&mut self, node: Self::Node) -> Result<Transformed<Self::Node>> {
304-
if let Some(lambda_column) = node.as_any().downcast_ref::<LambdaColumn>() {
305-
if let Some((value, shadows)) = self.columns.get(lambda_column.name()) {
304+
if let Some(lambda_variable) = node.as_any().downcast_ref::<LambdaVariable>() {
305+
if let Some((value, shadows)) = self.columns.get(lambda_variable.name()) {
306306
if *shadows == 0 {
307307
return Ok(Transformed::yes(Arc::new(
308-
lambda_column.clone().with_value(value.clone()),
308+
lambda_variable.clone().with_value(value.clone()),
309309
)));
310310
}
311311
}

datafusion/optimizer/src/analyzer/type_coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
599599
| Expr::Placeholder(_)
600600
| Expr::OuterReferenceColumn(_, _)
601601
| Expr::Lambda(_)
602-
| Expr::LambdaColumn(_) => Ok(Transformed::no(expr)),
602+
| Expr::LambdaVariable(_) => Ok(Transformed::no(expr)),
603603
}
604604
}
605605
}

datafusion/optimizer/src/common_subexpr_eliminate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ impl CSEController for ExprCSEController<'_> {
694694
}
695695

696696
fn is_valid(node: &Expr) -> bool {
697-
!node.is_volatile_node() && !matches!(node, Expr::LambdaColumn(_))
697+
!node.is_volatile_node() && !matches!(node, Expr::LambdaVariable(_))
698698
}
699699

700700
fn is_ignored(&self, node: &Expr) -> bool {
@@ -707,7 +707,7 @@ impl CSEController for ExprCSEController<'_> {
707707
| Expr::ScalarVariable(..)
708708
| Expr::Alias(..)
709709
| Expr::Wildcard { .. }
710-
| Expr::LambdaColumn(_)
710+
| Expr::LambdaVariable(_)
711711
);
712712

713713
let is_aggr = matches!(node, Expr::AggregateFunction(..));

datafusion/optimizer/src/push_down_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn can_evaluate_as_join_condition(predicate: &Expr) -> Result<bool> {
289289
| Expr::InList { .. }
290290
| Expr::ScalarFunction(_)
291291
| Expr::Lambda(_)
292-
| Expr::LambdaColumn(_) => Ok(TreeNodeRecursion::Continue),
292+
| Expr::LambdaVariable(_) => Ok(TreeNodeRecursion::Continue),
293293
// TODO: remove the next line after `Expr::Wildcard` is removed
294294
#[expect(deprecated)]
295295
Expr::AggregateFunction(_)

datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ impl TreeNodeRewriter for Canonicalizer {
468468
match (left.as_ref(), right.as_ref(), op.swap()) {
469469
// <col1> <op> <col2>
470470
(
471-
left_col @ (Expr::Column(_) | Expr::LambdaColumn(_)),
472-
right_col @ (Expr::Column(_) | Expr::LambdaColumn(_)),
471+
left_col @ (Expr::Column(_) | Expr::LambdaVariable(_)),
472+
right_col @ (Expr::Column(_) | Expr::LambdaVariable(_)),
473473
Some(swapped_op),
474474
) if right_col > left_col => {
475475
Ok(Transformed::yes(Expr::BinaryExpr(BinaryExpr {
@@ -481,7 +481,7 @@ impl TreeNodeRewriter for Canonicalizer {
481481
// <literal> <op> <col>
482482
(
483483
Expr::Literal(_, _),
484-
Expr::Column(_) | Expr::LambdaColumn(_),
484+
Expr::Column(_) | Expr::LambdaVariable(_),
485485
Some(swapped_op),
486486
) => Ok(Transformed::yes(Expr::BinaryExpr(BinaryExpr {
487487
left: right,
@@ -655,7 +655,7 @@ impl<'a> ConstEvaluator<'a> {
655655
| Expr::GroupingSet(_)
656656
| Expr::Wildcard { .. }
657657
| Expr::Placeholder(_)
658-
| Expr::LambdaColumn(_) => false,
658+
| Expr::LambdaVariable(_) => false,
659659
Expr::ScalarFunction(ScalarFunction { func, .. }) => {
660660
Self::volatility_ok(func.signature().volatility)
661661
}
@@ -2012,8 +2012,8 @@ fn are_inlist_and_eq(left: &Expr, right: &Expr) -> bool {
20122012
let left = as_inlist(left);
20132013
let right = as_inlist(right);
20142014
if let (Some(lhs), Some(rhs)) = (left, right) {
2015-
matches!(lhs.expr.as_ref(), Expr::Column(_) | Expr::LambdaColumn(_))
2016-
&& matches!(rhs.expr.as_ref(), Expr::Column(_) | Expr::LambdaColumn(_))
2015+
matches!(lhs.expr.as_ref(), Expr::Column(_) | Expr::LambdaVariable(_))
2016+
&& matches!(rhs.expr.as_ref(), Expr::Column(_) | Expr::LambdaVariable(_))
20172017
&& lhs.expr == rhs.expr
20182018
&& !lhs.negated
20192019
&& !rhs.negated
@@ -2028,14 +2028,14 @@ fn as_inlist(expr: &'_ Expr) -> Option<Cow<'_, InList>> {
20282028
Expr::InList(inlist) => Some(Cow::Borrowed(inlist)),
20292029
Expr::BinaryExpr(BinaryExpr { left, op, right }) if *op == Operator::Eq => {
20302030
match (left.as_ref(), right.as_ref()) {
2031-
(Expr::Column(_) | Expr::LambdaColumn(_), Expr::Literal(_, _)) => {
2031+
(Expr::Column(_) | Expr::LambdaVariable(_), Expr::Literal(_, _)) => {
20322032
Some(Cow::Owned(InList {
20332033
expr: left.clone(),
20342034
list: vec![*right.clone()],
20352035
negated: false,
20362036
}))
20372037
}
2038-
(Expr::Literal(_, _), Expr::Column(_) | Expr::LambdaColumn(_)) => {
2038+
(Expr::Literal(_, _), Expr::Column(_) | Expr::LambdaVariable(_)) => {
20392039
Some(Cow::Owned(InList {
20402040
expr: right.clone(),
20412041
list: vec![*left.clone()],
@@ -2057,14 +2057,14 @@ fn to_inlist(expr: Expr) -> Option<InList> {
20572057
op: Operator::Eq,
20582058
right,
20592059
}) => match (left.as_ref(), right.as_ref()) {
2060-
(Expr::Column(_) | Expr::LambdaColumn(_), Expr::Literal(_, _)) => {
2060+
(Expr::Column(_) | Expr::LambdaVariable(_), Expr::Literal(_, _)) => {
20612061
Some(InList {
20622062
expr: left,
20632063
list: vec![*right],
20642064
negated: false,
20652065
})
20662066
}
2067-
(Expr::Literal(_, _), Expr::Column(_) | Expr::LambdaColumn(_)) => {
2067+
(Expr::Literal(_, _), Expr::Column(_) | Expr::LambdaVariable(_)) => {
20682068
Some(InList {
20692069
expr: right,
20702070
list: vec![*left],

0 commit comments

Comments
 (0)