diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java index 9772b4d..f7a11fe 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java @@ -1248,6 +1248,20 @@ private VectorExpression getBetweenFilterExpression(List childExpr // prepare arguments for createVectorExpression List childrenAfterNot = foldConstantsForUnaryExprs(castChildren); + + // Consider the query: SELECT * FROM T1 WHERE C1 BETWEEN 100 AND 200; + // The childrenAfterNot list has 3 elements : + // 1. column on which the 'between' filter in performed. (C1 in the above example) + // 2. The start value of 'between' (100 in the above example) + // 3. The end value of 'between' (200 in the above example) + + // The first element better be a column and the remaining elements be constant values + // Else, vectorization cannot be performed. + if (!(childrenAfterNot.get(0) instanceof ExprNodeColumnDesc) || + !(childrenAfterNot.get(1) instanceof ExprNodeConstantDesc) || + !(childrenAfterNot.get(2) instanceof ExprNodeConstantDesc)) { + return null; + } // determine class Class cl = null;