You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by om...@apache.org on 2015/07/17 18:58:20 UTC
hive git commit: HIVE-11137. In DateWritable remove use of
LazyBinaryUtils.
Repository: hive
Updated Branches:
refs/heads/master b6f48cb91 -> 7788968ce
HIVE-11137. In DateWritable remove use of LazyBinaryUtils.
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7788968c
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7788968c
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7788968c
Branch: refs/heads/master
Commit: 7788968ce7baced7b6cbd575317d7413fc75d143
Parents: b6f48cb
Author: Owen O'Malley <om...@apache.org>
Authored: Sun Jun 28 17:04:49 2015 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Fri Jul 17 09:51:52 2015 -0700
----------------------------------------------------------------------
.../apache/hadoop/hive/serde2/io/DateWritable.java | 14 --------------
.../hadoop/hive/serde2/lazybinary/LazyBinaryDate.java | 4 +++-
.../hive/serde2/lazybinary/LazyBinarySerDe.java | 11 ++++++++---
3 files changed, 11 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/7788968c/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java b/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java
index 6cedf4c..e69351f 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java
@@ -25,9 +25,6 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
-import org.apache.hadoop.hive.serde2.ByteStream.RandomAccessOutput;
-import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
-import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableUtils;
@@ -146,17 +143,6 @@ public class DateWritable implements WritableComparable<DateWritable> {
return millisToDays(millisLocal);
}
- public void setFromBytes(byte[] bytes, int offset, int length, VInt vInt) {
- LazyBinaryUtils.readVInt(bytes, offset, vInt);
- assert (length == vInt.length);
- set(vInt.value);
- }
-
- public void writeToByteStream(RandomAccessOutput byteStream) {
- LazyBinaryUtils.writeVInt(byteStream, getDays());
- }
-
-
@Override
public void readFields(DataInput in) throws IOException {
daysSinceEpoch = WritableUtils.readVInt(in);
http://git-wip-us.apache.org/repos/asf/hive/blob/7788968c/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryDate.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryDate.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryDate.java
index d0c2504..4200e26 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryDate.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryDate.java
@@ -55,6 +55,8 @@ public class LazyBinaryDate extends
*/
@Override
public void init(ByteArrayRef bytes, int start, int length) {
- data.setFromBytes(bytes.getData(), start, length, vInt);
+ LazyBinaryUtils.readVInt(bytes.getData(), start, vInt);
+ assert (length == vInt.length);
+ data.set(vInt.value);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/7788968c/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java
index 3d14fbe..a5dc5d8 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java
@@ -250,9 +250,9 @@ public class LazyBinarySerDe extends AbstractSerDe {
*
* @param byteStream
* the byte stream storing the serialization data
- * @param obj
+ * @param fieldData
* the struct object to serialize
- * @param objInspector
+ * @param fieldOis
* the struct object inspector
* @param warnedOnceNullMapKey a boolean indicating whether a warning
* has been issued once already when encountering null map keys
@@ -311,6 +311,11 @@ public class LazyBinarySerDe extends AbstractSerDe {
public boolean value;
}
+ private static void writeDateToByteStream(RandomAccessOutput byteStream,
+ DateWritable date) {
+ LazyBinaryUtils.writeVInt(byteStream, date.getDays());
+ }
+
/**
* A recursive function that serialize an object to a byte buffer based on its
* object inspector.
@@ -422,7 +427,7 @@ public class LazyBinarySerDe extends AbstractSerDe {
case DATE: {
DateWritable d = ((DateObjectInspector) poi).getPrimitiveWritableObject(obj);
- d.writeToByteStream(byteStream);
+ writeDateToByteStream(byteStream, d);
return;
}
case TIMESTAMP: {