parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject incubator-parquet-mr git commit: PARQUET-114: Sample NanoTime class serializes and deserializes Timestamp incorrectly
Date Thu, 20 Nov 2014 17:19:42 GMT
Repository: incubator-parquet-mr
Updated Branches:
  refs/heads/master d105819a0 -> 3aa6f1178


PARQUET-114: Sample NanoTime class serializes and deserializes Timestamp incorrectly

I ran the Parquet Column tests and they passed.

FYI @rdblue

Author: Brock Noland <brock@apache.org>

Closes #71 from brockn/master and squashes the following commits:

69ba484 [Brock Noland] PARQUET-114 - Sample NanoTime class serializes and deserializes Timestamp
incorrectly


Project: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/commit/3aa6f117
Tree: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/tree/3aa6f117
Diff: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/diff/3aa6f117

Branch: refs/heads/master
Commit: 3aa6f11785a2f1b3b09df328a02a2c28dfa0bb57
Parents: d105819
Author: Brock Noland <brock@apache.org>
Authored: Thu Nov 20 09:19:25 2014 -0800
Committer: Brock Noland <brock@apache.org>
Committed: Thu Nov 20 09:19:25 2014 -0800

----------------------------------------------------------------------
 .../src/main/java/parquet/example/data/simple/NanoTime.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/3aa6f117/parquet-column/src/main/java/parquet/example/data/simple/NanoTime.java
----------------------------------------------------------------------
diff --git a/parquet-column/src/main/java/parquet/example/data/simple/NanoTime.java b/parquet-column/src/main/java/parquet/example/data/simple/NanoTime.java
index 040a83b..fc570ee 100644
--- a/parquet-column/src/main/java/parquet/example/data/simple/NanoTime.java
+++ b/parquet-column/src/main/java/parquet/example/data/simple/NanoTime.java
@@ -1,6 +1,7 @@
 package parquet.example.data.simple;
 
 import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 import parquet.Preconditions;
 import parquet.io.api.Binary;
 import parquet.io.api.RecordConsumer;
@@ -12,7 +13,10 @@ public class NanoTime extends Primitive {
   public static NanoTime fromBinary(Binary bytes) {
     Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
     ByteBuffer buf = bytes.toByteBuffer();
-    return new NanoTime(buf.getInt(), buf.getLong());
+    buf.order(ByteOrder.LITTLE_ENDIAN);
+    long timeOfDayNanos = buf.getLong();
+    int julianDay = buf.getInt();
+    return new NanoTime(julianDay, timeOfDayNanos);
   }
 
   public static NanoTime fromInt96(Int96Value int96) {
@@ -35,8 +39,9 @@ public class NanoTime extends Primitive {
 
   public Binary toBinary() {
     ByteBuffer buf = ByteBuffer.allocate(12);
-    buf.putInt(julianDay);
+    buf.order(ByteOrder.LITTLE_ENDIAN);
     buf.putLong(timeOfDayNanos);
+    buf.putInt(julianDay);
     buf.flip();
     return Binary.fromByteBuffer(buf);
   }


Mime
View raw message