Hrushikesh-ramilla opened a new pull request, #27232:
URL: https://github.com/apache/datafusion/pull/27232
## Which issue does this PR close?
- Closes #27088.
## Rationale for this change
When an identifier path such as `e.rule_action` is evaluated in the body of
a lambda function (where `e` is a struct lambda parameter), the SQL planner
produced `Schema error: No field named e.rule_action.`
This happened because `sql_compound_identifier_to_expr` only searched the
input schema and outer query schemas for `e.rule_action` (treating `e` as a
table or qualifier), falling back to a relation-qualified column
`Column::new("e", "rule_action")`. Unlike `sql_identifier_to_expr` (which
checks `planner_context.lambda_parameters()` first),
`sql_compound_identifier_to_expr` never checked for active lambda parameters.
## What changes are included in this PR?
- In `datafusion/sql/src/expr/identifier.rs`: updated
`sql_compound_identifier_to_expr` to check
`planner_context.lambda_parameters()` for `ids[0]` before attempting
table-schema resolution.
- For matching lambda parameters, constructs `Expr::LambdaVariable` and
iterates over any remaining nested identifiers (`ids[1..]`), resolving each
field access through `try_plan_field_access`.
- In `datafusion/sql/src/expr/mod.rs`: widened `try_plan_field_access`
visibility to `pub(super)`.
- In `datafusion/sqllogictest/test_files/array/array_transform.slt`: added
test coverage for dotted field access, expressions over dotted fields, and
multi-level nested struct field access.
## What is the testing strategy for this PR?
- Added regression test cases in
`datafusion/sqllogictest/test_files/array/array_transform.slt`.
- Verified all 607 tests in `datafusion-sql` pass.
- Verified `sqllogictests -- array_transform` passes.
## Are there any user-facing changes?
No.
--
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]