Github user yjshen commented on a diff in the pull request:
https://github.com/apache/spark/pull/2113#discussion_r35331907
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala
---
@@ -105,17 +105,18 @@ case class Min(child: Expression) extends
PartialAggregate with trees.UnaryNode[
case class MinFunction(expr: Expression, base: AggregateExpression)
extends AggregateFunction {
def this() = this(null, null) // Required for serialization.
- var currentMin: Any = _
+ val currentMin: MutableLiteral = MutableLiteral(null, expr.dataType)
+ val cmp = GreaterThan(currentMin, expr)
override def update(input: Row): Unit = {
- if (currentMin == null) {
- currentMin = expr.eval(input)
- } else if(GreaterThan(Literal(currentMin, expr.dataType),
expr).eval(input) == true) {
- currentMin = expr.eval(input)
+ if (currentMin.value == null) {
+ currentMin.value = expr.eval(input)
+ } else if(cmp.eval(input) == true) {
+ currentMin.value = expr.eval(input)
--- End diff --
yes, it would be a long journey, but I could ask the author whenever I have
a question ;)
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]