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

Creating a grand-child view on a table with an index fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.15.0, 4.14.1, 4.14.3
    • 5.1.0, 4.14.4, 4.16.0
    • None

    Description

      Steps to reproduce:

      • Build the latest Phoenix jar from the 4.x-HBase-1.3 branch.
      • Start HBase 1.3 server with above Phoenix jar in the classpath
      • Connect with a Phoenix client with above jar in classpath. From SQLLine:
      CREATE TABLE IF NOT EXISTS Z_BASE_TABLE (ID INTEGER NOT NULL PRIMARY KEY, HOST VARCHAR(10), FLAG BOOLEAN);
      
      CREATE VIEW Z_VIEW1 (col1 INTEGER, col2 INTEGER, col3 INTEGER, col4 INTEGER, col5 INTEGER) AS SELECT * FROM Z_BASE_TABLE WHERE ID>10;
      
      CREATE INDEX Z_INDEX ON Z_BASE_TABLE(HOST);
      
      CREATE VIEW GRAND_CHILD1 AS SELECT * FROM Z_VIEW1 WHERE col1 > 2;
      

      The last step fails with the following exception:

      Error: ERROR 504 (42703): Undefined column. columnName=Z_VIEW1#Z_INDEX.0:COL1 (state=42703,code=504)
      org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined column. columnName=Z_VIEW1#Z_INDEX.0:COL1
      	at org.apache.phoenix.schema.PTableImpl.getColumnForColumnName(PTableImpl.java:1076)
      	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.resolveColumn(FromCompiler.java:528)
      	at org.apache.phoenix.compile.ExpressionCompiler.resolveColumn(ExpressionCompiler.java:368)
      	at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:191)
      	at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
      	at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
      	at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
      	at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
      	at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
      	at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
      	at org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
      	at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
      	at org.apache.phoenix.parse.AndParseNode.accept(AndParseNode.java:47)
      	at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:94)
      	at org.apache.phoenix.util.IndexUtil.rewriteViewStatement(IndexUtil.java:549)
      	at org.apache.phoenix.util.ViewUtil.addIndexesFromParent(ViewUtil.java:283)
      	at org.apache.phoenix.util.ViewUtil.addDerivedColumnsAndIndexesFromParent(ViewUtil.java:531)
      	at org.apache.phoenix.schema.MetaDataClient.addColumnsAndIndexesFromAncestors(MetaDataClient.java:859)
      	at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:4456)
      	at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:4452)
      	at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:3004)
      	at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1049)
      	at org.apache.phoenix.compile.CreateTableCompiler$1.execute(CreateTableCompiler.java:217)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:411)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:394)
      	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:393)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:381)
      	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1843)
      	at sqlline.Commands.execute(Commands.java:814)
      	at sqlline.Commands.sql(Commands.java:754)
      	at sqlline.SqlLine.dispatch(SqlLine.java:646)
      	at sqlline.SqlLine.begin(SqlLine.java:510)
      	at sqlline.SqlLine.start(SqlLine.java:233)
      	at sqlline.SqlLine.main(SqlLine.java:175)
      

      Attachments

        1. PHOENIX-5529-master.patch
          5 kB
          Abhishek Singh Chouhan
        2. PHOENIX-5529-master.001.patch
          5 kB
          Abhishek Singh Chouhan

        Issue Links

          Activity

            People

              abhishek.chouhan Abhishek Singh Chouhan
              ckulkarni Chinmay Kulkarni
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: