Kudu C++ client API
|
A batch of columnar data returned from a scanner. More...
#include <columnar_scan_batch.h>
Public Member Functions | |
int | NumRows () const |
Status | GetFixedLengthColumn (int idx, Slice *data) const |
Status | GetVariableLengthColumn (int idx, Slice *offsets, Slice *data) const |
Status | GetNonNullBitmapForColumn (int idx, Slice *data) const |
A batch of columnar data returned from a scanner.
Similar to KuduScanBatch, this contains a batch of rows returned from a scanner. This type of batch is used if the KuduScanner::COLUMNAR_LAYOUT row format flag is enabled.
Retrieving rows in columnar layout can be significantly more efficient. It saves some CPU cycles on the Kudu cluster and can also enable faster processing of the returned data in certain client applications.
The columnar data retrieved by this class matches the columnar encoding described by Apache Arrow[1], but without the alignment and padding guarantees that are made by the Arrow IPC serialization.
[1] https://arrow.apache.org/docs/format/Columnar.html
NOTE: this class is not thread-safe.
Get the raw columnar data corresponding to the primitive-typed column with index 'idx'.
For variable-length (e.g. STRING, BINARY, VARCHAR) columns, use GetVariableLengthColumn instead.
[in] | idx | The column index. |
[out] | data | The data is in little-endian packed array format. No alignment or padding is guaranteed. Space is reserved for all cells regardless of whether they might be null. The data stored in a null cell may or may not be zeroed. |
Status kudu::client::KuduColumnarScanBatch::GetNonNullBitmapForColumn | ( | int | idx, |
Slice * | data | ||
) | const |
Get a bitmap corresponding to the non-null status of the cells in the given column.
It is an error to call this function on a column which is not marked as nullable in the schema.
[in] | idx | The column index. |
[out] | data | The bitmap corresponding to the non-null status of the cells in the given column. A set bit indicates a non-null cell. If the number of rows is not a multiple of 8, the state of the trailing bits in the bitmap is undefined. |
Status kudu::client::KuduColumnarScanBatch::GetVariableLengthColumn | ( | int | idx, |
Slice * | offsets, | ||
Slice * | data | ||
) | const |
Return the variable-length data for the variable-length-typed column with index 'idx'.
[in] | idx | The column index. |
[out] | offsets | If NumRows() is 0, the 'offsets' array will have length 0. Otherwise, this array will contain NumRows() + 1 entries, each indicating an offset within the variable-length data array returned in 'data'. For each cell with index 'n', offsets[n] indicates the starting offset of that cell, and offsets[n+1] indicates the ending offset of that cell. |
[out] | data | The variable-length data. |
int kudu::client::KuduColumnarScanBatch::NumRows | ( | ) | const |