Class

org.apache.spark.sql.execution.aggregate

TungstenAggregationIterator

Related Doc: package aggregate

Permalink

class TungstenAggregationIterator extends Iterator[UnsafeRow] with Logging

An iterator used to evaluate aggregate functions. It operates on UnsafeRows.

This iterator first uses hash-based aggregation to process input rows. It uses a hash map to store groups and their corresponding aggregation buffers. If we this map cannot allocate memory from memory manager, it spill the map into disk and create a new one. After processed all the input, then merge all the spills together using external sorter, and do sort-based aggregation.

The process has the following step:

The code of this class is organized as follows:

Linear Supertypes
Logging, Iterator[UnsafeRow], TraversableOnce[UnsafeRow], GenTraversableOnce[UnsafeRow], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TungstenAggregationIterator
  2. Logging
  3. Iterator
  4. TraversableOnce
  5. GenTraversableOnce
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TungstenAggregationIterator(groupingExpressions: Seq[NamedExpression], nonCompleteAggregateExpressions: Seq[AggregateExpression], nonCompleteAggregateAttributes: Seq[Attribute], completeAggregateExpressions: Seq[AggregateExpression], completeAggregateAttributes: Seq[Attribute], initialInputBufferOffset: Int, resultExpressions: Seq[NamedExpression], newMutableProjection: (Seq[Expression], Seq[Attribute]) ⇒ () ⇒ MutableProjection, originalInputAttributes: Seq[Attribute], inputIter: Iterator[InternalRow], testFallbackStartsAt: Option[Int], numInputRows: LongSQLMetric, numOutputRows: LongSQLMetric, dataSize: LongSQLMetric, spillSize: LongSQLMetric)

    Permalink

    groupingExpressions

    expressions for grouping keys

    nonCompleteAggregateExpressions

    AggregateExpression containing AggregateFunctions with mode Partial, PartialMerge, or Final.

    nonCompleteAggregateAttributes

    the attributes of the nonCompleteAggregateExpressions' outputs when they are stored in the final aggregation buffer.

    completeAggregateExpressions

    AggregateExpression containing AggregateFunctions with mode Complete.

    completeAggregateAttributes

    the attributes of completeAggregateExpressions' outputs when they are stored in the final aggregation buffer.

    resultExpressions

    expressions for generating output rows.

    newMutableProjection

    the function used to create mutable projections.

    originalInputAttributes

    attributes of representing input rows from inputIter.

    inputIter

    the iterator containing input UnsafeRows.

