Kudu C++ client API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
kudu::client::KuduTableAlterer Class Reference

Alters an existing table based on the provided steps. More...

#include <client.h>

Public Member Functions

KuduTableAltererRenameTo (const std::string &new_name)
 
KuduColumnSpecAddColumn (const std::string &name)
 
KuduColumnSpecAlterColumn (const std::string &name)
 
KuduTableAltererDropColumn (const std::string &name)
 
KuduTableAltererAddRangePartition (KuduPartialRow *lower_bound, KuduPartialRow *upper_bound, KuduTableCreator::RangePartitionBound lower_bound_type=KuduTableCreator::INCLUSIVE_BOUND, KuduTableCreator::RangePartitionBound upper_bound_type=KuduTableCreator::EXCLUSIVE_BOUND)
 
KuduTableAltererDropRangePartition (KuduPartialRow *lower_bound, KuduPartialRow *upper_bound, KuduTableCreator::RangePartitionBound lower_bound_type=KuduTableCreator::INCLUSIVE_BOUND, KuduTableCreator::RangePartitionBound upper_bound_type=KuduTableCreator::EXCLUSIVE_BOUND)
 
KuduTableAlterertimeout (const MonoDelta &timeout)
 
KuduTableAltererwait (bool wait)
 
Status Alter ()
 

Friends

class KuduClient
 

Detailed Description

Alters an existing table based on the provided steps.

Create a new instance of a table alterer using KuduClient::NewTableAlterer(). An example of usage:

* std::unique_ptr<KuduTableAlterer> alterer(
* client->NewTableAlterer("table-name"));
* alterer->AddColumn("foo")->Type(KuduColumnSchema::INT32)->NotNull();
* alterer->AlterColumn("bar")->Compression(KuduColumnStorageAttributes::LZ4);
* Status s = alterer->Alter();
*

Member Function Documentation

KuduColumnSpec* kudu::client::KuduTableAlterer::AddColumn ( const std::string &  name)

Add a new column to the table.

When adding a column, you must specify the default value of the new column using KuduColumnSpec::DefaultValue(...).

Parameters
nameName of the column do add.
Returns
Pointer to the result ColumnSpec object. The alterer keeps ownership of the newly created object.
KuduTableAlterer* kudu::client::KuduTableAlterer::AddRangePartition ( KuduPartialRow lower_bound,
KuduPartialRow upper_bound,
KuduTableCreator::RangePartitionBound  lower_bound_type = KuduTableCreator::INCLUSIVE_BOUND,
KuduTableCreator::RangePartitionBound  upper_bound_type = KuduTableCreator::EXCLUSIVE_BOUND 
)

Add a range partition to the table with the specified lower bound and upper bound.

Note
The table alterer takes ownership of the rows.
Multiple range partitions may be added as part of a single alter table transaction by calling this method multiple times on the table alterer.
This client may immediately write and scan the new tablets when Alter() returns success, however other existing clients may have to wait for a timeout period to elapse before the tablets become visible. This period is configured by the master's 'table_locations_ttl_ms' flag, and defaults to 5 minutes.
Parameters
[in]lower_boundThe lower bound of the range partition to add. If the row is empty, then the lower bound is unbounded. If any of the columns are unset, the logical minimum value for the column's type will be used by default.
[in]upper_boundThe upper bound of the range partition to add. If the row is empty, then the upper bound is unbounded. If any of the individual columns are unset, the logical minimum value for the column' type will be used by default.
[in]lower_bound_typeThe type of the lower bound, either inclusive or exclusive. Defaults to inclusive.
[in]upper_bound_typeThe type of the lower bound, either inclusive or exclusive. Defaults to exclusive.
Returns
Raw pointer to this alterer object.
Status kudu::client::KuduTableAlterer::Alter ( )
Returns
Status of the ALTER TABLE operation. The return value may indicate an error in the alter operation, or a misuse of the builder (e.g. add_column() with default_value=NULL). In the latter case, only the last error is returned.
KuduColumnSpec* kudu::client::KuduTableAlterer::AlterColumn ( const std::string &  name)

Alter an existing column.

Note
The column may not be in the primary key.
Parameters
[in]nameName of the column to alter.
Returns
Pointer to the result ColumnSpec object. The alterer keeps ownership of the newly created object.
KuduTableAlterer* kudu::client::KuduTableAlterer::DropColumn ( const std::string &  name)

Drops an existing column from the table.

Note
The column may not be in the primary key.
Parameters
[in]nameName of the column to alter.
Returns
Raw pointer to this alterer object.
KuduTableAlterer* kudu::client::KuduTableAlterer::DropRangePartition ( KuduPartialRow lower_bound,
KuduPartialRow upper_bound,
KuduTableCreator::RangePartitionBound  lower_bound_type = KuduTableCreator::INCLUSIVE_BOUND,
KuduTableCreator::RangePartitionBound  upper_bound_type = KuduTableCreator::EXCLUSIVE_BOUND 
)

Drop the range partition from the table with the specified lower bound and upper bound. The bounds must match an existing range partition exactly, and may not span multiple range partitions.

Note
The table alterer takes ownership of the rows.
Multiple range partitions may be dropped as part of a single alter table transaction by calling this method multiple times on the table alterer.
Parameters
[in]lower_boundThe inclusive lower bound of the range partition to drop. If the row is empty, then the lower bound is unbounded. If any of the columns are unset, the logical minimum value for the column's type will be used by default.
[in]upper_boundThe exclusive upper bound of the range partition to add. If the row is empty, then the upper bound is unbounded. If any of the individual columns are unset, the logical minimum value for the column' type will be used by default.
[in]lower_bound_typeThe type of the lower bound, either inclusive or exclusive. Defaults to inclusive.
[in]upper_bound_typeThe type of the lower bound, either inclusive or exclusive. Defaults to exclusive.
Returns
Raw pointer to this alterer object.
KuduTableAlterer* kudu::client::KuduTableAlterer::RenameTo ( const std::string &  new_name)

Rename the table.

Parameters
[in]new_nameThe new name for the table.
Returns
Raw pointer to this alterer object.
KuduTableAlterer* kudu::client::KuduTableAlterer::timeout ( const MonoDelta timeout)

Set a timeout for the alteration operation.

This includes any waiting after the alter has been submitted (i.e. if the alter is slow to be performed on a large table, it may time out and then later be successful).

Parameters
[in]timeoutTimeout to set.
Returns
Raw pointer to this alterer object.
KuduTableAlterer* kudu::client::KuduTableAlterer::wait ( bool  wait)

Whether to wait for completion of alteration operations.

If set to true, an alteration operation returns control only after the operation is complete. Otherwise, every operation returns immediately. By default (i.e. when an alteration object is created) it is set to true.

Parameters
[in]waitWhether to wait for alteration operation to complete before returning control.
Returns
Raw pointer to this alterer object.

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