Repository: hive
Updated Branches:
  refs/heads/master 5f742cfef -> b91b5f956


HIVE-20961: Retire NVL implementation (Laszlo Bodor via Zoltan Haindrich)

Signed-off-by: Zoltan Haindrich <k...@rxd.hu>


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

Branch: refs/heads/master
Commit: b91b5f956ce68043fc516d743e0c7ee1022be332
Parents: 5f742cf
Author: Laszlo Bodor <bodorlaszlo0...@gmail.com>
Authored: Wed Dec 12 13:26:34 2018 +0100
Committer: Zoltan Haindrich <k...@rxd.hu>
Committed: Wed Dec 12 13:26:34 2018 +0100

----------------------------------------------------------------------
 .../positive/accumulo_predicate_pushdown.q.out  |  4 +-
 .../results/positive/hbase_ppd_key_range.q.out  |  2 +-
 .../test/results/positive/hbase_pushdown.q.out  |  2 +-
 .../hadoop/hive/ql/exec/FunctionRegistry.java   |  2 +-
 .../apache/hadoop/hive/ql/exec/Registry.java    |  5 +-
 .../ql/exec/vector/VectorizationContext.java    |  9 +--
 .../optimizer/ConstantPropagateProcFactory.java |  6 +-
 .../hive/ql/optimizer/physical/Vectorizer.java  |  1 -
 .../hive/ql/parse/TypeCheckProcFactory.java     | 10 +--
 .../hive/ql/udf/generic/GenericUDFNvl.java      | 75 --------------------
 .../clientnegative/nvl_mismatch_type.q.out      |  2 +-
 .../clientpositive/constantPropWhen.q.out       | 16 ++---
 .../test/results/clientpositive/fold_case.q.out |  8 +--
 .../test/results/clientpositive/fold_when.q.out |  8 +--
 .../clientpositive/llap/partition_pruning.q.out | 12 ++--
 .../clientpositive/llap/udf_coalesce.q.out      |  1 +
 .../clientpositive/llap/vector_nvl.q.out        |  2 +-
 .../test/results/clientpositive/udf_nvl.q.out   | 11 +--
 .../results/clientpositive/union_offcbo.q.out   | 20 +++---
 .../results/clientpositive/vector_nvl.q.out     |  2 +-
 20 files changed, 61 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
