You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by dk...@apache.org on 2022/11/02 08:01:48 UTC

[hive] branch master updated: HIVE-26636: Support hyperbolic functions (Gopinath Gangadharan, reviewed by Denys Kuzmenko)

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

dkuzmenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new acb998f038a HIVE-26636: Support hyperbolic functions (Gopinath Gangadharan, reviewed by Denys Kuzmenko)
acb998f038a is described below

commit acb998f038ae9d7500fc45c38e56863228996294
Author: gopigowtham <go...@outlook.com>
AuthorDate: Wed Nov 2 13:31:39 2022 +0530

    HIVE-26636: Support hyperbolic functions (Gopinath Gangadharan, reviewed by Denys Kuzmenko)
    
    Closes #3681
---
 .../hadoop/hive/ql/exec/FunctionRegistry.java      |  6 +++
 .../hive/ql/exec/vector/VectorizationContext.java  |  3 ++
 .../hive/ql/optimizer/physical/Vectorizer.java     |  6 +++
 .../org/apache/hadoop/hive/ql/udf/UDFCosh.java     | 48 ++++++++++++++++++++++
 .../org/apache/hadoop/hive/ql/udf/UDFSinh.java     | 48 ++++++++++++++++++++++
 .../org/apache/hadoop/hive/ql/udf/UDFTanh.java     | 46 +++++++++++++++++++++
 .../org/apache/hadoop/hive/ql/udf/TestUDFMath.java | 24 +++++++++++
 ql/src/test/queries/clientpositive/udf_cosh.q      | 11 +++++
 ql/src/test/queries/clientpositive/udf_sinh.q      | 11 +++++
 ql/src/test/queries/clientpositive/udf_tanh.q      | 11 +++++
 .../clientpositive/llap/show_functions.q.out       |  7 ++++
 .../results/clientpositive/llap/udf_cosh.q.out     | 37 +++++++++++++++++
 .../results/clientpositive/llap/udf_sinh.q.out     | 37 +++++++++++++++++
 .../results/clientpositive/llap/udf_tanh.q.out     | 37 +++++++++++++++++
 .../apache/hadoop/hive/tools/GenVectorCode.java    |  6 +++
 15 files changed, 338 insertions(+)

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 ebc2552649c..e7f0f8e9711 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
@@ -198,6 +198,9 @@ import org.apache.hadoop.hive.ql.udf.UDFUnhex;
 import org.apache.hadoop.hive.ql.udf.UDFVersion;
 import org.apache.hadoop.hive.ql.udf.UDFWeekOfYear;
 import org.apache.hadoop.hive.ql.udf.UDFYear;
+import org.apache.hadoop.hive.ql.udf.UDFSinh;
+import org.apache.hadoop.hive.ql.udf.UDFCosh;
+import org.apache.hadoop.hive.ql.udf.UDFTanh;
 import org.apache.hadoop.hive.ql.udf.generic.*;
 import org.apache.hadoop.hive.ql.udf.ptf.MatchPath.MatchPathResolver;
 import org.apache.hadoop.hive.ql.udf.ptf.Noop.NoopResolver;
