Details
Description
While playing with the queries to reproduce PHOENIX-1362, I got the below exception (take the same schema and data as in PHOENIX-1362):
0: jdbc:phoenix:isthbase01-mnds2-1-crd> select min(VAL2), min(VAL3) from TT; +------------+------------+ | MIN(VAL2) | MIN(VAL3) | +------------+------------+ java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.phoenix.schema.KeyValueSchema.writeVarLengthField(KeyValueSchema.java:150) at org.apache.phoenix.schema.KeyValueSchema.toBytes(KeyValueSchema.java:116) at org.apache.phoenix.schema.KeyValueSchema.toBytes(KeyValueSchema.java:91) at org.apache.phoenix.expression.aggregator.Aggregators.toBytes(Aggregators.java:109) at org.apache.phoenix.iterate.GroupedAggregatingResultIterator.next(GroupedAggregatingResultIterator.java:83) at org.apache.phoenix.iterate.UngroupedAggregatingResultIterator.next(UngroupedAggregatingResultIterator.java:39) at org.apache.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:732) at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2429) at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2074) at sqlline.SqlLine.print(SqlLine.java:1735) at sqlline.SqlLine$Commands.execute(SqlLine.java:3683) at sqlline.SqlLine$Commands.sql(SqlLine.java:3584) at sqlline.SqlLine.dispatch(SqlLine.java:821) at sqlline.SqlLine.begin(SqlLine.java:699) at sqlline.SqlLine.mainWithInputRedirection(SqlLine.java:441) at sqlline.SqlLine.main(SqlLine.java:424) 0: jdbc:phoenix:isthbase01-mnds2-1-crd> select min(VAL1), min(VAL2) from TT; +------------+------------+ | MIN(VAL1) | MIN(VAL2) | +------------+------------+ | 0 | null | +------------+------------+