Skip to content

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

Open

Description

@rawsun007

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).

Activity

  1. added
    Prolific Authorauthor opened PRs or issues in more than 20 repositories in the last 30 days
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prolific Authorauthor opened PRs or issues in more than 20 repositories in the last 30 days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions