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;
101 Status SetBool(
const Slice& col_name,
bool val) WARN_UNUSED_RESULT;
103 Status SetInt8(
const Slice& col_name, int8_t val) WARN_UNUSED_RESULT;
104 Status SetInt16(
const Slice& col_name, int16_t val) WARN_UNUSED_RESULT;
105 Status SetInt32(
const Slice& col_name, int32_t val) WARN_UNUSED_RESULT;
106 Status SetInt64(
const Slice& col_name, int64_t val) WARN_UNUSED_RESULT;
107 Status SetUnixTimeMicros(
const Slice& col_name,
108 int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
110 Status SetFloat(
const Slice& col_name,
float val) WARN_UNUSED_RESULT;
111 Status SetDouble(
const Slice& col_name,
double val) WARN_UNUSED_RESULT;
112 #if KUDU_INT128_SUPPORTED
113 Status SetUnscaledDecimal(
const Slice& col_name, int128_t val) WARN_UNUSED_RESULT;
133 Status SetBool(
int col_idx,
bool val) WARN_UNUSED_RESULT;
135 Status SetInt8(
int col_idx, int8_t val) WARN_UNUSED_RESULT;
136 Status SetInt16(
int col_idx, int16_t val) WARN_UNUSED_RESULT;
137 Status SetInt32(
int col_idx, int32_t val) WARN_UNUSED_RESULT;
138 Status SetInt64(
int col_idx, int64_t val) WARN_UNUSED_RESULT;
139 Status SetUnixTimeMicros(
int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
141 Status SetFloat(
int col_idx,
float val) WARN_UNUSED_RESULT;
142 Status SetDouble(
int col_idx,
double val) WARN_UNUSED_RESULT;
143 #if KUDU_INT128_SUPPORTED
144 Status SetUnscaledDecimal(
int col_idx, int128_t val) WARN_UNUSED_RESULT;
165 Status SetBinary(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
166 Status SetString(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
191 Status SetBinary(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
192 Status SetString(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
207 Status SetBinaryCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
208 Status SetStringCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
228 Status SetStringCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
229 Status SetBinaryCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
249 Status SetBinaryNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
250 Status SetStringNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
275 Status SetBinaryNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
276 Status SetStringNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
287 Status SetNull(
const Slice& col_name) WARN_UNUSED_RESULT;
297 Status SetNull(
int col_idx) WARN_UNUSED_RESULT;
306 Status Unset(
const Slice& col_name) WARN_UNUSED_RESULT;
315 Status Unset(
int col_idx) WARN_UNUSED_RESULT;
322 bool IsColumnSet(
const Slice& col_name)
const;
329 bool IsColumnSet(
int col_idx)
const;
336 bool IsNull(
const Slice& col_name)
const;
343 bool IsNull(
int col_idx)
const;
356 Status GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
358 Status GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
359 Status GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
360 Status GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
361 Status GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
362 Status GetUnixTimeMicros(
const Slice& col_name,
363 int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
365 Status GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
366 Status GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
367 #if KUDU_INT128_SUPPORTED
369 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val) WARN_UNUSED_RESULT;
370 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val)
const WARN_UNUSED_RESULT;
392 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
394 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
395 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
396 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
397 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
398 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
400 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
401 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
402 #if KUDU_INT128_SUPPORTED
404 Status GetUnscaledDecimal(
int col_idx, int128_t* val) WARN_UNUSED_RESULT;
405 Status GetUnscaledDecimal(
int col_idx, int128_t* val)
const WARN_UNUSED_RESULT;
426 Status GetString(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
427 Status GetBinary(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
451 Status GetString(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
452 Status GetBinary(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
470 Status EncodeRowKey(std::string* encoded_key)
const;
478 std::string ToEncodedRowKeyOrDie()
const;
486 bool IsKeySet()
const;
489 bool AllColumnsSet()
const;
496 std::string ToString()
const;
499 const Schema*
schema()
const {
return schema_; }
502 friend class client::KuduWriteOperation;
503 friend class KeyUtilTest;
504 friend class PartitionSchema;
505 friend class RowOperationsPBDecoder;
506 friend class RowOperationsPBEncoder;
507 friend class tools::TableScanner;
508 friend class TestScanSpec;
509 template<
typename KeyTypeWrapper>
friend struct client::SliceKeysTestSetup;
510 template<
typename KeyTypeWrapper>
friend struct client::IntKeysTestSetup;
511 template<
typename KeyTypeWrapper>
friend struct tablet::SliceTypeRowOps;
512 template<
typename KeyTypeWrapper>
friend struct tablet::NumTypeRowOps;
513 FRIEND_TEST(KeyUtilTest, TestIncrementInt128PrimaryKey);
514 FRIEND_TEST(PartitionPrunerTest, TestIntPartialPrimaryKeyRangePruning);
515 FRIEND_TEST(PartitionPrunerTest, TestPartialPrimaryKeyRangePruning);
516 FRIEND_TEST(PartitionPrunerTest, TestPrimaryKeyRangePruning);
519 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
523 Status Set(
int col_idx,
const typename T::cpp_type& val,
527 Status Set(int32_t column_idx,
const uint8_t* val);
530 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
533 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
536 Status SetSliceCopy(
const Slice& col_name,
const Slice& val);
539 Status SetSliceCopy(
int col_idx,
const Slice& val);
545 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
548 void DeallocateOwnedStrings();
550 const Schema* schema_;
555 uint8_t* isset_bitmap_;
560 uint8_t* owned_strings_bitmap_;
const Schema * schema() const
Definition: partial_row.h:499
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:68