Phoenix500526 commented on issue #23820:
URL: https://github.com/apache/datafusion/issues/23820#issuecomment-6676283817

   This appears to be fixed on `main` by #26220, merged as 
9eeb66f2f4f399ab9857a2a18e4e582dc9d04e06. That PR linked #23819, but it also 
prevents nullable `UNIQUE` constraints from incorrectly expanding `GROUP BY`.
   
   I checked the original reproducer with a local `v57.0.0-dev` CLI:
   
   ```sql
   CREATE TABLE t (x INT UNIQUE, y INT)
   AS VALUES (NULL, 2), (NULL, 1), (1, 3);
   
   SELECT x, y FROM t GROUP BY x;
   ```
   
   It now correctly fails during planning because `y` is neither grouped nor 
aggregated, instead of silently adding `y` to the grouping keys and returning 
three rows. The PR also adds regression coverage for this case in 
`functional_dependencies.slt`.
   
   ```sql
   Error during planning: Column in SELECT must be in GROUP BY or an aggregate 
function: While expanding wildcard, column "t.y" must appear in the GROUP BY 
clause or must be part of an aggregate function, currently only "t.x" appears 
in the SELECT clause satisfies this requirement
   ```
   
   
   Could we close this issue as resolved?


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