Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.0 c222b8206 -> c8c383ead
PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c8c383ea Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c8c383ea Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c8c383ea Branch: refs/heads/4.4-HBase-1.0 Commit: c8c383eadda20ac594ba83732d0902adfee051fa Parents: c222b82 Author: ramkrishna <ramkrishna.s.vasude...@gmail.com> Authored: Tue Jun 2 14:32:02 2015 +0530 Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com> Committed: Tue Jun 2 14:37:56 2015 +0530 ---------------------------------------------------------------------- .../main/java/org/apache/phoenix/schema/types/PTimestamp.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c8c383ea/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java index d396adc..16b110e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.schema.SortOrder; +import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.DateUtil; public class PTimestamp extends PDataType<Timestamp> { @@ -47,6 +48,10 @@ public class PTimestamp extends PDataType<Timestamp> { @Override public int toBytes(Object object, byte[] bytes, int offset) { if (object == null) { + // Create the byte[] of size MAX_TIMESTAMP_BYTES + if(bytes.length != getByteSize()) { + bytes = Bytes.padTail(bytes, (getByteSize() - bytes.length)); + } PDate.INSTANCE.getCodec().encodeLong(0l, bytes, offset); Bytes.putInt(bytes, offset + Bytes.SIZEOF_LONG, 0); return getByteSize();