You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/05 07:07:23 UTC
[GitHub] [spark] maropu commented on a change in pull request #31005: [SPARK-33949][SQL] Make approx_count_distinct result consistent whether Optimize rule exists or not
maropu commented on a change in pull request #31005:
URL: https://github.com/apache/spark/pull/31005#discussion_r551751470
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/HyperLogLogPlusPlus.scala
##########
@@ -141,9 +141,11 @@ case class HyperLogLogPlusPlus(
object HyperLogLogPlusPlus {
def validateDoubleLiteral(exp: Expression): Double = exp match {
- case Literal(d: Double, DoubleType) => d
- case Literal(dec: Decimal, _) => dec.toDouble
+ case e if e.foldable && e.dataType == DoubleType =>
+ e.eval().asInstanceOf[Double]
+ case e if e.foldable && e.dataType.isInstanceOf[DecimalType] =>
+ e.eval().asInstanceOf[Decimal].toDouble
Review comment:
Ah, nice catch! Is this a last place having the same issue?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org