@@ -304,8 +307,10 @@ public final class FunctionRegistry {
     system.registerUDF("log2", UDFLog2.class, false);
     system.registerUDF("sin", UDFSin.class, false);
     system.registerUDF("asin", UDFAsin.class, false);
+    system.registerUDF("sinh", UDFSinh.class, false);
     system.registerUDF("cos", UDFCos.class, false);
     system.registerUDF("acos", UDFAcos.class, false);
+    system.registerUDF("cosh", UDFCosh.class, false);
     system.registerUDF("log10", UDFLog10.class, false);
     system.registerUDF("log", UDFLog.class, false);
     system.registerUDF("exp", UDFExp.class, false);
@@ -317,6 +322,7 @@ public final class FunctionRegistry {
     system.registerUDF("radians", UDFRadians.class, false);
     system.registerUDF("atan", UDFAtan.class, false);
     system.registerUDF("tan", UDFTan.class, false);
+    system.registerUDF("tanh", UDFTanh.class, false);
     system.registerUDF("e", UDFE.class, false);
     system.registerGenericUDF("factorial", GenericUDFFactorial.class);
     system.registerUDF("crc32", UDFCrc32.class, false);
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 ba980f9375c..dc80e13a2ee 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
@@ -644,7 +644,9 @@ import com.google.common.annotations.VisibleForTesting;
     udfsNeedingImplicitDecimalCast.add(UDFLog2.class);
     udfsNeedingImplicitDecimalCast.add(UDFSin.class);
     udfsNeedingImplicitDecimalCast.add(UDFAsin.class);
+    udfsNeedingImplicitDecimalCast.add(UDFSinh.class);
     udfsNeedingImplicitDecimalCast.add(UDFCos.class);
+    udfsNeedingImplicitDecimalCast.add(UDFCosh.class);
     udfsNeedingImplicitDecimalCast.add(UDFAcos.class);
     udfsNeedingImplicitDecimalCast.add(UDFLog10.class);
     udfsNeedingImplicitDecimalCast.add(UDFLog.class);
@@ -653,6 +655,7 @@ import com.google.common.annotations.VisibleForTesting;
     udfsNeedingImplicitDecimalCast.add(UDFRadians.class);
     udfsNeedingImplicitDecimalCast.add(UDFAtan.class);
     udfsNeedingImplicitDecimalCast.add(UDFTan.class);
+    udfsNeedingImplicitDecimalCast.add(UDFTanh.class);
     udfsNeedingImplicitDecimalCast.add(UDFOPLongDivide.class);
   }
 
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 3b7f226fe71..8e3408316fb 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
@@ -212,6 +212,9 @@ import org.apache.hadoop.hive.ql.udf.UDFToLong;
 import org.apache.hadoop.hive.ql.udf.UDFToShort;
 import org.apache.hadoop.hive.ql.udf.UDFWeekOfYear;
 import org.apache.hadoop.hive.ql.udf.UDFYear;
+import org.apache.hadoop.hive.ql.udf.UDFSinh;
+import org.apache.hadoop.hive.ql.udf.UDFCosh;
+import org.apache.hadoop.hive.ql.udf.UDFTanh;
 import org.apache.hadoop.hive.ql.udf.generic.*;
 import org.apache.hadoop.hive.serde.serdeConstants;
 import org.apache.hadoop.hive.serde2.AbstractSerDe;
@@ -446,8 +449,11 @@ public class Vectorizer implements PhysicalPlanResolver {
     supportedGenericUDFs.add(GenericUDFTrim.class);
 
     supportedGenericUDFs.add(UDFSin.class);
+    supportedGenericUDFs.add(UDFSinh.class);
     supportedGenericUDFs.add(UDFCos.class);
+    supportedGenericUDFs.add(UDFCosh.class);
     supportedGenericUDFs.add(UDFTan.class);
+    supportedGenericUDFs.add(UDFTanh.class);
     supportedGenericUDFs.add(UDFAsin.class);
     supportedGenericUDFs.add(UDFAcos.class);
     supportedGenericUDFs.add(UDFAtan.class);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFCosh.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFCosh.java
new file mode 100644
index 00000000000..ad8360835c1
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFCosh.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncCoshDoubleToDouble;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncCoshLongToDouble;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+
+/**
+ * UDFCosh.
+ */
+@Description(name = "cosh",
+        value = "_FUNC_(x) - returns the hyperbolic cosine of x (x is in radians)",
+        extended = "Example:\n "
+                + "  > SELECT _FUNC_(0) FROM src LIMIT 1;\n"
+                + "  1"
+)
+@VectorizedExpressions({FuncCoshDoubleToDouble.class, FuncCoshLongToDouble.class})
+public class UDFCosh  extends UDFMath{
+    private final DoubleWritable result = new DoubleWritable();
+
+    /**
+     * Take Cosine hyperbolic of a.
+     */
+    @Override
+    protected DoubleWritable doEvaluate(DoubleWritable a) {
+        result.set(StrictMath.cosh(a.get()));
+        return result;
+    }
+
+}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSinh.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSinh.java
new file mode 100644
index 00000000000..053f9c81b95
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSinh.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncSinhDoubleToDouble;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncSinhLongToDouble;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+
+/**
+ * UDFSinh.
+ */
+@Description(name = "sinh",
+        value = "_FUNC_(x) - returns the hyperbolic sin of x (x is in radians)",
+        extended = "Example:\n "
+                + "  > SELECT _FUNC_(0) FROM src LIMIT 1;\n"
+                + "  0")
+@VectorizedExpressions({FuncSinhLongToDouble.class, FuncSinhDoubleToDouble.class})
+public class UDFSinh extends UDFMath{
+
+    private final DoubleWritable result = new DoubleWritable();
+    /**
+     *
+     * Take Sin hyperbolic of a
+     */
+    @Override
+    protected DoubleWritable doEvaluate(DoubleWritable a) {
+        result.set(StrictMath.sinh(a.get()));
+        return result;
+    }
+}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTanh.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTanh.java
new file mode 100644
index 00000000000..5a2a9b51cea
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTanh.java
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncTanhDoubleToDouble;
+import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncTanhLongToDouble;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+
+@Description(name = "tanh",
+        value = "_FUNC_(x) - returns the hyperbolic tangent of x (x is in radians)",
+        extended = "Example:\n "
+                + "  > SELECT _FUNC_(0) FROM src LIMIT 1;\n"
+                + "  1"
+)
+@VectorizedExpressions({FuncTanhLongToDouble.class, FuncTanhDoubleToDouble.class})
+public class UDFTanh extends UDFMath{
+
+    private final DoubleWritable result = new DoubleWritable();
+
+    /**
+     * Take Tangent hyperbolic of a
+     */
+    @Override
+    protected DoubleWritable doEvaluate(DoubleWritable a) {
+        result.set(StrictMath.tanh(a.get()));
+        return result;
+    }
+}
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFMath.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFMath.java
index f43d69fd0e9..cea621293c9 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFMath.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFMath.java
@@ -143,6 +143,30 @@ public class TestUDFMath {
     Assert.assertEquals(7.0, res.get(), 0.000001);
   }
 
+  @Test
+  public void testCosh() throws HiveException {
+    UDFCosh udf = new UDFCosh();
+    input = createDecimal("0.7727408115633954");
+    DoubleWritable res = udf.evaluate(input);
+    Assert.assertEquals(1.3137198299489201, res.get(), 0.000001);
+  }
+
+  @Test
+  public void testSinh() throws HiveException {
+    UDFSinh udf = new UDFSinh();
+    input = createDecimal("0.7980555152315012");
+    DoubleWritable res = udf.evaluate(input);
+    Assert.assertEquals(0.8855070376410608, res.get(), 0.000001);
+  }
+
+  @Test
+  public void testTanh() throws HiveException {
+    UDFTanh udf = new UDFTanh();
+    input = createDecimal("0.7853981633974483");
+    DoubleWritable res = udf.evaluate(input);
+    Assert.assertEquals(0.6557942026326724, res.get(), 0.000001);
+  }
+
   private HiveDecimalWritable createDecimal(String input) {
     return new HiveDecimalWritable(HiveDecimal.create(input));
   }
diff --git a/ql/src/test/queries/clientpositive/udf_cosh.q b/ql/src/test/queries/clientpositive/udf_cosh.q
new file mode 100644
index 00000000000..0ecc12253cc
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/udf_cosh.q
@@ -0,0 +1,11 @@
+--! qt:dataset:src
+set hive.fetch.task.conversion=more;
+
+DESCRIBE FUNCTION cosh;
+DESCRIBE FUNCTION EXTENDED cosh;
+
+SELECT cosh(null)
+FROM src tablesample (1 rows);
+
+SELECT cosh(0.98), cosh(1.57), cosh(-0.5)
+FROM src tablesample (1 rows);
\ No newline at end of file
diff --git a/ql/src/test/queries/clientpositive/udf_sinh.q b/ql/src/test/queries/clientpositive/udf_sinh.q
new file mode 100644
index 00000000000..f80392cfe7b
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/udf_sinh.q
@@ -0,0 +1,11 @@
+--! qt:dataset:src
+set hive.fetch.task.conversion=more;
+
+DESCRIBE FUNCTION sinh;
+DESCRIBE FUNCTION EXTENDED sinh;
+
+SELECT sinh(null)
+FROM src tablesample (1 rows);
+
+SELECT sinh(0.98), sinh(1.57), sinh(-0.5)
+FROM src tablesample (1 rows);
diff --git a/ql/src/test/queries/clientpositive/udf_tanh.q b/ql/src/test/queries/clientpositive/udf_tanh.q
new file mode 100644
index 00000000000..afa61b74b18
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/udf_tanh.q
@@ -0,0 +1,11 @@
+--! qt:dataset:src
+set hive.fetch.task.conversion=more;
+
+DESCRIBE FUNCTION tanh;
+DESCRIBE FUNCTION EXTENDED tanh;
+
+SELECT tanh(null)
+FROM src tablesample (1 rows);
+
+SELECT tanh(1), tanh(6), tanh(-1.0)
+FROM src tablesample (1 rows);
diff --git a/ql/src/test/results/clientpositive/llap/show_functions.q.out b/ql/src/test/results/clientpositive/llap/show_functions.q.out
index 180e1d7e5b9..9006d187eea 100644
--- a/ql/src/test/results/clientpositive/llap/show_functions.q.out
+++ b/ql/src/test/results/clientpositive/llap/show_functions.q.out
@@ -81,6 +81,7 @@ context_ngrams
 conv
 corr
 cos
+cosh
 count
 covar_pop
 covar_samp
@@ -333,6 +334,7 @@ shiftright
 shiftrightunsigned
 sign
 sin
+sinh
 size
 sort_array
 sort_array_by
@@ -438,6 +440,7 @@ substring_index
 sum
 surrogate_key
 tan
+tanh
 to_date
 to_epoch_milli
 to_unix_timestamp
@@ -524,6 +527,7 @@ context_ngrams
 conv
 corr
 cos
+cosh
 count
 covar_pop
 covar_samp
@@ -692,6 +696,7 @@ context_ngrams
 conv
 corr
 cos
+cosh
 count
 covar_pop
 covar_samp
@@ -944,6 +949,7 @@ shiftright
 shiftrightunsigned
 sign
 sin
+sinh
 size
 sort_array
 sort_array_by
@@ -1049,6 +1055,7 @@ substring_index
 sum
 surrogate_key
 tan
+tanh
 to_date
 to_epoch_milli
 to_unix_timestamp
diff --git a/ql/src/test/results/clientpositive/llap/udf_cosh.q.out b/ql/src/test/results/clientpositive/llap/udf_cosh.q.out
new file mode 100644
index 00000000000..8415b0d61e6
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/udf_cosh.q.out
@@ -0,0 +1,37 @@
+PREHOOK: query: DESCRIBE FUNCTION cosh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION cosh
+POSTHOOK: type: DESCFUNCTION
+cosh(x) - returns the hyperbolic cosine of x (x is in radians)
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED cosh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED cosh
+POSTHOOK: type: DESCFUNCTION
+cosh(x) - returns the hyperbolic cosine of x (x is in radians)
+Example:
+   > SELECT cosh(0) FROM src LIMIT 1;
+  1
+Function class:org.apache.hadoop.hive.ql.udf.UDFCosh
+Function type:BUILTIN
+PREHOOK: query: SELECT cosh(null)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cosh(null)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: SELECT cosh(0.98), cosh(1.57), cosh(-0.5)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cosh(0.98), cosh(1.57), cosh(-0.5)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+1.5198836703904084	2.5073466880660993	1.1276259652063807
diff --git a/ql/src/test/results/clientpositive/llap/udf_sinh.q.out b/ql/src/test/results/clientpositive/llap/udf_sinh.q.out
new file mode 100644
index 00000000000..89533412761
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/udf_sinh.q.out
@@ -0,0 +1,37 @@
+PREHOOK: query: DESCRIBE FUNCTION sinh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION sinh
+POSTHOOK: type: DESCFUNCTION
+sinh(x) - returns the hyperbolic sin of x (x is in radians)
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED sinh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED sinh
+POSTHOOK: type: DESCFUNCTION
+sinh(x) - returns the hyperbolic sin of x (x is in radians)
+Example:
+   > SELECT sinh(0) FROM src LIMIT 1;
+  0
+Function class:org.apache.hadoop.hive.ql.udf.UDFSinh
+Function type:BUILTIN
+PREHOOK: query: SELECT sinh(null)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT sinh(null)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: SELECT sinh(0.98), sinh(1.57), sinh(-0.5)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT sinh(0.98), sinh(1.57), sinh(-0.5)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+1.1445725715390087	2.299301505709079	-0.5210953054937474
diff --git a/ql/src/test/results/clientpositive/llap/udf_tanh.q.out b/ql/src/test/results/clientpositive/llap/udf_tanh.q.out
new file mode 100644
index 00000000000..58692150345
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/udf_tanh.q.out
@@ -0,0 +1,37 @@
+PREHOOK: query: DESCRIBE FUNCTION tanh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION tanh
+POSTHOOK: type: DESCFUNCTION
+tanh(x) - returns the hyperbolic tangent of x (x is in radians)
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED tanh
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED tanh
+POSTHOOK: type: DESCFUNCTION
+tanh(x) - returns the hyperbolic tangent of x (x is in radians)
+Example:
+   > SELECT tanh(0) FROM src LIMIT 1;
+  1
+Function class:org.apache.hadoop.hive.ql.udf.UDFTanh
+Function type:BUILTIN
+PREHOOK: query: SELECT tanh(null)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tanh(null)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: SELECT tanh(1), tanh(6), tanh(-1.0)
+FROM src tablesample (1 rows)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tanh(1), tanh(6), tanh(-1.0)
+FROM src tablesample (1 rows)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+0.7615941559557649	0.9999877116507956	-0.7615941559557649
diff --git a/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java b/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
index a37edbd68a0..358680161ae 100644
--- a/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
+++ b/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
@@ -1100,10 +1100,16 @@ public class GenVectorCode extends Task {
       {"ColumnUnaryFunc", "FuncAbs", "long", "long", "MathExpr.abs", "", "", "", ""},
       {"ColumnUnaryFunc", "FuncSin", "double", "double", "Math.sin", "", "", "", ""},
       {"ColumnUnaryFunc", "FuncSin", "double", "long", "Math.sin", "(double)", "", "", ""},
+      {"ColumnUnaryFunc", "FuncSinh", "double", "double", "StrictMath.sinh", "", "", "", ""},
+      {"ColumnUnaryFunc", "FuncSinh", "double", "long", "StrictMath.sinh", "(double)", "", "", ""},
       {"ColumnUnaryFunc", "FuncCos", "double", "double", "StrictMath.cos", "", "", "", ""},
       {"ColumnUnaryFunc", "FuncCos", "double", "long", "StrictMath.cos", "(double)", "", "", ""},
+      {"ColumnUnaryFunc", "FuncCosh", "double", "double", "StrictMath.cosh", "", "", "", ""},
+      {"ColumnUnaryFunc", "FuncCosh", "double", "long", "StrictMath.cosh", "(double)", "", "", ""},
       {"ColumnUnaryFunc", "FuncTan", "double", "double", "Math.tan", "", "", "", ""},
       {"ColumnUnaryFunc", "FuncTan", "double", "long", "Math.tan", "(double)", "", "", ""},
+      {"ColumnUnaryFunc", "FuncTanh", "double", "double", "StrictMath.tanh", "", "", "", ""},
+      {"ColumnUnaryFunc", "FuncTanh", "double", "long", "StrictMath.tanh", "(double)", "", "", ""},
       {"ColumnUnaryFunc", "FuncATan", "double", "double", "Math.atan", "", "", "", ""},
       {"ColumnUnaryFunc", "FuncATan", "double", "long", "Math.atan", "(double)", "", "", ""},
       {"ColumnUnaryFunc", "FuncDegrees", "double", "double", "Math.toDegrees", "", "", "", ""},