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