Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7109#discussion_r33536789
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala
---
@@ -239,61 +231,13 @@ case class Bin(child: Expression)
}
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Binary math functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-case class Atan2(left: Expression, right: Expression)
- extends BinaryMathExpression(math.atan2, "ATAN2") {
-
- override def eval(input: InternalRow): Any = {
- val evalE1 = left.eval(input)
- if (evalE1 == null) {
- null
- } else {
- val evalE2 = right.eval(input)
- if (evalE2 == null) {
- null
- } else {
- // With codegen, the values returned by -0.0 and 0.0 are
different. Handled with +0.0
- val result = math.atan2(evalE1.asInstanceOf[Double] + 0.0,
- evalE2.asInstanceOf[Double] + 0.0)
- if (result.isNaN) null else result
- }
- }
- }
-
- override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode):
String = {
- defineCodeGen(ctx, ev, (c1, c2) => s"java.lang.Math.atan2($c1 + 0.0,
$c2 + 0.0)") + s"""
- if (Double.valueOf(${ev.primitive}).isNaN()) {
- ${ev.isNull} = true;
- }
- """
- }
-}
-
-case class Pow(left: Expression, right: Expression)
- extends BinaryMathExpression(math.pow, "POWER") {
- override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode):
String = {
- defineCodeGen(ctx, ev, (c1, c2) => s"java.lang.Math.pow($c1, $c2)") +
s"""
- if (Double.valueOf(${ev.primitive}).isNaN()) {
- ${ev.isNull} = true;
- }
- """
- }
-}
/**
* If the argument is an INT or binary, hex returns the number as a STRING
in hexadecimal format.
- * Otherwise if the number is a STRING,
- * it converts each character into its hexadecimal representation and
returns the resulting STRING.
- * Negative numbers would be treated as two's complement.
+ * Otherwise if the number is a STRING, it converts each character into
its hex representation
+ * and returns the resulting STRING. Negative numbers would be treated as
two's complement.
*/
-case class Hex(child: Expression)
- extends UnaryExpression with Serializable {
+case class Hex(child: Expression) extends UnaryExpression with
Serializable {
--- End diff --
previously Hex was put in the binary section.
cc @davies
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]