Lambda examples in the SQL function docs fail with the default dialect
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- documentation
Research direction
Start with the #[user_doc] attributes for any_match, array_filter, array_first, and array_transform, then inspect dev/update_function_docs.sh and the generated scalar_functions.md entries. Run the examples in datafusion-cli with the default and a supported lambda dialect; done means the documentation explains the dialect requirement and the generated examples are accurate.
Written by the indexing model from the issue text.
Description
Describe the bug
The SQL reference examples for any_match, array_filter, array_first and array_transform use lambda syntax (x -> x > 2), but none of them run in datafusion-cli with the default dialect. The -> is not parsed as a lambda, so the error points at the parameter instead:
> select array_filter([1, 2, 3, 4, 5], x -> x > 2);
Error: Schema error: No field named x.
The same happens for the other three examples. They work after switching to a dialect whose supports_lambda_functions() is true (databricks, duckdb, snowflake, spark, clickhouse):
> set datafusion.sql_parser.dialect = 'duckdb';
> select array_filter([1, 2, 3, 4, 5], x -> x > 2);
[3, 4, 5]
The sqllogictest files for these functions already do this (array_transform.slt and array_any_match.slt start with set datafusion.sql_parser.dialect = databricks;), so the requirement is known; the user guide just doesn't mention it.
To Reproduce
datafusion-cli built from main at 4d167a1, then any of the four documented examples.
Expected behavior
Either the docs say that lambdas need one of those dialects (a note on each function, or once at the top of the higher-order functions section), or lambdas parse under the default dialect. The note is the small fix. Happy to send a PR for it, generated through dev/update_function_docs.sh from the #[user_doc] attributes.
Additional context
Found by running every SQL example in scalar_functions.md against a main build. Written with Claude Code (Claude Opus 5.5).
- Dominant language
- Rust
- Stars
- 9.4k
- Forks
- 2.5k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 383
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/datafusion
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion#25913 ·
Maintainers usually reply within 1 day
-
trunc(x) on a column turns -0.0 into 0.0Possibly taken @1fanwang claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/datafusion#25702 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/datafusion#25266 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion#25213 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
apache/datafusion#25168 · 1 comment ·
Maintainers usually reply within 1 day
All issues in apache/datafusion
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day