limadog9 opened a new pull request, #25892:
URL: https://github.com/apache/datafusion/pull/25892

   ## Which issue does this PR close?
   
   - Closes #25844
   
   ## Rationale for this change
   
   A list UNNEST can produce several rows for one input key. Retaining the 
input's functional dependencies makes a later DISTINCT or GROUP BY discard 
unnested values, and can make an ordered window use the wrong frame. These 
queries return incorrect results.
   
   ## What changes are included in this PR?
   
   - Remap inherited dependency indices to output positions after struct 
expansion.
   - Downgrade dependencies after list unnest, remove unnested list outputs 
from dependency targets, and discard dependencies whose determinants are 
unnested.
   - Add SQL and plan-level regressions for distinct, grouping, window frames, 
and shifted indices.
   
   ## What is the testing strategy for this PR?
   
   - cargo fmt --all --check
   - cargo test -p datafusion-expr --lib unnest_remaps_functional_dependencies
   - cargo test --profile ci --test sqllogictests -- functional_dependencies.slt
   
   ## Are there any user-facing changes?
   
   Yes. A list unnest followed by DISTINCT, GROUP BY, or an ordered window now 
returns the expected result.


-- 
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]

Reply via email to