Skip to content

docs: explain dialect requirement for lambda examples - #26040

Closed
Prajwal-k-tech wants to merge 2 commits into
apache:mainfrom
Prajwal-k-tech:prajwal/25960-lambda-dialect
Closed

Prajwal-k-tech wants to merge 2 commits into
apache:mainfrom
Prajwal-k-tech:prajwal/25960-lambda-dialect

Conversation

@Prajwal-k-tech

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

The SQL reference examples for these higher-order array functions use lambda expressions, but the default SQL dialect does not parse the -> syntax. The examples work when a lambda-capable dialect is selected, and the current descriptions do not explain that requirement.

What changes are included in this PR?

  • Add a note to the user documentation for any_match, array_filter, array_first, and array_transform explaining that lambdas require a supporting dialect and showing how to select DuckDB.
  • Regenerate the scalar function reference from the source #[user_doc] descriptions.

This change was prepared with AI assistance. The patch and generated documentation were checked against the issue and repository guidance.

What is the testing strategy for this PR?

This is a documentation-only change, so no runtime tests were added. Verified the generated reference with ./dev/update_function_docs.sh, ran the repository documentation Prettier check, cargo +1.99.0 fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.

Are there any user-facing changes?

Yes. The SQL function reference now tells users which dialect setting is needed to run the lambda examples.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 21:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added documentation Improvements or additions to documentation functions Changes to functions implementation labels Oct 4, 2026

@kosiew kosiew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prajwal-k-tech,

Thanks for clarifying the SQL dialect requirement for the higher-order array functions. The documentation now explains why the lambda examples require a compatible dialect and identifies DuckDB as a supported option. The change is focused and preserves existing behavior.

The distinction between SQL parsing and function execution is important here. Generic does not enable arrow-lambda parsing, while DuckDB does. Documenting this prerequisite at the function level is the right approach, rather than changing parser defaults or introducing runtime workarounds. Repeating the guidance across independently discoverable functions is reasonable.

I'm approving because the change addresses the issue without introducing API or runtime changes. The two inline suggestions are optional usability and integration-test improvements, not correctness concerns or approval conditions.

#[user_doc(
doc_section(label = "Array Functions"),
description = "filters the values of an array using a boolean lambda",
description = "filters the values of an array using a boolean lambda. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: consider adding SET datafusion.sql_parser.dialect = 'DuckDB'; before the SQL example, and similarly for the other three functions, so each example is self-contained. The existing prose is already correct; if you adopt this, please update the source examples and regenerate the reference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prajwal-k-tech can you please address @kosiew 's comments?

#[user_doc(
doc_section(label = "Array Functions"),
description = "transforms the values of an array",
description = "transforms the values of an array. Lambda expressions require a dialect that supports them; set `datafusion.sql_parser.dialect` to `DuckDB` because the default dialect does not parse the `->` syntax.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional follow-up: consider adding a DuckDB smoke test to the existing array-transform SLT, verifying that array_transform([1, 2, 3], x -> x * 2) returns [2, 4, 6], then restoring the previous dialect. Existing Databricks tests cover transformation behavior, so this would specifically validate the recommended dialect configuration rather than address a missing correctness test.

@alamb alamb added the Prolific Author author opened PRs or issues in more than 20 repositories in the last 30 days label Oct 22, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.66%. Comparing base (c3ef346) to head (82523eb).
⚠️ Report is 247 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #26040   +/-   ##
=======================================
  Coverage   82.66%   82.66%           
=======================================
  Files        1147     1147           
  Lines      446357   446357           
  Branches   446357   446357           
=======================================
  Hits       368971   368971           
+ Misses      54997    54995    -2     
- Partials    22389    22391    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alamb

alamb commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Marking as draft until feedback is addressed. Please mark as ready when it is ready for another look

@alamb
alamb marked this pull request as draft October 24, 2026 09:55
@alamb

alamb commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This PR appears to be waiting on the author to respond to reviewer feedback so marking as draft. Please mark ready to review when it is ready for another look

@alamb

alamb commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Likely AI spam. Closing

@alamb alamb closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation functions Changes to functions implementation Prolific Author author opened PRs or issues in more than 20 repositories in the last 30 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lambda examples in the SQL function docs fail with the default dialect

5 participants