17 #ifndef KUDU_COMMON_PARTIAL_ROW_H
18 #define KUDU_COMMON_PARTIAL_ROW_H
26 #ifdef KUDU_HEADERS_NO_STUBS
27 #include <gtest/gtest_prod.h>
29 #include "kudu/gutil/port.h"
33 #include "kudu/client/stubs.h"
36 #include "kudu/util/kudu_export.h"
38 #include "kudu/util/slice.h"
44 class KuduWriteOperation;
45 template<
typename KeyTypeWrapper>
struct SliceKeysTestSetup;
46 template<
typename KeyTypeWrapper>
struct IntKeysTestSetup;
50 template<
typename KeyTypeWrapper>
struct SliceTypeRowOps;
51 template<
typename KeyTypeWrapper>
struct NumTypeRowOps;
96 Status SetBool(
const Slice& col_name,
bool val) WARN_UNUSED_RESULT;
98 Status SetInt8(
const Slice& col_name, int8_t val) WARN_UNUSED_RESULT;
99 Status SetInt16(
const Slice& col_name, int16_t val) WARN_UNUSED_RESULT;
100 Status SetInt32(
const Slice& col_name, int32_t val) WARN_UNUSED_RESULT;
101 Status SetInt64(
const Slice& col_name, int64_t val) WARN_UNUSED_RESULT;
102 Status SetUnixTimeMicros(
const Slice& col_name,
103 int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
105 Status SetFloat(
const Slice& col_name,
float val) WARN_UNUSED_RESULT;
106 Status SetDouble(
const Slice& col_name,
double val) WARN_UNUSED_RESULT;
125 Status SetBool(
int col_idx,
bool val) WARN_UNUSED_RESULT;
127 Status SetInt8(
int col_idx, int8_t val) WARN_UNUSED_RESULT;
128 Status SetInt16(
int col_idx, int16_t val) WARN_UNUSED_RESULT;
129 Status SetInt32(
int col_idx, int32_t val) WARN_UNUSED_RESULT;
130 Status SetInt64(
int col_idx, int64_t val) WARN_UNUSED_RESULT;
131 Status SetUnixTimeMicros(
int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
133 Status SetFloat(
int col_idx,
float val) WARN_UNUSED_RESULT;
134 Status SetDouble(
int col_idx,
double val) WARN_UNUSED_RESULT;
154 Status SetBinary(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
155 Status SetString(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
180 Status SetBinary(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
181 Status SetString(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
196 Status SetBinaryCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
197 Status SetStringCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
217 Status SetStringCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
218 Status SetBinaryCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
238 Status SetBinaryNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
239 Status SetStringNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
264 Status SetBinaryNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
265 Status SetStringNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
276 Status SetNull(
const Slice& col_name) WARN_UNUSED_RESULT;
286 Status SetNull(
int col_idx) WARN_UNUSED_RESULT;
295 Status Unset(
const Slice& col_name) WARN_UNUSED_RESULT;
304 Status Unset(
int col_idx) WARN_UNUSED_RESULT;
311 bool IsColumnSet(
const Slice& col_name)
const;
318 bool IsColumnSet(
int col_idx)
const;
325 bool IsNull(
const Slice& col_name)
const;
332 bool IsNull(
int col_idx)
const;
345 Status GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
347 Status GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
348 Status GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
349 Status GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
350 Status GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
351 Status GetUnixTimeMicros(
const Slice& col_name,
352 int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
354 Status GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
355 Status GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
376 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
378 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
379 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
380 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
381 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
382 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
384 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
385 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
405 Status GetString(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
406 Status GetBinary(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
430 Status GetString(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
431 Status GetBinary(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
449 Status EncodeRowKey(std::string* encoded_key)
const;
457 std::string ToEncodedRowKeyOrDie()
const;
465 bool IsKeySet()
const;
468 bool AllColumnsSet()
const;
475 std::string ToString()
const;
478 const Schema*
schema()
const {
return schema_; }
481 friend class client::KuduWriteOperation;
482 friend class KeyUtilTest;
483 friend class PartitionSchema;
484 friend class RowOperationsPBDecoder;
485 friend class RowOperationsPBEncoder;
486 friend class TestScanSpec;
487 template<
typename KeyTypeWrapper>
friend struct client::SliceKeysTestSetup;
488 template<
typename KeyTypeWrapper>
friend struct client::IntKeysTestSetup;
489 template<
typename KeyTypeWrapper>
friend struct tablet::SliceTypeRowOps;
490 template<
typename KeyTypeWrapper>
friend struct tablet::NumTypeRowOps;
491 FRIEND_TEST(PartitionPrunerTest, TestPrimaryKeyRangePruning);
492 FRIEND_TEST(PartitionPrunerTest, TestPartialPrimaryKeyRangePruning);
495 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
499 Status Set(
int col_idx,
const typename T::cpp_type& val,
503 Status Set(int32_t column_idx,
const uint8_t* val);
506 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
509 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
512 Status SetSliceCopy(
const Slice& col_name,
const Slice& val);
515 Status SetSliceCopy(
int col_idx,
const Slice& val);
521 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
524 void DeallocateOwnedStrings();
526 const Schema* schema_;
531 uint8_t* isset_bitmap_;
536 uint8_t* owned_strings_bitmap_;
const Schema * schema() const
Definition: partial_row.h:478
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:63