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

Non equality comparisons don't work for ARRAY type columns that are DESC in row key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.5.1
    • None
    • None

    Description

      An exception occurs when you attempt to query an array column declared as DESC in the row key with <, >, <=, and >=. Here's how to reproduce:

      create table a (k varchar array primary key desc);
      upsert into a values (array['a']);
      select * from a where k >= array['a'];
      

      The exception is:

      java.lang.IllegalArgumentException
      	at java.nio.Buffer.position(Buffer.java:236)
      	at org.apache.phoenix.schema.types.PArrayDataType.createPhoenixArray(PArrayDataType.java:1074)
      	at org.apache.phoenix.schema.types.PArrayDataType.toObject(PArrayDataType.java:335)
      	at org.apache.phoenix.schema.types.PVarcharArray.toObject(PVarcharArray.java:65)
      	at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:966)
      	at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:970)
      	at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:999)
      	at org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1072)
      	at org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1068)
      	at org.apache.phoenix.iterate.ExplainTable.appendPKColumnValue(ExplainTable.java:182)
      	at org.apache.phoenix.iterate.ExplainTable.appendScanRow(ExplainTable.java:257)
      	at org.apache.phoenix.iterate.ExplainTable.appendKeyRanges(ExplainTable.java:273)
      	at org.apache.phoenix.iterate.ExplainTable.explain(ExplainTable.java:122)
      	at org.apache.phoenix.iterate.BaseResultIterators.explain(BaseResultIterators.java:713)
      	at org.apache.phoenix.iterate.RoundRobinResultIterator.explain(RoundRobinResultIterator.java:153)
      	at org.apache.phoenix.execute.BaseQueryPlan.getPlanSteps(BaseQueryPlan.java:406)
      	at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:263)
      	at org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:161)
      	at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:265)
      	at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:255)
      	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:254)
      	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1435)
      	at sqlline.Commands.execute(Commands.java:822)
      	at sqlline.Commands.sql(Commands.java:732)
      	at sqlline.SqlLine.dispatch(SqlLine.java:808)
      	at sqlline.SqlLine.begin(SqlLine.java:681)
      	at sqlline.SqlLine.start(SqlLine.java:398)
      	at sqlline.SqlLine.main(SqlLine.java:292)
      

      Attachments

        1. PHOENIX-2138_v3.patch
          13 kB
          Dumindu Buddhika
        2. PHOENIX-2138_v2.patch
          11 kB
          Dumindu Buddhika
        3. PHOENIX-2138_v1.patch
          12 kB
          Dumindu Buddhika

        Activity

          People

            Dumindux Dumindu Buddhika
            jamestaylor James R. Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: