Hari Krishna Dara created PHOENIX-7154: ------------------------------------------
Summary: SELECT query with undefined column on an UNCOVERED INDEX results in StringIndexOutOfBoundsException Key: PHOENIX-7154 URL: https://issues.apache.org/jira/browse/PHOENIX-7154 Project: Phoenix Issue Type: Bug Affects Versions: 5.1.4 Reporter: Hari Krishna Dara If you run a SELECT query directly on an uncovered index with a column name that is undefined for that index, you get a {{{}java.lang.StringIndexOutOfBoundsException{}}}. In the below sample, you can see that using a valid column, the query worked fine, but an undefined column caused the exception. {{0: jdbc:phoenix:localhost> create table t (k INTEGER PRIMARY KEY, v1 INTEGER);}} {{No rows affected (0.64 seconds)}} {{0: jdbc:phoenix:localhost> create uncovered index tuidx on t (PHOENIX_ROW_TIMESTAMP());}} {{No rows affected (5.671 seconds)}} {{0: jdbc:phoenix:localhost> select abc from tuidx;}} {{java.lang.StringIndexOutOfBoundsException: String index out of range: -1}} {{ at java.lang.String.substring(String.java:1967)}} {{ at org.apache.phoenix.util.IndexUtil.getDataColumnFamilyName(IndexUtil.java:200)}} {{ at org.apache.phoenix.schema.IndexUncoveredDataColumnRef.<init>(IndexUncoveredDataColumnRef.java:51)}} {{ at org.apache.phoenix.compile.TupleProjectionCompiler$ColumnRefVisitor.visit(TupleProjectionCompiler.java:269)}} {{ at org.apache.phoenix.compile.TupleProjectionCompiler$ColumnRefVisitor.visit(TupleProjectionCompiler.java:245)}} {{ at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)}} {{ at org.apache.phoenix.compile.TupleProjectionCompiler.createProjectedTable(TupleProjectionCompiler.java:127)}} {{ at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:701)}} {{ at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:667)}} {{ at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:249)}} {{ at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:181)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:724)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:687)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:368)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:349)}} {{ at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:349)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:335)}} {{ at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:2362)}} {{ at sqlline.Commands.executeSingleQuery(Commands.java:1054)}} {{ at sqlline.Commands.execute(Commands.java:1003)}} {{ at sqlline.Commands.sql(Commands.java:967)}} {{ at sqlline.SqlLine.dispatch(SqlLine.java:734)}} {{ at sqlline.SqlLine.begin(SqlLine.java:541)}} {{ at sqlline.SqlLine.start(SqlLine.java:267)}} {{ at sqlline.SqlLine.main(SqlLine.java:206)}} {{0: jdbc:phoenix:localhost> select ":K" from tuidx;}} {{+----+}} {{| :K |}} {{+----+}} {{+----+}} -- This message was sent by Atlassian Jira (v8.20.10#820010)