Kudu C++ client API
Loading...
Searching...
No Matches
Public Member Functions | 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)
 
KuduTableAltererSetOwner (const std::string &new_owner)
 
KuduTableAltererSetComment (const std::string &new_comment)
 
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)
 
KuduTableAltererAddRangePartition (KuduRangePartition *partition)
 
KuduTableAltererAddRangePartitionWithDimension (KuduPartialRow *lower_bound, KuduPartialRow *upper_bound, const std::string &dimension_label, 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)
 
KuduTableAltererAlterExtraConfig (const std::map< std::string, std::string > &extra_configs)
 
KuduTableAltererSetTableDiskSizeLimit (int64_t disk_size_limit)
 
KuduTableAltererSetTableRowCountLimit (int64_t row_count_limit)
 
KuduTableAlterertimeout (const MonoDelta &timeout)
 
KuduTableAltererwait (bool wait)
 
Status Alter ()
 

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();
A representation of an operation's outcome.
Definition status.h:165

Member Function Documentation

◆ AddColumn()

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.

◆ AddRangePartition() [1/2]

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.

◆ AddRangePartition() [2/2]

KuduTableAlterer * kudu::client::KuduTableAlterer::AddRangePartition ( KuduRangePartition partition)

Add the specified range partition with custom hash schema to the table.

Note
The table alterer takes ownership of the partition object.
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]partitionThe range partition to be created: it can have a custom hash schema.
Returns
Raw pointer to this alterer object.

◆ AddRangePartitionWithDimension()

KuduTableAlterer * kudu::client::KuduTableAlterer::AddRangePartitionWithDimension ( KuduPartialRow lower_bound,
KuduPartialRow upper_bound,
const std::string &  dimension_label,
KuduTableCreator::RangePartitionBound  lower_bound_type = KuduTableCreator::INCLUSIVE_BOUND,
KuduTableCreator::RangePartitionBound  upper_bound_type = KuduTableCreator::EXCLUSIVE_BOUND 
)

Add a range partition to the table with dimension label.

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.
See KuduTableCreator::dimension_label() for details on dimension label.
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]dimension_labelThe dimension label for the tablet to be created.
[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.

◆ Alter()

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.

◆ AlterColumn()

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.

◆ AlterExtraConfig()

KuduTableAlterer * kudu::client::KuduTableAlterer::AlterExtraConfig ( const std::map< std::string, std::string > &  extra_configs)

Change the table's extra configuration properties.

Note
These configuration properties will be merged into existing configuration properties.
If the value of the kv pair is empty, the property will be unset.
Parameters
[in]extra_configsThe table's extra configuration properties.
Returns
Raw pointer to this alterer object.

◆ DropColumn()

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.

◆ DropRangePartition()

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.

◆ RenameTo()

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.

◆ SetComment()

KuduTableAlterer * kudu::client::KuduTableAlterer::SetComment ( const std::string &  new_comment)

Set the comment on the table.

Parameters
[in]new_commentThe new comment on the table.
Returns
Raw pointer to this alterer object.

◆ SetOwner()

KuduTableAlterer * kudu::client::KuduTableAlterer::SetOwner ( const std::string &  new_owner)

Set the owner of the table.

Parameters
[in]new_ownerThe new owner for the table.
Returns
Raw pointer to this alterer object.

◆ SetTableDiskSizeLimit()

KuduTableAlterer * kudu::client::KuduTableAlterer::SetTableDiskSizeLimit ( int64_t  disk_size_limit)

Set the disk size limit of the table by the super user.

Note
The table limit alterations, including disk_size_limit and row_count_limit, cannot be changed in the same alteration request with other alterations, because the table 'limit' alteration needs the super user permission.
It is experimental and may change or disappear in future. This feature currently applies size limit on a single table.
Parameters
[in]disk_size_limitThe max table disk size, -1 is for no limit
Returns
Raw pointer to this alterer object.

◆ SetTableRowCountLimit()

KuduTableAlterer * kudu::client::KuduTableAlterer::SetTableRowCountLimit ( int64_t  row_count_limit)

Set the row count limit of the table by the super user.

Note
The table limit alterations, including disk_size_limit and row_count_limit, cannot be changed in the same alteration request with other alterations, because the table 'limit' alteration needs the super user permission.
It is experimental and may change or disappear in future. This feature currently applies row count limit on a single table.
Parameters
[in]row_count_limitThe max row count of the table, -1 is for no limit
Returns
Raw pointer to this alterer object.

◆ timeout()

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.

◆ wait()

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: