spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-9747] [SQL] Avoid starving an unsafe op...
Date Fri, 07 Aug 2015 21:28:17 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8038#discussion_r36562889
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregate.scala
---
    @@ -61,32 +62,54 @@ case class TungstenAggregate(
       }
     
       protected override def doExecute(): RDD[InternalRow] = attachTree(this, "execute")
{
    -    child.execute().mapPartitions { iter =>
    -      val hasInput = iter.hasNext
    -      if (!hasInput && groupingExpressions.nonEmpty) {
    -        // This is a grouped aggregate and the input iterator is empty,
    -        // so return an empty iterator.
    -        Iterator.empty.asInstanceOf[Iterator[UnsafeRow]]
    -      } else {
    -        val aggregationIterator =
    -          new TungstenAggregationIterator(
    -            groupingExpressions,
    -            nonCompleteAggregateExpressions,
    -            completeAggregateExpressions,
    -            initialInputBufferOffset,
    -            resultExpressions,
    -            newMutableProjection,
    -            child.output,
    -            iter.asInstanceOf[Iterator[UnsafeRow]],
    -            testFallbackStartsAt)
     
    -        if (!hasInput && groupingExpressions.isEmpty) {
    +    /**
    +     * Set up the underlying unsafe data structures used before computing the parent
partition.
    +     * This makes sure our iterator is not starved by other operators in the same task.
    +     */
    +    def preparePartition(): TungstenAggregationIterator = {
    +      new TungstenAggregationIterator(
    +        groupingExpressions,
    +        nonCompleteAggregateExpressions,
    +        completeAggregateExpressions,
    +        initialInputBufferOffset,
    +        resultExpressions,
    +        newMutableProjection,
    +        child.output,
    +        testFallbackStartsAt)
    --- End diff --
    
    we'll fail fast with "unable to acquire memory" exception


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message