You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2023/07/12 20:10:50 UTC
[GitHub] [arrow-datafusion] comphead commented on issue #6543: Support columns having the same alias
comphead commented on issue #6543:
URL: https://github.com/apache/arrow-datafusion/issues/6543#issuecomment-1633142650
> 🤯 I didn't realize this worked
>
> ```sql
> (arrow_dev) alamb@MacBook-Pro-8:~/Software/influxdb_iox2$ datafusion-cli
> DataFusion CLI v26.0.0
> ❯ create table foo (x int) as values (1), (2), (3);
> 0 rows in set. Query took 0.003 seconds.
> ❯ select x as "my_col", x as "my col" from foo;
> +--------+--------+
> | my_col | my col |
> +--------+--------+
> | 1 | 1 |
> | 2 | 2 |
> | 3 | 3 |
> +--------+--------+
> 3 rows in set. Query took 0.005 seconds.
> ❯ select x as "my_col", x+1 as "my col" from foo;
> +--------+--------+
> | my_col | my col |
> +--------+--------+
> | 1 | 2 |
> | 2 | 3 |
> | 3 | 4 |
> ```
>
> However, using `c1` as the alias for some reason fails:
>
> ```sql
> ❯ select x as c1, x as c1 from foo;
> Error during planning: Projections require unique expression names but the expression "foo.x AS c1" at position 0 and "foo.x AS c1" at position 1 have the same name. Consider aliasing ("AS") one of them.+--------+--------+
> ```
its failed as DF has projection uniqueness column name check.
first test didn't fail because it has different aliases
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org