You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Swaroopa Kadam (Jira)" <ji...@apache.org> on 2019/11/21 01:30:00 UTC

[jira] [Created] (PHOENIX-5581) Cannot create a grandchild view with condition on newly added view column when the base table has an index

Swaroopa Kadam created PHOENIX-5581:
---------------------------------------

             Summary: Cannot create a grandchild view with condition on newly added view column when the base table has an index
                 Key: PHOENIX-5581
                 URL: https://issues.apache.org/jira/browse/PHOENIX-5581
             Project: Phoenix
          Issue Type: Bug
            Reporter: Swaroopa Kadam
             Fix For: 4.15.0, 5.1.0


CREATE TABLE IF NOT EXISTS TEST (ID INTEGER NOT NULL PRIMARY KEY, HOST VARCHAR(10));
CREATE INDEX I ON TEST(HOST);
-- create updatable view (equality condition in where clause)
CREATE VIEW V1 (col1 INTEGER) AS SELECT * FROM TEST WHERE ID=15;
CREATE VIEW GRAND_CHILD_V1 AS SELECT * FROM V1 WHERE col1 > 2;
-- Note that the where clause of the grandchild view is a condition on the new view column
 
The last step fails with the following exception: 
 
*Error: ERROR 504 (42703): Undefined column. columnName=V1#I.0:COL1 (state=42703,code=504)*
org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined column. columnName=V1#I.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:328)
at org.apache.phoenix.util.ViewUtil.addDerivedColumnsAndIndexesFromParent(ViewUtil.java:576)
at org.apache.phoenix.schema.MetaDataClient.addColumnsAndIndexesFromAncestors(MetaDataClient.java:868)
at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:4487)
at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:4483)
at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:3013)
at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1058)
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)
 
*However, the header rows for the grandchild view are still created in SYSTEM.CATALOG.*



--
This message was sent by Atlassian Jira
(v8.3.4#803005)