You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Nick Dimiduk (JIRA)" <ji...@apache.org> on 2016/01/11 23:50:39 UTC

[jira] [Created] (PHOENIX-2587) Decoding error for TIMESTAMP DESC values

Nick Dimiduk created PHOENIX-2587:
-------------------------------------

             Summary: Decoding error for TIMESTAMP DESC values
                 Key: PHOENIX-2587
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2587
             Project: Phoenix
          Issue Type: Bug
            Reporter: Nick Dimiduk
            Assignee: Nick Dimiduk
             Fix For: 4.6.0


A minor logic error in {{TIMESTAMP DESC}} values results in the following exception:

{noformat}
Caused by: java.lang.IllegalArgumentException: offset (8) + length (4) exceed the capacity of the array: 4
	at org.apache.hadoop.hbase.util.Bytes.explainWrongLengthOrOffset(Bytes.java:631)
	at org.apache.hadoop.hbase.util.Bytes.toInt(Bytes.java:801)
	at org.apache.hadoop.hbase.util.Bytes.toInt(Bytes.java:787)
	at org.apache.phoenix.schema.types.PUnsignedInt$UnsignedIntCodec.decodeInt(PUnsignedInt.java:162)
	at org.apache.phoenix.schema.types.PTimestamp.toObject(PTimestamp.java:109)
	at org.apache.phoenix.schema.types.PTimestamp.toObject(PTimestamp.java:32)
	at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:988)
	at org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:846)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:322)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:314)
	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:313)
	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:242)
	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:172)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeBatch(PhoenixStatement.java:1318)
	... 11 more
{noformat}

On inspection, looks like we don't compensate the offset parameter when the nanos part is being decoded.

{noformat}
    public int decodeInt(byte[] b, int o, SortOrder sortOrder) {
...
      if (sortOrder == SortOrder.DESC) {
        b = SortOrder.invert(b, o, new byte[Bytes.SIZEOF_INT], 0, Bytes.SIZEOF_INT);
      }
      int v = Bytes.toInt(b, o);
...
    }
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)