18#ifndef KUDU_CLIENT_SCHEMA_H
19#define KUDU_CLIENT_SCHEMA_H
29#ifdef KUDU_HEADERS_NO_STUBS
30#include <gtest/gtest_prod.h>
32#include "kudu/gutil/macros.h"
33#include "kudu/gutil/port.h"
35#include "kudu/client/stubs.h"
38#include "kudu/util/kudu_export.h"
47struct ColumnSchemaDelta;
50class RemoteKsckCluster;
57class GetTableSchemaRpc;
123 class KUDU_NO_EXPORT Data;
148 DEFAULT_COMPRESSION = 0,
170 int32_t block_size = 0)
171 ATTRIBUTE_DEPRECATED("this constructor will be private in a future release")
172 : encoding_(encoding),
173 compression_(compression),
174 block_size_(block_size) {
231 TIMESTAMP = UNIXTIME_MICROS,
276 ATTRIBUTE_DEPRECATED(
"use operator==(const KuduColumnSchema&) instead");
300 const std::string&
name()
const;
331#ifdef KUDU_HEADERS_NO_STUBS
332 FRIEND_TEST(KuduColumnSchemaTest, TestEquals);
337#if defined(__clang__) || \
338 (defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40600)
339#pragma GCC diagnostic push
340#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
344 const std::string &name,
346 bool is_nullable =
false,
347 bool is_immutable =
false,
348 bool is_auto_incrementing =
false,
349 const void* default_value = NULL,
352 const std::string& comment =
"");
353#if defined(__clang__) || \
354 (defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40600)
355#pragma GCC diagnostic pop
578 class KUDU_NO_EXPORT Data;
591 Status ToColumnSchemaDelta(ColumnSchemaDelta* col_delta)
const;
593 Slice DefaultValueAsSlice()
const;
665 const std::vector<std::string>& key_col_names);
679 class KUDU_NO_EXPORT Data;
724 Status Reset(
const std::vector<KuduColumnSchema>& columns,
int key_columns)
725 ATTRIBUTE_DEPRECATED(
"this method will be removed in a future release")
737 ATTRIBUTE_DEPRECATED("use operator==(const
KuduSchema&) instead");
768 size_t num_columns() const;
778 void GetPrimaryKeyColumnIndexes(std::vector<
int>* indexes) const;
789 int GetAutoIncrementingColumnIndex() const;
794 static const
char* const GetAutoIncrementingColumnName();
808 std::
string ToString() const;
819 static
KuduSchema FromSchema(const Schema& schema) KUDU_NO_EXPORT;
828 static Schema ToSchema(const
KuduSchema& kudu_schema) KUDU_NO_EXPORT;
833 friend class ClientTest;
842 friend class ScanConfiguration;
843 friend class internal::GetTableSchemaRpc;
844 friend class internal::LookupRpc;
845 friend class internal::MetaCache;
846 friend class internal::MetaCacheEntry;
847 friend class internal::WriteRpc;
848 friend class tools::RemoteKsckCluster;
849 friend class tools::ReplicaDumper;
853#if __cplusplus >= 201103
859 size_t num_key_columns()
const;
A row which may only contain values for a subset of the columns.
Definition partial_row.h:72
A wrapper around externally allocated data.
Definition slice.h:51
A representation of an operation's outcome.
Definition status.h:165
A handle for a connection to a cluster.
Definition client.h:687
Representation of the column schema.
Definition schema.h:215
const std::string & name() const
void CopyFrom(const KuduColumnSchema &other)
bool operator==(const KuduColumnSchema &rhs) const
KuduColumnTypeAttributes type_attributes() const
bool operator!=(const KuduColumnSchema &rhs) const
KuduColumnSchema & operator=(const KuduColumnSchema &other)
bool Equals(const KuduColumnSchema &other) const
DataType
Supported data types for columns.
Definition schema.h:218
static Status StringToDataType(const std::string &type_str, DataType *type)
bool is_immutable() const
const std::string & comment() const
static std::string DataTypeToString(DataType type)
KuduColumnStorageAttributes storage_attributes() const
KuduColumnSchema(const KuduColumnSchema &other)
Builder API for specifying or altering a column within a table schema.
Definition schema.h:370
KuduColumnSpec * NonUniquePrimaryKey()
KuduColumnSpec * Encoding(KuduColumnStorageAttributes::EncodingType encoding)
KuduColumnSpec * NotNull()
KuduColumnSpec * RenameTo(const std::string &new_name)
KuduColumnSpec * RemoveDefault()
KuduColumnSpec * Type(KuduColumnSchema::DataType type)
KuduColumnSpec * BlockSize(int32_t block_size)
KuduColumnSpec * Default(KuduValue *value)
KuduColumnSpec * Immutable()
KuduColumnSpec * Compression(KuduColumnStorageAttributes::CompressionType compression)
KuduColumnSpec * PrimaryKey()
KuduColumnSpec * Precision(int8_t precision)
KuduColumnSpec * Comment(const std::string &comment)
KuduColumnSpec * Nullable()
KuduColumnSpec * Scale(int8_t scale)
KuduColumnSpec * Length(uint16_t length)
KuduColumnSpec * Mutable()
Representation of column storage attributes.
Definition schema.h:130
std::string ToString() const
const CompressionType compression() const
Definition schema.h:183
static Status StringToEncodingType(const std::string &encoding, EncodingType *type)
const EncodingType encoding() const
Definition schema.h:178
KuduColumnStorageAttributes(EncodingType encoding=AUTO_ENCODING, CompressionType compression=DEFAULT_COMPRESSION, int32_t block_size=0)
Definition schema.h:167
EncodingType
Column encoding types.
Definition schema.h:133
static Status StringToCompressionType(const std::string &compression, CompressionType *type)
CompressionType
Column compression types.
Definition schema.h:147
Representation of column type attributes.
Definition schema.h:68
void CopyFrom(const KuduColumnTypeAttributes &other)
KuduColumnTypeAttributes(uint16_t length)
KuduColumnTypeAttributes(int8_t precision, int8_t scale)
KuduColumnTypeAttributes & operator=(const KuduColumnTypeAttributes &other)
KuduColumnTypeAttributes(const KuduColumnTypeAttributes &other)
Builds scan tokens for a table.
Definition client.h:3271
A scan descriptor limited to a single physical contiguous location.
Definition client.h:3210
This class is a representation of a single scan.
Definition client.h:2712
Builder API for constructing a KuduSchema object.
Definition schema.h:622
KuduColumnSpec * AddColumn(const std::string &name)
KuduSchemaBuilder * SetPrimaryKey(const std::vector< std::string > &key_col_names)
KuduSchemaBuilder * SetNonUniquePrimaryKey(const std::vector< std::string > &key_col_names)
Status Build(KuduSchema *schema)
A representation of a table's schema.
Definition schema.h:688
KuduSchema & operator=(const KuduSchema &other)
Status Reset(const std::vector< KuduColumnSchema > &columns, int key_columns) WARN_UNUSED_RESULT
KuduSchema(const KuduSchema &other)
void CopyFrom(const KuduSchema &other)
Alters an existing table based on the provided steps.
Definition client.h:1896
A helper class to create a new table with the desired options.
Definition client.h:1225
A representation of a table on a particular cluster.
Definition client.h:1613
A constant cell value with a specific type.
Definition value.h:37
A single-row write operation to be sent to a Kudu table.
Definition write_op.h:66