This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 5690db9e07e branch-3.1: [fix](nereids) fix tanh cosntant folding
#52100 (#52546)
5690db9e07e is described below
commit 5690db9e07ee845a0e1760418a4cc066eb789e93
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 1 19:14:12 2025 +0800
branch-3.1: [fix](nereids) fix tanh cosntant folding #52100 (#52546)
Cherry-picked from #52100
Co-authored-by: admiring_xm <[email protected]>
---
.../trees/expressions/functions/executable/NumericArithmetic.java | 2 +-
.../expression/fold_constant/fold_constant_numeric_arithmatic.groovy | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
index 57eda59ee7d..1368d8adcf7 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java
@@ -1050,7 +1050,7 @@ public class NumericArithmetic {
/**
* tanh
*/
- @ExecFunction(name = "cosh")
+ @ExecFunction(name = "tanh")
public static Expression tanh(DoubleLiteral first) {
return checkOutputBoundary(new
DoubleLiteral(Math.tanh(first.getValue())));
}
diff --git
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy
index bc1cb91ca9d..7aa09d8a186 100644
---
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy
+++
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy
@@ -470,6 +470,9 @@ suite("fold_constant_numeric_arithmatic") {
testFoldConst("SELECT TANH(0) AS tanh_case_1") //tanh(0) = 0
testFoldConst("SELECT TANH(1) AS tanh_case_2") //tanh(1)
testFoldConst("SELECT TANH(-1) AS tanh_case_3") //tanh(-1)
+ testFoldConst("SELECT TANH(NULL)")
+ testFoldConst("SELECT TANH(-0.5), TANH(0.5), TANH(10), TANH(-10)")
+ testFoldConst("SELECT TANH(-20), TANH(20), TANH(1E-7), TANH(-1E-7)")
//Truncate function cases
testFoldConst("SELECT TRUNCATE(123.456, 2) AS truncate_case_1")
//truncate(123.456, 2) = 123.45
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]