Github user maropu commented on the issue:
https://github.com/apache/spark/pull/18938
IMHO, other database(-like) systems prevent this name duplication in
temporary table/view, so it seems we might do so along with them.
```
// postgresql case
postgres=# create table s0 (a int, b int);
CREATE TABLE
postgres=# create table s1 (a int, b int);
CREATE TABLE
postgres=# select * from s0, s1 where s0.a = s1.a;
a | b | a | b
---+---+---+---
(0 rows)
postgres=# create view s2 as select * from s0, s1 where s0.a = s1.a;
ERROR: column "a" specified more than once
postgres=# create temporary view s2 as select * from s0, s1 where s0.a =
s1.a;
ERROR: column "a" specified more than once
// mysql case
mysql> create table s0 (a int, b int);
Query OK, 0 rows affected (0.02 sec)
mysql> create table s1 (a int, b int);
Query OK, 0 rows affected (0.02 sec)
mysql> select * from s0, s1 where s0.a = s1.a;
Empty set (0.00 sec)
mysql> create view s2 as select * from s0, s1 where s0.a = s1.a;
ERROR 1060 (42S21): Duplicate column name 'a'
mysql> create temporary table s2 as select * from s0, s1 where s0.a = s1.a;
ERROR 1060 (42S21): Duplicate column name 'a'
// hive case
hive> create table s0 (a int, b int);
OK
hive> create table s1 (a int, b int);
OK
hive> select * from s0, s1 where s0.a = s1.a;
OK
hive> create temporary view s2 as select * from s0, s1 where s0.a = s1.a;
FAILED: ParseException line 1:17 cannot recognize input near 'create'
'temporary' 'view' in ddl statement
hive> create view s2 as select * from s0, s1 where s0.a = s1.a;
FAILED: SemanticException
org.apache.hadoop.hive.ql.optimizer.calcite.CalciteViewSemanticException:
Duplicate column name: a
hive> create temporary table s2 as select * from s0, s1 where s0.a = s1.a;
FAILED: SemanticException [Error 10036]: Duplicate column name: a
```
But, I think this name duplication is an expected one in the 2.x releases
(for example, we already have some tests related to this:
https://github.com/apache/spark/blob/master/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala#L37).
So, this might be fixed for v3.x releases, maybe.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]