Kudu C++ client API
|
A batch of zero or more rows returned by a scan operation. More...
#include <scan_batch.h>
Public Types | |
typedef RowPtr | value_type |
A handy typedef for the RowPtr. | |
Public Member Functions | |
int | NumRows () const |
KuduScanBatch::RowPtr | Row (int idx) const |
const_iterator | begin () const |
const_iterator | end () const |
const KuduSchema * | projection_schema () const |
RowPtr () | |
const RowPtr * | operator-> () const |
bool | IsNull (const Slice &col_name) const |
bool | IsNull (int col_idx) const |
Status | IsDeleted (bool *val) const WARN_UNUSED_RESULT KUDU_NO_EXPORT |
const void * | cell (int col_idx) const |
std::string | ToString () const |
KuduScanBatch::RowPtr | operator* () const |
KuduScanBatch::RowPtr | operator-> () const |
const_iterator & | operator++ () |
const_iterator | operator++ (int) |
bool | operator== (const const_iterator &other) const |
bool | operator!= (const const_iterator &other) const |
Advanced/Unstable API | |
There are no guarantees on the stability of the format returned by these methods, which might change at any given time.
| |
Slice | direct_data () const |
Slice | indirect_data () const |
Getters for integral type columns by column name. | |
Status | GetBool (const Slice &col_name, bool *val) const WARN_UNUSED_RESULT |
Status | GetInt8 (const Slice &col_name, int8_t *val) const WARN_UNUSED_RESULT |
Status | GetInt16 (const Slice &col_name, int16_t *val) const WARN_UNUSED_RESULT |
Status | GetInt32 (const Slice &col_name, int32_t *val) const WARN_UNUSED_RESULT |
Status | GetInt64 (const Slice &col_name, int64_t *val) const WARN_UNUSED_RESULT |
Status | GetUnixTimeMicros (const Slice &col_name, int64_t *micros_since_utc_epoch) const WARN_UNUSED_RESULT |
Status | GetDate (const Slice &col_name, int32_t *days_since_unix_epoch) const WARN_UNUSED_RESULT |
Status | GetFloat (const Slice &col_name, float *val) const WARN_UNUSED_RESULT |
Status | GetDouble (const Slice &col_name, double *val) const WARN_UNUSED_RESULT |
Getters for integral type columns by column index. | |
These methods are faster than their name-based counterparts since using indices avoids a hashmap lookup, so index-based getters should be preferred in performance-sensitive code. | |
Status | GetBool (int col_idx, bool *val) const WARN_UNUSED_RESULT |
Status | GetInt8 (int col_idx, int8_t *val) const WARN_UNUSED_RESULT |
Status | GetInt16 (int col_idx, int16_t *val) const WARN_UNUSED_RESULT |
Status | GetInt32 (int col_idx, int32_t *val) const WARN_UNUSED_RESULT |
Status | GetInt64 (int col_idx, int64_t *val) const WARN_UNUSED_RESULT |
Status | GetUnixTimeMicros (int col_idx, int64_t *micros_since_utc_epoch) const WARN_UNUSED_RESULT |
Status | GetDate (int col_idx, int32_t *days_since_unix_epoch) const WARN_UNUSED_RESULT |
Status | GetFloat (int col_idx, float *val) const WARN_UNUSED_RESULT |
Status | GetDouble (int col_idx, double *val) const WARN_UNUSED_RESULT |
Getters for string/binary/varchar column by column name. | |
Status | GetString (const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT |
Status | GetBinary (const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT |
Status | GetVarchar (const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT |
Getters for string/binary/varchar column by column index. | |
Status | GetString (int col_idx, Slice *val) const WARN_UNUSED_RESULT |
Status | GetBinary (int col_idx, Slice *val) const WARN_UNUSED_RESULT |
Status | GetVarchar (int col_idx, Slice *val) const WARN_UNUSED_RESULT |
A batch of zero or more rows returned by a scan operation.
Every call to KuduScanner::NextBatch() returns a batch of zero or more rows. You can iterate over the rows in the batch using:
range-foreach loop (C++11):
regular for loop (C++03):
or
|
inline |
const void * kudu::client::KuduScanBatch::cell | ( | int | col_idx | ) | const |
Get the column's row data.
[in] | col_idx | The index of the column. |
Slice kudu::client::KuduScanBatch::direct_data | ( | ) | const |
Return a slice that points to the direct row data received from the server. Users of this API must have knowledge of the data format in order to decode the data.
|
inline |
Get the string/binary/varchar value for a column by its name.
[in] | col_name | Name of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. Get the string/binary/varchar value for a column by its index.
These methods are faster than their name-based counterparts since using indices avoids a hashmap lookup, so index-based getters should be preferred in performance-sensitive code.
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetBool | ( | int | col_idx, |
bool * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetDate | ( | const Slice & | col_name, |
int32_t * | days_since_unix_epoch | ||
) | const |
[in] | col_name | The name of the target column. |
[out] | days_since_unix_epoch | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetDate | ( | int | col_idx, |
int32_t * | days_since_unix_epoch | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | days_since_unix_epoch | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetDouble | ( | int | col_idx, |
double * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetFloat | ( | int | col_idx, |
float * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetInt16 | ( | int | col_idx, |
int16_t * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetInt32 | ( | int | col_idx, |
int32_t * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetInt64 | ( | int | col_idx, |
int64_t * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. [in] | col_name | The name of the target column. |
[out] | val | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetInt8 | ( | int | col_idx, |
int8_t * | val | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. |
true:
NULL
. Get the string/binary/varchar value for a column by its name.
[in] | col_name | Name of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. Get the string/binary/varchar value for a column by its index.
These methods are faster than their name-based counterparts since using indices avoids a hashmap lookup, so index-based getters should be preferred in performance-sensitive code.
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetUnixTimeMicros | ( | const Slice & | col_name, |
int64_t * | micros_since_utc_epoch | ||
) | const |
[in] | col_name | The name of the target column. |
[out] | micros_since_utc_epoch | Placeholder for the result value. |
true:
NULL
. Status kudu::client::KuduScanBatch::GetUnixTimeMicros | ( | int | col_idx, |
int64_t * | micros_since_utc_epoch | ||
) | const |
[in] | col_idx | The index of the column. |
[out] | micros_since_utc_epoch | Pointer to the placeholder to put the resulting value. |
true:
NULL
. Get the string/binary/varchar value for a column by its name.
[in] | col_name | Name of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. Get the string/binary/varchar value for a column by its index.
These methods are faster than their name-based counterparts since using indices avoids a hashmap lookup, so index-based getters should be preferred in performance-sensitive code.
[in] | col_idx | The index of the column. |
[out] | val | Pointer to the placeholder to put the resulting value. Note that the method does not copy the value. Callers should copy the resulting Slice if necessary. |
true:
NULL
. Slice kudu::client::KuduScanBatch::indirect_data | ( | ) | const |
Like the method above, but for indirect data.
Status kudu::client::KuduScanBatch::IsDeleted | ( | bool * | val | ) | const |
Get the value of the IS_DELETED virtual column.
[out] | val | Placeholder for the result value. |
bool kudu::client::KuduScanBatch::IsNull | ( | const Slice & | col_name | ) | const |
[in] | col_name | Name of the column. |
true
iff the specified column of the row has NULL
value. bool kudu::client::KuduScanBatch::IsNull | ( | int | col_idx | ) | const |
[in] | col_idx | Index of the column. |
true
iff the specified column of the row has NULL
value. int kudu::client::KuduScanBatch::NumRows | ( | ) | const |
|
inline |
An operator to check whether two iterators are 'not equal'.
[in] | other | The iterator to compare with. |
true
iff the other iterator points to a different row in the same batch, or to a row belonging to a different batch altogether.
|
inline |
|
inline |
Prefix increment operator: advances the iterator to the next position.
|
inline |
Postfix increment operator: advances the iterator to the next position.
|
inline |
Overloaded operator -> to support pointer trait for access via const_iterator.
|
inline |
|
inline |
An operator to check whether two iterators are 'equal'.
[in] | other | The iterator to compare with. |
true
iff the other iterator points to the same row of the same batch. const KuduSchema * kudu::client::KuduScanBatch::projection_schema | ( | ) | const |
KuduScanBatch::RowPtr kudu::client::KuduScanBatch::Row | ( | int | idx | ) | const |
Get a row at the specified index.
[in] | idx | The index of the row to return. |
|
inline |
Construct an invalid RowPtr. Before use, you must assign a properly-initialized value.
std::string kudu::client::KuduScanBatch::ToString | ( | ) | const |