[ 
https://issues.apache.org/jira/browse/OPTIQ-411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136335#comment-14136335
 ] 

Julian Hyde commented on OPTIQ-411:
-----------------------------------

Optiq supports duplicate aliases in SQL too (see 
https://github.com/julianhyde/optiq/commit/f7158805013c03f9e0252cb7808c26358a5c111c).
 But it does it without duplicate names in RelNode records. That would make 
this case easier, but some other things more difficult.

Optiq gets the column names from the validated AST. Could Hive do the same?

It's also possible that some other properties of the output columns, e.g. their 
precise type, change during the optimization process. That's another reason to 
keep the logical type info around.

By the way, at one point I considered banning duplicate expressions (regardless 
of their names) in "ProjectRel($0, $0)" because they are usually wasteful and 
confusing to other rules. But I relented because you sometimes need 'select a, 
a ...' at the top level and in the child of a union.

> Relax ProjectRelbase restriction on duplicate names
> ---------------------------------------------------
>
>                 Key: OPTIQ-411
>                 URL: https://issues.apache.org/jira/browse/OPTIQ-411
>             Project: Optiq
>          Issue Type: Bug
>            Reporter: Harish Butani
>            Assignee: Julian Hyde
>
> ProjectRelBase:180
> {code}
> !Util.isDistinct(rowType.getFieldNames()
> {code}
> disallows duplicate fieldNames. 
> But this the following is allowed in mysql, postgres and hive
> {code}
> create table t1(x int, y int);
> select x,x from t1;
> {code}
> Can optiq relax this check?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to