Skip to content

Commit

Permalink
Ensure that receive-side batches use GpuColumnVectorFromBuffer to avo…
Browse files Browse the repository at this point in the history
…id (#872)

extra calls to contig_split

Signed-off-by: Alessandro Bellina <abellina@nvidia.com>
  • Loading branch information
abellina authored Sep 29, 2020
1 parent 1877c29 commit d2006ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ public final class GpuColumnVectorFromBuffer extends GpuColumnVector {
public static ColumnarBatch from(ContiguousTable contigTable) {
DeviceMemoryBuffer buffer = contigTable.getBuffer();
Table table = contigTable.getTable();
return from(table, buffer);
}

/**
* Get a ColumnarBatch from a set of columns in a table, and the corresponding device buffer,
* which backs such columns. The resulting batch is composed of columns which are instances of
* GpuColumnVectorFromBuffer. This will increment the reference count for all columns
* converted so you will need to close both the table that is passed in and the batch
* returned to be sure that there are no leaks.
*
* @param table a table with columns at offsets of `buffer`
* @param buffer a device buffer that packs data for columns in `table`
* @return batch of GpuColumnVectorFromBuffer instances derived from the table and buffer
*/
public static ColumnarBatch from(Table table, DeviceMemoryBuffer buffer) {
long rows = table.getRowCount();
if (rows != (int) rows) {
throw new IllegalStateException("Cannot support a batch larger that MAX INT rows");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class RapidsDeviceMemoryStore(catalog: RapidsBufferCatalog = RapidsBufferCatalog

override def getColumnarBatch: ColumnarBatch = {
if (table.isDefined) {
GpuColumnVector.from(table.get) //REFCOUNT ++ of all columns
GpuColumnVectorFromBuffer.from(table.get, contigBuffer) //REFCOUNT ++ of all columns
} else {
columnarBatchFromDeviceBuffer(contigBuffer)
}
Expand Down

0 comments on commit d2006ff

Please sign in to comment.