You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by go...@apache.org on 2016/01/23 00:43:51 UTC
hive git commit: HIVE-12809: Vectorization: fast-path for coalesce if
input.noNulls = true (Gopal V, reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/master 165430b64 -> ca8662be5
HIVE-12809: Vectorization: fast-path for coalesce if input.noNulls = true (Gopal V, reviewed by Sergey Shelukhin)
Signed-off-by: Gopal V <go...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ca8662be
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ca8662be
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ca8662be
Branch: refs/heads/master
Commit: ca8662be576a78100a8c0515488faf71ad11a50f
Parents: 165430b
Author: Gopal V <go...@apache.org>
Authored: Fri Jan 22 15:41:22 2016 -0800
Committer: Gopal V <go...@apache.org>
Committed: Fri Jan 22 15:43:33 2016 -0800
----------------------------------------------------------------------
.../exec/vector/expressions/VectorCoalesce.java | 23 ++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/ca8662be/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorCoalesce.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorCoalesce.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorCoalesce.java
index 8ca84b7..543d7f0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorCoalesce.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorCoalesce.java
@@ -22,6 +22,8 @@ import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+import com.google.common.base.Preconditions;
+
import java.util.Arrays;
/**
@@ -38,6 +40,7 @@ public class VectorCoalesce extends VectorExpression {
this();
this.inputColumns = inputColumns;
this.outputColumn = outputColumn;
+ Preconditions.checkArgument(this.inputColumns.length > 0);
}
public VectorCoalesce() {
@@ -61,9 +64,25 @@ public class VectorCoalesce extends VectorExpression {
outputVector.init();
- outputVector.noNulls = false;
+ boolean noNulls = false;
+
+ for (int k = 0; k < inputColumns.length; k++) {
+ ColumnVector cv = batch.cols[inputColumns[k]];
+ // non-nulls in any column qualifies coalesce having no nulls
+ // common case: last column is a constant & non-null
+ noNulls = noNulls || cv.noNulls;
+ }
+
+ outputVector.noNulls = noNulls;
outputVector.isRepeating = false;
- if (batch.selectedInUse) {
+
+ ColumnVector first = batch.cols[inputColumns[0]];
+
+ if (first.noNulls && first.isRepeating) {
+ outputVector.isRepeating = true;
+ outputVector.isNull[0] = false;
+ outputVector.setElement(0, 0, first);
+ } else if (batch.selectedInUse) {
for (int j = 0; j != n; j++) {
int i = sel[j];
outputVector.isNull[i] = true;