This is an automated email from the ASF dual-hosted git repository.

zhangbutao pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new d17558a48e1 HIVE-25351: stddev(), stddev_pop() return NaN when CBO is 
enabled (#5262) (#5940)
d17558a48e1 is described below

commit d17558a48e165166bc80360d938b9a42036f1b5c
Author: Butao Zhang <zhangbu...@apache.org>
AuthorDate: Tue Jul 8 22:33:59 2025 +0800

    HIVE-25351: stddev(), stddev_pop() return NaN when CBO is enabled (#5262) 
(#5940)
    
    Co-authored-by: Yang Jiandan <succeedin2...@gmail.com>
---
 .../rules/HiveAggregateReduceFunctionsRule.java    |  19 +-
 .../stddev_variance_with_double_decimal_test.q     |  29 +++
 .../llap/cbo_aggregate_reduce_functions_rule.q.out |   2 +-
 .../results/clientpositive/llap/decimal_udf.q.out  |   4 +-
 ...pes_non_dictionary_encoding_vectorization.q.out |   2 +-
 .../llap/parquet_types_vectorization.q.out         |   2 +-
 .../llap/parquet_vectorization_1.q.out             |   8 +-
 .../llap/parquet_vectorization_12.q.out            |   8 +-
 .../llap/parquet_vectorization_14.q.out            |   8 +-
 .../llap/parquet_vectorization_16.q.out            |   8 +-
 .../llap/parquet_vectorization_4.q.out             |   8 +-
 .../llap/parquet_vectorization_9.q.out             |   8 +-
 .../stddev_variance_with_double_decimal_test.q.out | 209 +++++++++++++++++++++
 .../llap/udaf_binarysetfunctions.q.out             |   2 +-
 .../llap/vector_decimal_aggregate.q.out            |  16 +-
 .../clientpositive/llap/vector_decimal_udf.q.out   |  32 ++--
 .../clientpositive/llap/vectorization_1.q.out      |   8 +-
 .../clientpositive/llap/vectorization_12.q.out     |  10 +-
 .../clientpositive/llap/vectorization_14.q.out     |  10 +-
 .../clientpositive/llap/vectorization_16.q.out     |   8 +-
 .../clientpositive/llap/vectorization_4.q.out      |   8 +-
 .../clientpositive/llap/vectorization_9.q.out      |   8 +-
 .../llap/vectorization_input_format_excludes.q.out |  16 +-
 .../llap/vectorization_short_regress.q.out         |  45 +++--
 .../clientpositive/llap/vectorized_parquet.q.out   |   4 +-
 .../llap/vectorized_parquet_types.q.out            |   8 +-
 26 files changed, 375 insertions(+), 115 deletions(-)

diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateReduceFunctionsRule.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateReduceFunctionsRule.java
index 61c54bff707..731b34340fb 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateReduceFunctionsRule.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateReduceFunctionsRule.java
@@ -34,6 +34,7 @@
 import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.sql.SqlAggFunction;
 import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.fun.SqlLibraryOperators;
 import org.apache.calcite.sql.fun.SqlStdOperatorTable;
 import org.apache.calcite.sql.type.InferTypes;
 import org.apache.calcite.sql.type.ReturnTypes;
@@ -516,8 +517,20 @@ private RexNode reduceStddev(
 
     final RexNode diff =
         rexBuilder.makeCall(
-            SqlStdOperatorTable.MINUS,
-            sumArgSquared, avgSumSquaredArg);
+            SqlStdOperatorTable.MINUS, sumArgSquared, avgSumSquaredArg);
+
+    RelDataType oldArgType = SqlTypeUtil.projectTypes(
+        oldAggRel.getInput().getRowType(), oldCall.getArgList()).get(0);
+
+    final RexNode correctedDiff =
+        switch (oldArgType.getSqlTypeName()){
+          case DOUBLE, DECIMAL ->
+            rexBuilder.makeCall(
+                SqlLibraryOperators.GREATEST,
+                rexBuilder.makeExactLiteral(BigDecimal.ZERO),
+                diff);
+          default -> diff;
+        };
 
     final RexNode denominator;
     if (biased) {
@@ -540,7 +553,7 @@ private RexNode reduceStddev(
 
     final RexNode div =
         rexBuilder.makeCall(
-            SqlStdOperatorTable.DIVIDE, diff, denominator);
+            SqlStdOperatorTable.DIVIDE, correctedDiff, denominator);
 
     RexNode result = div;
     if (sqrt) {
diff --git 
a/ql/src/test/queries/clientpositive/stddev_variance_with_double_decimal_test.q 
b/ql/src/test/queries/clientpositive/stddev_variance_with_double_decimal_test.q
new file mode 100644
index 00000000000..fd90e7f944e
--- /dev/null
+++ 
b/ql/src/test/queries/clientpositive/stddev_variance_with_double_decimal_test.q
@@ -0,0 +1,29 @@
+set metastore.direct.product.name=fs;
+set hive.stats.column.autogather=false;
+
+with tempDataset as (
+select 10 as account_id, cast(23.79 as double) interest_paid
+union all select 10, 23.79
+union all select 10, 23.79
+union all select 11, 64.34
+union all select 11, 64.34
+union all select 11, 64.34
+)
+select account_id, STDDEV(interest_paid) as sdev, variance(interest_paid) as 
vari from tempDataset group by account_id;
+
+create table cbo_test (key string, v1 double, v2 float, v3 decimal(30,2), v4 
bigint);
+
+insert into cbo_test values
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230);
+
+explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from cbo_test;
+select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from cbo_test;
+
+set hive.cbo.enable=false;
+explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from cbo_test;
+select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from cbo_test;
diff --git 
a/ql/src/test/results/clientpositive/llap/cbo_aggregate_reduce_functions_rule.q.out
 
b/ql/src/test/results/clientpositive/llap/cbo_aggregate_reduce_functions_rule.q.out
index 981aee931ac..280652d2423 100644
--- 
a/ql/src/test/results/clientpositive/llap/cbo_aggregate_reduce_functions_rule.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/cbo_aggregate_reduce_functions_rule.q.out
@@ -158,7 +158,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@test
 #### A masked pattern was here ####
 CBO PLAN:
-HiveProject(_o__c0=[CAST(COALESCE($0, 0E0:DOUBLE)):DOUBLE], 
_o__c1=[CAST(COALESCE($1, 0E0:DOUBLE)):DOUBLE], _o__c2=[CAST(COALESCE($2, 
0E0:DOUBLE)):DOUBLE], _o__c3=[CAST(COALESCE($3, 0E0:DOUBLE)):DOUBLE], 
_o__c4=[CAST(COALESCE($4, 0E0:DOUBLE)):DOUBLE], _o__c5=[CAST(COALESCE($5, 
0E0:DOUBLE)):DOUBLE], _o__c6=[/($6, $7)], _o__c7=[/($1, $8)], _o__c8=[/($9, 
$10)], _o__c9=[/($3, $11)], _o__c10=[/($12, $13)], _o__c11=[/($5, $14)], 
_o__c12=[POWER(/(-($15, /(*($6, $6), $7)), $7), 0.5:DECIMAL(2, 1) [...]
+HiveProject(_o__c0=[CAST(COALESCE($0, 0E0:DOUBLE)):DOUBLE], 
_o__c1=[CAST(COALESCE($1, 0E0:DOUBLE)):DOUBLE], _o__c2=[CAST(COALESCE($2, 
0E0:DOUBLE)):DOUBLE], _o__c3=[CAST(COALESCE($3, 0E0:DOUBLE)):DOUBLE], 
_o__c4=[CAST(COALESCE($4, 0E0:DOUBLE)):DOUBLE], _o__c5=[CAST(COALESCE($5, 
0E0:DOUBLE)):DOUBLE], _o__c6=[/($6, $7)], _o__c7=[/($1, $8)], _o__c8=[/($9, 
$10)], _o__c9=[/($3, $11)], _o__c10=[/($12, $13)], _o__c11=[/($5, $14)], 
_o__c12=[POWER(/(-($15, /(*($6, $6), $7)), $7), 0.5:DECIMAL(2, 1) [...]
   HiveAggregate(group=[{}], agg#0=[sum($0)], agg#1=[sum($1)], agg#2=[sum($2)], 
agg#3=[sum($3)], agg#4=[sum($4)], agg#5=[sum($5)], agg#6=[sum($6)], 
agg#7=[count($6)], agg#8=[count($1)], agg#9=[sum($7)], agg#10=[count($7)], 
agg#11=[count($3)], agg#12=[sum($8)], agg#13=[count($8)], agg#14=[count($5)], 
agg#15=[sum($9)], agg#16=[sum($10)], agg#17=[sum($11)], agg#18=[sum($12)], 
agg#19=[sum($13)], agg#20=[sum($14)], agg#21=[count($0)], agg#22=[count($2)], 
agg#23=[count($4)])
     HiveProject($f0=[$0], $f1=[CAST($0):DOUBLE], $f2=[$1], 
$f3=[CAST($1):DOUBLE], $f4=[$2], $f5=[CAST($2):DOUBLE], $f00=[CAST($0):DOUBLE], 
$f20=[CAST($1):DOUBLE], $f40=[CAST($2):DOUBLE], $f9=[*(CAST($0):DOUBLE, 
CAST($0):DOUBLE)], $f10=[*(CAST($0):DOUBLE, CAST($0):DOUBLE)], 
$f11=[*(CAST($1):DOUBLE, CAST($1):DOUBLE)], $f12=[*(CAST($1):DOUBLE, 
CAST($1):DOUBLE)], $f13=[*(CAST($2):DOUBLE, CAST($2):DOUBLE)], 
$f14=[*(CAST($2):DOUBLE, CAST($2):DOUBLE)])
       HiveTableScan(table=[[default, test]], table:alias=[test])
diff --git a/ql/src/test/results/clientpositive/llap/decimal_udf.q.out 
b/ql/src/test/results/clientpositive/llap/decimal_udf.q.out
index 1196ad621d9..588061a7b98 100644
--- a/ql/src/test/results/clientpositive/llap/decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/llap/decimal_udf.q.out
@@ -1950,7 +1950,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / _col3), 0.5) (type: double), ((_col1 - ((_col2 * _col2) / 
_col3)) / _col3) (type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5) (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                   File Output Operator
@@ -2047,7 +2047,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
((_col1 - ((_col2 * _col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))) 
(type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: 
double), (greatest(0,(_col1 - ((_col2 * _col2) / _col3))) / if((_col3 = 1L), 
null, (_col3 - 1))) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                   File Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_types_non_dictionary_encoding_vectorization.q.out
 
b/ql/src/test/results/clientpositive/llap/parquet_types_non_dictionary_encoding_vectorization.q.out
index a411ffde5fd..1858408db26 100644
--- 
a/ql/src/test/results/clientpositive/llap/parquet_types_non_dictionary_encoding_vectorization.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/parquet_types_non_dictionary_encoding_vectorization.q.out
@@ -508,7 +508,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 150 Data size: 29744 Basic stats: 
COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), round((_col4 / _col5), 5) (type: 
double), round(power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5), 5) 
(type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), round((_col4 / _col5), 5) (type: 
double), round(power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 
0.5), 5) (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 150 Data size: 29744 Basic stats: 
COMPLETE Column stats: NONE
                   Reduce Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_types_vectorization.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_types_vectorization.q.out
index 062a59a45a7..2f60dd76959 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_types_vectorization.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_types_vectorization.q.out
@@ -228,7 +228,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 11 Data size: 2288 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), round((_col4 / _col5), 5) (type: 
double), round(power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5), 5) 
(type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), round((_col4 / _col5), 5) (type: 
double), round(power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 
0.5), 5) (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 11 Data size: 2288 Basic stats: 
COMPLETE Column stats: NONE
                   Reduce Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_1.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_1.q.out
index 954191c63f0..a00c56715b3 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_1.q.out
@@ -123,7 +123,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -139,13 +139,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9
                 Statistics: Num rows: 1 Data size: 72 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) / -26.28D) 
(type: double), _col3 (type: double), (-1.389D + _col3) (type: double), (_col3 
* (-1.389D + _col3)) (type: double), _col4 (type: tinyint), (- (_col3 * 
(-1.389D + _col3))) (type: double), _col5 (type: int), (CAST( _col5 AS 
decimal(10,0)) * 79.553) (type: decimal(16,3)), ((_col6 - ((_col7 * _col7) / 
_col8)) / if((_col8 = 1L), null, (_col8 -  [...]
+                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) / -26.28D) 
(type: double), _col3 (type: double), (-1.389D + _col3) (type: double), (_col3 
* (-1.389D + _col3)) (type: double), _col4 (type: tinyint), (- (_col3 * 
(-1.389D + _col3))) (type: double), _col5 (type: int), (CAST( _col5 AS 
decimal(10,0)) * 79.553) (type: decimal(16,3)), (greatest(0,(_col6 - ((_col7 * 
_col7) / _col8))) / if((_col8 = 1L), nul [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [13, 18, 3, 19, 21, 4, 24, 5, 
27, 34, 38, 9, 39]
-                      selectExpressions: DoubleColDivideLongColumn(col 
12:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 10:double) -> 11:double) -> 12:double) -> 13:double, 
DoubleColDivideDoubleScalar(col 17:double, val -26.28)(children: 
DoubleColDivideLongColumn(col 16:double, col 2:bigint)(children: DoubleCo [...]
+                      projectedOutputColumnNums: [13, 18, 3, 19, 21, 4, 24, 5, 
27, 35, 39, 9, 40]
+                      selectExpressions: DoubleColDivideLongColumn(col 
12:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 10:double) -> 11:double) -> 12:double) -> 13:double, 
DoubleColDivideDoubleScalar(col 17:double, val -26.28)(children: 
DoubleColDivideLongColumn(col 16:double, col 2:bigint)(children: DoubleCo [...]
                   Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_12.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_12.q.out
index 92f329c3f83..1ba06844f9d 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_12.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_12.q.out
@@ -150,7 +150,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -168,13 +168,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 1903 Data size: 283900 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: bigint), _col3 (type: boolean), 
_col2 (type: string), _col0 (type: double), (-6432.0D * _col0) (type: double), 
(- _col1) (type: bigint), _col4 (type: bigint), (_col1 * _col4) (type: bigint), 
power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 
1))), 0.5) (type: double), ((-6432.0D * _col0) / -6432.0D) (type: double), (- 
((-6432.0D * _col0) / -6432.0D)) (type: double), (_col8 / _col9) (type: 
double), (- (-6432.0D * _col0) [...]
+                  expressions: _col1 (type: bigint), _col3 (type: boolean), 
_col2 (type: string), _col0 (type: double), (-6432.0D * _col0) (type: double), 
(- _col1) (type: bigint), _col4 (type: bigint), (_col1 * _col4) (type: bigint), 
power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 
1))), 0.5) (type: double), ((-6432.0D * _col0) / -6432.0D) (type: double), (- 
((-6432.0D * _col0) / -6432.0D)) (type: double), (_col8 / _col9) (type: 
double), (- (-6432.0D * _col0) [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col18, _col19
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [1, 3, 2, 0, 12, 13, 4, 14, 
22, 24, 27, 28, 30, 32, 10, 35, 40, 45]
-                      selectExpressions: DoubleScalarMultiplyDoubleColumn(val 
-6432.0, col 0:double) -> 12:double, LongColUnaryMinus(col 1:bigint) -> 
13:bigint, LongColMultiplyLongColumn(col 1:bigint, col 4:bigint) -> 14:bigint, 
FuncPowerDoubleToDouble(col 21:double)(children: DoubleColDivideLongColumn(col 
17:double, col 20:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 16:double)(children: DoubleColDivideLongColumn(col 15:double, col 
7:bigint)(children: DoubleColMulti [...]
+                      projectedOutputColumnNums: [1, 3, 2, 0, 12, 13, 4, 14, 
22, 24, 27, 28, 30, 32, 10, 35, 40, 46]
+                      selectExpressions: DoubleScalarMultiplyDoubleColumn(val 
-6432.0, col 0:double) -> 12:double, LongColUnaryMinus(col 1:bigint) -> 
13:bigint, LongColMultiplyLongColumn(col 1:bigint, col 4:bigint) -> 14:bigint, 
FuncPowerDoubleToDouble(col 21:double)(children: DoubleColDivideLongColumn(col 
17:double, col 20:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 16:double)(children: DoubleColDivideLongColumn(col 15:double, col 
7:bigint)(children: DoubleColMulti [...]
                   Statistics: Num rows: 1903 Data size: 573156 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col3 (type: double), _col0 (type: 
bigint), _col2 (type: string)
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_14.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_14.q.out
index b333d723d9a..5acc12c3b71 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_14.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_14.q.out
@@ -152,7 +152,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -170,13 +170,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                 Statistics: Num rows: 758 Data size: 130530 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col3 (type: timestamp), _col1 (type: float), 
_col0 (type: string), _col4 (type: boolean), _col2 (type: double), (-26.28D + 
_col2) (type: double), (- (-26.28D + _col2)) (type: double), power(((_col5 - 
((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 1))), 0.5) (type: 
double), (_col1 * -26.28) (type: float), _col8 (type: float), (- _col1) (type: 
float), (- _col8) (type: float), ((- (-26.28D + _col2)) / 10.175D) (type: 
double), power(((_col9 - ((_ [...]
+                  expressions: _col3 (type: timestamp), _col1 (type: float), 
_col0 (type: string), _col4 (type: boolean), _col2 (type: double), (-26.28D + 
_col2) (type: double), (- (-26.28D + _col2)) (type: double), 
power((greatest(0,(_col5 - ((_col6 * _col6) / _col7))) / if((_col7 = 1L), null, 
(_col7 - 1))), 0.5) (type: double), (_col1 * -26.28) (type: float), _col8 
(type: float), (- _col1) (type: float), (- _col8) (type: float), ((- (-26.28D + 
_col2)) / 10.175D) (type: double), power(( [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [3, 1, 0, 4, 2, 13, 15, 23, 
24, 8, 25, 26, 29, 34, 12, 38, 47, 48, 52, 57, 64, 66]
-                      selectExpressions: DoubleScalarAddDoubleColumn(val 
-26.28, col 2:double) -> 13:double, DoubleColUnaryMinus(col 
14:double)(children: DoubleScalarAddDoubleColumn(val -26.28, col 2:double) -> 
14:double) -> 15:double, FuncPowerDoubleToDouble(col 22:double)(children: 
DoubleColDivideLongColumn(col 18:double, col 21:bigint)(children: 
DoubleColSubtractDoubleColumn(col 5:double, col 17:double)(children: 
DoubleColDivideLongColumn(col 16:double, col 7:bigint)(children: DoubleC [...]
+                      projectedOutputColumnNums: [3, 1, 0, 4, 2, 13, 15, 24, 
25, 8, 26, 27, 30, 35, 12, 39, 49, 50, 54, 59, 66, 68]
+                      selectExpressions: DoubleScalarAddDoubleColumn(val 
-26.28, col 2:double) -> 13:double, DoubleColUnaryMinus(col 
14:double)(children: DoubleScalarAddDoubleColumn(val -26.28, col 2:double) -> 
14:double) -> 15:double, FuncPowerDoubleToDouble(col 23:double)(children: 
DoubleColDivideLongColumn(col 19:double, col 22:bigint)(children: 
VectorUDFAdaptor(greatest(0,(_col5 - ((_col6 * _col6) / _col7))))(children: 
DoubleColSubtractDoubleColumn(col 5:double, col 17:double)(childr [...]
                   Statistics: Num rows: 758 Data size: 176010 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col2 (type: string), _col1 (type: 
float), _col4 (type: double), _col0 (type: timestamp)
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_16.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_16.q.out
index c5f8c25398b..eeab9c89af7 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_16.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_16.q.out
@@ -125,7 +125,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -143,13 +143,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 5979 Data size: 825318 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power(((_col4 - ((_col5 * 
_col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
(- power(((_col4 - ((_col5 * _col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 
1))), 0.5)) (type: double), (power(((_col4 - ((_col5 * _col5) / _col3)) / 
if((_col3 = 1L), null, (_col [...]
+                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power((greatest(0,(_col4 
- ((_col5 * _col5) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) 
(type: double), (- power((greatest(0,(_col4 - ((_col5 * _col5) / _col3))) / 
if((_col3 = 1L), null, (_col3 - 1))), 0.5)) (type: double), 
(power((greatest(0,(_col4 - ((_col5 * _col5) / _co [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 17, 26, 
36, 6, 37, 39, 47]
-                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
16:double)(children: DoubleColDivideLongColumn(col 12:double, col 
15:bigint)(children: DoubleColSubtractDoubleColumn(col 4:double, col 
11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
3:bigint)(child [...]
+                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 18, 28, 
39, 6, 40, 42, 51]
+                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
17:double)(children: DoubleColDivideLongColumn(col 13:double, col 
16:bigint)(children: VectorUDFAdaptor(greatest(0,(_col4 - ((_col5 * _col5) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 4:double, col 11:do [...]
                   Statistics: Num rows: 5979 Data size: 1734126 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_4.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_4.q.out
index e5e641105b7..aecd787c793 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_4.q.out
@@ -127,7 +127,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -143,13 +143,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: bigint), (_col0 * -563L) (type: 
bigint), (-3728L + _col0) (type: bigint), power(((_col1 - ((_col2 * _col2) / 
_col3)) / _col3), 0.5) (type: double), (- power(((_col1 - ((_col2 * _col2) / 
_col3)) / _col3), 0.5)) (type: double), (_col2 / _col3) (type: double), ((_col0 
* -563L) % _col0) (type: bigint), (UDFToDouble(((_col0 * -563L) % _col0)) / 
(_col2 / _col3)) (type: double), ((_col1 - ((_col2 * _col2) / _col3)) / _col3) 
(type: double), (- (UDFToDo [...]
+                  expressions: _col0 (type: bigint), (_col0 * -563L) (type: 
bigint), (-3728L + _col0) (type: bigint), power((greatest(0,(_col1 - ((_col2 * 
_col2) / _col3))) / _col3), 0.5) (type: double), (- power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5)) (type: double), (_col2 / _col3) 
(type: double), ((_col0 * -563L) % _col0) (type: bigint), (UDFToDouble(((_col0 
* -563L) % _col0)) / (_col2 / _col3)) (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3)))  [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 5, 6, 11, 17, 18, 20, 25, 
29, 35, 38, 4, 4, 46]
-                      selectExpressions: LongColMultiplyLongScalar(col 
0:bigint, val -563) -> 5:bigint, LongScalarAddLongColumn(val -3728, col 
0:bigint) -> 6:bigint, FuncPowerDoubleToDouble(col 10:double)(children: 
DoubleColDivideLongColumn(col 9:double, col 3:bigint)(children: 
DoubleColSubtractDoubleColumn(col 1:double, col 8:double)(children: 
DoubleColDivideLongColumn(col 7:double, col 3:bigint)(children: 
DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) -> 7:double) -> 
8:doubl [...]
+                      projectedOutputColumnNums: [0, 5, 6, 12, 19, 20, 22, 27, 
32, 38, 41, 4, 4, 49]
+                      selectExpressions: LongColMultiplyLongScalar(col 
0:bigint, val -563) -> 5:bigint, LongScalarAddLongColumn(val -3728, col 
0:bigint) -> 6:bigint, FuncPowerDoubleToDouble(col 11:double)(children: 
DoubleColDivideLongColumn(col 10:double, col 3:bigint)(children: 
VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / _col3))))(children: 
DoubleColSubtractDoubleColumn(col 1:double, col 8:double)(children: 
DoubleColDivideLongColumn(col 7:double, col 3:bigint)(children: Doub [...]
                   Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_vectorization_9.q.out 
b/ql/src/test/results/clientpositive/llap/parquet_vectorization_9.q.out
index c5f8c25398b..eeab9c89af7 100644
--- a/ql/src/test/results/clientpositive/llap/parquet_vectorization_9.q.out
+++ b/ql/src/test/results/clientpositive/llap/parquet_vectorization_9.q.out
@@ -125,7 +125,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -143,13 +143,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 5979 Data size: 825318 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power(((_col4 - ((_col5 * 
_col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
(- power(((_col4 - ((_col5 * _col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 
1))), 0.5)) (type: double), (power(((_col4 - ((_col5 * _col5) / _col3)) / 
if((_col3 = 1L), null, (_col [...]
+                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power((greatest(0,(_col4 
- ((_col5 * _col5) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) 
(type: double), (- power((greatest(0,(_col4 - ((_col5 * _col5) / _col3))) / 
if((_col3 = 1L), null, (_col3 - 1))), 0.5)) (type: double), 
(power((greatest(0,(_col4 - ((_col5 * _col5) / _co [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 17, 26, 
36, 6, 37, 39, 47]
-                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
16:double)(children: DoubleColDivideLongColumn(col 12:double, col 
15:bigint)(children: DoubleColSubtractDoubleColumn(col 4:double, col 
11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
3:bigint)(child [...]
+                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 18, 28, 
39, 6, 40, 42, 51]
+                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
17:double)(children: DoubleColDivideLongColumn(col 13:double, col 
16:bigint)(children: VectorUDFAdaptor(greatest(0,(_col4 - ((_col5 * _col5) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 4:double, col 11:do [...]
                   Statistics: Num rows: 5979 Data size: 1734126 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git 
a/ql/src/test/results/clientpositive/llap/stddev_variance_with_double_decimal_test.q.out
 
b/ql/src/test/results/clientpositive/llap/stddev_variance_with_double_decimal_test.q.out
new file mode 100644
index 00000000000..bf151938255
--- /dev/null
+++ 
b/ql/src/test/results/clientpositive/llap/stddev_variance_with_double_decimal_test.q.out
@@ -0,0 +1,209 @@
+PREHOOK: query: with tempDataset as (
+select 10 as account_id, cast(23.79 as double) interest_paid
+union all select 10, 23.79
+union all select 10, 23.79
+union all select 11, 64.34
+union all select 11, 64.34
+union all select 11, 64.34
+)
+select account_id, STDDEV(interest_paid) as sdev, variance(interest_paid) as 
vari from tempDataset group by account_id
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: with tempDataset as (
+select 10 as account_id, cast(23.79 as double) interest_paid
+union all select 10, 23.79
+union all select 10, 23.79
+union all select 11, 64.34
+union all select 11, 64.34
+union all select 11, 64.34
+)
+select account_id, STDDEV(interest_paid) as sdev, variance(interest_paid) as 
vari from tempDataset group by account_id
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+10     0.0     0.0
+11     0.0     0.0
+PREHOOK: query: create table cbo_test (key string, v1 double, v2 float, v3 
decimal(30,2), v4 bigint)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@cbo_test
+POSTHOOK: query: create table cbo_test (key string, v1 double, v2 float, v3 
decimal(30,2), v4 bigint)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@cbo_test
+PREHOOK: query: insert into cbo_test values
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@cbo_test
+POSTHOOK: query: insert into cbo_test values
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230),
+  ("001400000000000000000006375905", 10230.72, 10230.72, 10230.69, 10230)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@cbo_test
+POSTHOOK: Lineage: cbo_test.key SCRIPT []
+POSTHOOK: Lineage: cbo_test.v1 SCRIPT []
+POSTHOOK: Lineage: cbo_test.v2 SCRIPT []
+POSTHOOK: Lineage: cbo_test.v3 SCRIPT []
+POSTHOOK: Lineage: cbo_test.v4 SCRIPT []
+PREHOOK: query: explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) 
from cbo_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+POSTHOOK: query: explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) 
from cbo_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: cbo_test
+                  Statistics: Num rows: 6 Data size: 792 Basic stats: COMPLETE 
Column stats: NONE
+                  Select Operator
+                    expressions: v1 (type: double), (v1 * v1) (type: double), 
UDFToDouble(v2) (type: double), (UDFToDouble(v2) * UDFToDouble(v2)) (type: 
double), UDFToDouble(v3) (type: double), (UDFToDouble(v3) * UDFToDouble(v3)) 
(type: double), UDFToDouble(v4) (type: double), (UDFToDouble(v4) * 
UDFToDouble(v4)) (type: double)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                    Statistics: Num rows: 6 Data size: 792 Basic stats: 
COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: sum(_col1), sum(_col0), count(_col0), 
sum(_col3), sum(_col2), count(_col2), sum(_col5), sum(_col4), count(_col4), 
sum(_col7), sum(_col6), count(_col6)
+                      minReductionHashAggr: 0.99
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 1 Data size: 228 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        null sort order: 
+                        sort order: 
+                        Statistics: Num rows: 1 Data size: 228 Basic stats: 
COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: double), _col1 (type: 
double), _col2 (type: bigint), _col3 (type: double), _col4 (type: double), 
_col5 (type: bigint), _col6 (type: double), _col7 (type: double), _col8 (type: 
bigint), _col9 (type: double), _col10 (type: double), _col11 (type: bigint)
+            Execution mode: vectorized, llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0), sum(VALUE._col1), 
count(VALUE._col2), sum(VALUE._col3), sum(VALUE._col4), count(VALUE._col5), 
sum(VALUE._col6), sum(VALUE._col7), count(VALUE._col8), sum(VALUE._col9), 
sum(VALUE._col10), count(VALUE._col11)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 1 Data size: 228 Basic stats: COMPLETE 
Column stats: NONE
+                Select Operator
+                  expressions: power((greatest(0,(_col0 - ((_col1 * _col1) / 
_col2))) / _col2), 0.5) (type: double), power(((_col3 - ((_col4 * _col4) / 
_col5)) / _col5), 0.5) (type: double), power((greatest(0,(_col6 - ((_col7 * 
_col7) / _col8))) / _col8), 0.5) (type: double), power(((_col9 - ((_col10 * 
_col10) / _col11)) / _col11), 0.5) (type: double)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 1 Data size: 228 Basic stats: COMPLETE 
Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 228 Basic stats: 
COMPLETE Column stats: NONE
+                    table:
+                        input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from 
cbo_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+POSTHOOK: query: select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from 
cbo_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+0.0    0.0     0.0     0.0
+PREHOOK: query: explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) 
from cbo_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+POSTHOOK: query: explain select stddev(v1), stddev(v2), stddev(v3), stddev(v4) 
from cbo_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: cbo_test
+                  Statistics: Num rows: 6 Data size: 792 Basic stats: COMPLETE 
Column stats: NONE
+                  Select Operator
+                    expressions: v1 (type: double), v2 (type: float), v3 
(type: decimal(30,2)), v4 (type: bigint)
+                    outputColumnNames: v1, v2, v3, v4
+                    Statistics: Num rows: 6 Data size: 792 Basic stats: 
COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: stddev(v1), stddev(v2), stddev(v3), 
stddev(v4)
+                      minReductionHashAggr: 0.99
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 1 Data size: 452 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        null sort order: 
+                        sort order: 
+                        Statistics: Num rows: 1 Data size: 452 Basic stats: 
COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: 
struct<count:bigint,sum:double,variance:double>), _col1 (type: 
struct<count:bigint,sum:double,variance:double>), _col2 (type: 
struct<count:bigint,sum:double,variance:double>), _col3 (type: 
struct<count:bigint,sum:double,variance:double>)
+            Execution mode: vectorized, llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: stddev(VALUE._col0), stddev(VALUE._col1), 
stddev(VALUE._col2), stddev(VALUE._col3)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 1 Data size: 452 Basic stats: COMPLETE 
Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 452 Basic stats: COMPLETE 
Column stats: NONE
+                  table:
+                      input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from 
cbo_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+POSTHOOK: query: select stddev(v1), stddev(v2), stddev(v3), stddev(v4) from 
cbo_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@cbo_test
+#### A masked pattern was here ####
+5.42317860890711E-13   0.0     5.42317860890711E-13    0.0
diff --git 
a/ql/src/test/results/clientpositive/llap/udaf_binarysetfunctions.q.out 
b/ql/src/test/results/clientpositive/llap/udaf_binarysetfunctions.q.out
index 42725109742..900a2e5f8f9 100644
--- a/ql/src/test/results/clientpositive/llap/udaf_binarysetfunctions.q.out
+++ b/ql/src/test/results/clientpositive/llap/udaf_binarysetfunctions.q.out
@@ -420,7 +420,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18
                 Statistics: Num rows: 7 Data size: 2492 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), ((_col1 - ((_col2 * _col2) / 
_col3)) / _col3) (type: double), ((_col4 - ((_col5 * _col5) / _col6)) / _col6) 
(type: double), _col7 (type: double), _col8 (type: double), _col9 (type: 
double), _col10 (type: bigint), _col11 (type: double), _col12 (type: double), 
_col13 (type: double), _col14 (type: double), _col15 (type: double), _col16 
(type: double), _col17 (type: decimal(14,4)), _col18 (type: decimal(14,4))
+                  expressions: _col0 (type: int), (greatest(0,(_col1 - ((_col2 
* _col2) / _col3))) / _col3) (type: double), (greatest(0,(_col4 - ((_col5 * 
_col5) / _col6))) / _col6) (type: double), _col7 (type: double), _col8 (type: 
double), _col9 (type: double), _col10 (type: bigint), _col11 (type: double), 
_col12 (type: double), _col13 (type: double), _col14 (type: double), _col15 
(type: double), _col16 (type: double), _col17 (type: decimal(14,4)), _col18 
(type: decimal(14,4))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                   Statistics: Num rows: 7 Data size: 2268 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/vector_decimal_aggregate.q.out 
b/ql/src/test/results/clientpositive/llap/vector_decimal_aggregate.q.out
index 6705110e465..34b2bed04b9 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_aggregate.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_aggregate.q.out
@@ -323,7 +323,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 16
@@ -353,13 +353,13 @@ STAGE PLANS:
                   predicate: (_col15 > 1L) (type: boolean)
                   Statistics: Num rows: 2035 Data size: 1520120 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: _col0 (type: int), _col1 (type: bigint), 
_col2 (type: decimal(20,10)), _col3 (type: decimal(20,10)), _col4 (type: 
decimal(30,10)), CAST( (_col4 / _col1) AS decimal(24,14)) (type: 
decimal(24,14)), power(((_col5 - ((_col6 * _col6) / _col7)) / _col7), 0.5) 
(type: double), power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), 
null, (_col7 - 1))), 0.5) (type: double), _col8 (type: bigint), _col9 (type: 
decimal(23,14)), _col10 (type: decimal(23,14)), _c [...]
+                    expressions: _col0 (type: int), _col1 (type: bigint), 
_col2 (type: decimal(20,10)), _col3 (type: decimal(20,10)), _col4 (type: 
decimal(30,10)), CAST( (_col4 / _col1) AS decimal(24,14)) (type: 
decimal(24,14)), power((greatest(0,(_col5 - ((_col6 * _col6) / _col7))) / 
_col7), 0.5) (type: double), power((greatest(0,(_col5 - ((_col6 * _col6) / 
_col7))) / if((_col7 = 1L), null, (_col7 - 1))), 0.5) (type: double), _col8 
(type: bigint), _col9 (type: decimal(23,14)), _col10 (t [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2, 3, 4, 18, 23, 31, 
8, 9, 10, 11, 34, 39, 47]
-                        selectExpressions: CastDecimalToDecimal(col 
17:decimal(38,18))(children: DecimalColDivideDecimalColumn(col 
4:decimal(30,10), col 16:decimal(19,0))(children: CastLongToDecimal(col 
1:bigint) -> 16:decimal(19,0)) -> 17:decimal(38,18)) -> 18:decimal(24,14), 
FuncPowerDoubleToDouble(col 22:double)(children: DoubleColDivideLongColumn(col 
21:double, col 7:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 20:double)(children: DoubleColDivideLongColumn(col 1 [...]
+                        projectedOutputColumnNums: [0, 1, 2, 3, 4, 18, 24, 33, 
8, 9, 10, 11, 36, 42, 51]
+                        selectExpressions: CastDecimalToDecimal(col 
17:decimal(38,18))(children: DecimalColDivideDecimalColumn(col 
4:decimal(30,10), col 16:decimal(19,0))(children: CastLongToDecimal(col 
1:bigint) -> 16:decimal(19,0)) -> 17:decimal(38,18)) -> 18:decimal(24,14), 
FuncPowerDoubleToDouble(col 23:double)(children: DoubleColDivideLongColumn(col 
22:double, col 7:bigint)(children: VectorUDFAdaptor(greatest(0,(_col5 - ((_col6 
* _col6) / _col7))))(children: DoubleColSubtractDoubleC [...]
                     Statistics: Num rows: 2035 Data size: 1927120 Basic stats: 
COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
@@ -748,7 +748,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 16
@@ -778,13 +778,13 @@ STAGE PLANS:
                   predicate: (_col15 > 1L) (type: boolean)
                   Statistics: Num rows: 2035 Data size: 1520120 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: _col0 (type: int), _col1 (type: bigint), 
_col2 (type: decimal(11,5)), _col3 (type: decimal(11,5)), _col4 (type: 
decimal(21,5)), CAST( (_col4 / _col1) AS decimal(15,9)) (type: decimal(15,9)), 
power(((_col5 - ((_col6 * _col6) / _col7)) / _col7), 0.5) (type: double), 
power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 
1))), 0.5) (type: double), _col8 (type: bigint), _col9 (type: decimal(16,0)), 
_col10 (type: decimal(16,0)), _col11 (t [...]
+                    expressions: _col0 (type: int), _col1 (type: bigint), 
_col2 (type: decimal(11,5)), _col3 (type: decimal(11,5)), _col4 (type: 
decimal(21,5)), CAST( (_col4 / _col1) AS decimal(15,9)) (type: decimal(15,9)), 
power((greatest(0,(_col5 - ((_col6 * _col6) / _col7))) / _col7), 0.5) (type: 
double), power((greatest(0,(_col5 - ((_col6 * _col6) / _col7))) / if((_col7 = 
1L), null, (_col7 - 1))), 0.5) (type: double), _col8 (type: bigint), _col9 
(type: decimal(16,0)), _col10 (type: d [...]
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2, 3, 4, 18, 23, 31, 
8, 9, 10, 11, 34, 39, 47]
-                        selectExpressions: CastDecimalToDecimal(col 
17:decimal(38,22))(children: DecimalColDivideDecimalColumn(col 4:decimal(21,5), 
col 16:decimal(19,0))(children: CastLongToDecimal(col 1:bigint) -> 
16:decimal(19,0)) -> 17:decimal(38,22)) -> 18:decimal(15,9), 
FuncPowerDoubleToDouble(col 22:double)(children: DoubleColDivideLongColumn(col 
21:double, col 7:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 20:double)(children: DoubleColDivideLongColumn(col 19: [...]
+                        projectedOutputColumnNums: [0, 1, 2, 3, 4, 18, 24, 33, 
8, 9, 10, 11, 36, 42, 51]
+                        selectExpressions: CastDecimalToDecimal(col 
17:decimal(38,22))(children: DecimalColDivideDecimalColumn(col 4:decimal(21,5), 
col 16:decimal(19,0))(children: CastLongToDecimal(col 1:bigint) -> 
16:decimal(19,0)) -> 17:decimal(38,22)) -> 18:decimal(15,9), 
FuncPowerDoubleToDouble(col 23:double)(children: DoubleColDivideLongColumn(col 
22:double, col 7:bigint)(children: VectorUDFAdaptor(greatest(0,(_col5 - ((_col6 
* _col6) / _col7))))(children: DoubleColSubtractDoubleCol [...]
                     Statistics: Num rows: 2035 Data size: 1927120 Basic stats: 
COMPLETE Column stats: COMPLETE
                     File Output Operator
                       compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out 
b/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
index fcc5a1005ca..e1c29aa5b15 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
@@ -3413,7 +3413,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 4
@@ -3436,13 +3436,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 17 Data size: 476 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / _col3), 0.5) (type: double), ((_col1 - ((_col2 * _col2) / 
_col3)) / _col3) (type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5) (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 8, 12]
-                      selectExpressions: FuncPowerDoubleToDouble(col 
7:double)(children: DoubleColDivideLongColumn(col 6:double, col 
3:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double) -> 8:double, 
DoubleColDivideLongColumn(col 11:double, col 3:bigint)(children: 
DoubleColSubtractDo [...]
+                      projectedOutputColumnNums: [0, 9, 14]
+                      selectExpressions: FuncPowerDoubleToDouble(col 
8:double)(children: DoubleColDivideLongColumn(col 7:double, col 
3:bigint)(children: VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double) -> 8:double) -> 9:dou [...]
                   Statistics: Num rows: 17 Data size: 340 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
@@ -3583,7 +3583,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 4
@@ -3606,13 +3606,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 17 Data size: 476 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
((_col1 - ((_col2 * _col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))) 
(type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: 
double), (greatest(0,(_col1 - ((_col2 * _col2) / _col3))) / if((_col3 = 1L), 
null, (_col3 - 1))) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 11, 18]
-                      selectExpressions: FuncPowerDoubleToDouble(col 
10:double)(children: DoubleColDivideLongColumn(col 6:double, col 
9:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double, IfExprNullCondExpr(col 7:boolean, null, 
col 8:bigint)(children: LongColEqualLongScalar(col 3:bigint, val 1) - [...]
+                      projectedOutputColumnNums: [0, 12, 20]
+                      selectExpressions: FuncPowerDoubleToDouble(col 
11:double)(children: DoubleColDivideLongColumn(col 7:double, col 
10:bigint)(children: VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double, IfExprNullCondExpr( [...]
                   Statistics: Num rows: 17 Data size: 340 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
@@ -7538,7 +7538,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 4
@@ -7561,13 +7561,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / _col3), 0.5) (type: double), ((_col1 - ((_col2 * _col2) / 
_col3)) / _col3) (type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5) (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 8, 12]
-                      selectExpressions: FuncPowerDoubleToDouble(col 
7:double)(children: DoubleColDivideLongColumn(col 6:double, col 
3:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double) -> 8:double, 
DoubleColDivideLongColumn(col 11:double, col 3:bigint)(children: 
DoubleColSubtractDo [...]
+                      projectedOutputColumnNums: [0, 9, 14]
+                      selectExpressions: FuncPowerDoubleToDouble(col 
8:double)(children: DoubleColDivideLongColumn(col 7:double, col 
3:bigint)(children: VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double) -> 8:double) -> 9:dou [...]
                   Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                   File Output Operator
                     compressed: false
@@ -7708,7 +7708,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: z
                 reduceColumnSortOrder: +
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 4
@@ -7731,13 +7731,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), power(((_col1 - ((_col2 * 
_col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
((_col1 - ((_col2 * _col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))) 
(type: double)
+                  expressions: _col0 (type: int), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: 
double), (greatest(0,(_col1 - ((_col2 * _col2) / _col3))) / if((_col3 = 1L), 
null, (_col3 - 1))) (type: double)
                   outputColumnNames: _col0, _col1, _col2
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 11, 18]
-                      selectExpressions: FuncPowerDoubleToDouble(col 
10:double)(children: DoubleColDivideLongColumn(col 6:double, col 
9:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double, IfExprNullCondExpr(col 7:boolean, null, 
col 8:bigint)(children: LongColEqualLongScalar(col 3:bigint, val 1) - [...]
+                      projectedOutputColumnNums: [0, 12, 20]
+                      selectExpressions: FuncPowerDoubleToDouble(col 
11:double)(children: DoubleColDivideLongColumn(col 7:double, col 
10:bigint)(children: VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 1:double, col 
5:double)(children: DoubleColDivideLongColumn(col 4:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 4:double) -> 5:double) -> 6:double) -> 7:double, IfExprNullCondExpr( [...]
                   Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
                   File Output Operator
                     compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_1.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_1.q.out
index f8eaa6c757b..2df95500de4 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_1.q.out
@@ -133,7 +133,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: 
                 reduceColumnSortOrder: 
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 10
@@ -154,13 +154,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9
                 Statistics: Num rows: 1 Data size: 72 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) / -26.28D) 
(type: double), _col3 (type: double), (-1.389D + _col3) (type: double), (_col3 
* (-1.389D + _col3)) (type: double), _col4 (type: tinyint), (- (_col3 * 
(-1.389D + _col3))) (type: double), _col5 (type: int), (CAST( _col5 AS 
decimal(10,0)) * 79.553) (type: decimal(16,3)), ((_col6 - ((_col7 * _col7) / 
_col8)) / if((_col8 = 1L), null, (_col8 -  [...]
+                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) / -26.28D) 
(type: double), _col3 (type: double), (-1.389D + _col3) (type: double), (_col3 
* (-1.389D + _col3)) (type: double), _col4 (type: tinyint), (- (_col3 * 
(-1.389D + _col3))) (type: double), _col5 (type: int), (CAST( _col5 AS 
decimal(10,0)) * 79.553) (type: decimal(16,3)), (greatest(0,(_col6 - ((_col7 * 
_col7) / _col8))) / if((_col8 = 1L), nul [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [13, 18, 3, 19, 21, 4, 24, 5, 
27, 34, 38, 9, 39]
-                      selectExpressions: DoubleColDivideLongColumn(col 
12:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 10:double) -> 11:double) -> 12:double) -> 13:double, 
DoubleColDivideDoubleScalar(col 17:double, val -26.28)(children: 
DoubleColDivideLongColumn(col 16:double, col 2:bigint)(children: DoubleCo [...]
+                      projectedOutputColumnNums: [13, 18, 3, 19, 21, 4, 24, 5, 
27, 35, 39, 9, 40]
+                      selectExpressions: DoubleColDivideLongColumn(col 
12:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 10:double) -> 11:double) -> 12:double) -> 13:double, 
DoubleColDivideDoubleScalar(col 17:double, val -26.28)(children: 
DoubleColDivideLongColumn(col 16:double, col 2:bigint)(children: DoubleCo [...]
                   Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_12.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_12.q.out
index dbae880e0d8..dc321259307 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_12.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_12.q.out
@@ -161,7 +161,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: zzzz
                 reduceColumnSortOrder: ++++
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 12
@@ -184,13 +184,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 1903 Data size: 283900 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: bigint), _col3 (type: boolean), 
_col2 (type: string), _col0 (type: double), (-6432.0D * _col0) (type: double), 
(- _col1) (type: bigint), _col4 (type: bigint), (_col1 * _col4) (type: bigint), 
power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 
1))), 0.5) (type: double), ((-6432.0D * _col0) / -6432.0D) (type: double), (- 
((-6432.0D * _col0) / -6432.0D)) (type: double), (_col8 / _col9) (type: 
double), (- (-6432.0D * _col0) [...]
+                  expressions: _col1 (type: bigint), _col3 (type: boolean), 
_col2 (type: string), _col0 (type: double), (-6432.0D * _col0) (type: double), 
(- _col1) (type: bigint), _col4 (type: bigint), (_col1 * _col4) (type: bigint), 
power(((_col5 - ((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 
1))), 0.5) (type: double), ((-6432.0D * _col0) / -6432.0D) (type: double), (- 
((-6432.0D * _col0) / -6432.0D)) (type: double), (_col8 / _col9) (type: 
double), (- (-6432.0D * _col0) [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col18, _col19
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [1, 3, 2, 0, 12, 13, 4, 14, 
22, 24, 27, 28, 30, 32, 10, 35, 40, 45]
-                      selectExpressions: DoubleScalarMultiplyDoubleColumn(val 
-6432.0, col 0:double) -> 12:double, LongColUnaryMinus(col 1:bigint) -> 
13:bigint, LongColMultiplyLongColumn(col 1:bigint, col 4:bigint) -> 14:bigint, 
FuncPowerDoubleToDouble(col 21:double)(children: DoubleColDivideLongColumn(col 
17:double, col 20:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 16:double)(children: DoubleColDivideLongColumn(col 15:double, col 
7:bigint)(children: DoubleColMulti [...]
+                      projectedOutputColumnNums: [1, 3, 2, 0, 12, 13, 4, 14, 
22, 24, 27, 28, 30, 32, 10, 35, 40, 46]
+                      selectExpressions: DoubleScalarMultiplyDoubleColumn(val 
-6432.0, col 0:double) -> 12:double, LongColUnaryMinus(col 1:bigint) -> 
13:bigint, LongColMultiplyLongColumn(col 1:bigint, col 4:bigint) -> 14:bigint, 
FuncPowerDoubleToDouble(col 21:double)(children: DoubleColDivideLongColumn(col 
17:double, col 20:bigint)(children: DoubleColSubtractDoubleColumn(col 5:double, 
col 16:double)(children: DoubleColDivideLongColumn(col 15:double, col 
7:bigint)(children: DoubleColMulti [...]
                   Statistics: Num rows: 1903 Data size: 573156 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col3 (type: double), _col0 (type: 
bigint), _col2 (type: string)
@@ -201,7 +201,7 @@ STAGE PLANS:
                         keyColumns: 0:double, 1:bigint, 2:string
                         native: true
                         nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                        valueColumns: 3:boolean, 12:double, 13:bigint, 
4:bigint, 14:bigint, 22:double, 24:double, 27:double, 28:double, 30:double, 
32:decimal(22,2), 10:bigint, 35:double, 40:double, 45:double
+                        valueColumns: 3:boolean, 12:double, 13:bigint, 
4:bigint, 14:bigint, 22:double, 24:double, 27:double, 28:double, 30:double, 
32:decimal(22,2), 10:bigint, 35:double, 40:double, 46:double
                     Statistics: Num rows: 1903 Data size: 573156 Basic stats: 
COMPLETE Column stats: COMPLETE
                     value expressions: _col1 (type: boolean), _col4 (type: 
double), _col5 (type: bigint), _col6 (type: bigint), _col7 (type: bigint), 
_col8 (type: double), _col9 (type: double), _col10 (type: double), _col11 
(type: double), _col12 (type: double), _col13 (type: decimal(22,2)), _col14 
(type: bigint), _col15 (type: double), _col18 (type: double), _col19 (type: 
double)
         Reducer 3 
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_14.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_14.q.out
index 7038c3a78b0..25bfeb19bfc 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_14.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_14.q.out
@@ -163,7 +163,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: zzzzz
                 reduceColumnSortOrder: +++++
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 13
@@ -186,13 +186,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                 Statistics: Num rows: 758 Data size: 130530 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col3 (type: timestamp), _col1 (type: float), 
_col0 (type: string), _col4 (type: boolean), _col2 (type: double), (-26.28D + 
_col2) (type: double), (- (-26.28D + _col2)) (type: double), power(((_col5 - 
((_col6 * _col6) / _col7)) / if((_col7 = 1L), null, (_col7 - 1))), 0.5) (type: 
double), (_col1 * -26.28) (type: float), _col8 (type: float), (- _col1) (type: 
float), (- _col8) (type: float), ((- (-26.28D + _col2)) / 10.175D) (type: 
double), power(((_col9 - ((_ [...]
+                  expressions: _col3 (type: timestamp), _col1 (type: float), 
_col0 (type: string), _col4 (type: boolean), _col2 (type: double), (-26.28D + 
_col2) (type: double), (- (-26.28D + _col2)) (type: double), 
power((greatest(0,(_col5 - ((_col6 * _col6) / _col7))) / if((_col7 = 1L), null, 
(_col7 - 1))), 0.5) (type: double), (_col1 * -26.28) (type: float), _col8 
(type: float), (- _col1) (type: float), (- _col8) (type: float), ((- (-26.28D + 
_col2)) / 10.175D) (type: double), power(( [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [3, 1, 0, 4, 2, 13, 15, 23, 
24, 8, 25, 26, 29, 34, 12, 38, 47, 48, 52, 57, 64, 66]
-                      selectExpressions: DoubleScalarAddDoubleColumn(val 
-26.28, col 2:double) -> 13:double, DoubleColUnaryMinus(col 
14:double)(children: DoubleScalarAddDoubleColumn(val -26.28, col 2:double) -> 
14:double) -> 15:double, FuncPowerDoubleToDouble(col 22:double)(children: 
DoubleColDivideLongColumn(col 18:double, col 21:bigint)(children: 
DoubleColSubtractDoubleColumn(col 5:double, col 17:double)(children: 
DoubleColDivideLongColumn(col 16:double, col 7:bigint)(children: DoubleC [...]
+                      projectedOutputColumnNums: [3, 1, 0, 4, 2, 13, 15, 24, 
25, 8, 26, 27, 30, 35, 12, 39, 49, 50, 54, 59, 66, 68]
+                      selectExpressions: DoubleScalarAddDoubleColumn(val 
-26.28, col 2:double) -> 13:double, DoubleColUnaryMinus(col 
14:double)(children: DoubleScalarAddDoubleColumn(val -26.28, col 2:double) -> 
14:double) -> 15:double, FuncPowerDoubleToDouble(col 23:double)(children: 
DoubleColDivideLongColumn(col 19:double, col 22:bigint)(children: 
VectorUDFAdaptor(greatest(0,(_col5 - ((_col6 * _col6) / _col7))))(children: 
DoubleColSubtractDoubleColumn(col 5:double, col 17:double)(childr [...]
                   Statistics: Num rows: 758 Data size: 176010 Basic stats: 
COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col2 (type: string), _col1 (type: 
float), _col4 (type: double), _col0 (type: timestamp)
@@ -203,7 +203,7 @@ STAGE PLANS:
                         keyColumns: 0:string, 1:float, 2:double, 3:timestamp
                         native: true
                         nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                        valueColumns: 4:boolean, 13:double, 15:double, 
23:double, 24:float, 8:float, 25:float, 26:float, 29:double, 34:double, 
12:bigint, 38:double, 47:double, 48:double, 52:double, 57:double, 64:double, 
66:double
+                        valueColumns: 4:boolean, 13:double, 15:double, 
24:double, 25:float, 8:float, 26:float, 27:float, 30:double, 35:double, 
12:bigint, 39:double, 49:double, 50:double, 54:double, 59:double, 66:double, 
68:double
                     Statistics: Num rows: 758 Data size: 176010 Basic stats: 
COMPLETE Column stats: COMPLETE
                     value expressions: _col3 (type: boolean), _col5 (type: 
double), _col6 (type: double), _col7 (type: double), _col8 (type: float), _col9 
(type: float), _col10 (type: float), _col11 (type: float), _col12 (type: 
double), _col13 (type: double), _col14 (type: bigint), _col15 (type: double), 
_col16 (type: double), _col17 (type: double), _col18 (type: double), _col19 
(type: double), _col20 (type: double), _col21 (type: double)
         Reducer 3 
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_16.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_16.q.out
index 34703895783..7e8cb81144f 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_16.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_16.q.out
@@ -136,7 +136,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: zzz
                 reduceColumnSortOrder: +++
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 7
@@ -159,13 +159,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 5979 Data size: 825318 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power(((_col4 - ((_col5 * 
_col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
(- power(((_col4 - ((_col5 * _col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 
1))), 0.5)) (type: double), (power(((_col4 - ((_col5 * _col5) / _col3)) / 
if((_col3 = 1L), null, (_col [...]
+                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power((greatest(0,(_col4 
- ((_col5 * _col5) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) 
(type: double), (- power((greatest(0,(_col4 - ((_col5 * _col5) / _col3))) / 
if((_col3 = 1L), null, (_col3 - 1))), 0.5)) (type: double), 
(power((greatest(0,(_col4 - ((_col5 * _col5) / _co [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 17, 26, 
36, 6, 37, 39, 47]
-                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
16:double)(children: DoubleColDivideLongColumn(col 12:double, col 
15:bigint)(children: DoubleColSubtractDoubleColumn(col 4:double, col 
11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
3:bigint)(child [...]
+                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 18, 28, 
39, 6, 40, 42, 51]
+                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
17:double)(children: DoubleColDivideLongColumn(col 13:double, col 
16:bigint)(children: VectorUDFAdaptor(greatest(0,(_col4 - ((_col5 * _col5) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 4:double, col 11:do [...]
                   Statistics: Num rows: 5979 Data size: 1734126 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_4.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_4.q.out
index 0f53eda28fc..07a4df90aed 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_4.q.out
@@ -137,7 +137,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: 
                 reduceColumnSortOrder: 
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 5
@@ -158,13 +158,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: bigint), (_col0 * -563L) (type: 
bigint), (-3728L + _col0) (type: bigint), power(((_col1 - ((_col2 * _col2) / 
_col3)) / _col3), 0.5) (type: double), (- power(((_col1 - ((_col2 * _col2) / 
_col3)) / _col3), 0.5)) (type: double), (_col2 / _col3) (type: double), ((_col0 
* -563L) % _col0) (type: bigint), (UDFToDouble(((_col0 * -563L) % _col0)) / 
(_col2 / _col3)) (type: double), ((_col1 - ((_col2 * _col2) / _col3)) / _col3) 
(type: double), (- (UDFToDo [...]
+                  expressions: _col0 (type: bigint), (_col0 * -563L) (type: 
bigint), (-3728L + _col0) (type: bigint), power((greatest(0,(_col1 - ((_col2 * 
_col2) / _col3))) / _col3), 0.5) (type: double), (- power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5)) (type: double), (_col2 / _col3) 
(type: double), ((_col0 * -563L) % _col0) (type: bigint), (UDFToDouble(((_col0 
* -563L) % _col0)) / (_col2 / _col3)) (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3)))  [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 5, 6, 11, 17, 18, 20, 25, 
29, 35, 38, 4, 4, 46]
-                      selectExpressions: LongColMultiplyLongScalar(col 
0:bigint, val -563) -> 5:bigint, LongScalarAddLongColumn(val -3728, col 
0:bigint) -> 6:bigint, FuncPowerDoubleToDouble(col 10:double)(children: 
DoubleColDivideLongColumn(col 9:double, col 3:bigint)(children: 
DoubleColSubtractDoubleColumn(col 1:double, col 8:double)(children: 
DoubleColDivideLongColumn(col 7:double, col 3:bigint)(children: 
DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) -> 7:double) -> 
8:doubl [...]
+                      projectedOutputColumnNums: [0, 5, 6, 12, 19, 20, 22, 27, 
32, 38, 41, 4, 4, 49]
+                      selectExpressions: LongColMultiplyLongScalar(col 
0:bigint, val -563) -> 5:bigint, LongScalarAddLongColumn(val -3728, col 
0:bigint) -> 6:bigint, FuncPowerDoubleToDouble(col 11:double)(children: 
DoubleColDivideLongColumn(col 10:double, col 3:bigint)(children: 
VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 * _col2) / _col3))))(children: 
DoubleColSubtractDoubleColumn(col 1:double, col 8:double)(children: 
DoubleColDivideLongColumn(col 7:double, col 3:bigint)(children: Doub [...]
                   Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git a/ql/src/test/results/clientpositive/llap/vectorization_9.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_9.q.out
index 34703895783..7e8cb81144f 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_9.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_9.q.out
@@ -136,7 +136,7 @@ STAGE PLANS:
                 reduceColumnNullOrder: zzz
                 reduceColumnSortOrder: +++
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
                 rowBatchContext:
                     dataColumnCount: 7
@@ -159,13 +159,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 5979 Data size: 825318 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power(((_col4 - ((_col5 * 
_col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) (type: double), 
(- power(((_col4 - ((_col5 * _col5) / _col3)) / if((_col3 = 1L), null, (_col3 - 
1))), 0.5)) (type: double), (power(((_col4 - ((_col5 * _col5) / _col3)) / 
if((_col3 = 1L), null, (_col [...]
+                  expressions: _col0 (type: string), _col1 (type: double), 
_col2 (type: timestamp), (_col1 - 9763215.5639D) (type: double), (- (_col1 - 
9763215.5639D)) (type: double), _col3 (type: bigint), power((greatest(0,(_col4 
- ((_col5 * _col5) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))), 0.5) 
(type: double), (- power((greatest(0,(_col4 - ((_col5 * _col5) / _col3))) / 
if((_col3 = 1L), null, (_col3 - 1))), 0.5)) (type: double), 
(power((greatest(0,(_col4 - ((_col5 * _col5) / _co [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 17, 26, 
36, 6, 37, 39, 47]
-                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
16:double)(children: DoubleColDivideLongColumn(col 12:double, col 
15:bigint)(children: DoubleColSubtractDoubleColumn(col 4:double, col 
11:double)(children: DoubleColDivideLongColumn(col 10:double, col 
3:bigint)(child [...]
+                      projectedOutputColumnNums: [0, 1, 2, 7, 9, 3, 18, 28, 
39, 6, 40, 42, 51]
+                      selectExpressions: DoubleColSubtractDoubleScalar(col 
1:double, val 9763215.5639) -> 7:double, DoubleColUnaryMinus(col 
8:double)(children: DoubleColSubtractDoubleScalar(col 1:double, val 
9763215.5639) -> 8:double) -> 9:double, FuncPowerDoubleToDouble(col 
17:double)(children: DoubleColDivideLongColumn(col 13:double, col 
16:bigint)(children: VectorUDFAdaptor(greatest(0,(_col4 - ((_col5 * _col5) / 
_col3))))(children: DoubleColSubtractDoubleColumn(col 4:double, col 11:do [...]
                   Statistics: Num rows: 5979 Data size: 1734126 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
diff --git 
a/ql/src/test/results/clientpositive/llap/vectorization_input_format_excludes.q.out
 
b/ql/src/test/results/clientpositive/llap/vectorization_input_format_excludes.q.out
index 7b659f3a499..ae371709047 100644
--- 
a/ql/src/test/results/clientpositive/llap/vectorization_input_format_excludes.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/vectorization_input_format_excludes.q.out
@@ -216,7 +216,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -226,7 +226,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 128 Data size: 7556 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 128 Data size: 4484 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -553,7 +553,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -563,7 +563,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 128 Data size: 7556 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 128 Data size: 4484 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -900,7 +900,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -910,7 +910,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 128 Data size: 7556 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 128 Data size: 4484 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -1285,7 +1285,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -1295,7 +1295,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 128 Data size: 7556 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 128 Data size: 4484 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out 
b/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
index 8a1222c2dc4..6a4956a1f5c 100644
--- a/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorization_short_regress.q.out
@@ -694,7 +694,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -710,13 +710,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
                 Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (- ((_col0 - ((_col1 * _col1) / _col2)) / _col2)) (type: 
double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) - (- ((_col0 - ((_col1 
* _col1) / _col2)) / _col2))) (type: double), _col3 (type: bigint), (CAST( 
_col3 AS decimal(19,0)) % 79.553) (type: decimal(5,3)), _col4 (type: tinyint), 
(UDFToDouble(_col3) - (- ((_col0 - ((_col1 * _col1) / _col2)) / _col2))) (type: 
double), ((_col0 - ((_col1 *  [...]
+                  expressions: ((_col0 - ((_col1 * _col1) / _col2)) / _col2) 
(type: double), (- ((_col0 - ((_col1 * _col1) / _col2)) / _col2)) (type: 
double), (((_col0 - ((_col1 * _col1) / _col2)) / _col2) - (- ((_col0 - ((_col1 
* _col1) / _col2)) / _col2))) (type: double), _col3 (type: bigint), (CAST( 
_col3 AS decimal(19,0)) % 79.553) (type: decimal(5,3)), _col4 (type: tinyint), 
(UDFToDouble(_col3) - (- ((_col0 - ((_col1 * _col1) / _col2)) / _col2))) (type: 
double), ((_col0 - ((_col1 *  [...]
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [17, 22, 32, 3, 34, 4, 41, 
45, 51, 3, 52, 57, 62, 64, 8, 67, 74, 82, 84, 12, 86, 90]
-                      selectExpressions: DoubleColDivideLongColumn(col 
16:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 15:double)(children: DoubleColDivideLongColumn(col 14:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 14:double) -> 15:double) -> 16:double) -> 17:double, DoubleColUnaryMinus(col 
21:double)(children: DoubleColDivideLongColumn(col 20:double, col 
2:bigint)(children: DoubleColSubtractDoubleColum [...]
+                      projectedOutputColumnNums: [17, 22, 32, 3, 34, 4, 41, 
45, 51, 3, 52, 57, 62, 64, 8, 67, 74, 83, 85, 12, 87, 91]
+                      selectExpressions: DoubleColDivideLongColumn(col 
16:double, col 2:bigint)(children: DoubleColSubtractDoubleColumn(col 0:double, 
col 15:double)(children: DoubleColDivideLongColumn(col 14:double, col 
2:bigint)(children: DoubleColMultiplyDoubleColumn(col 1:double, col 1:double) 
-> 14:double) -> 15:double) -> 16:double) -> 17:double, DoubleColUnaryMinus(col 
21:double)(children: DoubleColDivideLongColumn(col 20:double, col 
2:bigint)(children: DoubleColSubtractDoubleColum [...]
                   Statistics: Num rows: 1 Data size: 272 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
@@ -2643,7 +2643,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -2661,24 +2661,33 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                 Statistics: Num rows: 3372 Data size: 155032 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: double), ((_col1 - ((_col2 * 
_col2) / _col3)) / if((_col3 = 1L), null, (_col3 - 1))) (type: double), 
(2563.58D * ((_col1 - ((_col2 * _col2) / _col3)) / if((_col3 = 1L), null, 
(_col3 - 1)))) (type: double), (- ((_col1 - ((_col2 * _col2) / _col3)) / 
if((_col3 = 1L), null, (_col3 - 1)))) (type: double), _col4 (type: bigint), 
((2563.58D * ((_col1 - ((_col2 * _col2) / _col3)) / if((_col3 = 1L), null, 
(_col3 - 1)))) + -5638.15D) (type: double), ((- ( [...]
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
+                  expressions: _col0 (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / if((_col3 = 1L), null, (_col3 - 1))) (type: 
double), _col4 (type: bigint), _col5 (type: double), (greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3) (type: double), power((greatest(0,(_col1 - 
((_col2 * _col2) / _col3))) / _col3), 0.5) (type: double), _col2 (type: double)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 12, 20, 28, 4, 37, 55, 5, 
59, 68, 73, 81, 82, 2, 84]
-                      selectExpressions: DoubleColDivideLongColumn(col 
8:double, col 11:bigint)(children: DoubleColSubtractDoubleColumn(col 1:double, 
col 7:double)(children: DoubleColDivideLongColumn(col 6:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 6:double) -> 7:double) -> 8:double, IfExprNullCondExpr(col 9:boolean, null, 
col 10:bigint)(children: LongColEqualLongScalar(col 3:bigint, val 1) -> 
9:boolean, LongColSubtractLongScalar(col 3:bi [...]
-                  Statistics: Num rows: 3372 Data size: 397816 Basic stats: 
COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: double)
-                    null sort order: z
-                    sort order: +
-                    Reduce Sink Vectorization:
-                        className: VectorReduceSinkObjectHashOperator
+                      projectedOutputColumnNums: [0, 13, 4, 5, 18, 24, 2]
+                      selectExpressions: DoubleColDivideLongColumn(col 
9:double, col 12:bigint)(children: VectorUDFAdaptor(greatest(0,(_col1 - ((_col2 
* _col2) / _col3))))(children: DoubleColSubtractDoubleColumn(col 1:double, col 
7:double)(children: DoubleColDivideLongColumn(col 6:double, col 
3:bigint)(children: DoubleColMultiplyDoubleColumn(col 2:double, col 2:double) 
-> 6:double) -> 7:double) -> 8:double) -> 9:double, IfExprNullCondExpr(col 
10:boolean, null, col 11:bigint)(children: Lo [...]
+                  Statistics: Num rows: 3372 Data size: 182008 Basic stats: 
COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: _col0 (type: double), _col1 (type: double), 
(2563.58D * _col1) (type: double), (- _col1) (type: double), _col2 (type: 
bigint), ((2563.58D * _col1) + -5638.15D) (type: double), ((- _col1) * 
((2563.58D * _col1) + -5638.15D)) (type: double), _col3 (type: double), _col4 
(type: double), (_col0 - (- _col1)) (type: double), _col5 (type: double), 
(_col0 + _col1) (type: double), (_col0 * 762.0D) (type: double), _col6 (type: 
double), (-863.257D % (_col0 * 762.0D))  [...]
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
+                    Select Vectorization:
+                        className: VectorSelectOperator
                         native: true
-                        nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        projectedOutputColumnNums: [0, 13, 25, 26, 4, 28, 32, 
5, 18, 34, 24, 35, 36, 2, 38]
+                        selectExpressions: 
DoubleScalarMultiplyDoubleColumn(val 2563.58, col 13:double) -> 25:double, 
DoubleColUnaryMinus(col 13:double) -> 26:double, DoubleColAddDoubleScalar(col 
27:double, val -5638.15)(children: DoubleScalarMultiplyDoubleColumn(val 
2563.58, col 13:double) -> 27:double) -> 28:double, 
DoubleColMultiplyDoubleColumn(col 29:double, col 31:double)(children: 
DoubleColUnaryMinus(col 13:double) -> 29:double, DoubleColAddDoubleScalar(col 
30:double, val -5638.15) [...]
                     Statistics: Num rows: 3372 Data size: 397816 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    value expressions: _col1 (type: double), _col2 (type: 
double), _col3 (type: double), _col4 (type: bigint), _col5 (type: double), 
_col6 (type: double), _col7 (type: double), _col8 (type: double), _col9 (type: 
double), _col10 (type: double), _col11 (type: double), _col12 (type: double), 
_col13 (type: double), _col14 (type: double)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: double)
+                      null sort order: z
+                      sort order: +
+                      Reduce Sink Vectorization:
+                          className: VectorReduceSinkObjectHashOperator
+                          native: true
+                          nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                      Statistics: Num rows: 3372 Data size: 397816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: double), _col2 (type: 
double), _col3 (type: double), _col4 (type: bigint), _col5 (type: double), 
_col6 (type: double), _col7 (type: double), _col8 (type: double), _col9 (type: 
double), _col10 (type: double), _col11 (type: double), _col12 (type: double), 
_col13 (type: double), _col14 (type: double)
         Reducer 3 
             Execution mode: vectorized, llap
             Reduce Vectorization:
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_parquet.q.out 
b/ql/src/test/results/clientpositive/llap/vectorized_parquet.q.out
index 21815728b3c..78eb986611a 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_parquet.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_parquet.q.out
@@ -186,7 +186,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -196,7 +196,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 128 Data size: 7556 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double)
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 128 Data size: 4484 Basic stats: 
COMPLETE Column stats: COMPLETE
                   File Output Operator
diff --git 
a/ql/src/test/results/clientpositive/llap/vectorized_parquet_types.q.out 
b/ql/src/test/results/clientpositive/llap/vectorized_parquet_types.q.out
index 589bb7f5996..51a5fc25c09 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_parquet_types.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_parquet_types.q.out
@@ -351,7 +351,7 @@ STAGE PLANS:
                 enabled: true
                 enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez] IS true
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
             Reduce Operator Tree:
               Group By Operator
@@ -369,13 +369,13 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9
                 Statistics: Num rows: 3 Data size: 516 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power(((_col6 - ((_col7 * _col7) / _col8)) / _col8), 0.5) (type: double), _col9 
(type: decimal(4,2))
+                  expressions: _col0 (type: tinyint), _col1 (type: int), _col2 
(type: smallint), _col3 (type: bigint), (_col4 / _col5) (type: double), 
power((greatest(0,(_col6 - ((_col7 * _col7) / _col8))) / _col8), 0.5) (type: 
double), _col9 (type: decimal(4,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                   Select Vectorization:
                       className: VectorSelectOperator
                       native: true
-                      projectedOutputColumnNums: [0, 1, 2, 3, 10, 15, 9]
-                      selectExpressions: DoubleColDivideLongColumn(col 
4:double, col 5:bigint) -> 10:double, FuncPowerDoubleToDouble(col 
14:double)(children: DoubleColDivideLongColumn(col 13:double, col 
8:bigint)(children: DoubleColSubtractDoubleColumn(col 6:double, col 
12:double)(children: DoubleColDivideLongColumn(col 11:double, col 
8:bigint)(children: DoubleColMultiplyDoubleColumn(col 7:double, col 7:double) 
-> 11:double) -> 12:double) -> 13:double) -> 14:double) -> 15:double
+                      projectedOutputColumnNums: [0, 1, 2, 3, 10, 16, 9]
+                      selectExpressions: DoubleColDivideLongColumn(col 
4:double, col 5:bigint) -> 10:double, FuncPowerDoubleToDouble(col 
15:double)(children: DoubleColDivideLongColumn(col 14:double, col 
8:bigint)(children: VectorUDFAdaptor(greatest(0,(_col6 - ((_col7 * _col7) / 
_col8))))(children: DoubleColSubtractDoubleColumn(col 6:double, col 
12:double)(children: DoubleColDivideLongColumn(col 11:double, col 
8:bigint)(children: DoubleColMultiplyDoubleColumn(col 7:double, col 7:double) - 
[...]
                   Statistics: Num rows: 3 Data size: 444 Basic stats: COMPLETE 
Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col0 (type: tinyint)

Reply via email to