ChunkedPack#

public class ChunkedPack implements AutoCloseable#

JNI interface to cudf::chunked_pack.

ChunkedPack has an Iterator-like API with the familiar hasNext and next methods. next should be used in a loop until hasNext returns false.

However, ChunkedPack.next is special because it takes a DeviceMemoryBuffer as a parameter, which means that the caller can call next giving any bounce buffer it may have previously allocated. No requirement exists that the bounce buffer be the same each time, the only requirement is that their sizes are all the same, and match the size that was passed to Table.makeChunkedPack (which instantiates this class).

The user of ChunkedPack must close .close() when done using it to clear up both host and device resources.

Constructor Summary

ChunkedPack(long nativePtr)

This constructor is invoked by Table.makeChunkedPack after creating a native cudf::chunked_pack.

Method Summary

buildMetadata()

Generates opaque table metadata that can be unpacked via cudf::unpack at a later time.

close()

getTotalContiguousSize()

Get the final contiguous size of the table we are packing.

hasNext()

Method to be called to ensure that ChunkedPack has work left.

next(DeviceMemoryBuffer userPtr)

Place the next contiguous chunk of our table into userPtr.

Constructors

public ChunkedPack(long nativePtr)#

This constructor is invoked by Table.makeChunkedPack after creating a native cudf::chunked_pack.

Parameters:

nativePtr – pointer to a cudf::chunked_pack

Methods

public long getTotalContiguousSize()#

Get the final contiguous size of the table we are packing.

This is the size that the final buffer should be, just like if the user called cudf::pack instead.

Returns:

the total number of bytes for the table in contiguous layout

public boolean hasNext()#

Method to be called to ensure that ChunkedPack has work left.

This method should be invoked followed by a call to next, until hasNext returns false.

Returns:

true if there is work left to be done (next should be called), false otherwise.

public long next(DeviceMemoryBuffer userPtr)#

Place the next contiguous chunk of our table into userPtr.

This method throws if hasNext is false.

Parameters:

userPtr – the bounce buffer to use for this iteration

Returns:

the number of bytes that we were able to place in userPtr. This is at most userPtr.getLength().

public PackedColumnMetadata buildMetadata()#

Generates opaque table metadata that can be unpacked via cudf::unpack at a later time.

Returns:

a PackedColumnMetadata instance referencing cuDF packed table metadata

public void close()#