[
https://issues.apache.org/jira/browse/CALCITE-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16996108#comment-16996108
]
Chunwei Lei edited comment on CALCITE-3387 at 12/14/19 3:16 AM:
----------------------------------------------------------------
Thanks for your review, [~julianhyde].
On one hand, the behavior is kind of the same with {{expandStar}} in which
common columns will be rewrited to {{COALESCE(...)}}[1]. On the other hand, I
think it makes sense to rewrite it to COALESCE since the columns will be
formatted to fully-qualify columns during validation.
[1]
[https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L6475]
was (Author: chunwei lei):
Thanks for your review, [~julianhyde].
On one hand, the behavior is kind of the same with {{expandStar}} in which
common columns will be rewrited to {{COALESCE(...)}}[1]. On the other hand, I
think it makes sense to rewrite it to COALESCE since the columns will be
formatted to fully-qualify columns during validation.
[1]
[https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L6475]
\{{}}
> Query with GROUP BY and JOIN ... USING wrongly fails with "Column 'DEPTNO' is
> ambiguous" error
> ----------------------------------------------------------------------------------------------
>
> Key: CALCITE-3387
> URL: https://issues.apache.org/jira/browse/CALCITE-3387
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Chunwei Lei
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Query with GROUP BY and JOIN ... USING wrongly fails with "Column 'DEPTNO' is
> ambiguous" error. Here is the query:
> {code}
> select deptno, count(*)
> from emp
> join dept using (deptno)
> group by deptno;
> {code}
> Because of USING, the two deptno fields should be merged into one, and
> therefore {{deptno}} is not ambiguous. That query works in Oracle. Also note
> that
> {code}select deptno
> from emp
> join dept using (deptno)
> {code}
> works correctly in Calcite, and has since CALCITE-2227 was fixed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)