Skip to content

Commit d10be4a

Browse files
committed
use TypeCollection to specify wanted input and implicit cast
1 parent c3b9839 commit d10be4a

File tree

1 file changed

+4
-1
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,10 @@ case class Round(child: Expression, scale: Expression) extends Expression with E
541541
case t => t
542542
}
543543

544-
override def inputTypes: Seq[AbstractDataType] = Seq(NumericType, IntegralType)
544+
override def inputTypes: Seq[AbstractDataType] = Seq(
545+
//rely on precedence to implicit cast String into Double
546+
TypeCollection(DoubleType, FloatType, LongType, IntegerType, ShortType, ByteType),
547+
TypeCollection(LongType, IntegerType, ShortType, ByteType))
545548

546549
override def checkInputDataTypes(): TypeCheckResult = {
547550
child.dataType match {

0 commit comments

Comments
 (0)