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
364 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val) WARN_UNUSED_RESULT;
386 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
388 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
389 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
390 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
391 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
392 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
394 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
395 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
396 #if KUDU_INT128_SUPPORTED
397 Status GetUnscaledDecimal(
int col_idx, int128_t* val) WARN_UNUSED_RESULT;
418 Status GetString(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
419 Status GetBinary(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
443 Status GetString(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
444 Status GetBinary(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
462 Status EncodeRowKey(std::string* encoded_key)
const;
470 std::string ToEncodedRowKeyOrDie()
const;
478 bool IsKeySet()
const;
481 bool AllColumnsSet()
const;
488 std::string ToString()
const;
491 const Schema*
schema()
const {
return schema_; }
494 friend class client::KuduWriteOperation;
495 friend class KeyUtilTest;
496 friend class PartitionSchema;
497 friend class RowOperationsPBDecoder;
498 friend class RowOperationsPBEncoder;
499 friend class TestScanSpec;
500 template<
typename KeyTypeWrapper>
friend struct client::SliceKeysTestSetup;
501 template<
typename KeyTypeWrapper>
friend struct client::IntKeysTestSetup;
502 template<
typename KeyTypeWrapper>
friend struct tablet::SliceTypeRowOps;
503 template<
typename KeyTypeWrapper>
friend struct tablet::NumTypeRowOps;
504 FRIEND_TEST(KeyUtilTest, TestIncrementInt128PrimaryKey);
505 FRIEND_TEST(PartitionPrunerTest, TestIntPartialPrimaryKeyRangePruning);
506 FRIEND_TEST(PartitionPrunerTest, TestPartialPrimaryKeyRangePruning);
507 FRIEND_TEST(PartitionPrunerTest, TestPrimaryKeyRangePruning);
510 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
514 Status Set(
int col_idx,
const typename T::cpp_type& val,
518 Status Set(int32_t column_idx,
const uint8_t* val);
521 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
524 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
527 Status SetSliceCopy(
const Slice& col_name,
const Slice& val);
530 Status SetSliceCopy(
int col_idx,
const Slice& val);
536 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
539 void DeallocateOwnedStrings();
541 const Schema* schema_;
546 uint8_t* isset_bitmap_;
551 uint8_t* owned_strings_bitmap_;
const Schema * schema() const
Definition: partial_row.h:491
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:64