You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2014/10/09 22:29:32 UTC
svn commit: r1630588 - in /hive/branches/branch-0.14: ./
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java
Author: brock
Date: Thu Oct 9 20:29:32 2014
New Revision: 1630588
URL: http://svn.apache.org/r1630588
Log:
Merge HIVE-8380 - NanoTime class serializes and deserializes Timestamp incorrectly
Modified:
hive/branches/branch-0.14/ (props changed)
hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java
Propchange: hive/branches/branch-0.14/
------------------------------------------------------------------------------
Merged /hive/trunk:r1630512
Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java?rev=1630588&r1=1630587&r2=1630588&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTime.java Thu Oct 9 20:29:32 2014
@@ -14,6 +14,7 @@
package org.apache.hadoop.hive.ql.io.parquet.timestamp;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
import parquet.Preconditions;
import parquet.io.api.Binary;
@@ -28,7 +29,10 @@ public class NanoTime {
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 NanoTime(int julianDay, long timeOfDayNanos) {
@@ -46,8 +50,9 @@ public class NanoTime {
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);
}
@@ -60,4 +65,4 @@ public class NanoTime {
public String toString() {
return "NanoTime{julianDay="+julianDay+", timeOfDayNanos="+timeOfDayNanos+"}";
}
-}
\ No newline at end of file
+}