You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "shehab-ali (via GitHub)" <gi...@apache.org> on 2026/09/10 19:56:18 UTC

[PR] Support dotted field access on struct lambda parameters in SQL exprs [datafusion]

shehab-ali opened a new pull request, #25177:
URL: https://github.com/apache/datafusion/pull/25177

   
   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   - Closes #.
   
   ## Rationale for this change
   Struct-valued lambda parameters cannot currently be accessed using dotted field syntax. For example, the following query fails because `record.rule_action` is resolved as a table-qualified column instead of field access on the lambda parameter:
   
   ```sql
   SELECT array_transform(
     records,
     record -> record.rule_action
   );
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   
   Please explain the problem you are trying to solve in terms of the user-visible
   behavior, rather than the implementation.
   
   For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of the
   implementation. "COUNT(DISTINCT) returns wrong results when the column contains
   nulls" is the user-visible problem.
   -->
   
   ## What changes are included in this PR?
   When a compound identifier begins with an active lambda parameter, resolve the root as a lambda variable and plan each remaining identifier as named struct-field access.
   This supports expressions such as:
   record.rule_action
   record.metadata.rule_action
   record.items[1]
   Field access is planned through the configured expression planners, consistent with existing field-access handling.
   <!--
   There is no need to duplicate the description in the issue here, but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## What is the testing strategy for this PR?
   Added sqllogictest coverage in array/array_transform.slt for:
   Direct field access on a struct-valued lambda parameter.
   Field access followed by list indexing.
   Chained field access through nested structs.
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   Briefly describe how this PR is tested, and point to the specific tests you added. For example: 'This new feature is covered by the `sqllogictest` cases added in `foo.slt`'.
   
   If this PR does not add tests, explain why. For example, if the change is already covered by existing tests, please mention it.
   
   You should also check the `codecov` bot reply on this PR to confirm the changed code is exercised.
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Support dotted field access on struct lambda parameters in SQL exprs [datafusion]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #25177:
URL: https://github.com/apache/datafusion/pull/25177#issuecomment-5624887331

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/25177?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `85.00000%` with `3 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 81.90%. Comparing base ([`5747e87`](https://app.codecov.io/gh/apache/datafusion/commit/5747e87e95f3a224b9bf98a8c157c9e069a7d24c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4e1c42e`](https://app.codecov.io/gh/apache/datafusion/commit/4e1c42e6e7bde9a0afa4694ae14171e039fb67a9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on main.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion/pull/25177?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [datafusion/sql/src/expr/identifier.rs](https://app.codecov.io/gh/apache/datafusion/pull/25177?src=pr&el=tree&filepath=datafusion%2Fsql%2Fsrc%2Fexpr%2Fidentifier.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9zcWwvc3JjL2V4cHIvaWRlbnRpZmllci5ycw==) | 85.00% | [1 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/25177?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@           Coverage Diff            @@
   ##             main   #25177    +/-   ##
   ========================================
     Coverage   81.90%   81.90%            
   ========================================
     Files        1132     1132            
     Lines      420155   420590   +435     
     Branches   420155   420590   +435     
   ========================================
   + Hits       344126   344499   +373     
   - Misses      55742    55771    +29     
   - Partials    20287    20320    +33     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/25177?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org