Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ class ObjectAggregationIterator(
generateProcessRow(newExpressions, newFunctions, newInputAttributes)
}

// A safe projection used to do deep clone of input rows to prevent false sharing.
private[this] val safeProjection: Projection =
FromUnsafeProjection(outputAttributes.map(_.dataType))

/**
* Start processing input rows.
*/
Expand Down Expand Up @@ -151,12 +147,11 @@ class ObjectAggregationIterator(
val groupingKey = groupingProjection.apply(null)
val buffer: InternalRow = getAggregationBufferByKey(hashMap, groupingKey)
while (inputRows.hasNext) {
val newInput = safeProjection(inputRows.next())
processRow(buffer, newInput)
processRow(buffer, inputRows.next())
}
} else {
while (inputRows.hasNext && !sortBased) {
val newInput = safeProjection(inputRows.next())
val newInput = inputRows.next()
val groupingKey = groupingProjection.apply(newInput)
val buffer: InternalRow = getAggregationBufferByKey(hashMap, groupingKey)
processRow(buffer, newInput)
Expand Down Expand Up @@ -266,9 +261,7 @@ class SortBasedAggregator(
// Firstly, update the aggregation buffer with input rows.
while (hasNextInput &&
groupingKeyOrdering.compare(inputIterator.getKey, groupingKey) == 0) {
// Since `inputIterator.getValue` is an `UnsafeRow` whose underlying buffer will be
// overwritten when `inputIterator` steps forward, we need to do a deep copy here.
processRow(result.aggregationBuffer, inputIterator.getValue.copy())
processRow(result.aggregationBuffer, inputIterator.getValue)
hasNextInput = inputIterator.next()
}

Expand All @@ -277,12 +270,7 @@ class SortBasedAggregator(
// be called after calling processRow.
while (hasNextAggBuffer &&
groupingKeyOrdering.compare(initialAggBufferIterator.getKey, groupingKey) == 0) {
mergeAggregationBuffers(
result.aggregationBuffer,
// Since `inputIterator.getValue` is an `UnsafeRow` whose underlying buffer will be
// overwritten when `inputIterator` steps forward, we need to do a deep copy here.
initialAggBufferIterator.getValue.copy()
)
mergeAggregationBuffers(result.aggregationBuffer, initialAggBufferIterator.getValue)
hasNextAggBuffer = initialAggBufferIterator.next()
}

Expand Down