Skip to content

Commit 8cf37b7

Browse files
committed
For comments.
1 parent bc89597 commit 8cf37b7

File tree

2 files changed

+5
-13
lines changed
  • sql
    • catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions
    • core/src/main/scala/org/apache/spark/sql

2 files changed

+5
-13
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,19 @@ abstract class UnaryMathExpression(f: Double => Double, name: String)
8989
}
9090
}
9191

92-
/**
93-
* A binary expression specifically for math functions that take two input parameters and
94-
* returns one output value.
95-
* @param name The short name of the function
96-
*/
97-
abstract class AbstractBinaryMathExpression[T, U, V](name: String)
98-
extends BinaryExpression with Serializable with ExpectsInputTypes { self: Product =>
99-
override def toString: String = s"$name($left, $right)"
100-
}
101-
10292
/**
10393
* A binary expression specifically for math functions that take two `Double`s as input and returns
10494
* a `Double`.
10595
* @param f The math function.
10696
* @param name The short name of the function
10797
*/
10898
abstract class BinaryMathExpression(f: (Double, Double) => Double, name: String)
109-
extends AbstractBinaryMathExpression[Double, Double, Double](name) { self: Product =>
99+
extends BinaryExpression with Serializable with ExpectsInputTypes { self: Product =>
110100

111101
override def expectedChildTypes: Seq[DataType] = Seq(DoubleType, DoubleType)
112102

103+
override def toString: String = s"$name($left, $right)"
104+
113105
override def dataType: DataType = DoubleType
114106

115107
override def eval(input: InternalRow): Any = {
@@ -222,7 +214,7 @@ case class ToRadians(child: Expression) extends UnaryMathExpression(math.toRadia
222214

223215

224216
case class Atan2(left: Expression, right: Expression)
225-
extends AbstractBinaryMathExpression("ATAN2") {
217+
extends BinaryMathExpression(math.atan2, "ATAN2") {
226218
override def expectedChildTypes: Seq[DataType] = Seq(DoubleType, DoubleType)
227219
override def dataType: DataType = DoubleType
228220

sql/core/src/main/scala/org/apache/spark/sql/functions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ object functions {
10971097
* @group math_funcs
10981098
* @since 1.4.0
10991099
*/
1100-
def log(base: Double, a: String): Column = log(base, Column(a))
1100+
def log(base: Double, columnName: String): Column = log(base, Column(columnName))
11011101

11021102
/**
11031103
* Computes the logarithm of the given value in base 10.

0 commit comments

Comments
 (0)