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/int128.h" 37 #include "kudu/util/kudu_export.h" 38 #include "kudu/util/slice.h" 45 class KuduWriteOperation;
46 template<
typename KeyTypeWrapper>
struct SliceKeysTestSetup;
47 template<
typename KeyTypeWrapper>
struct IntKeysTestSetup;
51 template<
typename KeyTypeWrapper>
struct SliceTypeRowOps;
52 template<
typename KeyTypeWrapper>
struct NumTypeRowOps;
97 Status SetBool(
const Slice& col_name,
bool val) WARN_UNUSED_RESULT;
99 Status SetInt8(
const Slice& col_name, int8_t val) WARN_UNUSED_RESULT;
100 Status SetInt16(
const Slice& col_name, int16_t val) WARN_UNUSED_RESULT;
101 Status SetInt32(
const Slice& col_name, int32_t val) WARN_UNUSED_RESULT;
102 Status SetInt64(
const Slice& col_name, int64_t val) WARN_UNUSED_RESULT;
103 Status SetUnixTimeMicros(
const Slice& col_name,
104 int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
106 Status SetFloat(
const Slice& col_name,
float val) WARN_UNUSED_RESULT;
107 Status SetDouble(
const Slice& col_name,
double val) WARN_UNUSED_RESULT;
108 #if KUDU_INT128_SUPPORTED 109 Status SetUnscaledDecimal(
const Slice& col_name, int128_t val) WARN_UNUSED_RESULT;
129 Status SetBool(
int col_idx,
bool val) WARN_UNUSED_RESULT;
131 Status SetInt8(
int col_idx, int8_t val) WARN_UNUSED_RESULT;
132 Status SetInt16(
int col_idx, int16_t val) WARN_UNUSED_RESULT;
133 Status SetInt32(
int col_idx, int32_t val) WARN_UNUSED_RESULT;
134 Status SetInt64(
int col_idx, int64_t val) WARN_UNUSED_RESULT;
135 Status SetUnixTimeMicros(
int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
137 Status SetFloat(
int col_idx,
float val) WARN_UNUSED_RESULT;
138 Status SetDouble(
int col_idx,
double val) WARN_UNUSED_RESULT;
139 #if KUDU_INT128_SUPPORTED 140 Status SetUnscaledDecimal(
int col_idx, int128_t val) WARN_UNUSED_RESULT;
161 Status SetBinary(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
162 Status SetString(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
187 Status SetBinary(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
188 Status SetString(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
203 Status SetBinaryCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
204 Status SetStringCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
224 Status SetStringCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
225 Status SetBinaryCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
245 Status SetBinaryNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
246 Status SetStringNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
271 Status SetBinaryNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
272 Status SetStringNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
283 Status SetNull(
const Slice& col_name) WARN_UNUSED_RESULT;
293 Status SetNull(
int col_idx) WARN_UNUSED_RESULT;
302 Status Unset(
const Slice& col_name) WARN_UNUSED_RESULT;
311 Status Unset(
int col_idx) WARN_UNUSED_RESULT;
318 bool IsColumnSet(
const Slice& col_name)
const;
325 bool IsColumnSet(
int col_idx)
const;
332 bool IsNull(
const Slice& col_name)
const;
339 bool IsNull(
int col_idx)
const;
352 Status GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
354 Status GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
355 Status GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
356 Status GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
357 Status GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
358 Status GetUnixTimeMicros(
const Slice& col_name,
359 int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
361 Status GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
362 Status GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
363 #if KUDU_INT128_SUPPORTED 365 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val) WARN_UNUSED_RESULT;
366 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val)
const WARN_UNUSED_RESULT;
388 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
390 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
391 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
392 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
393 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
394 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
396 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
397 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
398 #if KUDU_INT128_SUPPORTED 400 Status GetUnscaledDecimal(
int col_idx, int128_t* val) WARN_UNUSED_RESULT;
401 Status GetUnscaledDecimal(
int col_idx, int128_t* val)
const WARN_UNUSED_RESULT;
422 Status GetString(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
423 Status GetBinary(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
447 Status GetString(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
448 Status GetBinary(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
466 Status EncodeRowKey(std::string* encoded_key)
const;
474 std::string ToEncodedRowKeyOrDie()
const;
482 bool IsKeySet()
const;
485 bool AllColumnsSet()
const;
492 std::string ToString()
const;
495 const Schema*
schema()
const {
return schema_; }
498 friend class client::KuduWriteOperation;
499 friend class KeyUtilTest;
500 friend class PartitionSchema;
501 friend class RowOperationsPBDecoder;
502 friend class RowOperationsPBEncoder;
503 friend class TestScanSpec;
504 template<
typename KeyTypeWrapper>
friend struct client::SliceKeysTestSetup;
505 template<
typename KeyTypeWrapper>
friend struct client::IntKeysTestSetup;
506 template<
typename KeyTypeWrapper>
friend struct tablet::SliceTypeRowOps;
507 template<
typename KeyTypeWrapper>
friend struct tablet::NumTypeRowOps;
508 FRIEND_TEST(KeyUtilTest, TestIncrementInt128PrimaryKey);
509 FRIEND_TEST(PartitionPrunerTest, TestIntPartialPrimaryKeyRangePruning);
510 FRIEND_TEST(PartitionPrunerTest, TestPartialPrimaryKeyRangePruning);
511 FRIEND_TEST(PartitionPrunerTest, TestPrimaryKeyRangePruning);
514 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
518 Status Set(
int col_idx,
const typename T::cpp_type& val,
522 Status Set(int32_t column_idx,
const uint8_t* val);
525 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
528 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
531 Status SetSliceCopy(
const Slice& col_name,
const Slice& val);
534 Status SetSliceCopy(
int col_idx,
const Slice& val);
540 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
543 void DeallocateOwnedStrings();
545 const Schema* schema_;
550 uint8_t* isset_bitmap_;
555 uint8_t* owned_strings_bitmap_;
Definition: callbacks.h:28
const Schema * schema() const
Definition: partial_row.h:495
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:64