Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2930

Cannot resolve columns aliased to its own name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.4.0
    • 4.9.0
    • None

    Description

      Tableau generates queries that alias a fully-qualified column name to its shortened name.

      Similar to:

      create table test (pk integer primary key);
      select test.pk as pk from test group by pk;
      

      Phoenix reports:

      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
      

      Attachments

        1. PHOENIX-2930.2.patch
          5 kB
          Wei Xue
        2. PHOENIX-2930.patch
          6 kB
          Ankit Singhal

        Activity

          People

            ankit@apache.org Ankit Singhal
            kliew Kevin Liew
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: