spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yjshen <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-3197] [SQL] Reduce the Expression tree ...
Date Thu, 23 Jul 2015 15:10:12 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message