Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8038#discussion_r36684718
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TungstenAggregationIterator.scala
---
@@ -666,21 +676,20 @@ class TungstenAggregationIterator(
}
///////////////////////////////////////////////////////////////////////////
- // Part 8: A utility function used to generate a output row when there
is no
- // input and there is no grouping expression.
+ // Part 8: Utility functions
///////////////////////////////////////////////////////////////////////////
+ /**
+ * Generate a output row when there is no input and there is no grouping
expression.
+ */
def outputForEmptyGroupingKeyWithoutInput(): UnsafeRow = {
- if (groupingExpressions.isEmpty) {
- sortBasedAggregationBuffer.copyFrom(initialAggregationBuffer)
- // We create a output row and copy it. So, we can free the map.
- val resultCopy =
- generateOutput(UnsafeRow.createFromByteArray(0, 0),
sortBasedAggregationBuffer).copy()
- hashMap.free()
- resultCopy
- } else {
- throw new IllegalStateException(
- "This method should not be called when groupingExpressions is not
empty.")
- }
+ assert(groupingExpressions.isEmpty)
+ assert(!inputIter.hasNext)
--- End diff --
If we change `inputIter`'s initial value to `null`, we need to also change
it to a null check.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]