Skip to content
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

[auto-merge] branch-23.12 to branch-24.02 [skip ci] [bot] #9734

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
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 @@ -340,6 +340,8 @@ object BatchWithPartitionDataUtils {
* Splits the input ColumnarBatch into smaller batches, wraps these batches with partition
* data, and returns them as a sequence of [[BatchWithPartitionData]].
*
* This function does not take ownership of `batch`, and callers should make sure to close.
*
* @note Partition values are merged with the columnar batches lazily by the resulting Iterator
* to save GPU memory.
* @param batch Input ColumnarBatch.
Expand Down Expand Up @@ -502,9 +504,10 @@ object BatchWithPartitionDataUtils {
throw new SplitAndRetryOOM("GPU OutOfMemory: cannot split input with one row")
}
// Split the batch into two halves
val cb = batchWithPartData.inputBatch.getColumnarBatch()
splitAndCombineBatchWithPartitionData(cb, splitPartitionData,
batchWithPartData.partitionSchema)
withResource(batchWithPartData.inputBatch.getColumnarBatch()) { cb =>
splitAndCombineBatchWithPartitionData(cb, splitPartitionData,
batchWithPartData.partitionSchema)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ class BatchWithPartitionDataSuite extends RmmSparkRetrySuiteBase with SparkQuery
withResource(buildBatch(getSampleValueData)) { valueBatch =>
withResource(buildBatch(partCols)) { partBatch =>
withResource(GpuColumnVector.combineColumns(valueBatch, partBatch)) { expectedBatch =>
// we incRefCounts here because `addPartitionValuesToBatch` takes ownership of
// `valueBatch`, but we are keeping it alive since its columns are part of
// `expectedBatch`
GpuColumnVector.incRefCounts(valueBatch)
val resultBatchIter = BatchWithPartitionDataUtils.addPartitionValuesToBatch(valueBatch,
partRows, partValues, partSchema, maxGpuColumnSizeBytes)
withResource(resultBatchIter) { _ =>
RmmSpark.forceSplitAndRetryOOM(RmmSpark.getCurrentThreadId)
// Assert that the final count of rows matches expected batch
val rowCounts = resultBatchIter.map(_.numRows()).sum
// We also need to close each batch coming from `resultBatchIter`.
val rowCounts = resultBatchIter.map(withResource(_){_.numRows()}).sum
assert(rowCounts == expectedBatch.numRows())
}
}
Expand Down