@@ -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 */
10898abstract 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
224216case 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
0 commit comments