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

[PR] fix: do not drop GROUP BY keys using nullable UNIQUE constraints [datafusion]

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

   ## Which issue does this PR close?
   
   - Closes #23819.
   
   ## Rationale for this change
   
   A nullable UNIQUE column permits multiple NULL rows, so it cannot safely
   determine other grouping columns. Dropping those columns can merge distinct
   groups and return incorrect results.
   
   ## What changes are included in this PR?
   
   - Only rewrite GROUP BY expressions using dependencies valid across NULLs.
   - Apply the same check to DISTINCT elimination to preserve correct results.
   - Add regression tests and an upgrade guide note.
   
   ## What is the testing strategy for this PR?
   
   SLT and plan-builder tests cover nullable and composite UNIQUE keys,
   DISTINCT after GROUP BY, and valid PRIMARY KEY / NOT NULL UNIQUE cases.
   The DISTINCT regressions fail without the fix.
   
   ## Are there any user-facing changes?
   
   Yes: incorrect results are fixed
   


-- 
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] fix: do not drop GROUP BY keys using nullable UNIQUE constraints [datafusion]

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 merged PR #26220:
URL: https://github.com/apache/datafusion/pull/26220


-- 
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] fix: do not drop GROUP BY keys using nullable UNIQUE constraints [datafusion]

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

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/26220?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 `91.54930%` with `6 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 82.80%. Comparing base ([`b295a67`](https://app.codecov.io/gh/apache/datafusion/commit/b295a672ce6fcef216c94aaca88987c98449803c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`dbeddb3`](https://app.codecov.io/gh/apache/datafusion/commit/dbeddb3286ca0a1aac133cd5d3b34f38313e1f80?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/26220?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/expr/src/logical\_plan/builder.rs](https://app.codecov.io/gh/apache/datafusion/pull/26220?src=pr&el=tree&filepath=datafusion%2Fexpr%2Fsrc%2Flogical_plan%2Fbuilder.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9leHByL3NyYy9sb2dpY2FsX3BsYW4vYnVpbGRlci5ycw==) | 84.61% | [0 Missing and 6 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/26220?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   #26220      +/-   ##
   ==========================================
   - Coverage   82.80%   82.80%   -0.01%     
   ==========================================
     Files        1149     1149              
     Lines      452234   452286      +52     
     Branches   452234   452286      +52     
   ==========================================
   + Hits       374493   374524      +31     
   - Misses      54946    54956      +10     
   - Partials    22795    22806      +11     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/26220?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


Re: [PR] fix: do not drop GROUP BY keys using nullable UNIQUE constraints [datafusion]

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

   Thank you


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