You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by cw...@apache.org on 2017/05/03 21:51:46 UTC

hive git commit: HIVE-15229: 'like any' and 'like all' operators in hive (Simanchal Das via Carl Steinbach)

Repository: hive
Updated Branches:
  refs/heads/master ed6501ed3 -> 740779f66


HIVE-15229: 'like any' and 'like all' operators in hive (Simanchal Das via Carl Steinbach)


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

Branch: refs/heads/master
Commit: 740779f66a4678324428ca0c240ae3ca44a00974
Parents: ed6501e
Author: Carl Steinbach <cw...@apache.org>
Authored: Wed May 3 14:46:31 2017 -0700
Committer: Carl Steinbach <cw...@apache.org>
Committed: Wed May 3 14:46:31 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/exec/FunctionRegistry.java   |   2 +
 .../org/apache/hadoop/hive/ql/parse/HiveLexer.g |   1 +
 .../apache/hadoop/hive/ql/parse/HiveParser.g    |   2 +
 .../hadoop/hive/ql/parse/IdentifiersParser.g    |   6 +
 .../hive/ql/parse/TypeCheckProcFactory.java     |   3 +
 .../hive/ql/udf/generic/GenericUDFLikeAll.java  | 133 +++++++++++++
 .../hive/ql/udf/generic/GenericUDFLikeAny.java  | 134 +++++++++++++
 .../ql/udf/generic/TestGenericUDFLikeAll.java   |  88 +++++++++
 .../ql/udf/generic/TestGenericUDFLikeAny.java   |  87 +++++++++
 .../queries/clientnegative/udf_likeall_wrong1.q |   2 +
 .../queries/clientnegative/udf_likeany_wrong1.q |   2 +
 .../test/queries/clientpositive/udf_likeall.q   |  57 ++++++
 .../test/queries/clientpositive/udf_likeany.q   |  57 ++++++
 .../clientnegative/udf_likeall_wrong1.q.out     |   1 +
 .../clientnegative/udf_likeany_wrong1.q.out     |   1 +
 .../results/clientpositive/show_functions.q.out |   2 +
 .../results/clientpositive/udf_likeall.q.out    | 187 +++++++++++++++++++
 .../results/clientpositive/udf_likeany.q.out    | 187 +++++++++++++++++++
 18 files changed, 952 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/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 8dc5f2e..1b556ac 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
@@ -272,6 +272,8 @@ public final class FunctionRegistry {
     system.registerGenericUDF("initcap", GenericUDFInitCap.class);
 
     system.registerUDF("like", UDFLike.class, true);
+    system.registerGenericUDF("likeany", GenericUDFLikeAny.class);
+    system.registerGenericUDF("likeall", GenericUDFLikeAll.class);
     system.registerGenericUDF("rlike", GenericUDFRegExp.class);
     system.registerGenericUDF("regexp", GenericUDFRegExp.class);
     system.registerUDF("regexp_replace", UDFRegExpReplace.class, false);

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
index 0721b92..190b66b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
@@ -49,6 +49,7 @@ KW_AND : 'AND';
 KW_OR : 'OR';
 KW_NOT : 'NOT' | '!';
 KW_LIKE : 'LIKE';
+KW_ANY : 'ANY';
 
 KW_IF : 'IF';
 KW_EXISTS : 'EXISTS';

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index d98a663..ca639d3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -397,6 +397,8 @@ TOK_OPERATOR;
 TOK_EXPRESSION;
 TOK_DETAIL;
 TOK_BLOCKING;
+TOK_LIKEANY;
+TOK_LIKEALL;
 }
 
 

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index 8598fae..645ced9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -567,6 +567,12 @@ precedenceSimilarExpressionAtom[CommonTree t]
     |
     KW_BETWEEN (min=precedenceBitwiseOrExpression) KW_AND (max=precedenceBitwiseOrExpression)
     -> ^(TOK_FUNCTION Identifier["between"] KW_FALSE {$t} $min $max)
