Skip to content

Commit 82df9e7

Browse files
authored
feat: hyperbolic trig functions (#2784)
1 parent 7f90fc4 commit 82df9e7

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

docs/source/user-guide/latest/expressions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Expressions that are not Spark-compatible will fall back to Spark by default and
125125
| BRound | `bround` | Yes | |
126126
| Ceil | `ceil` | Yes | |
127127
| Cos | `cos` | Yes | |
128+
| Cosh | `cosh` | Yes | |
128129
| Cot | `cot` | Yes | |
129130
| Divide | `/` | Yes | |
130131
| Exp | `exp` | Yes | |
@@ -144,9 +145,11 @@ Expressions that are not Spark-compatible will fall back to Spark by default and
144145
| Round | `round` | Yes | |
145146
| Signum | `signum` | Yes | |
146147
| Sin | `sin` | Yes | |
148+
| Sinh | `sinh` | Yes | |
147149
| Sqrt | `sqrt` | Yes | |
148150
| Subtract | `-` | Yes | |
149151
| Tan | `tan` | Yes | |
152+
| Tanh | `tanh` | Yes | |
150153
| TryAdd | `try_add` | Yes | Only integer inputs are supported |
151154
| TryDivide | `try_div` | Yes | Only integer inputs are supported |
152155
| TryMultiply | `try_mul` | Yes | Only integer inputs are supported |

fuzz-testing/src/main/scala/org/apache/comet/fuzz/Meta.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ object Meta {
9898
createUnaryNumericFunction("atan"),
9999
createFunctionWithInputTypes("atan2", Seq(SparkNumericType, SparkNumericType)),
100100
createUnaryNumericFunction("cos"),
101+
createUnaryNumericFunction("cosh"),
101102
createUnaryNumericFunction("exp"),
102103
createUnaryNumericFunction("expm1"),
103104
createFunctionWithInputTypes("log", Seq(SparkNumericType, SparkNumericType)),
@@ -112,8 +113,10 @@ object Meta {
112113
FunctionSignature(Seq(SparkNumericType, SparkIntType)))),
113114
createUnaryNumericFunction("signum"),
114115
createUnaryNumericFunction("sin"),
116+
createUnaryNumericFunction("sinh"),
115117
createUnaryNumericFunction("sqrt"),
116118
createUnaryNumericFunction("tan"),
119+
createUnaryNumericFunction("tanh"),
117120
createUnaryNumericFunction("cot"),
118121
createUnaryNumericFunction("ceil"),
119122
createUnaryNumericFunction("floor"),

spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ object QueryPlanSerde extends Logging with CometExprShim {
9191
classOf[Atan2] -> CometAtan2,
9292
classOf[Ceil] -> CometCeil,
9393
classOf[Cos] -> CometScalarFunction("cos"),
94+
classOf[Cosh] -> CometScalarFunction("cosh"),
9495
classOf[Divide] -> CometDivide,
9596
classOf[Exp] -> CometScalarFunction("exp"),
9697
classOf[Expm1] -> CometScalarFunction("expm1"),
@@ -109,9 +110,11 @@ object QueryPlanSerde extends Logging with CometExprShim {
109110
classOf[Round] -> CometRound,
110111
classOf[Signum] -> CometScalarFunction("signum"),
111112
classOf[Sin] -> CometScalarFunction("sin"),
113+
classOf[Sinh] -> CometScalarFunction("sinh"),
112114
classOf[Sqrt] -> CometScalarFunction("sqrt"),
113115
classOf[Subtract] -> CometSubtract,
114116
classOf[Tan] -> CometScalarFunction("tan"),
117+
classOf[Tanh] -> CometScalarFunction("tanh"),
115118
classOf[Cot] -> CometScalarFunction("cot"),
116119
classOf[UnaryMinus] -> CometUnaryMinus,
117120
classOf[Unhex] -> CometUnhex,

spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,13 +1348,16 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
13481348
"asin",
13491349
"atan",
13501350
"cos",
1351+
"cosh",
13511352
"exp",
13521353
"ln",
13531354
"log10",
13541355
"log2",
13551356
"sin",
1357+
"sinh",
13561358
"sqrt",
13571359
"tan",
1360+
"tanh",
13581361
"cot")) {
13591362
val (_, cometPlan) =
13601363
checkSparkAnswerAndOperatorWithTol(sql(s"SELECT $expr(_1), $expr(_2) FROM tbl"))

0 commit comments

Comments
 (0)