Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A5D118D2D for ; Wed, 24 Jun 2015 20:23:59 +0000 (UTC) Received: (qmail 87030 invoked by uid 500); 24 Jun 2015 20:23:59 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 86815 invoked by uid 500); 24 Jun 2015 20:23:58 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 85280 invoked by uid 99); 24 Jun 2015 20:23:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 20:23:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8A1B6E3663; Wed, 24 Jun 2015 20:23:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tdsilva@apache.org To: commits@phoenix.apache.org Date: Wed, 24 Jun 2015 20:24:29 -0000 Message-Id: In-Reply-To: <5312c7b805ef46998125644800c0460e@git.apache.org> References: <5312c7b805ef46998125644800c0460e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [33/49] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram) 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/json Commit: 6c3d50ac198dd9159fb50cfe898734db99257c10 Parents: 7f6bf10 Author: ramkrishna Authored: Tue Jun 2 14:32:02 2015 +0530 Committer: ramkrishna 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 { @@ -47,6 +48,10 @@ public class PTimestamp extends PDataType { @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();