Kudu C++ client API
|
A row which may only contain values for a subset of the columns. More...
#include <partial_row.h>
Public Member Functions | |||||||
KuduPartialRow (const Schema *schema) | |||||||
KuduPartialRow (const KuduPartialRow &other) | |||||||
KuduPartialRow & | operator= (KuduPartialRow other) | ||||||
Status | SetNull (const Slice &col_name) WARN_UNUSED_RESULT | ||||||
Status | SetNull (int col_idx) WARN_UNUSED_RESULT | ||||||
Status | Unset (const Slice &col_name) WARN_UNUSED_RESULT | ||||||
Status | Unset (int col_idx) WARN_UNUSED_RESULT | ||||||
bool | IsColumnSet (const Slice &col_name) const | ||||||
bool | IsColumnSet (int col_idx) const | ||||||
bool | IsNull (const Slice &col_name) const | ||||||
bool | IsNull (int col_idx) const | ||||||
Status | EncodeRowKey (std::string *encoded_key) const | ||||||
std::string | ToEncodedRowKeyOrDie () const | ||||||
bool | IsKeySet () const | ||||||
bool | AllColumnsSet () const | ||||||
std::string | ToString () const | ||||||
const Schema * | schema () const | ||||||
Setters for integral type columns by name. | |||||||
Set value for a column by name.
| |||||||
Status | SetBool (const Slice &col_name, bool val) WARN_UNUSED_RESULT | ||||||
Status | SetInt8 (const Slice &col_name, int8_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt16 (const Slice &col_name, int16_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt32 (const Slice &col_name, int32_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt64 (const Slice &col_name, int64_t val) WARN_UNUSED_RESULT | ||||||
Status | SetUnixTimeMicros (const Slice &col_name, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT | ||||||
Status | SetFloat (const Slice &col_name, float val) WARN_UNUSED_RESULT | ||||||
Status | SetDouble (const Slice &col_name, double val) WARN_UNUSED_RESULT | ||||||
Setters for integral type columns by index. | |||||||
Set value for a column by index. These setters are the same as corresponding column-name-based setters, but with numeric column indexes. These are faster since they avoid hashmap lookups, so should be preferred in performance-sensitive code (e.g. bulk loaders).
| |||||||
Status | SetBool (int col_idx, bool val) WARN_UNUSED_RESULT | ||||||
Status | SetInt8 (int col_idx, int8_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt16 (int col_idx, int16_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt32 (int col_idx, int32_t val) WARN_UNUSED_RESULT | ||||||
Status | SetInt64 (int col_idx, int64_t val) WARN_UNUSED_RESULT | ||||||
Status | SetUnixTimeMicros (int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT | ||||||
Status | SetFloat (int col_idx, float val) WARN_UNUSED_RESULT | ||||||
Status | SetDouble (int col_idx, double val) WARN_UNUSED_RESULT | ||||||
Setters for binary/string columns by name (copying). | |||||||
Set the binary/string value for a column by name, copying the specified data immediately.
| |||||||
Status | SetBinary (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetString (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetBinaryCopy (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetStringCopy (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Setters for binary/string columns by index (copying). | |||||||
Set the binary/string value for a column by index, copying the specified data immediately. These setters are the same as the corresponding column-name-based setters, but with numeric column indexes. These are faster since they avoid hashmap lookups, so should be preferred in performance-sensitive code (e.g. bulk loaders).
| |||||||
Status | SetBinary (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetString (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetStringCopy (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetBinaryCopy (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Setters for binary/string columns by name (non-copying). | |||||||
Set the binary/string value for a column by name, not copying the specified data.
| |||||||
Status | SetBinaryNoCopy (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetStringNoCopy (const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT | ||||||
Setters for binary/string columns by index (non-copying). | |||||||
Set the binary/string value for a column by index, not copying the specified data. These setters are the same as the corresponding column-name-based setters, but with numeric column indexes. These are faster since they avoid hashmap lookups, so should be preferred in performance-sensitive code (e.g. bulk loaders).
| |||||||
Status | SetBinaryNoCopy (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Status | SetStringNoCopy (int col_idx, const Slice &val) WARN_UNUSED_RESULT | ||||||
Getters for integral type columns by column name. | |||||||
Get value of the column specified by 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 | 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 column of integral type by column index. | |||||||
Get value of a column of integral type by column index. These getters are the same as the corresponding column-name-based getters, but with numeric column indexes. These are faster since they avoid hashmap lookups, so should be preferred in performance-sensitive code (e.g. bulk loaders).
| |||||||
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 | 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 column by column name. | |||||||
Get the string/binary value for a column by its 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 | ||||||
Getters for string/binary column by column index. | |||||||
Get the string/binary value for a column by its index. These methods are faster than their name-based counterparts since they use indices to avoid hashmap lookups, so index-based getters should be preferred in performance-sensitive code.
| |||||||
Status | GetString (int col_idx, Slice *val) const WARN_UNUSED_RESULT | ||||||
Status | GetBinary (int col_idx, Slice *val) const WARN_UNUSED_RESULT | ||||||
A row which may only contain values for a subset of the columns.
This object contains a normal contiguous row, plus a bitfield indicating which columns have been set. Additionally, this type may optionally own copies of indirect data for variable length columns.
|
explicit |
[in] | schema | Schema to use for the row. The given Schema object must remain valid for the lifetime of this row. |
kudu::KuduPartialRow::KuduPartialRow | ( | const KuduPartialRow & | other | ) |
Create a copy of KuduPartialRow instance.
[in] | other | KuduPartialRow instance to copy from. |
bool kudu::KuduPartialRow::AllColumnsSet | ( | ) | const |
true
if all column values have been set. Status kudu::KuduPartialRow::EncodeRowKey | ( | std::string * | encoded_key | ) | const |
Encode a row key.
The result is suitable for use as a tablet split key, an encoded key range, etc.
[out] | encoded_key | The encoded key (i.e. the result of the encoding). |
bool kudu::KuduPartialRow::IsColumnSet | ( | const Slice & | col_name | ) | const |
Check whether the specified column is set for the row.
[in] | col_name | Name of the column. |
true
iff the given column has been specified. bool kudu::KuduPartialRow::IsColumnSet | ( | int | col_idx | ) | const |
Check whether the specified column is set for the row.
[in] | col_idx | The index of the column. |
true
iff the given column has been specified. bool kudu::KuduPartialRow::IsKeySet | ( | ) | const |
true
if all key column values have been set for this mutation. bool kudu::KuduPartialRow::IsNull | ( | const Slice & | col_name | ) | const |
Check whether the specified column is NULL
for the row.
[in] | col_name | Name of the target column. |
true
iff the given column's value is NULL
. bool kudu::KuduPartialRow::IsNull | ( | int | col_idx | ) | const |
Check whether the specified column is NULL
for the row.
[in] | col_idx | The index of the column. |
true
iff the given column's value is NULL
. KuduPartialRow& kudu::KuduPartialRow::operator= | ( | KuduPartialRow | other | ) |
Overwrite this KuduPartialRow instance with data from other instance.
[in] | other | KuduPartialRow instance to assign from. |
|
inline |
Set column value to NULL
; the column is identified by its name.
This will only succeed on nullable columns. Use Unset() to restore column value to its default.
[in] | col_name | Name of the target column. |
Status kudu::KuduPartialRow::SetNull | ( | int | col_idx | ) |
Set column value to NULL
; the column is identified by its index.
This will only succeed on nullable columns. Use Unset() to restore column value to its default.
[in] | col_idx | The index of the target column. |
std::string kudu::KuduPartialRow::ToEncodedRowKeyOrDie | ( | ) | const |
Convenience method which is similar to EncodeRowKey.
This is equivalent to the EncodeRowKey, but triggers a FATAL error on failure.
std::string kudu::KuduPartialRow::ToString | ( | ) | const |
Unset the given column by name, restoring its default value.
NULL
.[in] | col_name | Name of the target column. |
Status kudu::KuduPartialRow::Unset | ( | int | col_idx | ) |
Unset the given column by index, restoring its default value.
NULL
.[in] | col_idx | The index of the target column. |