17 #ifndef KUDU_COMMON_PARTIAL_ROW_H
18 #define KUDU_COMMON_PARTIAL_ROW_H
24 #ifdef KUDU_HEADERS_NO_STUBS
25 #include "kudu/gutil/macros.h"
26 #include "kudu/gutil/port.h"
27 #include <gtest/gtest_prod.h>
31 #include "kudu/client/stubs.h"
34 #include "kudu/util/kudu_export.h"
35 #include "kudu/util/slice.h"
40 class KuduWriteOperation;
86 Status SetBool(
const Slice& col_name,
bool val) WARN_UNUSED_RESULT;
88 Status SetInt8(
const Slice& col_name, int8_t val) WARN_UNUSED_RESULT;
89 Status SetInt16(
const Slice& col_name, int16_t val) WARN_UNUSED_RESULT;
90 Status SetInt32(
const Slice& col_name, int32_t val) WARN_UNUSED_RESULT;
91 Status SetInt64(
const Slice& col_name, int64_t val) WARN_UNUSED_RESULT;
93 int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
95 Status SetFloat(
const Slice& col_name,
float val) WARN_UNUSED_RESULT;
96 Status SetDouble(
const Slice& col_name,
double val) WARN_UNUSED_RESULT;
115 Status SetBool(
int col_idx,
bool val) WARN_UNUSED_RESULT;
117 Status SetInt8(
int col_idx, int8_t val) WARN_UNUSED_RESULT;
118 Status SetInt16(
int col_idx, int16_t val) WARN_UNUSED_RESULT;
119 Status SetInt32(
int col_idx, int32_t val) WARN_UNUSED_RESULT;
120 Status SetInt64(
int col_idx, int64_t val) WARN_UNUSED_RESULT;
121 Status SetUnixTimeMicros(
int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
123 Status SetFloat(
int col_idx,
float val) WARN_UNUSED_RESULT;
124 Status SetDouble(
int col_idx,
double val) WARN_UNUSED_RESULT;
144 Status SetBinary(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
145 Status SetString(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
170 Status SetBinary(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
171 Status SetString(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
186 Status SetBinaryCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
187 Status SetStringCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
207 Status SetStringCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
208 Status SetBinaryCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
228 Status SetBinaryNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
229 Status SetStringNoCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
254 Status SetBinaryNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
255 Status SetStringNoCopy(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
266 Status SetNull(
const Slice& col_name) WARN_UNUSED_RESULT;
276 Status SetNull(
int col_idx) WARN_UNUSED_RESULT;
285 Status Unset(
const Slice& col_name) WARN_UNUSED_RESULT;
294 Status Unset(
int col_idx) WARN_UNUSED_RESULT;
301 bool IsColumnSet(
const Slice& col_name)
const;
308 bool IsColumnSet(
int col_idx)
const;
315 bool IsNull(
const Slice& col_name)
const;
322 bool IsNull(
int col_idx)
const;
335 Status GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
337 Status GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
338 Status GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
339 Status GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
340 Status GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
342 int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
344 Status GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
345 Status GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
366 Status GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
368 Status GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
369 Status GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
370 Status GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
371 Status GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
372 Status GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
374 Status GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
375 Status GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
395 Status GetString(
const Slice& col_name,
Slice* val)
const WARN_UNUSED_RESULT;
396 Status GetBinary(
const Slice& col_name,
Slice* val)
const WARN_UNUSED_RESULT;
420 Status GetString(
int col_idx,
Slice* val)
const WARN_UNUSED_RESULT;
421 Status GetBinary(
int col_idx,
Slice* val)
const WARN_UNUSED_RESULT;
439 Status EncodeRowKey(std::string* encoded_key)
const;
447 std::string ToEncodedRowKeyOrDie()
const;
455 bool IsKeySet()
const;
458 bool AllColumnsSet()
const;
461 std::string ToString()
const;
464 const Schema*
schema()
const {
return schema_; }
468 friend class KeyUtilTest;
469 friend class PartitionSchema;
470 friend class RowOperationsPBDecoder;
471 friend class RowOperationsPBEncoder;
472 friend class TestScanSpec;
475 FRIEND_TEST(TestPartitionPruner, TestPrimaryKeyRangePruning);
476 FRIEND_TEST(TestPartitionPruner, TestPartialPrimaryKeyRangePruning);
479 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
483 Status Set(
int col_idx,
const typename T::cpp_type& val,
487 Status Set(int32_t column_idx,
const uint8_t* val);
490 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
493 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
499 Status SetSliceCopy(
int col_idx,
const Slice& val);
505 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
508 void DeallocateOwnedStrings();
510 const Schema* schema_;
515 uint8_t* isset_bitmap_;
520 uint8_t* owned_strings_bitmap_;
A representation of an operation's outcome.
Definition: status.h:106
Definition: partial_row.h:42
Definition: partial_row.h:41
A wrapper around externally allocated data.
Definition: slice.h:43
const Schema * schema() const
Definition: partial_row.h:464
A single-row write operation to be sent to a Kudu table.
Definition: write_op.h:55
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:53