[ 
https://issues.apache.org/jira/browse/PHOENIX-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maryann Xue updated PHOENIX-2930:
---------------------------------
    Attachment: PHOENIX-2930.2.patch

Came up with a slightly different patch. Instead of making up a new 
ColumnParseNode and test equality between the two nodes, it might be better to 
test if they can be resolved as the same column reference. I'll go ahead and 
commit it if this patch passes all tests.

> Cannot resolve columns aliased to its own name
> ----------------------------------------------
>
>                 Key: PHOENIX-2930
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2930
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.4.0
>            Reporter: Kevin Liew
>            Assignee: Ankit Singhal
>              Labels: alias
>             Fix For: 4.9.0
>
>         Attachments: PHOENIX-2930.2.patch, PHOENIX-2930.patch
>
>
> Tableau generates queries that alias a fully-qualified column name to its 
> shortened name.
> Similar to:
> {code}
> create table test (pk integer primary key);
> select test.pk as pk from test group by pk;
> {code}
> Phoenix reports:
> {code}
> 8org.apache.calcite.avatica.proto.Responses$ErrorResponse¨
> ðjava.lang.RuntimeException: 
> org.apache.phoenix.schema.AmbiguousColumnException: ERROR 502 (42702): Column 
> reference ambiguous or duplicate names. columnName=PK
>       at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:671)
>       at org.apache.calcite.avatica.jdbc.JdbcMeta.prepare(JdbcMeta.java:695)
>       at 
> org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:208)
>       at 
> org.apache.calcite.avatica.remote.Service$PrepareRequest.accept(Service.java:1157)
>       at 
> org.apache.calcite.avatica.remote.Service$PrepareRequest.accept(Service.java:1131)
>       at 
> org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:95)
>       at 
> org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46)
>       at 
> org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:127)
>       at 
> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>       at org.eclipse.jetty.server.Server.handle(Server.java:499)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
>       at 
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.phoenix.schema.AmbiguousColumnException: ERROR 502 
> (42702): Column reference ambiguous or duplicate names. columnName=PK
>       at 
> org.apache.phoenix.parse.ParseNodeRewriter.visit(ParseNodeRewriter.java:406)
>       at 
> org.apache.phoenix.compile.StatementNormalizer.visit(StatementNormalizer.java:177)
>       at 
> org.apache.phoenix.compile.StatementNormalizer.visit(StatementNormalizer.java:58)
>       at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>       at 
> org.apache.phoenix.parse.ParseNodeRewriter.rewrite(ParseNodeRewriter.java:111)
>       at 
> org.apache.phoenix.compile.StatementNormalizer.normalize(StatementNormalizer.java:107)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:398)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:378)
>       at 
> org.apache.phoenix.jdbc.PhoenixPreparedStatement.getMetaData(PhoenixPreparedStatement.java:223)
>       at org.apache.calcite.avatica.jdbc.JdbcMeta.prepare(JdbcMeta.java:689)
>       ... 15 more
> {code}



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

Reply via email to