lovasoa opened a new pull request, #2149: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2149
## Summary This PR adds support for parsing DuckDB's `LAMBDA` keyword syntax for lambda functions. DuckDB supports two syntaxes for lambda functions: - Arrow syntax: `x -> x + 1` (already supported) - Lambda keyword syntax: `lambda x : x + 1` (added in this PR) ### Changes - Added `LAMBDA` keyword to keywords list - Added `LambdaSyntax` enum to track which syntax style was used (for correct round-tripping) - Added `parse_lambda_expr()` to parse `lambda <params> : <expr>` syntax - Updated `LambdaFunction` struct to include `syntax` field - Added tests for DuckDB lambda functions ### Examples ```sql -- Single parameter SELECT list_filter([1, 2, 3], lambda x : x > 1) -- Multiple parameters (with index) SELECT list_filter([1, 3, 1, 5], lambda x, i : x > i) -- Method call syntax SELECT [3, 4, 5, 6].list_filter(lambda x : x > 4) ``` ## Test plan - [x] Added `test_duckdb_lambda_function` test covering single param, multi-param, and method call syntax - [x] All existing lambda tests pass (Databricks, ClickHouse, common) - [x] All DuckDB tests pass --- > [!NOTE] > This code was generated by an LLM (Claude) and reviewed by @lovasoa. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
