gruuya commented on PR #20819:
URL: https://github.com/apache/datafusion/pull/20819#issuecomment-4065785422
> This approach doesn't handle queries like:
>
> `SELECT a, b FROM t1 UNION ALL SELECT count(*), count(*) FROM t2;`
>
> (Error during planning: Projections require unique expression names but
the expression "count(Int64(1)) AS count(*)" at position 0 and "count(Int64(1))
AS count(*)" at position 1 have the same name. Consider aliasing ("AS") one of
them.)
>
> Or other non-column-name expressions in the target list of non-first
queries.
Fair point, this occurs because of the `is_literal_value` condition for
aliasing.
> I wonder if it would be cleaner to arrange not to check for duplicate
column names in set operation queries that aren't the left-most query? Since
the column names for such queries are discarded anyway, it seems a bit
laborious to first rewrite them to ensure they are unique, and then check that
they are indeed unique, before discarding them anyway.
Agreed, i actually thought about this first, but it seemed less clean and
more invasive in the end, so i ended up with this approach. Let me rethink
about it.
--
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]