This is an automated email from the ASF dual-hosted git repository.
krisztiankasa 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 a029c5fd042 HIVE-27145: Use StrictMath for remaining Math functions as
followup of HIVE-23133 (Himanshu Mishra, reviewed by Krisztian Kasa, Syed
Shameerur Rahman)
a029c5fd042 is described below
commit a029c5fd04268bd3254a3db2d44b08299b4b4ffb
Author: Himanshu Mishra
AuthorDate: Thu Apr 13 18:29:53 2023 +0530
HIVE-27145: Use StrictMath for remaining Math functions as followup of
HIVE-23133 (Himanshu Mishra, reviewed by Krisztian Kasa, Syed Shameerur Rahman)
HIVE-23133 started using StrictMath for cos, exp, log UDFs to fix Q
Tests failing because results could vary based on hardware when
using Math library.
1. There are other Math functions that can have same impact of underlying
hardware namely, sin, tan, asin, acos, atan, sqrt, pow, cbrt. Using
StrictMath for these as well.
2. HIVE-23133 missed custom vector classes for Log, using StrictMath for
those.
3. JDK-4477961 (in Java 9) changed radians and degrees calculation
leading to Q Test failures. Using round() to ensure tests pass on JDK 8
and later
Co-authored-by: Himanshu Mishra
---
.../expressions/FuncLogWithBaseDoubleToDouble.java | 2 +-
.../expressions/FuncLogWithBaseLongToDouble.java | 2 +-
.../expressions/FuncPowerDoubleToDouble.java | 2 +-
.../vector/expressions/FuncPowerLongToDouble.java | 2 +-
.../org/apache/hadoop/hive/ql/udf/UDFAcos.java | 2 +-
.../org/apache/hadoop/hive/ql/udf/UDFAsin.java | 2 +-
.../org/apache/hadoop/hive/ql/udf/UDFAtan.java | 2 +-
.../java/org/apache/hadoop/hive/ql/udf/UDFSin.java | 2 +-
.../org/apache/hadoop/hive/ql/udf/UDFSqrt.java | 2 +-
.../java/org/apache/hadoop/hive/ql/udf/UDFTan.java | 2 +-
.../hadoop/hive/ql/udf/generic/GenericUDFCbrt.java | 2 +-
.../hive/ql/udf/generic/GenericUDFPower.java | 2 +-
ql/src/test/queries/clientpositive/udf_radians.q | 9 ++--
.../clientpositive/vector_decimal_math_funcs.q | 8 +--
.../queries/clientpositive/vector_decimal_udf2.q | 6 ++-
.../queries/clientpositive/vectorized_math_funcs.q | 3 +-
.../results/clientpositive/llap/udf_radians.q.out | 16 +++---
.../llap/vector_decimal_math_funcs.q.out | 60 --
.../clientpositive/llap/vector_decimal_udf2.q.out | 12 ++---
.../llap/vectorized_math_funcs.q.out | 28 +-
.../apache/hadoop/hive/tools/GenVectorCode.java| 24 -
21 files changed, 101 insertions(+), 89 deletions(-)
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseDoubleToDouble.java
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseDoubleToDouble.java
index b799379d57c..5c9d220f762 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseDoubleToDouble.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseDoubleToDouble.java
@@ -40,7 +40,7 @@ public class FuncLogWithBaseDoubleToDouble extends
MathFuncDoubleToDouble {
@Override
protected double func(double d) {
-return Math.log(d) / Math.log(base);
+return StrictMath.log(d) / StrictMath.log(base);
}
public double getBase() {
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseLongToDouble.java
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseLongToDouble.java
index f23783e376a..1ac288a9d22 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseLongToDouble.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncLogWithBaseLongToDouble.java
@@ -40,7 +40,7 @@ public class FuncLogWithBaseLongToDouble extends
MathFuncLongToDouble {
@Override
protected double func(long l) {
-return Math.log((double) l) / Math.log(base);
+return StrictMath.log((double) l) / StrictMath.log(base);
}
public double getBase() {
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncPowerDoubleToDouble.java
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncPowerDoubleToDouble.java
index 6b43a02785e..b25c06c9248 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncPowerDoubleToDouble.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncPowerDoubleToDouble.java
@@ -43,7 +43,7 @@ public class FuncPowerDoubleToDouble extends
MathFuncDoubleToDouble {
@Override
public double func(double d) {
-return Math.pow(d, power);
+return StrictMath.pow(d, power);
}
public double getPower() {
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FuncPowerLongToDouble.java