-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce memory usage in aggregate.scala #6859
Conversation
Signed-off-by: Alessandro Bellina <abellina@nvidia.com>
sql-plugin/src/main/scala/com/nvidia/spark/rapids/aggregate.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/aggregate.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/aggregate.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nits. Looks good though.
val isLastInputBatch = GpuColumnVector.isTaggedAsFinalBatch(childBatch) | ||
val aggBatch = computeAggregateAndClose(childBatch, aggHelper) | ||
|
||
val spillableBatch = withResource(aggBatch) { _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not just combine these two lines?
val spillableBatch = withResource(computeAggregateAndClose(childBatch, aggHelper)) { aggBatch =>
|
||
// a post-processing step required in some scenarios, casting or picking | ||
// apart a struct | ||
helper.postProcess(aggregated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels rather inconsistent that postProcess
closes the aggregated batch, but preProcess
does not. This is not new, but it might be nice to rename postProcess
to indicate that it closes the batch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made neither close the batch, so the names stay the same. Please see cbbbf6b.
build |
This PR failed on this unrelated issue: #6865 |
build |
Signed-off-by: Alessandro Bellina abellina@nvidia.com
This PR contributes to #6758. It reduces the amount of outstanding memory by un-nesting
withResource
usage in a few key places where memory was being kept alive unnecessarily.