Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/17999#discussion_r117300361 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala --- @@ -544,6 +544,24 @@ case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT" case class Tan(child: Expression) extends UnaryMathExpression(math.tan, "TAN") @ExpressionDescription( + usage = "_FUNC_(expr) - Returns the cotangent of `expr`.", + extended = """ + Examples: + > SELECT _FUNC_(1); + 0.6420926159343306 + """) +case class Cot(child: Expression) + extends UnaryMathExpression((x: Double) => 1 / math.tan(x), "COT") { + override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { + defineCodeGen(ctx, ev, c => + s""" + ${ev.value} = 1 / java.lang.Math.tan($c); + """ + ) --- End diff -- Since it fits one line, could you change it to? ```Scala defineCodeGen(ctx, ev, c => s"${ev.value} = 1 / java.lang.Math.tan($c);") ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org