Kudu C++ client API
Public Member Functions | Friends | List of all members
kudu::client::KuduColumnSpec Class Reference

Builder API for specifying or altering a column within a table schema. More...

#include <schema.h>

Public Member Functions

KuduColumnSpecDefault (KuduValue *value)
 
KuduColumnSpecCompression (KuduColumnStorageAttributes::CompressionType compression)
 
KuduColumnSpecEncoding (KuduColumnStorageAttributes::EncodingType encoding)
 
KuduColumnSpecBlockSize (int32_t block_size)
 
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().

Note
Primary keys may not be changed after a table is created.
Returns
Pointer to the modified object.
KuduColumnSpecPrimaryKey ()
 
KuduColumnSpecNotNull ()
 
KuduColumnSpecNullable ()
 
KuduColumnSpecType (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.

Returns
Pointer to the modified object.
KuduColumnSpecRemoveDefault ()
 
KuduColumnSpecRenameTo (const std::string &new_name)
 

Friends

class KuduSchemaBuilder
 
class KuduTableAlterer
 

Detailed Description

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.

Todo:
KUDU-861: this API will also be used for an improved AlterTable API.

Member Function Documentation

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.

Note
The block size specified here corresponds to uncompressed data. The actual size of the unit read from disk may be smaller if compression is enabled.
It's recommended that this not be set any lower than 4096 (4KB) or higher than 1048576 (1MB).
Todo:
KUDU-1107: move above info to docs
Parameters
[in]block_sizeBlock size (in bytes) to use.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::Compression ( KuduColumnStorageAttributes::CompressionType  compression)

Set the preferred compression type for the column.

Parameters
[in]compressionThe compression type to use.
Returns
Pointer to the modified object.
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.

Parameters
[in]valueThe value to use as the default. The KuduColumnSpec takes ownership over the passed parameter.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::Encoding ( KuduColumnStorageAttributes::EncodingType  encoding)

Set the preferred encoding for the column.

Note
Not all encodings are supported for all column types.
Parameters
[in]encodingThe encoding to use.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::NotNull ( )

Set the column to be not nullable.

Note
Column nullability may not be changed once a table is created.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::Nullable ( )

Set the column to be nullable (the default).

Note
Column nullability may not be changed once a table is created.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::RenameTo ( const std::string &  new_name)

Rename the column.

Parameters
[in]new_nameThe new name for the column.
Returns
Pointer to the modified object.
KuduColumnSpec* kudu::client::KuduColumnSpec::Type ( KuduColumnSchema::DataType  type)

Set the data type of the column.

Note
Column data types may not be changed once a table is created.
Parameters
[in]typeThe data type to set.
Returns
Pointer to the modified object.

The documentation for this class was generated from the following file: