Kudu C++ client API
|
Builder API for specifying or altering a column within a table schema. More...
#include <schema.h>
Public Member Functions | ||||
KuduColumnSpec * | Default (KuduValue *value) | |||
KuduColumnSpec * | Compression (KuduColumnStorageAttributes::CompressionType compression) | |||
KuduColumnSpec * | Encoding (KuduColumnStorageAttributes::EncodingType encoding) | |||
KuduColumnSpec * | BlockSize (int32_t block_size) | |||
KuduColumnSpec * | Comment (const std::string &comment) | |||
Operations only relevant for decimal columns. | ||||
Set the precision for the column. Clients must specify a precision for decimal columns. Precision is the total number of digits that can be represented by the column, regardless of the location of the decimal point. For example, representing integer values up to 9999, and fractional values up to 99.99, both require a precision of 4. You can also represent corresponding negative values, without any change in the precision. For example, the range -9999 to 9999 still only requires a precision of 4. The precision must be between 1 and 38.
| ||||
KuduColumnSpec * | Precision (int8_t precision) | |||
KuduColumnSpec * | Scale (int8_t scale) | |||
Operation only relevant for VARCHAR columns. | ||||
Set the length for a column. Clients can specify a length for VARCHAR columns. Length represents the maximum length of a VARCHAR column in characters. The length must be greater than 0 and less than 65536. If no length is provided a default length of 65535 is used.
| ||||
KuduColumnSpec * | Length (uint16_t length) | |||
Operations only relevant for Create Table | ||||
Set the column to be the primary key of the table. This may only be used to set non-composite primary keys. If a composite key is desired, use KuduSchemaBuilder::SetPrimaryKey(). This may not be used in conjunction with KuduSchemaBuilder::SetPrimaryKey().
| ||||
KuduColumnSpec * | PrimaryKey () | |||
KuduColumnSpec * | NotNull () | |||
KuduColumnSpec * | Nullable () | |||
KuduColumnSpec * | Type (KuduColumnSchema::DataType type) | |||
Operations only relevant for Alter Table | ||||
Remove the default value for the column. Without a default, clients must always specify a value for the column when inserting data.
| ||||
KuduColumnSpec * | RemoveDefault () | |||
KuduColumnSpec * | RenameTo (const std::string &new_name) | |||
Builder API for specifying or altering a column within a table schema.
An object of this type cannot be constructed directly, but rather is returned from KuduSchemaBuilder::AddColumn() to specify a column within a Schema.
KuduColumnSpec* kudu::client::KuduColumnSpec::BlockSize | ( | int32_t | block_size | ) |
Set the target block size for the column.
This is the number of bytes of user data packed per block on disk, and represents the unit of IO when reading the column. Larger values may improve scan performance, particularly on spinning media. Smaller values may improve random access performance, particularly for workloads that have high cache hit rates or operate on fast storage such as SSD.
[in] | block_size | Block size (in bytes) to use. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Comment | ( | const std::string & | comment | ) |
Set the comment of the column.
[in] | comment | The comment for the column. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Compression | ( | KuduColumnStorageAttributes::CompressionType | compression | ) |
Set the preferred compression type for the column.
[in] | compression | The compression type to use. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Default | ( | KuduValue * | value | ) |
Set the default value for the column.
When adding a new column to a table, this default value will be used to fill the new column in all existing rows. The default value will also be used when inserting a new row with no value for the column.
[in] | value | The value to use as the default. The KuduColumnSpec takes ownership over the passed parameter. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Encoding | ( | KuduColumnStorageAttributes::EncodingType | encoding | ) |
Set the preferred encoding for the column.
[in] | encoding | The encoding to use. |
KuduColumnSpec* kudu::client::KuduColumnSpec::NotNull | ( | ) |
Set the column to be not nullable.
KuduColumnSpec* kudu::client::KuduColumnSpec::Nullable | ( | ) |
Set the column to be nullable (the default).
KuduColumnSpec* kudu::client::KuduColumnSpec::RenameTo | ( | const std::string & | new_name | ) |
Rename the column.
[in] | new_name | The new name for the column. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Scale | ( | int8_t | scale | ) |
Set the scale for the column.
Clients can specify a scale for decimal columns. Scale represents the number of fractional digits. This value must be less than or equal to precision. A scale of 0 produces integral values, with no fractional part. If precision and scale are equal, all the digits come after the decimal point, making all the values between 0.9999 and -0.9999.
The scale must be greater than 0 and less than the column's precision. If no scale is provided a default scale of 0 is used.
[in] | scale | Desired scale to set. |
KuduColumnSpec* kudu::client::KuduColumnSpec::Type | ( | KuduColumnSchema::DataType | type | ) |
Set the data type of the column.
[in] | type | The data type to set. |