Tonix517 commented on a change in pull request #24994: [SPARK-28133] Adding
inverse hyperbolic functions in SQL
URL: https://github.com/apache/spark/pull/24994#discussion_r298770863
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
##########
@@ -557,6 +578,27 @@ case class Sin(child: Expression) extends
UnaryMathExpression(math.sin, "SIN")
""")
case class Sinh(child: Expression) extends UnaryMathExpression(math.sinh,
"SINH")
+@ExpressionDescription(
+ usage = """
+ _FUNC_(expr) - Returns inverse hyperbolic sine of `expr`.
+ """,
+ arguments = """
+ Arguments:
+ * expr - hyperbolic angle
+ """,
+ examples = """
+ Examples:
+ > SELECT _FUNC_(0);
+ 0.0
+ """)
+case class Asinh(child: Expression)
+ extends UnaryMathExpression((x: Double) => math.log(x + math.sqrt(x * x +
1.0)), "ASINH") {
+ override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
+ defineCodeGen(ctx, ev, c =>
+ s"${ev.value} = java.lang.Math.log($c + java.lang.Math.sqrt($c * $c +
1.0));")
Review comment:
thanks for reminding me of FastMath lib. Maybe we can simply use that lib
here, without this hand-crafted calculation?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]