[ https://issues.apache.org/jira/browse/PHOENIX-6123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chinmay Kulkarni reopened PHOENIX-6123: --------------------------------------- > Old clients cannot query a view if the parent has an index > ---------------------------------------------------------- > > Key: PHOENIX-6123 > URL: https://issues.apache.org/jira/browse/PHOENIX-6123 > Project: Phoenix > Issue Type: Bug > Affects Versions: 5.0.0, 4.15.0 > Reporter: Chinmay Kulkarni > Priority: Blocker > Fix For: 5.1.0, 4.16.0 > > > Steps to repro: > 1. Start a 4.16 cluster and run the following with a 4.16 client: > {code:sql} > CREATE TABLE IF NOT EXISTS S.T (A INTEGER NOT NULL PRIMARY KEY, B INTEGER, C > INTEGER); > CREATE INDEX IF NOT EXISTS IDX ON S.T(B); > CREATE VIEW IF NOT EXISTS V1 AS SELECT * FROM S.T WHERE C > 1; > {code} > 2. From a 4.14 client, try to query the newly created view: > {code:sql} > 0: jdbc:phoenix:> SELECT * FROM V1; > Error: ERROR 504 (42703): Undefined column. columnName=S.IDX.0:C > (state=42703,code=504) > org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): > Undefined column. columnName=S.IDX.0:C > at > org.apache.phoenix.schema.PTableImpl.getColumnForColumnName(PTableImpl.java:828) > at > org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.resolveColumn(FromCompiler.java:477) > at > org.apache.phoenix.compile.ExpressionCompiler.resolveColumn(ExpressionCompiler.java:372) > at > org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:197) > at > org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:183) > at > org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:170) > 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.compile.WhereCompiler.compile(WhereCompiler.java:96) > at > org.apache.phoenix.util.IndexUtil.rewriteViewStatement(IndexUtil.java:535) > at > org.apache.phoenix.schema.MetaDataClient.addIndexesFromParentTable(MetaDataClient.java:918) > at > org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:4036) > at > org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:680) > at > org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:539) > at > org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:573) > at > org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:391) > at > org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:228) > at > org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:206) > at > org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:593) > at > org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:567) > at > org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:330) > at > org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:315) > at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:314) > at > org.apache.phoenix.jdbc.PhoenixStatement.access$600(PhoenixStatement.java:238) > at > org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:382) > at > org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:315) > at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:314) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:307) > at > org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1947) > 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) > {code} > The same happens if the view is created on top of a view that has an index. > Similarly, a view creation from an old client also fails with the same error > as above. -- This message was sent by Atlassian Jira (v8.3.4#803005)