You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/06/20 21:39:56 UTC

[7/7] hive git commit: HIVE-14012 : some ColumnVector-s are missing ensureSize (Sergey Shelukhin, reviewed by Prasanth J)

HIVE-14012 : some ColumnVector-s are missing ensureSize (Sergey Shelukhin, reviewed by Prasanth J)

Conflicts:
	storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9c39b322
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9c39b322
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9c39b322

Branch: refs/heads/branch-1
Commit: 9c39b3225ace628ffb44ef221a8565ef620b5632
Parents: 89fa0a1
Author: Sergey Shelukhin <se...@apache.org>
Authored: Mon Jun 20 14:36:46 2016 -0700
Committer: Sergey Shelukhin <se...@apache.org>
Committed: Mon Jun 20 14:38:44 2016 -0700

----------------------------------------------------------------------
 .../vector/IntervalDayTimeColumnVector.java     | 19 ++++++++++++++++++
 .../ql/exec/vector/TimestampColumnVector.java   | 21 +++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/9c39b322/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/IntervalDayTimeColumnVector.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/IntervalDayTimeColumnVector.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/IntervalDayTimeColumnVector.java
index 39ccea8..c4a6c0f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/IntervalDayTimeColumnVector.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/IntervalDayTimeColumnVector.java
@@ -345,4 +345,23 @@ public class IntervalDayTimeColumnVector extends ColumnVector {
       buffer.append("null");
     }
   }
+
+  @Override
+  public void ensureSize(int size, boolean preserveData) {
+    super.ensureSize(size, preserveData);
+    if (size <= totalSeconds.length) return;
+    long[] oldTime = totalSeconds;
+    int[] oldNanos = nanos;
+    totalSeconds = new long[size];
+    nanos = new int[size];
+    if (preserveData) {
+      if (isRepeating) {
+        totalSeconds[0] = oldTime[0];
+        nanos[0] = oldNanos[0];
+      } else {
+        System.arraycopy(oldTime, 0, totalSeconds, 0, oldTime.length);
+        System.arraycopy(oldNanos, 0, nanos, 0, oldNanos.length);
+      }
+    }
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/9c39b322/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java
index c0dd5ed..d212af6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/TimestampColumnVector.java
@@ -392,4 +392,23 @@ public class TimestampColumnVector extends ColumnVector {
       buffer.append("null");
     }
   }
-}
\ No newline at end of file
+
+  @Override
+  public void ensureSize(int size, boolean preserveData) {
+    super.ensureSize(size, preserveData);
+    if (size <= time.length) return;
+    long[] oldTime = time;
+    int[] oldNanos = nanos;
+    time = new long[size];
+    nanos = new int[size];
+    if (preserveData) {
+      if (isRepeating) {
+        time[0] = oldTime[0];
+        nanos[0] = oldNanos[0];
+      } else {
+        System.arraycopy(oldTime, 0, time, 0, oldTime.length);
+        System.arraycopy(oldNanos, 0, nanos, 0, oldNanos.length);
+      }
+    }
+  }
+}