Istvan Toth created PHOENIX-7512:
------------------------------------

             Summary: StringIndexOutOfBoundsException on nonexistent double 
quoted column name reference on local index
                 Key: PHOENIX-7512
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7512
             Project: Phoenix
          Issue Type: Bug
          Components: core
            Reporter: Istvan Toth


While the query is wrong, Phoenix should report an "Undefined column." error 
instead of the StringIndexOutOfBoundsException exception.
{noformat}
CREATE TABLE SCH.DATA (
    K1 VARCHAR(6) NOT NULL,
    V1 VARCHAR(18),
    V2 VARCHAR(100),
    K2 VARCHAR(6) NOT NULL,
    CONSTRAINT pk PRIMARY KEY (K1, K2)
);
CREATE LOCAL INDEX DATA_IDX_2 ON SCH.DATA(V2);
select * from DATA_IDX_2 where ":K1" = "something"
java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 9
    at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
    at java.base/java.lang.String.substring(String.java:1874)
    at 
org.apache.phoenix.util.IndexUtil.getDataColumnFamilyName(IndexUtil.java:195)
    at 
org.apache.phoenix.schema.IndexUncoveredDataColumnRef.<init>(IndexUncoveredDataColumnRef.java:51)
    at 
org.apache.phoenix.compile.ExpressionCompiler.resolveColumn(ExpressionCompiler.java:400)
    at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:241)
    at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:227)
    at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:214)
    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.ComparisonParseNode.accept(ComparisonParseNode.java:45)
    at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:184)
    at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:154)
    at 
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:842)
    at 
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:740)
    at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:311)
    at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:195)
    at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:847)
    at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:810)
    at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:379)
    at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:360)
    at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
    at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:360)
    at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:342)
    at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:2529)
    at sqlline.Commands.executeSingleQuery(Commands.java:1130)
    at sqlline.Commands.execute(Commands.java:1079)
    at sqlline.Commands.sql(Commands.java:1033)
    at sqlline.SqlLine.dispatch(SqlLine.java:822)
    at sqlline.SqlLine.begin(SqlLine.java:596)
    at sqlline.SqlLine.start(SqlLine.java:269)
    at sqlline.SqlLine.main(SqlLine.java:208)
{noformat}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to