+    |
+    KW_LIKE KW_ANY (expr=expressionsInParenthesis[false])
+    -> ^(TOK_FUNCTION TOK_LIKEANY {$t} {$expr.tree})
+    |
+    KW_LIKE KW_ALL (expr=expressionsInParenthesis[false])
+    -> ^(TOK_FUNCTION TOK_LIKEALL {$t} {$expr.tree})
     ;
 
 precedenceSimilarExpressionIn[CommonTree t]

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/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 8f8eab0..c3227c9 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
@@ -198,6 +198,7 @@ public class TypeCheckProcFactory {
         + HiveParser.KW_WHEN + "%|" + HiveParser.KW_IN + "%|"
         + HiveParser.KW_ARRAY + "%|" + HiveParser.KW_MAP + "%|"
         + HiveParser.KW_STRUCT + "%|" + HiveParser.KW_EXISTS + "%|"
+        + HiveParser.TOK_LIKEALL + "%|" + HiveParser.TOK_LIKEANY + "%|"
         + HiveParser.TOK_SUBQUERY_OP_NOTIN + "%"),
         tf.getStrExprProcessor());
     opRules.put(new RuleRegExp("R4", HiveParser.KW_TRUE + "%|"
@@ -724,6 +725,8 @@ public class TypeCheckProcFactory {
       specialFunctionTextHashMap = new HashMap<Integer, String>();
       specialFunctionTextHashMap.put(HiveParser.TOK_ISNULL, "isnull");
       specialFunctionTextHashMap.put(HiveParser.TOK_ISNOTNULL, "isnotnull");
+      specialFunctionTextHashMap.put(HiveParser.TOK_LIKEANY, "likeany");
+      specialFunctionTextHashMap.put(HiveParser.TOK_LIKEALL, "likeall");
       conversionFunctionTextHashMap = new HashMap<Integer, String>();
       conversionFunctionTextHashMap.put(HiveParser.TOK_BOOLEAN,
           serdeConstants.BOOLEAN_TYPE_NAME);

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAll.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAll.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAll.java
new file mode 100644
index 0000000..2a92689
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAll.java
@@ -0,0 +1,133 @@
+/**
+ * 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.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.UDFLike;
+import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveGrouping;
+import org.apache.hadoop.io.BooleanWritable;
+import org.apache.hadoop.io.Text;
+
+/**
+ * GenericUDFLikeAll is return true if a text(column value) matches to all patterns
+ *
+ * Example usage: SELECT key FROM src WHERE key like all ('%ab%', 'a%','b%','abc');
+ *
+ * LIKE ALL returns true if test matches all patterns patternN.
+ * Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL.
+ *
+ */
+
+@Description(
+    name = "like all",
+    value = "test _FUNC_(pattern1, pattern2...) - returns true if test matches all patterns patternN. "
+        + " Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL.")
+public class GenericUDFLikeAll extends GenericUDF {
+  private transient PrimitiveCategory[] inputTypes;
+  private transient Converter[] converters;
+  private transient boolean isConstantNullPatternContain;
+  private boolean isAllPatternsConstant = true;
+  private final BooleanWritable bw = new BooleanWritable();
+
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
+    if (arguments.length < 2) {
+      throw new UDFArgumentLengthException("The like all operator requires at least one pattern for matching, got "
+          + (arguments.length - 1));
+    }
+    inputTypes = new PrimitiveCategory[arguments.length];
+    converters = new Converter[arguments.length];
+
+    /**expects string or null arguments */
+    for (int idx = 0; idx < arguments.length; idx++) {
+      checkArgPrimitive(arguments, idx);
+      checkArgGroups(arguments, idx, inputTypes, PrimitiveGrouping.STRING_GROUP, PrimitiveGrouping.VOID_GROUP);
+      PrimitiveCategory inputType = ((PrimitiveObjectInspector) arguments[idx]).getPrimitiveCategory();
+      if (arguments[idx] instanceof ConstantObjectInspector && idx != 0) {
+        Object constValue = ((ConstantObjectInspector) arguments[idx]).getWritableConstantValue();
+        if (!isConstantNullPatternContain && constValue == null) {
+          isConstantNullPatternContain = true;
+        }
+      } else if (idx != 0 && isAllPatternsConstant) {
+        isAllPatternsConstant = false;
+      }
+      converters[idx] = ObjectInspectorConverters.getConverter(arguments[idx], getOutputOI(inputType));
+      inputTypes[idx] = inputType;
+    }
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    bw.set(true);
+
+    /**If field value or any constant string pattern value is null then return null*/
+    if (arguments[0].get() == null || isConstantNullPatternContain) {
+      return null;
+    }
+    /**If all patterns are constant string and no pattern have null value the do short circuit boolean check
+     * Else evaluate all patterns if any pattern contains null value then return null otherwise at last return matching result
+     * */
+    Text columnValue = (Text) converters[0].convert(arguments[0].get());
+    Text pattern = new Text();
+    UDFLike likeUdf = new UDFLike();
+    for (int idx = 1; idx < arguments.length; idx++) {
+      if (arguments[idx].get() == null) {
+        return null;
+      }
+      pattern.set((Text) converters[idx].convert(arguments[idx].get()));
+      if (!likeUdf.evaluate(columnValue, pattern).get() && bw.get()) {
+        bw.set(false);
+        if (isAllPatternsConstant) {
+          return bw;
+        }
+      }
+    }
+    return bw;
+  }
+
+  @Override
+  public String getDisplayString(String[] children) {
+    return getStandardDisplayString("likeall", children);
+  }
+
+  private ObjectInspector getOutputOI(PrimitiveCategory inputType) {
+    switch (inputType) {
+      case CHAR:
+      case STRING:
+      case VARCHAR:
+        return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+      case VOID:
+        return PrimitiveObjectInspectorFactory.writableVoidObjectInspector;
+      default:
+        break;
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAny.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAny.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAny.java
new file mode 100644
index 0000000..65413a0
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLikeAny.java
@@ -0,0 +1,134 @@
+/**
+ * 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.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.UDFLike;
+import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveGrouping;
+import org.apache.hadoop.io.BooleanWritable;
+import org.apache.hadoop.io.Text;
+
+
+/**
+ * GenericUDFLikeAll is return true if a text(column value) matches to any patterns
+ *
+ * Example usage: SELECT key FROM src WHERE key like any ('%ab%', 'a%','b%','abc');
+ *
+ * like ANY returns true if test matches any patterns patternN.
+ * Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL.
+ */
+
+@Description(
+    name = "like any",
+    value = "test _FUNC_(pattern1, pattern2...) - returns true if test matches any patterns patternN."
+        + " Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL. ")
+public class GenericUDFLikeAny extends GenericUDF {
+  private transient PrimitiveCategory[] inputTypes;
+  private transient Converter[] converters;
+  private transient boolean isConstantNullPatternContain;
+  private boolean isAllPatternsConstant = true;
+  private final BooleanWritable bw = new BooleanWritable();
+
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
+    if (arguments.length < 2) {
+      throw new UDFArgumentLengthException("The like any operator requires at least one pattern for matching, got "
+          + (arguments.length - 1));
+    }
+    inputTypes = new PrimitiveCategory[arguments.length];
+    converters = new Converter[arguments.length];
+
+    /**expects string and null arguments */
+    for (int idx = 0; idx < arguments.length; idx++) {
+      checkArgPrimitive(arguments, idx);
+      checkArgGroups(arguments, idx, inputTypes, PrimitiveGrouping.STRING_GROUP, PrimitiveGrouping.VOID_GROUP);
+      PrimitiveCategory inputType = ((PrimitiveObjectInspector) arguments[idx]).getPrimitiveCategory();
+      if (arguments[idx] instanceof ConstantObjectInspector && idx != 0) {
+        Object constValue = ((ConstantObjectInspector) arguments[idx]).getWritableConstantValue();
+        if (!isConstantNullPatternContain && constValue == null) {
+          isConstantNullPatternContain = true;
+        }
+      } else if (idx != 0 && isAllPatternsConstant) {
+        isAllPatternsConstant = false;
+      }
+      converters[idx] = ObjectInspectorConverters.getConverter(arguments[idx], getOutputOI(inputType));
+      inputTypes[idx] = inputType;
+    }
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    bw.set(false);
+
+    /**If field value or any constant string pattern value is null then return null*/
+    if (arguments[0].get() == null || isConstantNullPatternContain) {
+      return null;
+    }
+
+    /**If all patterns are constant string and no pattern have null value the do short circuit boolean check
+     * Else evaluate all patterns if any pattern contains null value then return null otherwise at last return matching result
+     * */
+    Text columnValue = (Text) converters[0].convert(arguments[0].get());
+    Text pattern = new Text();
+    UDFLike likeUdf = new UDFLike();
+    for (int idx = 1; idx < arguments.length; idx++) {
+      if (arguments[idx].get() == null) {
+        return null;
+      }
+      pattern.set(converters[idx].convert(arguments[idx].get()).toString());
+      if (likeUdf.evaluate(columnValue, pattern).get() && !bw.get()) {
+        bw.set(true);
+        if (isAllPatternsConstant) {
+          return bw;
+        }
+      }
+    }
+    return bw;
+  }
+
+  @Override
+  public String getDisplayString(String[] children) {
+    return getStandardDisplayString("likeany", children);
+  }
+
+  private ObjectInspector getOutputOI(PrimitiveCategory inputType) {
+    switch (inputType) {
+      case CHAR:
+      case STRING:
+      case VARCHAR:
+        return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+      case VOID:
+        return PrimitiveObjectInspectorFactory.writableVoidObjectInspector;
+      default:
+        break;
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAll.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAll.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAll.java
new file mode 100644
index 0000000..1078de2
--- /dev/null
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAll.java
@@ -0,0 +1,88 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+
+import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.BooleanWritable;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+
+public class TestGenericUDFLikeAll {
+  GenericUDFLikeAll udf = null;
+
+  @Test
+  public void testTrue() throws HiveException {
+    udf = new GenericUDFLikeAll();
+
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOITwo = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOIThree = PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne, valueOITwo, valueOIThree };
+
+    udf.initialize(arguments);
+    DeferredJavaObject valueObjOne = new DeferredJavaObject(new Text("abc"));
+    DeferredJavaObject valueObjTwo = new DeferredJavaObject(new Text("%b%"));
+
+    HiveVarchar vc = new HiveVarchar();
+    vc.setValue("a%");
+    GenericUDF.DeferredJavaObject[] args =
+        { valueObjOne, valueObjTwo, new GenericUDF.DeferredJavaObject(new HiveVarcharWritable(vc)) };
+
+    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
+
+    assertEquals(true, output.get());
+
+  }
+
+  @Test(expected = UDFArgumentException.class)
+  public void expectException() throws HiveException {
+    udf = new GenericUDFLikeAll();
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne };
+    udf.initialize(arguments);
+  }
+
+  @Test
+  public void testNull() throws HiveException {
+    udf = new GenericUDFLikeAll();
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOITwo = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOIThree = PrimitiveObjectInspectorFactory.writableVoidObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne, valueOITwo, valueOIThree };
+    udf.initialize(arguments);
+    DeferredObject valueObjOne = new DeferredJavaObject(new Text("linkedin"));
+    DeferredObject valueObjTwo = new DeferredJavaObject(new Text("%oo%"));
+    DeferredObject valueObjThree = new DeferredJavaObject(NullWritable.get());
+    DeferredObject[] args = { valueObjOne, valueObjTwo, valueObjThree };
+    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
+    assertEquals(null, output);
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAny.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAny.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAny.java
new file mode 100644
index 0000000..0ce7736
--- /dev/null
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLikeAny.java
@@ -0,0 +1,87 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.BooleanWritable;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+
+public class TestGenericUDFLikeAny {
+
+  GenericUDFLikeAny udf = null;
+
+  @Test
+  public void testTrue() throws HiveException {
+    udf = new GenericUDFLikeAny();
+
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOITwo = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOIThree = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne, valueOITwo, valueOIThree };
+    udf.initialize(arguments);
+    DeferredJavaObject valueObjOne = new DeferredJavaObject(new Text("abc"));
+    DeferredJavaObject valueObjTwo = new DeferredJavaObject(new Text("%b%"));
+    HiveVarchar vc = new HiveVarchar();
+    vc.setValue("a%");
+    GenericUDF.DeferredJavaObject[] args =
+        { valueObjOne, valueObjTwo, new GenericUDF.DeferredJavaObject(new HiveVarcharWritable(vc)) };
+    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
+    assertEquals(true, output.get());
+
+  }
+
+  @Test(expected = UDFArgumentException.class)
+  public void testExpectException() throws IOException, HiveException {
+    udf = new GenericUDFLikeAny();
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne };
+    udf.initialize(arguments);
+    udf.close();
+  }
+
+  @Test
+  public void testNull() throws HiveException {
+    udf = new GenericUDFLikeAny();
+    ObjectInspector valueOIOne = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector valueOITwo = PrimitiveObjectInspectorFactory.writableVoidObjectInspector;
+    ObjectInspector valueOIThree = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector[] arguments = { valueOIOne, valueOITwo, valueOIThree };
+    udf.initialize(arguments);
+    DeferredObject valueObjOne = new DeferredJavaObject(new Text("abc"));
+    DeferredObject valueObjTwo = new DeferredJavaObject(NullWritable.get());
+    DeferredObject valueObjThree = new DeferredJavaObject(new Text("%b%"));
+    DeferredObject[] args = { valueObjOne, valueObjTwo, valueObjThree };
+    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
+    assertEquals(null, output);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/queries/clientnegative/udf_likeall_wrong1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/udf_likeall_wrong1.q b/ql/src/test/queries/clientnegative/udf_likeall_wrong1.q
new file mode 100644
index 0000000..2578ee2
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/udf_likeall_wrong1.q
@@ -0,0 +1,2 @@
+SELECT 120 like all ('a%','%bc%','%c')
+FROM src WHERE src.key = 86;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/queries/clientnegative/udf_likeany_wrong1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/udf_likeany_wrong1.q b/ql/src/test/queries/clientnegative/udf_likeany_wrong1.q
new file mode 100644
index 0000000..fcc0905
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/udf_likeany_wrong1.q
@@ -0,0 +1,2 @@
+SELECT 120 like any ('a%','%bc%','%c')
+FROM src WHERE src.key = 86;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/queries/clientpositive/udf_likeall.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_likeall.q b/ql/src/test/queries/clientpositive/udf_likeall.q
new file mode 100644
index 0000000..a580ae8
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/udf_likeall.q
@@ -0,0 +1,57 @@
+SELECT 'abc' like all ('a%','%bc%','%c')
+FROM src WHERE src.key = 86;
+
+SELECT 'abc' LIKE ALL ('z%','%y','%dx%')
+FROM src WHERE src.key = 86;
+
+SELECT 'abc' like all ('abc')
+FROM src WHERE src.key = 86;
+
+DESCRIBE FUNCTION likeall;
+DESCRIBE FUNCTION EXTENDED likeall;
+
+DROP TABLE IF EXISTS like_all_table;
+
+CREATE TABLE like_all_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%gl%" as pat
+UNION ALL
+SELECT "facebook" as company,"%bo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+;
+
+select company from like_all_table where company like all ('%oo%','%go%') ;
+
+select company from like_all_table where company like all ('microsoft','%yoo%') ;
+
+select
+    company,
+    CASE
+        WHEN company like all ('%oo%','%go%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like all ('%oo%','go%') OR company like all ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_all_table ;
+
+--Mix test with constant pattern and column value
+select company from like_all_table where company like all ('%oo%',pat) ;
+
+-- not like all test
+
+select company from like_all_table where company not like all ('%oo%','%in','fa%') ;
+select company from like_all_table where company not like all ('microsoft','%yoo%') ;
+
+-- null test
+
+select company from like_all_table where company like all ('%oo%',null) ;
+
+select company from like_all_table where company not like all ('%oo%',null) ;
+
+select company from like_all_table where company not like all (null,null) ;
+
+select company from like_all_table where company not like all (null,null) ;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/queries/clientpositive/udf_likeany.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_likeany.q b/ql/src/test/queries/clientpositive/udf_likeany.q
new file mode 100644
index 0000000..b3e6dc1
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/udf_likeany.q
@@ -0,0 +1,57 @@
+SELECT 'abc' like any ('a%','%d','%cd%')
+FROM src WHERE src.key = 86;
+
+SELECT 'abc' LIKE ANY ('z%','%y','%dx%')
+FROM src WHERE src.key = 86;
+
+SELECT 'abc' like any ('abc')
+FROM src WHERE src.key = 86;
+
+DESCRIBE FUNCTION likeany;
+DESCRIBE FUNCTION EXTENDED likeany;
+
+DROP TABLE IF EXISTS like_any_table;
+
+CREATE TABLE like_any_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%oo%" as pat
+UNION ALL
+SELECT "facebook" as company,"%oo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+;
+
+select company from like_any_table where company like any ('%oo%','%in','fa%') ;
+
+select company from like_any_table where company like any ('microsoft','%yoo%') ;
+
+select
+    company,
+    CASE
+        WHEN company like any ('%oo%','%in','fa%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like any ('%oo%','fa%') OR company like any ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_any_table;
+
+--Mix test with constant pattern and column value
+select company from like_any_table where company like any ('%zz%',pat) ;
+
+-- not like any test
+
+select company from like_any_table where company not like any ('%oo%','%in','fa%') ;
+select company from like_any_table where company not like any ('microsoft','%yoo%') ;
+
+-- null test
+
+select company from like_any_table where company like any ('%oo%',null) ;
+
+select company from like_any_table where company not like any ('%oo%',null) ;
+
+select company from like_any_table where company like any (null,null) ;
+
+select company from like_any_table where company not like any (null,null) ;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/results/clientnegative/udf_likeall_wrong1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_likeall_wrong1.q.out b/ql/src/test/results/clientnegative/udf_likeall_wrong1.q.out
new file mode 100644
index 0000000..bf48229
--- /dev/null
+++ b/ql/src/test/results/clientnegative/udf_likeall_wrong1.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException [Error 10016]: Line 1:7 Argument type mismatch '120': likeall only takes STRING_GROUP, VOID_GROUP types as 1st argument, got INT

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/results/clientnegative/udf_likeany_wrong1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_likeany_wrong1.q.out b/ql/src/test/results/clientnegative/udf_likeany_wrong1.q.out
new file mode 100644
index 0000000..3b7f41d
--- /dev/null
+++ b/ql/src/test/results/clientnegative/udf_likeany_wrong1.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException [Error 10016]: Line 1:7 Argument type mismatch '120': likeany only takes STRING_GROUP, VOID_GROUP types as 1st argument, got INT

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/results/clientpositive/show_functions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/show_functions.q.out b/ql/src/test/results/clientpositive/show_functions.q.out
index ac5ca41..e638638 100644
--- a/ql/src/test/results/clientpositive/show_functions.q.out
+++ b/ql/src/test/results/clientpositive/show_functions.q.out
@@ -134,6 +134,8 @@ least
 length
 levenshtein
 like
+likeall
+likeany
 ln
 locate
 log

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/results/clientpositive/udf_likeall.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_likeall.q.out b/ql/src/test/results/clientpositive/udf_likeall.q.out
new file mode 100644
index 0000000..7a089c9
--- /dev/null
+++ b/ql/src/test/results/clientpositive/udf_likeall.q.out
@@ -0,0 +1,187 @@
+PREHOOK: query: SELECT 'abc' like all ('a%','%bc%','%c')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' like all ('a%','%bc%','%c')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true
+PREHOOK: query: SELECT 'abc' LIKE ALL ('z%','%y','%dx%')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' LIKE ALL ('z%','%y','%dx%')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+false
+PREHOOK: query: SELECT 'abc' like all ('abc')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' like all ('abc')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true
+PREHOOK: query: DESCRIBE FUNCTION likeall
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION likeall
+POSTHOOK: type: DESCFUNCTION
+test likeall(pattern1, pattern2...) - returns true if test matches all patterns patternN.  Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL.
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED likeall
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED likeall
+POSTHOOK: type: DESCFUNCTION
+test likeall(pattern1, pattern2...) - returns true if test matches all patterns patternN.  Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL.
+Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFLikeAll
+Function type:BUILTIN
+PREHOOK: query: DROP TABLE IF EXISTS like_all_table
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS like_all_table
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE like_all_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%gl%" as pat
+UNION ALL
+SELECT "facebook" as company,"%bo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: database:default
+PREHOOK: Output: default@like_all_table
+POSTHOOK: query: CREATE TABLE like_all_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%gl%" as pat
+UNION ALL
+SELECT "facebook" as company,"%bo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@like_all_table
+POSTHOOK: Lineage: like_all_table.company EXPRESSION []
+POSTHOOK: Lineage: like_all_table.pat EXPRESSION []
+PREHOOK: query: select company from like_all_table where company like all ('%oo%','%go%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company like all ('%oo%','%go%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+google
+PREHOOK: query: select company from like_all_table where company like all ('microsoft','%yoo%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company like all ('microsoft','%yoo%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+PREHOOK: query: select
+    company,
+    CASE
+        WHEN company like all ('%oo%','%go%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like all ('%oo%','go%') OR company like all ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_all_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select
+    company,
+    CASE
+        WHEN company like all ('%oo%','%go%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like all ('%oo%','go%') OR company like all ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_all_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+google	Y	Y
+facebook	N	N
+linkedin	N	N
+PREHOOK: query: select company from like_all_table where company like all ('%oo%',pat)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company like all ('%oo%',pat)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+google
+facebook
+PREHOOK: query: select company from like_all_table where company not like all ('%oo%','%in','fa%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company not like all ('%oo%','%in','fa%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+google
+facebook
+linkedin
+PREHOOK: query: select company from like_all_table where company not like all ('microsoft','%yoo%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company not like all ('microsoft','%yoo%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+google
+facebook
+linkedin
+PREHOOK: query: select company from like_all_table where company like all ('%oo%',null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company like all ('%oo%',null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_all_table where company not like all ('%oo%',null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company not like all ('%oo%',null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_all_table where company not like all (null,null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company not like all (null,null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_all_table where company not like all (null,null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_all_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_all_table where company not like all (null,null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_all_table
+#### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/740779f6/ql/src/test/results/clientpositive/udf_likeany.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_likeany.q.out b/ql/src/test/results/clientpositive/udf_likeany.q.out
new file mode 100644
index 0000000..fc36686
--- /dev/null
+++ b/ql/src/test/results/clientpositive/udf_likeany.q.out
@@ -0,0 +1,187 @@
+PREHOOK: query: SELECT 'abc' like any ('a%','%d','%cd%')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' like any ('a%','%d','%cd%')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true
+PREHOOK: query: SELECT 'abc' LIKE ANY ('z%','%y','%dx%')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' LIKE ANY ('z%','%y','%dx%')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+false
+PREHOOK: query: SELECT 'abc' like any ('abc')
+FROM src WHERE src.key = 86
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT 'abc' like any ('abc')
+FROM src WHERE src.key = 86
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true
+PREHOOK: query: DESCRIBE FUNCTION likeany
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION likeany
+POSTHOOK: type: DESCFUNCTION
+test likeany(pattern1, pattern2...) - returns true if test matches any patterns patternN. Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL. 
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED likeany
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED likeany
+POSTHOOK: type: DESCFUNCTION
+test likeany(pattern1, pattern2...) - returns true if test matches any patterns patternN. Returns NULL if the expression on the left hand side is NULL or if one of the patterns in the list is NULL. 
+Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFLikeAny
+Function type:BUILTIN
+PREHOOK: query: DROP TABLE IF EXISTS like_any_table
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS like_any_table
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE like_any_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%oo%" as pat
+UNION ALL
+SELECT "facebook" as company,"%oo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: database:default
+PREHOOK: Output: default@like_any_table
+POSTHOOK: query: CREATE TABLE like_any_table
+STORED AS TEXTFILE
+AS
+SELECT "google" as company,"%oo%" as pat
+UNION ALL
+SELECT "facebook" as company,"%oo%" as pat
+UNION ALL
+SELECT "linkedin" as company,"%in" as pat
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@like_any_table
+POSTHOOK: Lineage: like_any_table.company EXPRESSION []
+POSTHOOK: Lineage: like_any_table.pat EXPRESSION []
+PREHOOK: query: select company from like_any_table where company like any ('%oo%','%in','fa%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company like any ('%oo%','%in','fa%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+google
+facebook
+linkedin
+PREHOOK: query: select company from like_any_table where company like any ('microsoft','%yoo%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company like any ('microsoft','%yoo%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+PREHOOK: query: select
+    company,
+    CASE
+        WHEN company like any ('%oo%','%in','fa%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like any ('%oo%','fa%') OR company like any ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_any_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select
+    company,
+    CASE
+        WHEN company like any ('%oo%','%in','fa%') THEN 'Y'
+        ELSE 'N'
+    END AS is_available,
+    CASE
+        WHEN company like any ('%oo%','fa%') OR company like any ('%in','ms%') THEN 'Y'
+        ELSE 'N'
+    END AS mix
+From like_any_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+google	Y	Y
+facebook	Y	Y
+linkedin	Y	Y
+PREHOOK: query: select company from like_any_table where company like any ('%zz%',pat)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company like any ('%zz%',pat)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+google
+facebook
+linkedin
+PREHOOK: query: select company from like_any_table where company not like any ('%oo%','%in','fa%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company not like any ('%oo%','%in','fa%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_any_table where company not like any ('microsoft','%yoo%')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company not like any ('microsoft','%yoo%')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+google
+facebook
+linkedin
+PREHOOK: query: select company from like_any_table where company like any ('%oo%',null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company like any ('%oo%',null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_any_table where company not like any ('%oo%',null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company not like any ('%oo%',null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_any_table where company like any (null,null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company like any (null,null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+PREHOOK: query: select company from like_any_table where company not like any (null,null)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@like_any_table
+#### A masked pattern was here ####
+POSTHOOK: query: select company from like_any_table where company not like any (null,null)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@like_any_table
+#### A masked pattern was here ####