Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19321#discussion_r140647928
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
---
@@ -123,7 +124,13 @@ case class ApproximatePercentile(
val value = child.eval(inputRow)
// Ignore empty rows, for example: percentile_approx(null)
if (value != null) {
- buffer.add(value.asInstanceOf[Double])
+ // Convert the value to a double value
+ val doubleValue = child.dataType match {
+ case DateType => value.asInstanceOf[Int].toDouble
+ case TimestampType => value.asInstanceOf[Long].toDouble
+ case n: NumericType =>
n.numeric.toDouble(value.asInstanceOf[n.InternalType])
--- End diff --
The same here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]