----------------------------------------------------------------------
diff --git 
a/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out 
b/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
index 8a1e060..197d3ba 100644
--- 
a/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
+++ 
b/accumulo-handler/src/test/results/positive/accumulo_predicate_pushdown.q.out
@@ -414,10 +414,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: accumulo_pushdown
-            filterExpr: (not NVL((key < '90'),false)) (type: boolean)
+            filterExpr: (not COALESCE((key < '90'),false)) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Filter Operator
-              predicate: (not NVL((key < '90'),false)) (type: boolean)
+              predicate: (not COALESCE((key < '90'),false)) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out 
b/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
index 5e05154..dcfe7c7 100644
--- a/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_ppd_key_range.q.out
@@ -416,7 +416,7 @@ STAGE PLANS:
             alias: hbase_pushdown
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Filter Operator
-              predicate: (not NVL((key < '90'),false)) (type: boolean)
+              predicate: (not COALESCE((key < '90'),false)) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbase_pushdown.q.out 
b/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
index 57613c3..e814423 100644
--- a/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_pushdown.q.out
@@ -305,7 +305,7 @@ STAGE PLANS:
             alias: hbase_pushdown
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Filter Operator
-              predicate: (not NVL((key = 90),false)) (type: boolean)
+              predicate: (not COALESCE((key = 90),false)) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index 578b16c..d7f069e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -283,7 +283,7 @@ public final class FunctionRegistry {
     system.registerUDF("replace", UDFReplace.class, false);
     system.registerUDF("regexp_extract", UDFRegExpExtract.class, false);
     system.registerUDF("parse_url", UDFParseUrl.class, false);
-    system.registerGenericUDF("nvl", GenericUDFNvl.class);
+    system.registerGenericUDF("nvl", GenericUDFCoalesce.class); //HIVE-20961
     system.registerGenericUDF("split", GenericUDFSplit.class);
     system.registerGenericUDF("str_to_map", GenericUDFStringToMap.class);
     system.registerGenericUDF("translate", GenericUDFTranslate.class);

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
index 7c0efc4..f4a46e6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
@@ -525,8 +525,9 @@ public class Registry {
       FunctionInfo prev = mFunctions.get(functionName);
       if (prev != null) {
         if (isBuiltInFunc(prev.getFunctionClass())) {
-          throw new RuntimeException("Function " + functionName + " is hive 
builtin function, " +
-              "which cannot be overridden.");
+          String message = String.format("Function (%s / %s) is hive builtin 
function, which cannot be overridden.", functionName, prev.getFunctionClass());
+          LOG.debug(message);
+          throw new RuntimeException(message);
         }
         prev.discarded();
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
index 9e2531b..5ff3386 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
@@ -1279,8 +1279,8 @@ import com.google.common.annotations.VisibleForTesting;
     } else {
 
       // Casts to exact types including long to double etc. are needed in some 
special cases.
-      if (udf instanceof GenericUDFCoalesce || udf instanceof GenericUDFNvl
-          || udf instanceof GenericUDFElt || udf instanceof GenericUDFIf) {
+      if (udf instanceof GenericUDFCoalesce || udf instanceof GenericUDFElt
+          || udf instanceof GenericUDFIf) {
         GenericUDF genericUdf = getGenericUDFForCast(castType);
         List<ExprNodeDesc> children = new ArrayList<>();
         children.add(child);
@@ -2257,10 +2257,7 @@ import com.google.common.annotations.VisibleForTesting;
       ve = getWhenExpression(childExpr, mode, returnType);
     } else if (udf instanceof GenericUDFOPPositive) {
       ve = getIdentityExpression(childExpr);
-    } else if (udf instanceof GenericUDFCoalesce || udf instanceof 
GenericUDFNvl) {
-
-      // Coalesce is a special case because it can take variable number of 
arguments.
-      // Nvl is a specialization of the Coalesce.
+    } else if (udf instanceof GenericUDFCoalesce) {
       ve = getCoalesceExpression(childExpr, mode, returnType);
     } else if (udf instanceof GenericUDFElt) {
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
index 11159d2..b539787 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
@@ -68,7 +68,7 @@ import 
org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBaseCompare;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCase;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDFNvl;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCoalesce;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNot;
@@ -763,7 +763,7 @@ public final class ConstantPropagateProcFactory {
           List<ExprNodeDesc> children = new ArrayList<>();
           children.add(whenExpr);
           children.add(new ExprNodeConstantDesc(false));
-          ExprNodeGenericFuncDesc func = 
ExprNodeGenericFuncDesc.newInstance(new GenericUDFNvl(),
+          ExprNodeGenericFuncDesc func = 
ExprNodeGenericFuncDesc.newInstance(new GenericUDFCoalesce(),
               children);
           if (Boolean.TRUE.equals(thenVal)) {
             return func;
@@ -816,7 +816,7 @@ public final class ConstantPropagateProcFactory {
           List<ExprNodeDesc> children = new ArrayList<>();
           children.add(equal);
           children.add(new ExprNodeConstantDesc(false));
-          ExprNodeGenericFuncDesc func = 
ExprNodeGenericFuncDesc.newInstance(new GenericUDFNvl(),
+          ExprNodeGenericFuncDesc func = 
ExprNodeGenericFuncDesc.newInstance(new GenericUDFCoalesce(),
               children);
           if (Boolean.TRUE.equals(thenVal)) {
             return func;

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
index d3492f3..0a1a25f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
@@ -479,7 +479,6 @@ public class Vectorizer implements PhysicalPlanResolver {
     supportedGenericUDFs.add(GenericUDFCase.class);
     supportedGenericUDFs.add(GenericUDFWhen.class);
     supportedGenericUDFs.add(GenericUDFCoalesce.class);
-    supportedGenericUDFs.add(GenericUDFNvl.class);
     supportedGenericUDFs.add(GenericUDFElt.class);
     supportedGenericUDFs.add(GenericUDFInitCap.class);
     supportedGenericUDFs.add(GenericUDFInBloomFilter.class);

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
index fd151b9..fa4abf9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
@@ -71,8 +71,8 @@ import org.apache.hadoop.hive.ql.plan.ExprNodeSubQueryDesc;
 import org.apache.hadoop.hive.ql.udf.SettableUDF;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBaseCompare;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCoalesce;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDFNvl;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualNS;
@@ -1250,9 +1250,9 @@ public class TypeCheckProcFactory {
           }
           desc = ExprNodeGenericFuncDesc.newInstance(genericUDF, funcText,
               childrenList);
-        } else if (ctx.isFoldExpr() && canConvertIntoNvl(genericUDF, 
children)) {
-          // Rewrite CASE into NVL
-          desc = ExprNodeGenericFuncDesc.newInstance(new GenericUDFNvl(),
+        } else if (ctx.isFoldExpr() && canConvertIntoCoalesce(genericUDF, 
children)) {
+          // Rewrite CASE into COALESCE
+          desc = ExprNodeGenericFuncDesc.newInstance(new GenericUDFCoalesce(),
                   Lists.newArrayList(children.get(0), new 
ExprNodeConstantDesc(false)));
           if (Boolean.FALSE.equals(((ExprNodeConstantDesc) 
children.get(1)).getValue())) {
             desc = ExprNodeGenericFuncDesc.newInstance(new GenericUDFOPNot(),
@@ -1427,7 +1427,7 @@ public class TypeCheckProcFactory {
       return constVal;
     }
 
-    private boolean canConvertIntoNvl(GenericUDF genericUDF, 
ArrayList<ExprNodeDesc> children) {
+    private boolean canConvertIntoCoalesce(GenericUDF genericUDF, 
ArrayList<ExprNodeDesc> children) {
       if (genericUDF instanceof GenericUDFWhen && children.size() == 3 &&
               children.get(1) instanceof ExprNodeConstantDesc &&
               children.get(2) instanceof ExprNodeConstantDesc) {

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNvl.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNvl.java 
b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNvl.java
deleted file mode 100644
index 8148781..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNvl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hive.ql.udf.generic;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
-import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
-import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
-import org.apache.hadoop.hive.ql.metadata.HiveException;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-@Description(name = "nvl",
-value = "_FUNC_(value,default_value) - Returns default value if value is null 
else returns value",
-extended = "Example:\n"
-+ "  > SELECT _FUNC_(null,'bla') FROM src LIMIT 1;\n" + "  bla")
-public class GenericUDFNvl extends GenericUDF{
-  private transient GenericUDFUtils.ReturnObjectInspectorResolver 
returnOIResolver;
-  private transient ObjectInspector[] argumentOIs;
-
-  @Override
-  public ObjectInspector initialize(ObjectInspector[] arguments) throws 
UDFArgumentException {
-    argumentOIs = arguments;
-    if (arguments.length != 2) {
-      throw new UDFArgumentLengthException(
-          "The operator 'NVL'  accepts 2 arguments.");
-    }
-    returnOIResolver = new GenericUDFUtils.ReturnObjectInspectorResolver(true);
-    if (!(returnOIResolver.update(arguments[0]) && returnOIResolver
-        .update(arguments[1]))) {
-      throw new UDFArgumentTypeException(1,
-          "The first and seconds arguments of function NLV should have the 
same type, "
-          + "but they are different: \"" + arguments[0].getTypeName()
-          + "\" and \"" + arguments[1].getTypeName() + "\"");
-    }
-    return returnOIResolver.get();
-  }
-
-  @Override
-  public Object evaluate(DeferredObject[] arguments) throws HiveException {
-    Object retVal = returnOIResolver.convertIfNecessary(arguments[0].get(),
-        argumentOIs[0]);
-    if (retVal == null ){
-      retVal = returnOIResolver.convertIfNecessary(arguments[1].get(),
-          argumentOIs[1]);
-    }
-    return retVal;
-  }
-
-  @Override
-  public String getDisplayString(String[] children) {
-    StringBuilder sb = new StringBuilder();
-    sb.append("NVL(");
-    sb.append(children[0]);
-    sb.append(',');
-    sb.append(children[1]);
-    sb.append(')');
-    return sb.toString() ;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientnegative/nvl_mismatch_type.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/nvl_mismatch_type.q.out 
b/ql/src/test/results/clientnegative/nvl_mismatch_type.q.out
index 80406bc..f60d641 100644
--- a/ql/src/test/results/clientnegative/nvl_mismatch_type.q.out
+++ b/ql/src/test/results/clientnegative/nvl_mismatch_type.q.out
@@ -40,4 +40,4 @@ POSTHOOK: query: load data local inpath 
'../../data/files/over1k' into table ove
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@over1k
-FAILED: SemanticException [Error 10016]: Line 4:14 Argument type mismatch 
'true': The first and seconds arguments of function NLV should have the same 
type, but they are different: "tinyint" and "boolean"
+FAILED: SemanticException [Error 10016]: Line 4:14 Argument type mismatch 
'true': The expressions after COALESCE should all have the same type: "tinyint" 
is expected but "boolean" is found

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/constantPropWhen.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/constantPropWhen.q.out 
b/ql/src/test/results/clientpositive/constantPropWhen.q.out
index 4e7af0c..5fb2a4b 100644
--- a/ql/src/test/results/clientpositive/constantPropWhen.q.out
+++ b/ql/src/test/results/clientpositive/constantPropWhen.q.out
@@ -40,7 +40,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: (not NVL((id = id2),false)) (type: boolean)
+              expressions: (not COALESCE((id = id2),false)) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -90,7 +90,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: (not NVL((id = id2),false)) (type: boolean)
+              expressions: (not COALESCE((id = id2),false)) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -140,7 +140,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: NVL((id = id2),false) (type: boolean)
+              expressions: COALESCE((id = id2),false) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -190,7 +190,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: NVL((id = id2),false) (type: boolean)
+              expressions: COALESCE((id = id2),false) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -240,7 +240,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: (not NVL((id = id2),false)) (type: boolean)
+              expressions: (not COALESCE((id = id2),false)) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -290,7 +290,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: (not NVL((id = id2),false)) (type: boolean)
+              expressions: (not COALESCE((id = id2),false)) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -340,7 +340,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: NVL((id = id2),false) (type: boolean)
+              expressions: COALESCE((id = id2),false) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator
@@ -390,7 +390,7 @@ STAGE PLANS:
             alias: test_1_n4
             Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE Column 
stats: NONE
             Select Operator
-              expressions: NVL((id = id2),false) (type: boolean)
+              expressions: COALESCE((id = id2),false) (type: boolean)
               outputColumnNames: _col0
               Statistics: Num rows: 4 Data size: 24 Basic stats: COMPLETE 
Column stats: NONE
               File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/fold_case.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/fold_case.q.out 
b/ql/src/test/results/clientpositive/fold_case.q.out
index 408275d..d04d6b4 100644
--- a/ql/src/test/results/clientpositive/fold_case.q.out
+++ b/ql/src/test/results/clientpositive/fold_case.q.out
@@ -75,10 +75,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not NVL((key = '238'),false)) (type: boolean)
+            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE 
Column stats: NONE
             Filter Operator
-              predicate: (not NVL((key = '238'),false)) (type: boolean)
+              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
                 Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
@@ -378,10 +378,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not NVL((key = '238'),false)) (type: boolean)
+            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE 
Column stats: NONE
             Filter Operator
-              predicate: (not NVL((key = '238'),false)) (type: boolean)
+              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
                 expressions: CASE WHEN ((key = '238')) THEN (null) ELSE 
(false) END (type: boolean)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/fold_when.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/fold_when.q.out 
b/ql/src/test/results/clientpositive/fold_when.q.out
index 6f3a479..956a17b 100644
--- a/ql/src/test/results/clientpositive/fold_when.q.out
+++ b/ql/src/test/results/clientpositive/fold_when.q.out
@@ -376,10 +376,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not NVL((key = '238'),false)) (type: boolean)
+            filterExpr: (not COALESCE((key = '238'),false)) (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE 
Column stats: NONE
             Filter Operator
-              predicate: (not NVL((key = '238'),false)) (type: boolean)
+              predicate: (not COALESCE((key = '238'),false)) (type: boolean)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
                 expressions: key (type: string)
@@ -501,10 +501,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: src
-            filterExpr: (not NVL((key = '11'),false)) (type: boolean)
+            filterExpr: (not COALESCE((key = '11'),false)) (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE 
Column stats: NONE
             Filter Operator
-              predicate: (not NVL((key = '11'),false)) (type: boolean)
+              predicate: (not COALESCE((key = '11'),false)) (type: boolean)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
                 expressions: key (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/llap/partition_pruning.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/partition_pruning.q.out 
b/ql/src/test/results/clientpositive/llap/partition_pruning.q.out
index 0e74fc7..1382266 100644
--- a/ql/src/test/results/clientpositive/llap/partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/partition_pruning.q.out
@@ -162,11 +162,11 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: daysales
-          filterExpr: NVL((customer = 1),false) (type: boolean)
+          filterExpr: COALESCE((customer = 1),false) (type: boolean)
           GatherStats: false
           Filter Operator
             isSamplingPred: false
-            predicate: NVL((customer = 1),false) (type: boolean)
+            predicate: COALESCE((customer = 1),false) (type: boolean)
             Select Operator
               expressions: customer (type: int), dt (type: string)
               outputColumnNames: _col0, _col1
@@ -290,11 +290,11 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: daysales
-          filterExpr: NVL(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
+          filterExpr: COALESCE(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
           GatherStats: false
           Filter Operator
             isSamplingPred: false
-            predicate: NVL(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
+            predicate: COALESCE(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
             Select Operator
               expressions: customer (type: int), dt (type: string)
               outputColumnNames: _col0, _col1
@@ -418,11 +418,11 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: daysales
-          filterExpr: NVL(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
+          filterExpr: COALESCE(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
           GatherStats: false
           Filter Operator
             isSamplingPred: false
-            predicate: NVL(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
+            predicate: COALESCE(((dt = '2001-01-01') or (customer = 3)),false) 
(type: boolean)
             Select Operator
               expressions: customer (type: int), dt (type: string)
               outputColumnNames: _col0, _col1

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/llap/udf_coalesce.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/udf_coalesce.q.out 
b/ql/src/test/results/clientpositive/llap/udf_coalesce.q.out
index 34e610d..f35ec7a 100644
--- a/ql/src/test/results/clientpositive/llap/udf_coalesce.q.out
+++ b/ql/src/test/results/clientpositive/llap/udf_coalesce.q.out
@@ -8,6 +8,7 @@ PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION EXTENDED coalesce
 POSTHOOK: type: DESCFUNCTION
 coalesce(a1, a2, ...) - Returns the first non-null argument
+Synonyms: nvl
 Example:
   > SELECT coalesce(NULL, 1, NULL) FROM src LIMIT 1;
   1

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/llap/vector_nvl.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_nvl.q.out 
b/ql/src/test/results/clientpositive/llap/vector_nvl.q.out
index bf8b5b8..420520e 100644
--- a/ql/src/test/results/clientpositive/llap/vector_nvl.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_nvl.q.out
@@ -140,7 +140,7 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: cfloat (type: float), NVL(cfloat,1) (type: 
float)
+                    expressions: cfloat (type: float), COALESCE(cfloat,1) 
(type: float)
                     outputColumnNames: _col0, _col1
                     Select Vectorization:
                         className: VectorSelectOperator

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/udf_nvl.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_nvl.q.out 
b/ql/src/test/results/clientpositive/udf_nvl.q.out
index 32272a9..d072b9b 100644
--- a/ql/src/test/results/clientpositive/udf_nvl.q.out
+++ b/ql/src/test/results/clientpositive/udf_nvl.q.out
@@ -2,16 +2,17 @@ PREHOOK: query: DESCRIBE FUNCTION nvl
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION nvl
 POSTHOOK: type: DESCFUNCTION
-nvl(value,default_value) - Returns default value if value is null else returns 
value
+nvl(a1, a2, ...) - Returns the first non-null argument
 PREHOOK: query: DESCRIBE FUNCTION EXTENDED nvl
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION EXTENDED nvl
 POSTHOOK: type: DESCFUNCTION
-nvl(value,default_value) - Returns default value if value is null else returns 
value
+nvl(a1, a2, ...) - Returns the first non-null argument
+Synonyms: coalesce
 Example:
-  > SELECT nvl(null,'bla') FROM src LIMIT 1;
-  bla
-Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFNvl
+  > SELECT nvl(NULL, 1, NULL) FROM src LIMIT 1;
+  1
+Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFCoalesce
 Function type:BUILTIN
 PREHOOK: query: EXPLAIN
 SELECT NVL( 1 , 2 ) AS COL1,

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/union_offcbo.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/union_offcbo.q.out 
b/ql/src/test/results/clientpositive/union_offcbo.q.out
index 7d31613..6141398 100644
--- a/ql/src/test/results/clientpositive/union_offcbo.q.out
+++ b/ql/src/test/results/clientpositive/union_offcbo.q.out
@@ -294,7 +294,7 @@ STAGE PLANS:
           outputColumnNames: _col8, _col9, _col10, _col12, _col13, _col16, 
_col17, _col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and (CASE WHEN ((_col18 is not null and _col8 is null and 
(_col12 >= '2016-02-05'))) THEN ('DEL') WHEN ((_col18 is not null and _col8 is 
null and (_col12 <= '2016-02-05'))) THEN ('RET') WHEN (((_col18 = _col8) and 
(_col19 <> _col9))) THEN ('A_INS') ELSE ('NA') END <> 'RET') and _col18 is not 
null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and (CASE WHEN ((_col18 is not 
null and _col8 is null and (_col12 >= '2016-02-05'))) THEN ('DEL') WHEN 
((_col18 is not null and _col8 is null and (_col12 <= '2016-02-05'))) THEN 
('RET') WHEN (((_col18 = _col8) and (_col19 <> _col9))) THEN ('A_INS') ELSE 
('NA') END <> 'RET') and _col18 is not null) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col10 (type: bigint), _col16 (type: string), 
_col17 (type: bigint), _col13 (type: string), _col18 (type: string), _col19 
(type: string), CASE WHEN ((_col18 is not null and _col8 is null and (_col12 >= 
'2016-02-05'))) THEN ('DEL') WHEN ((_col18 is not null and _col8 is null and 
(_col12 <= '2016-02-05'))) THEN ('RET') WHEN (((_col18 = _col8) and (_col19 <> 
_col9))) THEN ('A_INS') ELSE ('NA') END (type: string)
@@ -386,7 +386,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col6, _col7, _col8, _col9, _col11, 
_col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and (CASE WHEN ((_col18 is not null and _col8 is null and 
(_col11 <= _col1))) THEN ('DEL') WHEN (((_col18 is null and _col8 is not null) 
or ((_col18 = _col8) and (_col19 <> _col9)))) THEN ('INS') ELSE ('NA') END <> 
'RET') and _col8 is not null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and (CASE WHEN ((_col18 is not 
null and _col8 is null and (_col11 <= _col1))) THEN ('DEL') WHEN (((_col18 is 
null and _col8 is not null) or ((_col18 = _col8) and (_col19 <> _col9)))) THEN 
('INS') ELSE ('NA') END <> 'RET') and _col8 is not null) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col0 (type: bigint), _col6 (type: string), _col7 
(type: bigint), '2099-12-31' (type: string), _col8 (type: string), _col9 (type: 
string), CASE WHEN ((_col18 is not null and _col8 is null and (_col11 <= 
_col1))) THEN ('DEL') WHEN (((_col18 is null and _col8 is not null) or ((_col18 
= _col8) and (_col19 <> _col9)))) THEN ('INS') ELSE ('NA') END (type: string)
@@ -644,7 +644,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col8
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col0,-1) <> NVL(_col7,-1)) or (NVL(_col1,-1) <> 
NVL(_col8,-1))) and CASE WHEN ((_col0 is null and (_col3 >= '2016-02-05'))) 
THEN (true) WHEN ((_col0 is null and (_col3 <= '2016-02-05'))) THEN (false) 
WHEN (((_col7 = _col0) and (_col8 <> _col1))) THEN (true) ELSE (true) END) 
(type: boolean)
+            predicate: (((COALESCE(_col0,-1) <> COALESCE(_col7,-1)) or 
(COALESCE(_col1,-1) <> COALESCE(_col8,-1))) and CASE WHEN ((_col0 is null and 
(_col3 >= '2016-02-05'))) THEN (true) WHEN ((_col0 is null and (_col3 <= 
'2016-02-05'))) THEN (false) WHEN (((_col7 = _col0) and (_col8 <> _col1))) THEN 
(true) ELSE (true) END) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col2 (type: bigint), _col5 (type: string), _col6 
(type: bigint), _col4 (type: string), _col7 (type: string), _col8 (type: 
string), CASE WHEN ((_col0 is null and (_col3 >= '2016-02-05'))) THEN ('DEL') 
WHEN ((_col0 is null and (_col3 <= '2016-02-05'))) THEN ('RET') WHEN (((_col7 = 
_col0) and (_col8 <> _col1))) THEN ('A_INS') ELSE ('NA') END (type: string)
@@ -739,7 +739,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: ((NVL(_col3,-1) <> NVL(_col5,-1)) or (NVL(_col4,-1) <> 
NVL(_col6,-1))) (type: boolean)
+            predicate: ((COALESCE(_col3,-1) <> COALESCE(_col5,-1)) or 
(COALESCE(_col4,-1) <> COALESCE(_col6,-1))) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col0 (type: bigint), _col1 (type: string), _col2 
(type: bigint), '2099-12-31' (type: string), _col3 (type: string), _col4 (type: 
string), CASE WHEN ((_col5 is null or ((_col5 = _col3) and (_col6 <> _col4)))) 
THEN ('INS') ELSE ('NA') END (type: string)
@@ -994,7 +994,7 @@ STAGE PLANS:
           outputColumnNames: _col8, _col9, _col10, _col12, _col13, _col16, 
_col17, _col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and _col18 is not null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and _col18 is not null) (type: 
boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col10 (type: bigint), _col16 (type: string), 
_col17 (type: bigint), _col13 (type: string), _col18 (type: string), _col19 
(type: string), CASE WHEN ((_col18 is not null and _col8 is null and (_col12 >= 
'2016-02-05'))) THEN ('DEL') WHEN ((_col18 is not null and _col8 is null and 
(_col12 <= '2016-02-05'))) THEN ('RET') WHEN (((_col18 = _col8) and (_col19 <> 
_col9))) THEN ('A_INS') ELSE ('NA') END (type: string)
@@ -1100,7 +1100,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col6, _col7, _col8, _col9, _col11, 
_col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and _col8 is not null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and _col8 is not null) (type: 
boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col0 (type: bigint), _col6 (type: string), _col7 
(type: bigint), '2099-12-31' (type: string), _col8 (type: string), _col9 (type: 
string), CASE WHEN ((_col18 is not null and _col8 is null and (_col11 <= 
_col1))) THEN ('DEL') WHEN (((_col18 is null and _col8 is not null) or ((_col18 
= _col8) and (_col19 <> _col9)))) THEN ('INS') ELSE ('NA') END (type: string)
@@ -1353,7 +1353,7 @@ STAGE PLANS:
           outputColumnNames: _col8, _col9, _col10, _col12, _col13, _col16, 
_col17, _col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and _col18 is not null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and _col18 is not null) (type: 
boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col10 (type: bigint), _col16 (type: string), 
_col17 (type: bigint), _col13 (type: string), _col18 (type: string), _col19 
(type: string), CASE WHEN ((_col18 is not null and _col8 is null and (_col12 >= 
'2016-02-05'))) THEN ('DEL') WHEN ((_col18 is not null and _col8 is null and 
(_col12 <= '2016-02-05'))) THEN ('RET') WHEN (((_col18 = _col8) and (_col19 <> 
_col9))) THEN ('A_INS') ELSE ('NA') END (type: string)
@@ -1457,7 +1457,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col6, _col7, _col8, _col9, _col11, 
_col18, _col19
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col8,-1) <> NVL(_col18,-1)) or (NVL(_col9,-1) 
<> NVL(_col19,-1))) and _col8 is not null) (type: boolean)
+            predicate: (((COALESCE(_col8,-1) <> COALESCE(_col18,-1)) or 
(COALESCE(_col9,-1) <> COALESCE(_col19,-1))) and _col8 is not null) (type: 
boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col0 (type: bigint), _col6 (type: string), _col7 
(type: bigint), '2099-12-31' (type: string), _col8 (type: string), _col9 (type: 
string), CASE WHEN ((_col18 is not null and _col8 is null and (_col11 <= 
_col1))) THEN ('DEL') WHEN (((_col18 is null and _col8 is not null) or ((_col18 
= _col8) and (_col19 <> _col9)))) THEN ('INS') ELSE ('NA') END (type: string)
@@ -1713,7 +1713,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col8
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: (((NVL(_col0,-1) <> NVL(_col7,-1)) or (NVL(_col1,-1) <> 
NVL(_col8,-1))) and CASE WHEN ((_col0 is null and (_col3 >= '2016-02-05'))) 
THEN (true) WHEN ((_col0 is null and (_col3 <= '2016-02-05'))) THEN (false) 
WHEN (((_col7 = _col0) and (_col8 <> _col1))) THEN (true) ELSE (true) END) 
(type: boolean)
+            predicate: (((COALESCE(_col0,-1) <> COALESCE(_col7,-1)) or 
(COALESCE(_col1,-1) <> COALESCE(_col8,-1))) and CASE WHEN ((_col0 is null and 
(_col3 >= '2016-02-05'))) THEN (true) WHEN ((_col0 is null and (_col3 <= 
'2016-02-05'))) THEN (false) WHEN (((_col7 = _col0) and (_col8 <> _col1))) THEN 
(true) ELSE (true) END) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col2 (type: bigint), _col5 (type: string), _col6 
(type: bigint), _col4 (type: string), _col7 (type: string), _col8 (type: 
string), CASE WHEN ((_col0 is null and (_col3 >= '2016-02-05'))) THEN ('DEL') 
WHEN ((_col0 is null and (_col3 <= '2016-02-05'))) THEN ('RET') WHEN (((_col7 = 
_col0) and (_col8 <> _col1))) THEN ('A_INS') ELSE ('NA') END (type: string)
@@ -1806,7 +1806,7 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
           Filter Operator
-            predicate: ((NVL(_col3,-1) <> NVL(_col5,-1)) or (NVL(_col4,-1) <> 
NVL(_col6,-1))) (type: boolean)
+            predicate: ((COALESCE(_col3,-1) <> COALESCE(_col5,-1)) or 
(COALESCE(_col4,-1) <> COALESCE(_col6,-1))) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
             Select Operator
               expressions: _col0 (type: bigint), _col1 (type: string), _col2 
(type: bigint), '2099-12-31' (type: string), _col3 (type: string), _col4 (type: 
string), CASE WHEN ((_col5 is null or ((_col5 = _col3) and (_col6 <> _col4)))) 
THEN ('INS') ELSE ('NA') END (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/b91b5f95/ql/src/test/results/clientpositive/vector_nvl.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_nvl.q.out 
b/ql/src/test/results/clientpositive/vector_nvl.q.out
index de1cb36..b7b7e75 100644
--- a/ql/src/test/results/clientpositive/vector_nvl.q.out
+++ b/ql/src/test/results/clientpositive/vector_nvl.q.out
@@ -133,7 +133,7 @@ STAGE PLANS:
             TableScan Vectorization:
                 native: true
             Select Operator
-              expressions: cfloat (type: float), NVL(cfloat,1) (type: float)
+              expressions: cfloat (type: float), COALESCE(cfloat,1) (type: 
float)
               outputColumnNames: _col0, _col1
               Select Vectorization:
                   className: VectorSelectOperator

Reply via email to