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"
45class ClientTest_TestProjectionPredicatesFuzz_Test;
46class KuduWriteOperation;
50template<
typename KeyTypeWrapper>
struct SliceKeysTestSetup;
51template<
typename KeyTypeWrapper>
struct IntKeysTestSetup;
55 template<
typename KeyTypeWrapper>
struct SliceTypeRowOps;
56 template<
typename KeyTypeWrapper>
struct NumTypeRowOps;
104 Status
SetBool(
const Slice& col_name,
bool val) WARN_UNUSED_RESULT;
105 Status
SetInt8(
const Slice& col_name, int8_t val) WARN_UNUSED_RESULT;
106 Status
SetInt16(
const Slice& col_name, int16_t val) WARN_UNUSED_RESULT;
107 Status
SetInt32(
const Slice& col_name, int32_t val) WARN_UNUSED_RESULT;
108 Status
SetInt64(
const Slice& col_name, int64_t val) WARN_UNUSED_RESULT;
109 Status
SetSerial(
const Slice& col_name, uint64_t val) WARN_UNUSED_RESULT;
118 int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT;
126 Status
SetDate(
const Slice& col_name, int32_t days_since_unix_epoch) WARN_UNUSED_RESULT;
127 Status
SetFloat(
const Slice& col_name,
float val) WARN_UNUSED_RESULT;
128 Status
SetDouble(
const Slice& col_name,
double val) WARN_UNUSED_RESULT;
129#if KUDU_INT128_SUPPORTED
130 Status SetUnscaledDecimal(
const Slice& col_name, int128_t val) WARN_UNUSED_RESULT;
147 Status
SetBool(
int col_idx,
bool val) WARN_UNUSED_RESULT;
149 Status
SetInt8(
int col_idx, int8_t val) WARN_UNUSED_RESULT;
150 Status
SetInt16(
int col_idx, int16_t val) WARN_UNUSED_RESULT;
151 Status
SetInt32(
int col_idx, int32_t val) WARN_UNUSED_RESULT;
152 Status
SetInt64(
int col_idx, int64_t val) WARN_UNUSED_RESULT;
153 Status
SetSerial(
int col_idx, uint64_t val) WARN_UNUSED_RESULT;
167 Status
SetDate(
int col_idx, int32_t days_since_unix_epoch) WARN_UNUSED_RESULT;
169 Status
SetFloat(
int col_idx,
float val) WARN_UNUSED_RESULT;
170 Status
SetDouble(
int col_idx,
double val) WARN_UNUSED_RESULT;
171#if KUDU_INT128_SUPPORTED
172 Status SetUnscaledDecimal(
int col_idx, int128_t val) WARN_UNUSED_RESULT;
192 Status
SetBinary(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
193 Status
SetString(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
205 Status
SetVarchar(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
228 Status
SetBinary(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
229 Status
SetString(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
245 Status
SetVarchar(
int col_idx,
const Slice& val) WARN_UNUSED_RESULT;
258 Status
SetBinaryCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
259 Status
SetStringCopy(
const Slice& col_name,
const Slice& val) WARN_UNUSED_RESULT;
387 Status
SetNull(
const Slice& col_name) WARN_UNUSED_RESULT;
397 Status
SetNull(
int col_idx) WARN_UNUSED_RESULT;
406 Status
Unset(
const Slice& col_name) WARN_UNUSED_RESULT;
415 Status
Unset(
int col_idx) WARN_UNUSED_RESULT;
436 bool IsNull(
const Slice& col_name)
const;
459 Status
GetBool(
const Slice& col_name,
bool* val)
const WARN_UNUSED_RESULT;
461 Status
GetInt8(
const Slice& col_name, int8_t* val)
const WARN_UNUSED_RESULT;
462 Status
GetInt16(
const Slice& col_name, int16_t* val)
const WARN_UNUSED_RESULT;
463 Status
GetInt32(
const Slice& col_name, int32_t* val)
const WARN_UNUSED_RESULT;
464 Status
GetInt64(
const Slice& col_name, int64_t* val)
const WARN_UNUSED_RESULT;
465 Status
GetSerial(
const Slice& col_name, uint64_t* val)
const WARN_UNUSED_RESULT;
477 int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
488 Status
GetDate(
const Slice& col_name, int32_t* days_since_unix_epoch)
const WARN_UNUSED_RESULT;
489 Status
GetFloat(
const Slice& col_name,
float* val)
const WARN_UNUSED_RESULT;
490 Status
GetDouble(
const Slice& col_name,
double* val)
const WARN_UNUSED_RESULT;
491#if KUDU_INT128_SUPPORTED
493 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val) WARN_UNUSED_RESULT;
494 Status GetUnscaledDecimal(
const Slice& col_name, int128_t* val)
const WARN_UNUSED_RESULT;
517 Status
GetBool(
int col_idx,
bool* val)
const WARN_UNUSED_RESULT;
518 Status
GetInt8(
int col_idx, int8_t* val)
const WARN_UNUSED_RESULT;
519 Status
GetInt16(
int col_idx, int16_t* val)
const WARN_UNUSED_RESULT;
520 Status
GetInt32(
int col_idx, int32_t* val)
const WARN_UNUSED_RESULT;
521 Status
GetInt64(
int col_idx, int64_t* val)
const WARN_UNUSED_RESULT;
522 Status
GetSerial(
int col_idx, uint64_t* val)
const WARN_UNUSED_RESULT;
533 Status
GetUnixTimeMicros(
int col_idx, int64_t* micros_since_utc_epoch)
const WARN_UNUSED_RESULT;
544 Status
GetDate(
int col_idx, int32_t* days_since_unix_epoch)
const WARN_UNUSED_RESULT;
545 Status
GetFloat(
int col_idx,
float* val)
const WARN_UNUSED_RESULT;
546 Status
GetDouble(
int col_idx,
double* val)
const WARN_UNUSED_RESULT;
547#if KUDU_INT128_SUPPORTED
549 Status GetUnscaledDecimal(
int col_idx, int128_t* val) WARN_UNUSED_RESULT;
550 Status GetUnscaledDecimal(
int col_idx, int128_t* val)
const WARN_UNUSED_RESULT;
570 Status
GetString(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
571 Status
GetBinary(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
572 Status
GetVarchar(
const Slice& col_name, Slice* val)
const WARN_UNUSED_RESULT;
595 Status
GetString(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
596 Status
GetBinary(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
597 Status
GetVarchar(
int col_idx, Slice* val)
const WARN_UNUSED_RESULT;
652 const Schema*
schema()
const {
return schema_; }
655 friend class client::KuduWriteOperation;
656 friend class client::internal::WriteRpc;
657 friend class KeyUtilTest;
658 friend class PartitionSchema;
659 friend class RowOperationsPBDecoder;
660 friend class RowOperationsPBEncoder;
661 friend class ScanSpec;
662 friend class tools::TableScanner;
663 friend class TestScanSpec;
664 template<
typename KeyTypeWrapper>
friend struct client::SliceKeysTestSetup;
665 template<
typename KeyTypeWrapper>
friend struct client::IntKeysTestSetup;
666 template<
typename KeyTypeWrapper>
friend struct tablet::SliceTypeRowOps;
667 template<
typename KeyTypeWrapper>
friend struct tablet::NumTypeRowOps;
668 FRIEND_TEST(client::ClientTest, TestProjectionPredicatesFuzz);
669 FRIEND_TEST(KeyUtilTest, TestIncrementInt128PrimaryKey);
670 FRIEND_TEST(PartitionPrunerTest, TestIntPartialPrimaryKeyRangePruning);
671 FRIEND_TEST(PartitionPrunerTest, TestPartialPrimaryKeyRangePruning);
672 FRIEND_TEST(PartitionPrunerTest, TestPrimaryKeyRangePruning);
673 FRIEND_TEST(PartitionPrunerTest, TestHashSchemasPerRangeWithPartialPrimaryKeyRangePruning);
674 FRIEND_TEST(RowOperationsTest, ProjectionTestWholeSchemaSpecified);
675 FRIEND_TEST(RowOperationsTest, TestProjectUpdates);
676 FRIEND_TEST(RowOperationsTest, TestProjectDeletes);
679 Status Set(
const Slice& col_name,
const typename T::cpp_type& val,
683 Status Set(
int col_idx,
const typename T::cpp_type& val,
687 Status Set(int32_t column_idx,
const uint8_t* val);
690 Status Get(
const Slice& col_name,
typename T::cpp_type* val)
const;
693 Status Get(
int col_idx,
typename T::cpp_type* val)
const;
696 Status SetSliceCopy(
const Slice& col_name,
const Slice& val);
699 Status SetSliceCopy(
int col_idx,
const Slice& val);
705 void DeallocateStringIfSet(
int col_idx,
const ColumnSchema& col);
708 void DeallocateOwnedStrings();
710 const Schema* schema_;
715 uint8_t* isset_bitmap_;
720 uint8_t* owned_strings_bitmap_;
A row which may only contain values for a subset of the columns.
Definition partial_row.h:72
Status GetDate(const Slice &col_name, int32_t *days_since_unix_epoch) const WARN_UNUSED_RESULT
Status SetInt32(const Slice &col_name, int32_t val) WARN_UNUSED_RESULT
Status GetString(const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT
Status SetString(int col_idx, const Slice &val) WARN_UNUSED_RESULT
Status SetUnixTimeMicros(const Slice &col_name, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT
const Schema * schema() const
Definition partial_row.h:652
std::string ToString() const
Status GetFloat(int col_idx, float *val) const WARN_UNUSED_RESULT
Status SetBinaryCopy(int col_idx, const Slice &val) WARN_UNUSED_RESULT
Status SetDate(int col_idx, int32_t days_since_unix_epoch) WARN_UNUSED_RESULT
Status GetBinary(int col_idx, Slice *val) const WARN_UNUSED_RESULT
Status SetStringNoCopy(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
bool IsNull(int col_idx) const
Status SetSerial(const Slice &col_name, uint64_t val) WARN_UNUSED_RESULT
Status GetInt8(const Slice &col_name, int8_t *val) const WARN_UNUSED_RESULT
Status SetInt16(const Slice &col_name, int16_t val) WARN_UNUSED_RESULT
Status GetDouble(int col_idx, double *val) const WARN_UNUSED_RESULT
Status EncodeRowKey(std::string *encoded_key) const
bool IsNonUniqueKeySet() const
Status GetUnixTimeMicros(const Slice &col_name, int64_t *micros_since_utc_epoch) const WARN_UNUSED_RESULT
Status GetInt16(const Slice &col_name, int16_t *val) const WARN_UNUSED_RESULT
Status GetDouble(const Slice &col_name, double *val) const WARN_UNUSED_RESULT
Status SetVarchar(int col_idx, const Slice &val) WARN_UNUSED_RESULT
Status SetInt64(int col_idx, int64_t val) WARN_UNUSED_RESULT
Status SetFloat(const Slice &col_name, float val) WARN_UNUSED_RESULT
Status SetBinaryNoCopy(int col_idx, const Slice &val) WARN_UNUSED_RESULT
Status GetString(int col_idx, Slice *val) const WARN_UNUSED_RESULT
Status SetUnixTimeMicros(int col_idx, int64_t micros_since_utc_epoch) WARN_UNUSED_RESULT
std::string ToEncodedRowKeyOrDie() const
bool IsColumnSet(int col_idx) const
Status SetSerial(int col_idx, uint64_t val) WARN_UNUSED_RESULT
bool IsAutoIncrementingColumnSet() const
Status SetBinaryNoCopy(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status SetDouble(int col_idx, double val) WARN_UNUSED_RESULT
Status GetBool(const Slice &col_name, bool *val) const WARN_UNUSED_RESULT
Status SetInt8(const Slice &col_name, int8_t val) WARN_UNUSED_RESULT
Status SetBool(int col_idx, bool val) WARN_UNUSED_RESULT
Status GetSerial(int col_idx, uint64_t *val) const WARN_UNUSED_RESULT
Status GetInt32(int col_idx, int32_t *val) const WARN_UNUSED_RESULT
Status SetString(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status Unset(int col_idx) WARN_UNUSED_RESULT
Status GetInt16(int col_idx, int16_t *val) const WARN_UNUSED_RESULT
bool IsNull(const Slice &col_name) const
Status GetVarchar(int col_idx, Slice *val) const WARN_UNUSED_RESULT
Status GetInt32(const Slice &col_name, int32_t *val) const WARN_UNUSED_RESULT
Status GetSerial(const Slice &col_name, uint64_t *val) const WARN_UNUSED_RESULT
Status GetFloat(const Slice &col_name, float *val) const WARN_UNUSED_RESULT
Status SetStringCopy(int col_idx, const Slice &val) WARN_UNUSED_RESULT
Status GetInt64(int col_idx, int64_t *val) const WARN_UNUSED_RESULT
KuduPartialRow(const Schema *schema)
Status GetBinary(const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT
Status SetBinary(int col_idx, const Slice &val) WARN_UNUSED_RESULT
bool IsColumnSet(const Slice &col_name) const
Status SetStringCopy(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status GetUnixTimeMicros(int col_idx, int64_t *micros_since_utc_epoch) const WARN_UNUSED_RESULT
KuduPartialRow(const KuduPartialRow &other)
Status SetVarcharNoCopyUnsafe(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status SetDouble(const Slice &col_name, double val) WARN_UNUSED_RESULT
Status SetInt64(const Slice &col_name, int64_t val) WARN_UNUSED_RESULT
Status SetNull(int col_idx) WARN_UNUSED_RESULT
Status SetInt32(int col_idx, int32_t val) WARN_UNUSED_RESULT
Status SetDate(const Slice &col_name, int32_t days_since_unix_epoch) WARN_UNUSED_RESULT
Status SetBinaryCopy(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status SetFloat(int col_idx, float val) WARN_UNUSED_RESULT
Status SetVarchar(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status GetVarchar(const Slice &col_name, Slice *val) const WARN_UNUSED_RESULT
Status GetInt8(int col_idx, int8_t *val) const WARN_UNUSED_RESULT
Status SetInt16(int col_idx, int16_t val) WARN_UNUSED_RESULT
Status Unset(const Slice &col_name) WARN_UNUSED_RESULT
Status SetBinary(const Slice &col_name, const Slice &val) WARN_UNUSED_RESULT
Status GetInt64(const Slice &col_name, int64_t *val) const WARN_UNUSED_RESULT
Status SetStringNoCopy(int col_idx, const Slice &val) WARN_UNUSED_RESULT
bool AllColumnsSet() const
Status SetBool(const Slice &col_name, bool val) WARN_UNUSED_RESULT
Status SetNull(const Slice &col_name) WARN_UNUSED_RESULT
Status SetVarcharNoCopyUnsafe(int col_idx, const Slice &val) WARN_UNUSED_RESULT
KuduPartialRow & operator=(KuduPartialRow other)
Status GetDate(int col_idx, int32_t *days_since_unix_epoch) const WARN_UNUSED_RESULT
Status SetInt8(int col_idx, int8_t val) WARN_UNUSED_RESULT
Status GetBool(int col_idx, bool *val) const WARN_UNUSED_RESULT