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

Exception thrown when executing an IN list of Row Value Constructors against salted tables.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0, 4.0.0
    • None
    • None
    • None

    Description

      1) Table - Salted. Query - IN list of RVCs. Result - fails with exception. 
      
      Details:
      
      Table DDL - CREATE TABLE t (pk1 varchar(5) NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key (pk1,pk2,pk3)) SALT_BUCKETS=4
      
      Query - select pk1, pk2, pk3 from t WHERE (pk1, pk2, pk3) IN ((?, ?, ?), (?, ?, ?))
      
      Exception:
      java.lang.ArrayIndexOutOfBoundsException: 1
      	at org.apache.phoenix.schema.ValueSchema.getField(ValueSchema.java:300)
      	at org.apache.phoenix.util.ScanUtil.setKey(ScanUtil.java:260)
      	at org.apache.phoenix.compile.ScanRanges.getPointKeys(ScanRanges.java:185)
      	at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:61)
      	at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:224)
      	at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:105)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:260)
      	at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:128)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:264)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:1)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:199)
      	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeQuery(PhoenixPreparedStatement.java:157)
      	at org.apache.phoenix.end2end.RowValueConstructorIT.testInListOfRVC5(RowValueConstructorIT.java:1078)
      
      
      2) Most likely related to 1)  Table - multi-tenant and salted. Query - IN list of RVCs. Result - Fails with exception.  
      
      Details:
      Base Table DDL - CREATE TABLE t (tenantId varchar(5) NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key (tenantId,pk2,pk3)) SALT_BUCKETS=4, MULTI_TENANT=true
      
      Tenant View DDL - CREATE VIEW t_view (tenant_col VARCHAR) AS SELECT * FROM t
      
      Query using global connection : select pk2, pk3 from t WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?))
      
      Stacktrace:
      
      java.lang.ArrayIndexOutOfBoundsException: 1
      	at org.apache.phoenix.schema.ValueSchema.getField(ValueSchema.java:300)
      	at org.apache.phoenix.util.ScanUtil.setKey(ScanUtil.java:260)
      	at org.apache.phoenix.compile.ScanRanges.getPointKeys(ScanRanges.java:185)
      	at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:61)
      	at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:224)
      	at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:105)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:260)
      	at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:128)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:264)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:1)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:199)
      	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeQuery(PhoenixPreparedStatement.java:157)
      	at org.apache.phoenix.end2end.RowValueConstructorIT.testInListOfRVC4(RowValueConstructorIT.java:1042)
      
      

      Attachments

        1. PHOENIX-1077.patch
          14 kB
          Kyle Buzsaki

        Activity

          People

            kbuzsaki Kyle Buzsaki
            samarthjain Samarth Jain
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: