You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ra...@apache.org on 2015/06/02 11:03:00 UTC

phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)

Repository: phoenix
Updated Branches:
  refs/heads/master 7f6bf10b2 -> 6c3d50ac1


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/6c3d50ac
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6c3d50ac
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6c3d50ac

Branch: refs/heads/master
Commit: 6c3d50ac198dd9159fb50cfe898734db99257c10
Parents: 7f6bf10
Author: ramkrishna <ra...@gmail.com>
Authored: Tue Jun 2 14:32:02 2015 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Tue Jun 2 14:32:02 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/6c3d50ac/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();