Skip to content

feat: expose lambda and higher-order array functions#1561

Open
timsaucer wants to merge 1 commit into
apache:mainfrom
timsaucer:feat/lambda-support
Open

feat: expose lambda and higher-order array functions#1561
timsaucer wants to merge 1 commit into
apache:mainfrom
timsaucer:feat/lambda-support

Conversation

@timsaucer
Copy link
Copy Markdown
Member

@timsaucer timsaucer commented May 26, 2026

Which issue does this PR close?

Closes #811

Rationale for this change

DataFusion gained lambda expressions and higher-order array functions (apache/datafusion#21172). The Python binding already had the read-only Lambda, HigherOrderFunction, and LambdaVariable wrapper classes, but offered no way to construct a lambda or call the higher-order functions. This PR adds a Pythonic API for both.

What changes are included in this PR?

Adds the following:

  • Functions array_transform and array_any_match that accept either a Python callable or an explicit lambda built with lambda_ / lambda_var
  • Unit tests
  • Functions to create lambda expressions or variables
  • Documentation

Are there any user-facing changes?

There are new APIs but they are all new additions.

Add a Pythonic API for DataFusion's higher-order array functions and the
lambda expressions they consume.

- Rust: lambda_, lambda_var, array_transform, and array_any_match pyfunctions,
  plus a ResolveLambdaVariables analyzer rule so expression-builder plans
  (which emit unresolved lambda variables) resolve before optimization.
- Python: array_transform / array_any_match (with list_transform, any_match,
  list_any_match aliases) accept either a Python callable or an explicit
  lambda built with lambda_ / lambda_var. Callables are introspected so their
  parameter names become the lambda parameters.
- Tests and docs (expressions guide + agent skill), noting v1 limits: lambda
  expressions are not serializable, and SQL arrow syntax needs the DuckDB
  dialect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add functions.transform

1 participant