You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: expose lambda and higher-order array functions (#1561)
* feat: expose lambda and higher-order array functions
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.
* test: fold lambda tests into pytest parameterization
Combine the eight higher-order function result tests into a single
parametrized test_higher_order_function_results, and the two to_lambda
rejection tests into test_to_lambda_rejects_invalid_arg. Each case keeps
a readable id via pytest.param.
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: expose array_filter higher-order function
Add array_filter, the remaining lambda-based higher-order array function
in DataFusion (alongside the already-exposed array_transform and
array_any_match). Includes the list_filter alias matching upstream, tests,
and documentation in the expressions guide and skill.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: emphasize lambda terminology, trim skill lambda section
Lead user-facing array-lambda docs with "lambda function" instead of
"higher-order function," which is less recognizable to users. Drop the
alias list, serialization caveat, and DuckDB-dialect note from the skill
to keep it lean; those details already live in the docstrings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: broaden SQL lambda dialect coverage
Other dialects (ClickHouse, Snowflake, Databricks) also enable lambda
parsing via sqlparser-rs. Document the full set and recommend the
``lambda x: x`` keyword form, since DuckDB will drop the ``x -> x``
arrow form in v2.1. Parametrize the SQL test over the four dialects
using the keyword syntax.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments