Kudu C++ client API
Public Member Functions | List of all members
kudu::client::KuduColumnarScanBatch Class Reference

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
 

Detailed Description

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.

Member Function Documentation

Status kudu::client::KuduColumnarScanBatch::GetFixedLengthColumn ( int  idx,
Slice data 
) const

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.

Note
The Slice returned is only valid for the lifetime of the KuduColumnarScanBatch.
Parameters
[in]idxThe column index.
[out]dataThe 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.
Returns
Operation result status.
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.

Note
The Slice returned is only valid for the lifetime of the KuduColumnarScanBatch.
Parameters
[in]idxThe column index.
[out]dataThe 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.
Returns
Operation result status.
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'.

Parameters
[in]idxThe column index.
[out]offsetsIf 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]dataThe variable-length data.
Returns
Operation result status.
int kudu::client::KuduColumnarScanBatch::NumRows ( ) const
Returns
The number of rows in this batch.

The documentation for this class was generated from the following file: