Github user larvaboy commented on a diff in the pull request:
https://github.com/apache/spark/pull/737#discussion_r12574227
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala
---
@@ -269,6 +308,34 @@ case class CountFunction(expr: Expression, base:
AggregateExpression) extends Ag
override def eval(input: Row): Any = count
}
+case class ApproxCountDistinctPartitionFunction(expr: Expression, base:
AggregateExpression)
+ extends AggregateFunction {
+ def this() = this(null, null) // Required for serialization.
+
+ private val hyperLogLog = new HyperLogLog(ApproxCountDistinct.RelativeSD)
+
+ override def update(input: Row): Unit = {
+ val evaluatedExpr = expr.eval(input)
+ Option(evaluatedExpr).foreach(hyperLogLog.offer(_))
--- End diff --
This has been changed into a null check.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---