[
https://issues.apache.org/jira/browse/PHOENIX-2587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nick Dimiduk updated PHOENIX-2587:
----------------------------------
Attachment: 2587.patch
Simple fix. I'm not sure where tests should live. [~jamestaylor] any
suggestions?
> Decoding error for TIMESTAMP DESC values
> ----------------------------------------
>
> Key: PHOENIX-2587
> URL: https://issues.apache.org/jira/browse/PHOENIX-2587
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.6.0
> Reporter: Nick Dimiduk
> Assignee: Nick Dimiduk
> Fix For: 4.7.0, 4.6.1
>
> Attachments: 2587.patch
>
>
> 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)