You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by JoshRosen <gi...@git.apache.org> on 2015/10/09 01:07:49 UTC

[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

GitHub user JoshRosen opened a pull request:

    https://github.com/apache/spark/pull/9038

    [SPARK-11017] Support ImperativeAggregates in TungstenAggregate

    This patch extends TungstenAggregate to support ImperativeAggregate functions. The existing TungstenAggregate operator only supported DeclarativeAggregate functions, which are defined in terms of Catalyst expressions and can be evaluated via generated projections. ImperativeAggregate functions, on the other hand, are evaluated by calling their `initialize`, `update`, `merge`, and `eval` methods.
    
    The basic strategy here is similar to how SortBasedAggregate evaluates both types of aggregate functions: use a generated projection to evaluate the expression-based declarative aggregates with dummy placeholder expressions inserted in place of the imperative aggregate function output, then invoke the imperative aggregate functions and target them against the aggregation buffer. The bulk of the diff here consists of code that was copied and adapted from SortBasedAggregate, with some key changes to handle TungstenAggregate's sort fallback path.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/JoshRosen/spark support-interpreted-in-tungsten-agg-final

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9038.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #9038
    
----
commit 9d141c44818d415b37965444bd001ea8aaa54877
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-07T23:57:02Z

    Add initialInputBufferOffset to TungstenAggregate.

commit 3e92fd1176403512e6076acebc6241d33123f95d
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T00:36:08Z

    Refactor TungstenAggregationIterator constructor to accept imperative aggregate functions, too.

commit 78aaab2b5844b093705bac04cca6e6a55a8c7a8d
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T00:39:09Z

    Try enabling ImperativeAggregate for agg queries w/o distinct to see what breaks.

commit fc9c2a0a9866a768b029dc9588bd63a99d46dcff
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T01:41:20Z

    Fix result projection for interpreted aggs.

commit fdd6b91156300c7910e90f44d4a929e1bbc63640
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T01:51:43Z

    Use SpecificMutableRow in more places

commit cec6cef6669680c86c49100cca1283fcb608aa64
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T02:25:50Z

    Re-initialize aggregate functions when switching to sort.

commit 53b6462f677c7746589d7d3e8a65ee74c8135b59
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T02:26:23Z

    Remove stray println

commit 2d2ab17a7793c1f53939baab685f84e1bf468350
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T02:35:24Z

    Fix None.get issue.

commit c945bd610a52ad7732cb217fd5b5c077640fe221
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T02:45:56Z

    Work around lazy val initialization issues to fix attr. binding errors.

commit b5be45402612be83fad6196870e53d2fec7b87d5
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T02:52:06Z

    Use NoOp instead of a null literal.

commit e820d78e645bad43ff3641f368f4796d42686b1e
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T08:17:32Z

    Improvements to agg buffer initialization.

commit 7a34e03696bb8b96b23c7a5c6fa9ead169ce4602
Author: Josh Rosen <jo...@databricks.com>
Date:   2015-10-08T18:21:37Z

    Reset input buffer offset after spilling to sort

----


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148221003
  
    LGTM pending jenkins.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146987156
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41661979
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,73 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    +      val aggregateExpressionIsNonComplete = i < nonCompleteAggregateExpressions.length
    +      // We need to use this mode instead of func.mode in order to handle aggregation mode switching
    +      // when switching to sort-based aggregation:
    +      val mode =
    +        if (aggregateExpressionIsNonComplete) aggregationMode._1 else aggregationMode._2
    +      val funcWithBoundReferences = mode match {
    +        case Some(Partial) | Some(Complete) if func.isInstanceOf[ImperativeAggregate] =>
    +          // We need to create BoundReferences if the function is not an
    +          // expression-based aggregate function (it does not support code-gen) and the mode of
    +          // this function is Partial or Complete because we will call eval of this
    +          // function's children in the update method of this aggregate function.
    +          // Those eval calls require BoundReferences to work.
    +          BindReferences.bindReference(func, originalInputAttributes)
    +        case _ =>
    +          // We only need to set inputBufferOffset for aggregate functions with mode
    +          // PartialMerge and Final.
    +          func match {
    +            case function: ImperativeAggregate =>
    +              function.withNewInputAggBufferOffset(inputBufferOffset)
    +            case _ =>
    +          }
    +          inputBufferOffset += func.aggBufferSchema.length
    +          func
    +      }
    +      // Set mutableBufferOffset for this function. It is important that setting
    +      // mutableBufferOffset happens after all potential bindReference operations
    +      // because bindReference will create a new instance of the function.
    +      funcWithBoundReferences match {
    +        case function: ImperativeAggregate =>
    +          function.withNewMutableAggBufferOffset(mutableBufferOffset)
    +        case _ =>
    +      }
    +      mutableBufferOffset += funcWithBoundReferences.aggBufferSchema.length
    +      functions(i) = funcWithBoundReferences
    +      i += 1
         }
    +    functions
    +  }
    +
    +  private[this] var allAggregateFunctions: Array[AggregateFunction2] =
    --- End diff --
    
    Maybe we should add comments to `allImperativeAggregateFunctionPositions` and `expressionAggInitialProjection` to explain why we do not need to update them after we update `allAggregateFunctions`?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147019194
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147021136
  
      [Test build #43502 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43502/console) for   PR 9038 at commit [`b22ee55`](https://github.com/apache/spark/commit/b22ee55f2f214f5879f1c10aaddbd6c4bce7315b).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41679635
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -70,7 +70,6 @@ object Utils {
         // Check if we can use TungstenAggregate.
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -      aggregateExpressions.forall(_.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    --- End diff --
    
    Whoops, good catch. I removed this from `planAggregateWithOneDistinct` and it led to a failure in `single distinct column set`:
    
    ```
    [info]   == Results ==
    [info]   !== Correct Answer - 4 ==                                                        == Spark Answer - 4 ==
    [info]   ![100.0,0.3333333333333333,1.0,2,99.33333333333333,10.0,2.0]                     [100.0,0.3333333333333333,1.0,2,101.0,10.0,2.0]
    [info]   ![110.0,10.0,20.0,null,109.0,11.0,30.0]                                          [110.0,10.0,20.0,null,120.0,11.0,30.0]
    [info]   ![120.0,23.333333333333332,-3.3333333333333335,1,122.33333333333333,12.0,20.0]   [120.0,23.333333333333332,-3.3333333333333335,1,96.66666666666667,12.0,20.0]
    [info]   ![null,null,3.0,3,null,null,null]                                                [null,null,3.0,3,103.0,null,null] (AggregationQuerySuite.scala:690)
    ```
    
    Based on the failure mode here, I suspect that another one of the buffer offsets needs to be reset in response to the sort fallback.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148222712
  
      [Test build #43746 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43746/consoleFull) for   PR 9038 at commit [`4867a3d`](https://github.com/apache/spark/commit/4867a3dcdf0f7562741760e110ce8cbec280c236).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148220232
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148213519
  
    I tried the UDAF in https://databricks.com/blog/2015/09/16/spark-1-5-dataframe-api-highlights-datetimestring-handling-time-intervals-and-udafs.html. I tried the following test in `build/sbt -Phive sparkShell`.
    ```
    // Generating data
    sc
      .parallelize(1 to 1000, 1)
      .flatMap(i => (1 to 20000).map(j => (i, j, j, j, j, j, j, j, j, j, j)))
      .toDF("i", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8", "j9", "j10")
      .write
      .format("parquet")
      .saveAsTable("testAgg")
    
    // Run query.
    import org.apache.spark.sql.functions._
    
    val gm = new GeometricMean
    sqlContext.udf.register("gm", gm)
    
    sqlContext.sql("set spark.sql.shuffle.partitions=1")
    sqlContext.read.load("/user/hive/warehouse/testagg").registerTempTable("testAgg")
    
    val start = System.currentTimeMillis
    (1 to 10).foreach { i=>
    sqlContext.sql("""
      select
        i,
        gm(j1),
        gm(j2),
        gm(j3),
        gm(j4),
        gm(j5),
        sum(j6),
        sum(j7),
        sum(j8),
        sum(j9),
        sum(j10)
      from testAgg
      group by i""").queryExecution.executedPlan.execute().foreach(x => Unit)
    }
    println("took " + ((System.currentTimeMillis - start).toDouble / 1000/10))
    ```
    Without this PR, the avg execution time was 31.6s. With this PR, the avg execution time was 27.8s. 


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147013441
  
      [Test build #43502 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43502/consoleFull) for   PR 9038 at commit [`b22ee55`](https://github.com/apache/spark/commit/b22ee55f2f214f5879f1c10aaddbd6c4bce7315b).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147021153
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43502/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146989740
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43491/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146998544
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148220800
  
    test this please


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147125927
  
    Okay, I have a theory as to what might be causing the test failure. The assertion failure is only occurring in the final aggregation, `finalAndCompleteAggregate`.
    
    Consider the input of `finalAndCompleteAggregate`: this is the output of `partialMergeAggregate`, whose result expressions are
    
    ```scala
            groupingAttributes ++
              Seq(distinctColumnAttribute) ++
              partialMergeAggregateExpressions.flatMap(_.aggregateFunction.inputAggBufferAttributes)
    ```
    
    Here, the input to the `finalAndCompleteAggregate` is a partial aggregate because its attributes are `inputAggBufferAttributes`. If we fall back to sort while evaluating `finalAndCompleteAggregate` then we need to extract the partial aggregate results from the input row rather than calling `processRow` to initialize empty aggregation buffers. I think that this is the first problem: it looks like we're mistakenly calling the `needsProcess` branch instead. In this branch, the `inputBufferOffset`s of the imperative aggregate functions will not have been set properly, which I think is leading to wrong answers.
    
    I tried redefining `needsProcess` as 
    
    ```scala
        val needsProcess = (initialInputBufferOffset == 0)
    ```
    
    but this led to attribute binding errors. Therefore, I think that we might be assigning the wrong attributes to the result of `partialMergeAggregate`. I'm going to try to fix this by changing the attributes of `partialMergeAggregate` and refactoring the logic when falling back to sort.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147874402
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147015023
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43497/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41661916
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,73 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    +      val aggregateExpressionIsNonComplete = i < nonCompleteAggregateExpressions.length
    +      // We need to use this mode instead of func.mode in order to handle aggregation mode switching
    +      // when switching to sort-based aggregation:
    +      val mode =
    +        if (aggregateExpressionIsNonComplete) aggregationMode._1 else aggregationMode._2
    +      val funcWithBoundReferences = mode match {
    +        case Some(Partial) | Some(Complete) if func.isInstanceOf[ImperativeAggregate] =>
    +          // We need to create BoundReferences if the function is not an
    +          // expression-based aggregate function (it does not support code-gen) and the mode of
    +          // this function is Partial or Complete because we will call eval of this
    +          // function's children in the update method of this aggregate function.
    +          // Those eval calls require BoundReferences to work.
    +          BindReferences.bindReference(func, originalInputAttributes)
    +        case _ =>
    +          // We only need to set inputBufferOffset for aggregate functions with mode
    +          // PartialMerge and Final.
    +          func match {
    +            case function: ImperativeAggregate =>
    +              function.withNewInputAggBufferOffset(inputBufferOffset)
    +            case _ =>
    +          }
    +          inputBufferOffset += func.aggBufferSchema.length
    +          func
    +      }
    +      // Set mutableBufferOffset for this function. It is important that setting
    +      // mutableBufferOffset happens after all potential bindReference operations
    +      // because bindReference will create a new instance of the function.
    +      funcWithBoundReferences match {
    +        case function: ImperativeAggregate =>
    +          function.withNewMutableAggBufferOffset(mutableBufferOffset)
    +        case _ =>
    +      }
    +      mutableBufferOffset += funcWithBoundReferences.aggBufferSchema.length
    +      functions(i) = funcWithBoundReferences
    +      i += 1
         }
    +    functions
    +  }
    +
    +  private[this] var allAggregateFunctions: Array[AggregateFunction2] =
    --- End diff --
    
    Since it will be a `var`, let's double check places where we use it and make sure they will be updated after we change it. I did a quick search, seems `allImperativeAggregateFunctionPositions` and `expressionAggInitialProjection` are the only two `val`s that will not be updated after we change `allAggregateFunctions`. But, I think we are fine because these two will not be affected by the change of `startingInputBufferOffset`. 


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147045018
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581609
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -170,10 +232,27 @@ class TungstenAggregationIterator(
         val bufferRowSize: Int = bufferSchema.length
     
         val genericMutableBuffer = new GenericMutableRow(bufferRowSize)
    -    val unsafeProjection =
    -      UnsafeProjection.create(bufferSchema.map(_.dataType))
    -    val buffer = unsafeProjection.apply(genericMutableBuffer)
    -    initialProjection.target(buffer)(EmptyRow)
    +    // TODO(josh): figure out whether we have to use
    +    val useUnsafeBuffer = bufferSchema.map(_.dataType).forall(UnsafeRow.isMutable)
    +
    +    val buffer =  /* if (useUnsafeBuffer) */ {
    --- End diff --
    
    Whoops, I meant to clean this up. One concern that I have is whether it's safe to expose an UnsafeRow aggregation buffer to InterpretedAggregate functions. Even if UnsafeRow supports in-place updates for all of the data types used by the aggregate function's buffer schema, I'm still slightly worried about what might happen if the imperative aggregate code were to call the generic `MutableRow.update()` method. As long as we can guarantee that `update()` won't be called by any valid imperative aggregate function, then I think it should be fine to just always use UnsafeRow here.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147045114
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43516/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147550854
  
    What is the failed test (and the stack trace)?


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581951
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -288,17 +419,33 @@ class TungstenAggregationIterator(
             val joinedRow = new JoinedRow()
             val evalExpressions = allAggregateFunctions.map {
               case ae: DeclarativeAggregate => ae.evaluateExpression
    -          // case agg: AggregateFunction2 => Literal.create(null, agg.dataType)
    +          case agg: AggregateFunction2 => NoOp
             }
    -        val expressionAggEvalProjection = UnsafeProjection.create(evalExpressions, bufferAttributes)
    +        val expressionAggEvalProjection = newMutableProjection(evalExpressions, bufferAttributes)()
    --- End diff --
    
    I think that the issue here was that some aggregate _did_ call `update()` on the UnsafeRow, leading to problems. I'll go ahead and confirm this, though.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41651685
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -70,7 +70,6 @@ object Utils {
         // Check if we can use TungstenAggregate.
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -      aggregateExpressions.forall(_.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    --- End diff --
    
    Can we also remove it from `planAggregateWithOneDistinct`?
    
    For `planAggregateWithoutPartial`, we can add the flag `usesTungstenAggregate` and whenever possible use `TungstenAggregate` (we can do it in a separate pr.).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147553565
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146999443
  
      [Test build #43497 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43497/consoleFull) for   PR 9038 at commit [`1f3dfa0`](https://github.com/apache/spark/commit/1f3dfa045c6afca0fb80112021fc4799bc2d2780).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147019180
  
      [Test build #43500 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43500/console) for   PR 9038 at commit [`9673b83`](https://github.com/apache/spark/commit/9673b83b0cb214d5a8db6b8b32142031714bf183).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146987178
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146990561
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147885014
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147609673
  
    To elaborate on the test failures:
    
    All tests pass as of 8695e3f, when the Tungsten code path is not used for imperative distinct aggregates.
    
    As of a09c51bc6936cdd3bbbdd4a7b73735079f62896d, which enables this for distinct aggregates, the "single distinct column set" query fails by returning the wrong answer. Here, I think the problem was that the attribute bindings were being mixed up, causing us to return the wrong columns in one of the projections.
    
    After trying to fix things by copying when changing the buffer offsets, I wound up getting binding errors. My current understanding of attribute binding is that we shouldn't be creating new attributes on executors because this could lead to expression ids being re-used in an incorrect fashion. Given this, I think the cleanest thing to do will be to do the ImperativeAggregate mutable-part/immutable-part interface refactoring that I proposed earlier.



---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147885015
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43683/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147008479
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036877
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147151593
  
    For that failed test, I think the problem is that those two agg operators in the reducer are holding the same reference of those aggregate functions. Essentially, we want to have a way to clone a agg function without changing `aggBufferAttributes` and `inputAggBufferAttributes`. How about we address this issue in a separate PR?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41714857
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,74 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    --- End diff --
    
    Yeah, it will be good to return a new instance when we call `with*Offset`. For UDAF, I think it may make sense to add a `newInstance` interface so, if a user-defined one has internal states, we can create copies of it  at executor side. There is one difficulty that we need to preserve those aggBufferAttributes and inputAggBufferAttributes' exprIds when we create new instances. So, binding references can work correctly without requiring too many changes. Is there an easy way to do that?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036458
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r42058972
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -481,10 +610,10 @@ class TungstenAggregationIterator(
           // When needsProcess is false, the format of input rows is groupingKey + aggregation buffer.
           // We need to project the aggregation buffer part from an input row.
           val buffer = createNewAggregationBuffer()
    -      // The originalInputAttributes are using cloneBufferAttributes. So, we need to use
    -      // allAggregateFunctions.flatMap(_.cloneBufferAttributes).
    +      // The originalInputAttributes are using inputAggBufferAttributes. So, we need to use
    +      // allAggregateFunctions.flatMap(_.inputAggBufferAttributes).
           val bufferExtractor = newMutableProjection(
    -        allAggregateFunctions.flatMap(_.inputAggBufferAttributes),
    +        originalInputAttributes.drop(initialInputBufferOffset),
    --- End diff --
    
    I'm folding this into the comments right now. Thanks for summarizing.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148242852
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43746/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146714227
  
      [Test build #43438 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43438/consoleFull) for   PR 9038 at commit [`7a34e03`](https://github.com/apache/spark/commit/7a34e03696bb8b96b23c7a5c6fa9ead169ce4602).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148224084
  
    I took a look at query plans of dfs used in those `TungstenAggregation*` tests. Those plans look good.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146713029
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41706713
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,74 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    --- End diff --
    
    I guess that this would also help to avoid potential issues caused by executor-side mutable state in the aggregate functions, should they wind up being used multiple times in different parts of a pipeline.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148217303
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147014998
  
      [Test build #43497 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43497/console) for   PR 9038 at commit [`1f3dfa0`](https://github.com/apache/spark/commit/1f3dfa045c6afca0fb80112021fc4799bc2d2780).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r42071456
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -154,143 +146,150 @@ object Utils {
         val aggregateExpressions = functionsWithDistinct ++ functionsWithoutDistinct
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -        aggregateExpressions.forall(
    -          _.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    -        supportsTungstenAggregate(
    +        TungstenAggregate.supportsAggregate(
               groupingExpressions,
               aggregateExpressions.flatMap(_.aggregateFunction.aggBufferAttributes))
     
    -    // 1. Create an Aggregate Operator for partial aggregations.
    -    val groupingAttributes = groupingExpressions.map(_.toAttribute)
    -
    -    // It is safe to call head at here since functionsWithDistinct has at least one
    -    // AggregateExpression2.
    -    val distinctColumnExpressions =
    -      functionsWithDistinct.head.aggregateFunction.children
    -    val namedDistinctColumnExpressions = distinctColumnExpressions.map {
    -      case ne: NamedExpression => ne -> ne
    -      case other =>
    -        val withAlias = Alias(other, other.toString)()
    -        other -> withAlias
    +    // functionsWithDistinct is guaranteed to be non-empty. Even though it may contain more than one
    +    // DISTINCT aggregate function, all of those functions will have the same column expression.
    +    // For example, it would be valid for functionsWithDistinct to be
    +    // [COUNT(DISTINCT foo), MAX(DISTINCT foo)], but [COUNT(DISTINCT bar), COUNT(DISTINCT foo)] is
    +    // disallowed because those two distinct aggregates have different column expressions.
    +    val distinctColumnExpression: Expression = {
    +      val allDistinctColumnExpressions = functionsWithDistinct.head.aggregateFunction.children
    +      assert(allDistinctColumnExpressions.length == 1)
    +      allDistinctColumnExpressions.head
    +    }
    +    val namedDistinctColumnExpression: NamedExpression = distinctColumnExpression match {
    +      case ne: NamedExpression => ne
    +      case other => Alias(other, other.toString)()
         }
    -    val distinctColumnExpressionMap = namedDistinctColumnExpressions.toMap
    -    val distinctColumnAttributes = namedDistinctColumnExpressions.map(_._2.toAttribute)
    +    val distinctColumnAttribute: Attribute = namedDistinctColumnExpression.toAttribute
    +    val groupingAttributes = groupingExpressions.map(_.toAttribute)
     
    -    val partialAggregateExpressions = functionsWithoutDistinct.map(_.copy(mode = Partial))
    -    val partialAggregateAttributes =
    -      partialAggregateExpressions.flatMap(_.aggregateFunction.aggBufferAttributes)
    -    val partialAggregateGroupingExpressions =
    -      groupingExpressions ++ namedDistinctColumnExpressions.map(_._2)
    -    val partialAggregateResult =
    +    // 1. Create an Aggregate Operator for partial aggregations.
    +    val partialAggregate: SparkPlan = {
    +      val partialAggregateExpressions = functionsWithoutDistinct.map(_.copy(mode = Partial))
    +      val partialAggregateAttributes =
    +        partialAggregateExpressions.flatMap(_.aggregateFunction.aggBufferAttributes)
    +      // We will group by the original grouping expression, plus an additional expression for the
    +      // DISTINCT column. For example, for AVG(DISTINCT value) GROUP BY key, the the grouping
    +      // expressions will be [value, key].
    --- End diff --
    
    seems it should be `[key, value]`. Will fix it while merging it.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148239404
  
      [Test build #1903 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1903/console) for   PR 9038 at commit [`4867a3d`](https://github.com/apache/spark/commit/4867a3dcdf0f7562741760e110ce8cbec280c236).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class HyperLogLogPlusPlus(`



---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41660046
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -511,8 +658,10 @@ class TungstenAggregationIterator(
         }
         aggregationMode = newAggregationMode
     
    +    allAggregateFunctions = initializeAllAggregateFunctions(startingInputBufferOffset = 0)
    --- End diff --
    
    Maybe add a comment at here?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147012464
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41813019
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -154,143 +146,150 @@ object Utils {
         val aggregateExpressions = functionsWithDistinct ++ functionsWithoutDistinct
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -        aggregateExpressions.forall(
    -          _.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    --- End diff --
    
    Should we create a PR to include changes we made before we deleted this check? So, we can merge those changes earlier first and then spend time to figure out the current issue. What do you think?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036452
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147141366
  
    ah, `assert(initialInputBufferOffset > 0)` failed because when there is not grouping expression and the mode is not partial, initialInputBufferOffset will be 0.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147045113
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147532433
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/9038


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41671105
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -288,17 +419,33 @@ class TungstenAggregationIterator(
             val joinedRow = new JoinedRow()
             val evalExpressions = allAggregateFunctions.map {
               case ae: DeclarativeAggregate => ae.evaluateExpression
    -          // case agg: AggregateFunction2 => Literal.create(null, agg.dataType)
    +          case agg: AggregateFunction2 => NoOp
             }
    -        val expressionAggEvalProjection = UnsafeProjection.create(evalExpressions, bufferAttributes)
    +        val expressionAggEvalProjection = newMutableProjection(evalExpressions, bufferAttributes)()
             // These are the attributes of the row produced by `expressionAggEvalProjection`
             val aggregateResultSchema = nonCompleteAggregateAttributes ++ completeAggregateAttributes
    +        // TODO: Use unsafe row.
    +        val aggregateResult = new SpecificMutableRow(aggregateResultSchema.map(_.dataType))
    +        expressionAggEvalProjection.target(aggregateResult)
             val resultProjection =
               UnsafeProjection.create(resultExpressions, groupingAttributes ++ aggregateResultSchema)
     
    +        val allImperativeAggregateFunctions: Array[ImperativeAggregate] =
    +          allImperativeAggregateFunctionPositions
    +            .map(allAggregateFunctions)
    +            .map(_.asInstanceOf[ImperativeAggregate])
    +
             (currentGroupingKey: UnsafeRow, currentBuffer: UnsafeRow) => {
               // Generate results for all expression-based aggregate functions.
    -          val aggregateResult = expressionAggEvalProjection.apply(currentBuffer)
    +          expressionAggEvalProjection(currentBuffer)
    +          // Generate results for all imperative aggregate functions.
    +          var i = 0
    +          while (i < allImperativeAggregateFunctions.length) {
    +            aggregateResult.update(
    --- End diff --
    
    Oh, right; this was on my list of things to discuss. I think that we can handle this by calling the specific setter methods because we happen to know the data type. We might want to do this by building up an array of functions to perform the update, similar to how we used to do things in CatalystTypeConverters.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036874
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147008488
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41667789
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -288,17 +419,33 @@ class TungstenAggregationIterator(
             val joinedRow = new JoinedRow()
             val evalExpressions = allAggregateFunctions.map {
               case ae: DeclarativeAggregate => ae.evaluateExpression
    -          // case agg: AggregateFunction2 => Literal.create(null, agg.dataType)
    +          case agg: AggregateFunction2 => NoOp
             }
    -        val expressionAggEvalProjection = UnsafeProjection.create(evalExpressions, bufferAttributes)
    +        val expressionAggEvalProjection = newMutableProjection(evalExpressions, bufferAttributes)()
             // These are the attributes of the row produced by `expressionAggEvalProjection`
             val aggregateResultSchema = nonCompleteAggregateAttributes ++ completeAggregateAttributes
    +        // TODO: Use unsafe row.
    +        val aggregateResult = new SpecificMutableRow(aggregateResultSchema.map(_.dataType))
    +        expressionAggEvalProjection.target(aggregateResult)
             val resultProjection =
               UnsafeProjection.create(resultExpressions, groupingAttributes ++ aggregateResultSchema)
     
    +        val allImperativeAggregateFunctions: Array[ImperativeAggregate] =
    +          allImperativeAggregateFunctionPositions
    +            .map(allAggregateFunctions)
    +            .map(_.asInstanceOf[ImperativeAggregate])
    +
             (currentGroupingKey: UnsafeRow, currentBuffer: UnsafeRow) => {
               // Generate results for all expression-based aggregate functions.
    -          val aggregateResult = expressionAggEvalProjection.apply(currentBuffer)
    +          expressionAggEvalProjection(currentBuffer)
    +          // Generate results for all imperative aggregate functions.
    +          var i = 0
    +          while (i < allImperativeAggregateFunctions.length) {
    +            aggregateResult.update(
    --- End diff --
    
    This `update` prevent us from using `UnsafeRow`, right?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147532408
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147631386
  
    See #9093 for an exploration of some sketchy-looking `newExprId` calls which might be involved in the problems that we're experiencing here.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41704981
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,74 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    --- End diff --
    
    I tried
    ```
    val originalFunc = allAggregateExpressions(i).aggregateFunction
    val baos = new ByteArrayOutputStream()
    val funcOut = new ObjectOutputStream(baos)
          funcOut.reset()
    funcOut.writeObject(originalFunc)
    val byteArray = baos.toByteArray
    funcOut.close()
    val funcIn = new ObjectInputStream((new ByteArrayInputStream(byteArray)))
    val func = funcIn.readObject().asInstanceOf[AggregateFunction2]
    ```
    to confirm my guess (multiple operators are holding the same ImperativeAggregate instance). After I add this, all tests of `TungstenAggregationQueryWithControlledFallbackSuite` pass.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41701104
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -154,143 +146,150 @@ object Utils {
         val aggregateExpressions = functionsWithDistinct ++ functionsWithoutDistinct
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -        aggregateExpressions.forall(
    -          _.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    -        supportsTungstenAggregate(
    +        TungstenAggregate.supportsAggregate(
               groupingExpressions,
               aggregateExpressions.flatMap(_.aggregateFunction.aggBufferAttributes))
     
    -    // 1. Create an Aggregate Operator for partial aggregations.
    -    val groupingAttributes = groupingExpressions.map(_.toAttribute)
    -
    -    // It is safe to call head at here since functionsWithDistinct has at least one
    -    // AggregateExpression2.
    -    val distinctColumnExpressions =
    -      functionsWithDistinct.head.aggregateFunction.children
    -    val namedDistinctColumnExpressions = distinctColumnExpressions.map {
    -      case ne: NamedExpression => ne -> ne
    -      case other =>
    -        val withAlias = Alias(other, other.toString)()
    -        other -> withAlias
    +    // functionsWithDistinct is guaranteed to be non-empty. Even though it may contain more than one
    --- End diff --
    
    I did a bit of refactoring here to try to add some assertions to clarify what's going on (namely, show that there is only one column expression for the distinct aggregates).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147045102
  
      [Test build #43516 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43516/console) for   PR 9038 at commit [`31b116e`](https://github.com/apache/spark/commit/31b116ec1dc05fa4a905f28c437665f8c88f5fd2).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148220975
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581219
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/functions.scala ---
    @@ -546,6 +546,9 @@ case class HyperLogLogPlusPlus(child: Expression, relativeSD: Double = 0.05)
         AttributeReference(s"MS[$i]", LongType)()
       }
     
    +  override val inputAggBufferAttributes: Seq[AttributeReference] =
    --- End diff --
    
    To explain what's going on here: it turns out that the refactoring in #8973 to lift this into `InterpretedAggregate` ended up introducing a bug due to lazy val initialization issues. To avoid this, I just pushed these copies to the leaves of our inheritance hierarchy and removed the default implementation from the parent class.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147548152
  
    @yhuai, I think that we need to understand why my latest fix works, since I think that the test failure might impact non-distinct aggregates as well (in which case we can't easily split this ticket into the distinct and non-distinct cases).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148221201
  
      [Test build #1903 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1903/consoleFull) for   PR 9038 at commit [`4867a3d`](https://github.com/apache/spark/commit/4867a3dcdf0f7562741760e110ce8cbec280c236).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147553566
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43589/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148220234
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43744/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146988029
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146715344
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147045022
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43518/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41648516
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/functions.scala ---
    @@ -546,6 +546,9 @@ case class HyperLogLogPlusPlus(child: Expression, relativeSD: Double = 0.05)
         AttributeReference(s"MS[$i]", LongType)()
       }
     
    +  override val inputAggBufferAttributes: Seq[AttributeReference] =
    --- End diff --
    
    So, if anyone tries to move it back to `ImperativeAggregate`, he/she will see an test failure? Should we add a comment to `ImperativeAggregate` to explain why a leaf class needs to implement this?


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146729145
  
    YAY


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r42032759
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -481,10 +610,10 @@ class TungstenAggregationIterator(
           // When needsProcess is false, the format of input rows is groupingKey + aggregation buffer.
           // We need to project the aggregation buffer part from an input row.
           val buffer = createNewAggregationBuffer()
    -      // The originalInputAttributes are using cloneBufferAttributes. So, we need to use
    -      // allAggregateFunctions.flatMap(_.cloneBufferAttributes).
    +      // The originalInputAttributes are using inputAggBufferAttributes. So, we need to use
    +      // allAggregateFunctions.flatMap(_.inputAggBufferAttributes).
           val bufferExtractor = newMutableProjection(
    -        allAggregateFunctions.flatMap(_.inputAggBufferAttributes),
    +        originalInputAttributes.drop(initialInputBufferOffset),
    --- End diff --
    
    Had a discussion with @JoshRosen offline. Here is the explaining for this change.
    
    Our `ImperativeAggregate` and `DeclarativeAggregate` are quite different. For an `ImperativeAggregate`, its correctness is based on the correctness of `mutableAggBufferOffset` and `inputAggBufferOffset`, and when there is no fallback, it does not rely on attribute ids for binding. To make `mutableAggBufferOffset` and `inputAggBufferOffset` immutable, whenever we call `withNewMutableAggBufferOffset` and `withNewInputAggBufferOffset`, we create a new copy of the `ImperativeAggregate`. Although a new copy contains a new set of attribute ids for `aggBufferAttributes` and `inputAggBufferAttributes`, in most cases, those new ids do not introduce any problem because an `ImperativeAggregate` does not rely on these ids. However, once we fallback to sort-based aggregation and we need to extract input aggregation buffers, we need to have matching attribute ids to make it work. Since  `allAggregateFunctions.flatMap(_.inputAggBufferAttributes)` will have attributes with a new set of ids, we w
 ill see a binding error at here. `originalInputAttributes.drop(initialInputBufferOffset)` is fine at here.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146990563
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43493/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41705892
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,74 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    --- End diff --
    
    Good catch! I wonder whether we can address this treating ImperativeAggregtate instances as immutable and changing the `with*Offset` methods to return new instances. This seems a bit easier / safer than having to remember to clone.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147532885
  
      [Test build #43589 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43589/consoleFull) for   PR 9038 at commit [`17b1d7a`](https://github.com/apache/spark/commit/17b1d7a2f411c61c7e213182c56964f0c394760e).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146998558
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581336
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggregationIterator.scala ---
    @@ -367,7 +368,7 @@ abstract class AggregationIterator(
     
             (currentGroupingKey: InternalRow, currentBuffer: MutableRow) => {
               // Generate results for all expression-based aggregate functions.
    -          expressionAggEvalProjection.target(aggregateResult)(currentBuffer)
    --- End diff --
    
    Here, I noticed that `expressionAggEvalProjection` is always targeted at `aggregateResult`, so I decided to do the targeting once outside of the loop.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146715345
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43438/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41679774
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -70,7 +70,6 @@ object Utils {
         // Check if we can use TungstenAggregate.
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -      aggregateExpressions.forall(_.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    --- End diff --
    
    This also reminds me: are there planner tests that should be updated to assert that we're actually using the new Tungsten path? Let me check and see.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41675080
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -170,10 +232,27 @@ class TungstenAggregationIterator(
         val bufferRowSize: Int = bufferSchema.length
     
         val genericMutableBuffer = new GenericMutableRow(bufferRowSize)
    -    val unsafeProjection =
    -      UnsafeProjection.create(bufferSchema.map(_.dataType))
    -    val buffer = unsafeProjection.apply(genericMutableBuffer)
    -    initialProjection.target(buffer)(EmptyRow)
    +    // TODO(josh): figure out whether we have to use
    +    val useUnsafeBuffer = bufferSchema.map(_.dataType).forall(UnsafeRow.isMutable)
    +
    +    val buffer =  /* if (useUnsafeBuffer) */ {
    --- End diff --
    
    Ah, good point. I'll update to reflect this.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146712508
  
    /cc @yhuai for review. There are a few specific questions that I'd like to clarify and I will comment on them inline.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581411
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,73 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    --- End diff --
    
    This is one of the key changes: we need to be able to re-initialize the imperative aggregate functions after we fall back to the sort-based path.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581748
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -187,72 +266,124 @@ class TungstenAggregationIterator(
         aggregationMode match {
           // Partial-only
           case (Some(Partial), None) =>
    -        val updateExpressions = allAggregateFunctions.flatMap(_.updateExpressions)
    -        val updateProjection =
    +        val updateExpressions = allAggregateFunctions.flatMap {
    +          case ae: DeclarativeAggregate => ae.updateExpressions
    +          case agg: AggregateFunction2 => Seq.fill(agg.aggBufferAttributes.length)(NoOp)
    +        }
    +        val imperativeAggregateFunctions: Array[ImperativeAggregate] =
    --- End diff --
    
    While `imperativeAggregateFunctions` can't as easily be defined at the top of the class (since it would need to be reset when switching to spilling), I think that I _could_ lift it out of this `match` statement and put it at the top of this function to cut down on code duplication a bit.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148242850
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41647560
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -170,10 +232,27 @@ class TungstenAggregationIterator(
         val bufferRowSize: Int = bufferSchema.length
     
         val genericMutableBuffer = new GenericMutableRow(bufferRowSize)
    -    val unsafeProjection =
    -      UnsafeProjection.create(bufferSchema.map(_.dataType))
    -    val buffer = unsafeProjection.apply(genericMutableBuffer)
    -    initialProjection.target(buffer)(EmptyRow)
    +    // TODO(josh): figure out whether we have to use
    +    val useUnsafeBuffer = bufferSchema.map(_.dataType).forall(UnsafeRow.isMutable)
    +
    +    val buffer =  /* if (useUnsafeBuffer) */ {
    --- End diff --
    
    When we do hash-based aggregation, the buffer is an UnsafeRow anyway. So, I guess it is fine to let InterpretedAggregate functions to work with UnsafeRows directly. When a developer adds an new InterpretedAggregate function whose aggregate buffer data types are compatible with TungstenAggregate, if he/she uses `update`, he/she will get the exception while testing the function, right? If so, it is safe to say that the code committed in master will not use `update`.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146989737
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147019195
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43500/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581661
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -170,10 +232,27 @@ class TungstenAggregationIterator(
         val bufferRowSize: Int = bufferSchema.length
     
         val genericMutableBuffer = new GenericMutableRow(bufferRowSize)
    -    val unsafeProjection =
    -      UnsafeProjection.create(bufferSchema.map(_.dataType))
    -    val buffer = unsafeProjection.apply(genericMutableBuffer)
    -    initialProjection.target(buffer)(EmptyRow)
    +    // TODO(josh): figure out whether we have to use
    +    val useUnsafeBuffer = bufferSchema.map(_.dataType).forall(UnsafeRow.isMutable)
    +
    +    val buffer =  /* if (useUnsafeBuffer) */ {
    +      val unsafeProjection =
    +        UnsafeProjection.create(bufferSchema.map(_.dataType))
    +      unsafeProjection.apply(genericMutableBuffer)
    +//    } else {
    +//      genericMutableBuffer
    +    }
    +    expressionAggInitialProjection.target(buffer)(EmptyRow)
    +    // TODO(josh): this can be done more cleanly
    --- End diff --
    
    I think that I thought that this block of code was a bit messy while I was working on it. Will clean up while addressing any code review comments.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147875246
  
      [Test build #43683 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43683/consoleFull) for   PR 9038 at commit [`2547b29`](https://github.com/apache/spark/commit/2547b29e61cc27580f5dbb68a8ed8f65d8c04848).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148240000
  
    Thank you @JoshRosen ! I am merging it to master.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147553479
  
      [Test build #43589 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43589/console) for   PR 9038 at commit [`17b1d7a`](https://github.com/apache/spark/commit/17b1d7a2f411c61c7e213182c56964f0c394760e).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class HyperLogLogPlusPlus(`



---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036813
  
      [Test build #43516 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43516/consoleFull) for   PR 9038 at commit [`31b116e`](https://github.com/apache/spark/commit/31b116ec1dc05fa4a905f28c437665f8c88f5fd2).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147874435
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147008738
  
      [Test build #43500 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43500/consoleFull) for   PR 9038 at commit [`9673b83`](https://github.com/apache/spark/commit/9673b83b0cb214d5a8db6b8b32142031714bf183).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148217276
  
     Merged build triggered.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148221006
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-148242774
  
      [Test build #43746 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43746/console) for   PR 9038 at commit [`4867a3d`](https://github.com/apache/spark/commit/4867a3dcdf0f7562741760e110ce8cbec280c236).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class HyperLogLogPlusPlus(`



---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146713043
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41788573
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -134,19 +137,74 @@ class TungstenAggregationIterator(
           completeAggregateExpressions.map(_.mode).distinct.headOption
       }
     
    -  // All aggregate functions. TungstenAggregationIterator only handles expression-based aggregate.
    -  // If there is any functions that is an ImperativeAggregateFunction, we throw an
    -  // IllegalStateException.
    -  private[this] val allAggregateFunctions: Array[DeclarativeAggregate] = {
    -    if (!allAggregateExpressions.forall(
    -        _.aggregateFunction.isInstanceOf[DeclarativeAggregate])) {
    -      throw new IllegalStateException(
    -        "Only ExpressionAggregateFunctions should be passed in TungstenAggregationIterator.")
    +  // Initialize all AggregateFunctions by binding references, if necessary,
    +  // and setting inputBufferOffset and mutableBufferOffset.
    +  private def initializeAllAggregateFunctions(
    +      startingInputBufferOffset: Int): Array[AggregateFunction2] = {
    +    var mutableBufferOffset = 0
    +    var inputBufferOffset: Int = startingInputBufferOffset
    +    val functions = new Array[AggregateFunction2](allAggregateExpressions.length)
    +    var i = 0
    +    while (i < allAggregateExpressions.length) {
    +      val func = allAggregateExpressions(i).aggregateFunction
    --- End diff --
    
    One thought: instead of trying to preserve  `aggBufferAttributes` and `inputAggBufferAttributes` when returning a new instance, what if we also updated the other expressions which referenced those attributes? Maybe that would be easier.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147611336
  
    I'm fairly concerned about the implications of having mutable state inside of ImperativeAggregates which isn't reset when switching to sort / could be shared across stages of a pipeline, so I'm slightly worried about the idea of reverting back to 8695e3f and merging this PR as of then: it seems like the same underlying problems could exist there, too.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41682767
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -288,17 +419,33 @@ class TungstenAggregationIterator(
             val joinedRow = new JoinedRow()
             val evalExpressions = allAggregateFunctions.map {
               case ae: DeclarativeAggregate => ae.evaluateExpression
    -          // case agg: AggregateFunction2 => Literal.create(null, agg.dataType)
    +          case agg: AggregateFunction2 => NoOp
             }
    -        val expressionAggEvalProjection = UnsafeProjection.create(evalExpressions, bufferAttributes)
    +        val expressionAggEvalProjection = newMutableProjection(evalExpressions, bufferAttributes)()
             // These are the attributes of the row produced by `expressionAggEvalProjection`
             val aggregateResultSchema = nonCompleteAggregateAttributes ++ completeAggregateAttributes
    +        // TODO: Use unsafe row.
    +        val aggregateResult = new SpecificMutableRow(aggregateResultSchema.map(_.dataType))
    +        expressionAggEvalProjection.target(aggregateResult)
             val resultProjection =
               UnsafeProjection.create(resultExpressions, groupingAttributes ++ aggregateResultSchema)
     
    +        val allImperativeAggregateFunctions: Array[ImperativeAggregate] =
    +          allImperativeAggregateFunctionPositions
    +            .map(allAggregateFunctions)
    +            .map(_.asInstanceOf[ImperativeAggregate])
    +
             (currentGroupingKey: UnsafeRow, currentBuffer: UnsafeRow) => {
               // Generate results for all expression-based aggregate functions.
    -          val aggregateResult = expressionAggEvalProjection.apply(currentBuffer)
    +          expressionAggEvalProjection(currentBuffer)
    +          // Generate results for all imperative aggregate functions.
    +          var i = 0
    +          while (i < allImperativeAggregateFunctions.length) {
    +            aggregateResult.update(
    --- End diff --
    
    As discussed offline, let's not make this change as part of this patch. There's a good chance that calling UnsafeRow's specific setters via this loop may wind up being just as slow as using a SpecificMutableRow. Note that this operator will still _output_ UnsafeRows, since `resultProjection` outputs them.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146988055
  
    Merged build started.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-146715340
  
      [Test build #43438 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43438/console) for   PR 9038 at commit [`7a34e03`](https://github.com/apache/spark/commit/7a34e03696bb8b96b23c7a5c6fa9ead169ce4602).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `trait Encoder[T] `
      * `case class ClassEncoder[T](`
      * `case class StaticInvoke(`
      * `case class Invoke(`
      * `case class NewInstance(`
      * `case class UnwrapOption(`
      * `case class LambdaVariable(value: String, isNull: String, dataType: DataType) extends Expression `
      * `case class MapObjects(`



---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147044913
  
      [Test build #43518 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43518/console) for   PR 9038 at commit [`00021a7`](https://github.com/apache/spark/commit/00021a7409d96e952679b31e50745460636de277).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147021152
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147015022
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41582004
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -511,8 +658,10 @@ class TungstenAggregationIterator(
         }
         aggregationMode = newAggregationMode
     
    +    allAggregateFunctions = initializeAllAggregateFunctions(startingInputBufferOffset = 0)
    --- End diff --
    
    Here's the other TungstenAggregate-specific change.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147884972
  
      [Test build #43683 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43683/console) for   PR 9038 at commit [`2547b29`](https://github.com/apache/spark/commit/2547b29e61cc27580f5dbb68a8ed8f65d8c04848).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class HyperLogLogPlusPlus(`
      * `case class ExprId(id: Long, jvmId: UUID)`



---
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


[GitHub] spark pull request: [SPARK-11017] Support ImperativeAggregates in ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41581301
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggregationIterator.scala ---
    @@ -321,7 +321,7 @@ abstract class AggregationIterator(
       // Initializing the function used to generate the output row.
       protected val generateOutput: (InternalRow, MutableRow) => InternalRow = {
         val rowToBeEvaluated = new JoinedRow
    -    val safeOutputRow = new GenericMutableRow(resultExpressions.length)
    +    val safeOutputRow = new SpecificMutableRow(resultExpressions.map(_.dataType))
    --- End diff --
    
    These changes in `AggregationIterator.scala` are just some minor optimizations motivated by things that I noticed while working on the Tungsten version. Here, and down below, I noticed that we might be unnecessarily boxing via our use of GenericMutableRow, hence this change.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147036929
  
      [Test build #43518 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/43518/consoleFull) for   PR 9038 at commit [`00021a7`](https://github.com/apache/spark/commit/00021a7409d96e952679b31e50745460636de277).


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41671522
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala ---
    @@ -288,17 +419,33 @@ class TungstenAggregationIterator(
             val joinedRow = new JoinedRow()
             val evalExpressions = allAggregateFunctions.map {
               case ae: DeclarativeAggregate => ae.evaluateExpression
    -          // case agg: AggregateFunction2 => Literal.create(null, agg.dataType)
    +          case agg: AggregateFunction2 => NoOp
             }
    -        val expressionAggEvalProjection = UnsafeProjection.create(evalExpressions, bufferAttributes)
    +        val expressionAggEvalProjection = newMutableProjection(evalExpressions, bufferAttributes)()
             // These are the attributes of the row produced by `expressionAggEvalProjection`
             val aggregateResultSchema = nonCompleteAggregateAttributes ++ completeAggregateAttributes
    +        // TODO: Use unsafe row.
    +        val aggregateResult = new SpecificMutableRow(aggregateResultSchema.map(_.dataType))
    +        expressionAggEvalProjection.target(aggregateResult)
             val resultProjection =
               UnsafeProjection.create(resultExpressions, groupingAttributes ++ aggregateResultSchema)
     
    +        val allImperativeAggregateFunctions: Array[ImperativeAggregate] =
    +          allImperativeAggregateFunctionPositions
    +            .map(allAggregateFunctions)
    +            .map(_.asInstanceOf[ImperativeAggregate])
    +
             (currentGroupingKey: UnsafeRow, currentBuffer: UnsafeRow) => {
               // Generate results for all expression-based aggregate functions.
    -          val aggregateResult = expressionAggEvalProjection.apply(currentBuffer)
    +          expressionAggEvalProjection(currentBuffer)
    +          // Generate results for all imperative aggregate functions.
    +          var i = 0
    +          while (i < allImperativeAggregateFunctions.length) {
    +            aggregateResult.update(
    --- End diff --
    
    Will https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/udaf.scala#L99-L202 help?


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9038#discussion_r41813748
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
    @@ -154,143 +146,150 @@ object Utils {
         val aggregateExpressions = functionsWithDistinct ++ functionsWithoutDistinct
         val usesTungstenAggregate =
           child.sqlContext.conf.unsafeEnabled &&
    -        aggregateExpressions.forall(
    -          _.aggregateFunction.isInstanceOf[DeclarativeAggregate]) &&
    --- End diff --
    
    Perhaps. Let me see if I'm convinced that the other tests are still valid even if we skip this distinct case.


---
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


[GitHub] spark pull request: [SPARK-11017] [SQL] Support ImperativeAggregat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9038#issuecomment-147012459
  
     Merged build triggered.


---
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