albel727 commented on issue #4667:
URL: 
https://github.com/apache/arrow-datafusion/issues/4667#issuecomment-1356838250

   After a bit of experimenting, it doesn't seem like the bug is limited to 
selecting from `UNION`, but rather any `SELECT ... FROM (SELECT DISTINCT ... 
FROM ...)`. Which is apparently how `UNION` is implemented internally 
https://github.com/apache/arrow-datafusion/issues/998#issuecomment-923155977
   E.g. the following also yields wrong results:
   ```sql
   SELECT DISTINCT * FROM tbl;
   ```
   ```
   +----+------+
   | id | data |
   +----+------+
   | 1  | 10   |
   | 1  | 20   |
   +----+------+
   ```
   ```sql
   SELECT id FROM (SELECT DISTINCT * FROM tbl);
   ```
   ```
   +----+
   | id |
   +----+
   | 1  |
   +----+
   ```
   Where it of course should have returned two rows.


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

Reply via email to