Type Members

  1. class GroupedIterator[B >: A] extends AbstractIterator[Seq[B]] with Iterator[Seq[B]]

    Permalink
    Definition Classes
    Iterator

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++[B >: UnsafeRow](that: ⇒ GenTraversableOnce[B]): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  4. def /:[B](z: B)(op: (B, UnsafeRow) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  5. def :\[B](z: B)(op: (UnsafeRow, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. def addString(b: StringBuilder): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  8. def addString(b: StringBuilder, sep: String): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  9. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Permalink
    Definition Classes
    TraversableOnce
  10. def aggregate[B](z: ⇒ B)(seqop: (B, UnsafeRow) ⇒ B, combop: (B, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def buffered: BufferedIterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def collect[B](pf: PartialFunction[UnsafeRow, B]): Iterator[B]

    Permalink
    Definition Classes
    Iterator
    Annotations
    @migration
    Migration

    (Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.

  15. def collectFirst[B](pf: PartialFunction[UnsafeRow, B]): Option[B]

    Permalink
    Definition Classes
    TraversableOnce
  16. def contains(elem: Any): Boolean

    Permalink
    Definition Classes
    Iterator
  17. def copyToArray[B >: UnsafeRow](xs: Array[B], start: Int, len: Int): Unit

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  18. def copyToArray[B >: UnsafeRow](xs: Array[B]): Unit

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  19. def copyToArray[B >: UnsafeRow](xs: Array[B], start: Int): Unit

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  20. def copyToBuffer[B >: UnsafeRow](dest: Buffer[B]): Unit

    Permalink
    Definition Classes
    TraversableOnce
  21. def corresponds[B](that: GenTraversableOnce[B])(p: (UnsafeRow, B) ⇒ Boolean): Boolean

    Permalink
    Definition Classes
    Iterator
  22. def count(p: (UnsafeRow) ⇒ Boolean): Int

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  23. def drop(n: Int): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  24. def dropWhile(p: (UnsafeRow) ⇒ Boolean): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  25. def duplicate: (Iterator[UnsafeRow], Iterator[UnsafeRow])

    Permalink
    Definition Classes
    Iterator
  26. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  28. def exists(p: (UnsafeRow) ⇒ Boolean): Boolean

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  29. def filter(p: (UnsafeRow) ⇒ Boolean): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  30. def filterNot(p: (UnsafeRow) ⇒ Boolean): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  31. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. def find(p: (UnsafeRow) ⇒ Boolean): Option[UnsafeRow]

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  33. def flatMap[B](f: (UnsafeRow) ⇒ GenTraversableOnce[B]): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  34. def fold[A1 >: UnsafeRow](z: A1)(op: (A1, A1) ⇒ A1): A1

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  35. def foldLeft[B](z: B)(op: (B, UnsafeRow) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  36. def foldRight[B](z: B)(op: (UnsafeRow, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  37. def forall(p: (UnsafeRow) ⇒ Boolean): Boolean

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  38. def foreach[U](f: (UnsafeRow) ⇒ U): Unit

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  39. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  40. def grouped[B >: UnsafeRow](size: Int): GroupedIterator[B]

    Permalink
    Definition Classes
    Iterator
  41. def hasDefiniteSize: Boolean

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  42. final def hasNext: Boolean

    Permalink
    Definition Classes
    TungstenAggregationIterator → Iterator
  43. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  44. def indexOf[B >: UnsafeRow](elem: B): Int

    Permalink
    Definition Classes
    Iterator
  45. def indexWhere(p: (UnsafeRow) ⇒ Boolean): Int

    Permalink
    Definition Classes
    Iterator
  46. def isEmpty: Boolean

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  47. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  48. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  49. def isTraversableAgain: Boolean

    Permalink
    Definition Classes
    Iterator → GenTraversableOnce
  50. def length: Int

    Permalink
    Definition Classes
    Iterator
  51. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  52. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  53. def logDebug(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  54. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  55. def logError(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  56. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  57. def logInfo(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  58. def logName: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  59. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  60. def logTrace(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  61. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  62. def logWarning(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  63. def map[B](f: (UnsafeRow) ⇒ B): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  64. def max[B >: UnsafeRow](implicit cmp: Ordering[B]): UnsafeRow

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  65. def maxBy[B](f: (UnsafeRow) ⇒ B)(implicit cmp: Ordering[B]): UnsafeRow

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  66. def min[B >: UnsafeRow](implicit cmp: Ordering[B]): UnsafeRow

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  67. def minBy[B](f: (UnsafeRow) ⇒ B)(implicit cmp: Ordering[B]): UnsafeRow

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  68. def mkString: String

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  69. def mkString(sep: String): String

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  70. def mkString(start: String, sep: String, end: String): String

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  71. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  72. final def next(): UnsafeRow

    Permalink
    Definition Classes
    TungstenAggregationIterator → Iterator
  73. def nonEmpty: Boolean

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  74. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  75. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  76. def outputForEmptyGroupingKeyWithoutInput(): UnsafeRow

    Permalink

    Generate a output row when there is no input and there is no grouping expression.

  77. def padTo[A1 >: UnsafeRow](len: Int, elem: A1): Iterator[A1]

    Permalink
    Definition Classes
    Iterator
  78. def partition(p: (UnsafeRow) ⇒ Boolean): (Iterator[UnsafeRow], Iterator[UnsafeRow])

    Permalink
    Definition Classes
    Iterator
  79. def patch[B >: UnsafeRow](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  80. def product[B >: UnsafeRow](implicit num: Numeric[B]): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  81. def reduce[A1 >: UnsafeRow](op: (A1, A1) ⇒ A1): A1

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  82. def reduceLeft[B >: UnsafeRow](op: (B, UnsafeRow) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce
  83. def reduceLeftOption[B >: UnsafeRow](op: (B, UnsafeRow) ⇒ B): Option[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  84. def reduceOption[A1 >: UnsafeRow](op: (A1, A1) ⇒ A1): Option[A1]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  85. def reduceRight[B >: UnsafeRow](op: (UnsafeRow, B) ⇒ B): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  86. def reduceRightOption[B >: UnsafeRow](op: (UnsafeRow, B) ⇒ B): Option[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  87. def reversed: List[UnsafeRow]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    TraversableOnce
  88. def sameElements(that: Iterator[_]): Boolean

    Permalink
    Definition Classes
    Iterator
  89. def scanLeft[B](z: B)(op: (B, UnsafeRow) ⇒ B): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  90. def scanRight[B](z: B)(op: (UnsafeRow, B) ⇒ B): Iterator[B]

    Permalink
    Definition Classes
    Iterator
  91. def seq: Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  92. def size: Int

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  93. def slice(from: Int, until: Int): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  94. def sliding[B >: UnsafeRow](size: Int, step: Int): GroupedIterator[B]

    Permalink
    Definition Classes
    Iterator
  95. def span(p: (UnsafeRow) ⇒ Boolean): (Iterator[UnsafeRow], Iterator[UnsafeRow])

    Permalink
    Definition Classes
    Iterator
  96. def sum[B >: UnsafeRow](implicit num: Numeric[B]): B

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  97. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  98. def take(n: Int): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  99. def takeWhile(p: (UnsafeRow) ⇒ Boolean): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  100. def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, UnsafeRow, Col[UnsafeRow]]): Col[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  101. def toArray[B >: UnsafeRow](implicit arg0: ClassTag[B]): Array[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  102. def toBuffer[B >: UnsafeRow]: Buffer[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  103. def toIndexedSeq: IndexedSeq[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  104. def toIterable: Iterable[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  105. def toIterator: Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator → GenTraversableOnce
  106. def toList: List[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  107. def toMap[T, U](implicit ev: <:<[UnsafeRow, (T, U)]): Map[T, U]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  108. def toSeq: Seq[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  109. def toSet[B >: UnsafeRow]: Set[B]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  110. def toStream: Stream[UnsafeRow]

    Permalink
    Definition Classes
    Iterator → GenTraversableOnce
  111. def toString(): String

    Permalink
    Definition Classes
    Iterator → AnyRef → Any
  112. def toTraversable: Traversable[UnsafeRow]

    Permalink
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  113. def toVector: Vector[UnsafeRow]

    Permalink
    Definition Classes
    TraversableOnce → GenTraversableOnce
  114. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  115. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  116. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  117. def withFilter(p: (UnsafeRow) ⇒ Boolean): Iterator[UnsafeRow]

    Permalink
    Definition Classes
    Iterator
  118. def zip[B](that: Iterator[B]): Iterator[(UnsafeRow, B)]

    Permalink
    Definition Classes
    Iterator
  119. def zipAll[B, A1 >: UnsafeRow, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1): Iterator[(A1, B1)]

    Permalink
    Definition Classes
    Iterator
  120. def zipWithIndex: Iterator[(UnsafeRow, Int)]

    Permalink
    Definition Classes
    Iterator

Inherited from Logging

Inherited from Iterator[UnsafeRow]

Inherited from TraversableOnce[UnsafeRow]

Inherited from GenTraversableOnce[UnsafeRow]

Inherited from AnyRef

Inherited from Any

Ungrouped