public class AlterTableRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.alterTable(AlterTableRequest)
.
Apply various modifications to a table, view, or collection. The available modifications include the following:
Manage a table's columns--a column can be added, removed, or have its type and properties modified, including whether it is compressed or not.
Create or delete an index on a particular column. This can speed up certain operations when using expressions containing equality or relational operators on indexed columns. This only applies to tables.
Create or delete a foreign key on a particular column.
Manage a range-partitioned or a manual list-partitioned table's partitions.
Set (or reset) the tier strategy of a table or view.
Refresh and manage the refresh mode of a materialized view.
Set the time-to-live (TTL). This can be applied to tables, views, or collections. When applied to collections, every contained table & view that is not protected will have its TTL set to the given value.
Set the global access mode (i.e. locking) for a table. This setting trumps any role-based access controls that may be in place; e.g., a user with write access to a table marked read-only will not be able to insert records into it. The mode can be set to read-only, write-only, read/write, and no access.
Change the protection mode to prevent or allow automatic expiration. This can be applied to tables, views, and collections.
Modifier and Type | Class and Description |
---|---|
static class |
AlterTableRequest.Action
Modification operation to be applied
Supported values:
ALLOW_HOMOGENEOUS_TABLES : No longer supported; action will be ignored. |
static class |
AlterTableRequest.Options
Optional parameters.
|
Constructor and Description |
---|
AlterTableRequest()
Constructs an AlterTableRequest object with default parameters.
|
AlterTableRequest(String tableName,
String action,
String value,
Map<String,String> options)
Constructs an AlterTableRequest object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Object |
get(int index)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getAction() |
static org.apache.avro.Schema |
getClassSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
Map<String,String> |
getOptions() |
org.apache.avro.Schema |
getSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getTableName() |
String |
getValue() |
int |
hashCode() |
void |
put(int index,
Object value)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
AlterTableRequest |
setAction(String action) |
AlterTableRequest |
setOptions(Map<String,String> options) |
AlterTableRequest |
setTableName(String tableName) |
AlterTableRequest |
setValue(String value) |
String |
toString() |
public AlterTableRequest()
public AlterTableRequest(String tableName, String action, String value, Map<String,String> options)
tableName
- Table on which the operation will be performed. Must
be an existing table, view, or collection.action
- Modification operation to be applied
Supported values:
ALLOW_HOMOGENEOUS_TABLES
: No longer supported; action
will be ignored.
CREATE_INDEX
: Creates either a column (attribute) index or chunk skip index, depending on the
specified index_type
, on the column name
specified in value
. If this column already has
the specified index, an error will be returned.
DELETE_INDEX
: Deletes either a column (attribute) index or chunk skip index, depending on the
specified index_type
, on the column name
specified in value
. If this column does not have
the specified index, an error will be returned.
MOVE_TO_COLLECTION
: Moves a table or view into a
collection named value
. If the collection
provided is non-existent, the collection will be
automatically created. If value
is empty, then
the table or view will be top-level.
PROTECTED
: Sets whether the given tableName
should be protected or not. The value
must be either 'true' or 'false'.
RENAME_TABLE
: Renames a table, view or collection to
value
. Has the same naming restrictions as tables.
TTL
:
Sets the time-to-live in minutes of the table,
view, or collection specified in tableName
.
ADD_COLUMN
: Adds the column specified in value
to the table specified in tableName
. Use column_type
and column_properties
in options
to set the column's type and properties,
respectively.
CHANGE_COLUMN
: Changes type and properties of the column
specified in value
. Use column_type
and
column_properties
in options
to set the
column's type and properties, respectively. Note that
primary key and/or shard key columns cannot be changed.
All unchanging column properties must be listed for the
change to take place, e.g., to add dictionary encoding to
an existing 'char4' column, both 'char4' and 'dict' must
be specified in the options
map.
SET_COLUMN_COMPRESSION
: Modifies the compression setting on the column
specified in value
to the compression type
specified in compression_type
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key specified in value
using the format '(source_column_name [, ...]) references
target_table_name(primary_key_column_name [, ...]) [as
foreign_key_name]'.
DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should
be the foreign_key_name specified when creating the key
or the complete string used to define it.
ADD_PARTITION
: Adds the partition specified in value
, to either a range-partitioned or manual list-partitioned table.
REMOVE_PARTITION
: Removes the partition specified in
value
(and relocates all of its data to the
default partition) from either a range-partitioned or manual list-partitioned table.
DELETE_PARTITION
: Deletes the partition specified in
value
(and all of its data) from either a range-partitioned or manual list-partitioned table.
SET_GLOBAL_ACCESS_MODE
: Sets the global access mode
(i.e. locking) for the table specified in tableName
. Specify the access mode in value
.
Valid modes are 'no_access', 'read_only', 'write_only'
and 'read_write'.
REFRESH
: Replays all the table creation commands
required to create this materialized view.
SET_REFRESH_METHOD
: Sets the method by which this materialized view is refreshed to the
method specified in value
- one of 'manual',
'periodic', 'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to the datetime
string specified in value
with format 'YYYY-MM-DD
HH:MM:SS'. Subsequent refreshes occur at the specified
time + N * the refresh period.
SET_REFRESH_PERIOD
: Sets the time interval in seconds at
which to refresh this materialized view to the value
specified in value
. Also, sets the refresh
method to periodic if not already set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: Removes text search attribute from all columns.
SET_STRATEGY_DEFINITION
: Sets the tier strategy for the table and its
columns to the one specified in value
, replacing
the existing tier strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples.
value
- The value of the modification, depending on action
. For example, if action
is add_column
, this would be the column name; while the
column's definition would be covered by the column_type
, column_properties
, column_default_value
, and add_column_expression
in options
. If action
is ttl
, it
would be the number of minutes for the new TTL. If action
is refresh
, this field would be blank.options
- Optional parameters.
ACTION
COLUMN_NAME
TABLE_NAME
COLUMN_DEFAULT_VALUE
: When adding a column, set a
default value for existing records. For nullable
columns, the default value will be null, regardless of
data type.
COLUMN_PROPERTIES
: When adding or changing a column,
set the column properties (strings, separated by a
comma: data, store_only, text_search, char8, int8 etc).
COLUMN_TYPE
: When adding or changing a column, set the
column type (strings, separated by a comma: int, double,
string, null etc).
COMPRESSION_TYPE
: When setting column compression
(set_column_compression
for action
),
compression type to use: none
(to use no
compression) or a valid compression type.
Supported values:
The default value is SNAPPY
.
COPY_VALUES_FROM_COLUMN
: Deprecated. Please use add_column_expression
instead.
RENAME_COLUMN
: When changing a column, specify new
column name.
VALIDATE_CHANGE_COLUMN
: When changing a column,
validate the change before applying it. If true
,
then validate all values. A value too large (or too
long) for the new type will prevent any change. If
false
, then when a value is too large or long,
it will be truncated.
Supported values:
The default value is TRUE
.
UPDATE_LAST_ACCESS_TIME
: Indicates whether the time-to-live (TTL) expiration
countdown timer should be reset to the table's TTL.
Supported values:
TRUE
:
Reset the expiration countdown timer to the table's
configured TTL.
FALSE
: Don't reset the timer; expiration countdown will
continue from where it is, as if the table had not been
accessed.
TRUE
.
ADD_COLUMN_EXPRESSION
: When adding a column, an
optional expression to use for the new column's values.
Any valid expression may be used, including one
containing references to existing columns in the same
table.
STRATEGY_DEFINITION
: Optional parameter for specifying
the tier strategy for the table and its
columns when action
is set_strategy_definition
, replacing the existing tier
strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples.
This option will be ignored if value
is also
specified.
INDEX_TYPE
: Type of index to create, when action
is create_index
, or to delete, when
action
is delete_index
.
Supported values:
COLUMN
: Create or delete a column (attribute) index.
CHUNK_SKIP
: Create or delete a chunk skip index.
COLUMN
.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getTableName()
public AlterTableRequest setTableName(String tableName)
tableName
- Table on which the operation will be performed. Must
be an existing table, view, or collection.this
to mimic the builder pattern.public String getAction()
ALLOW_HOMOGENEOUS_TABLES
: No longer supported; action will be
ignored.
CREATE_INDEX
: Creates either a column (attribute) index or chunk skip index, depending on the specified
index_type
, on the column name specified in value
. If this column already has the specified index, an error
will be returned.
DELETE_INDEX
: Deletes either a column (attribute) index or chunk skip index, depending on the specified
index_type
, on the column name specified in value
. If this column does not have the specified index, an
error will be returned.
MOVE_TO_COLLECTION
: Moves a table or view into a collection
named value
. If the collection provided is
non-existent, the collection will be automatically created. If
value
is empty, then the table or view will be
top-level.
PROTECTED
: Sets whether the given tableName
should be
protected or not. The value
must be
either 'true' or 'false'.
RENAME_TABLE
: Renames a table, view or collection to value
. Has the same naming restrictions as tables.
TTL
: Sets the
time-to-live in minutes of the table, view, or
collection specified in tableName
.
ADD_COLUMN
: Adds the column specified in value
to the
table specified in tableName
. Use column_type
and column_properties
in options
to set the
column's type and properties, respectively.
CHANGE_COLUMN
: Changes type and properties of the column
specified in value
. Use column_type
and column_properties
in options
to set the column's type
and properties, respectively. Note that primary key and/or shard
key columns cannot be changed. All unchanging column properties
must be listed for the change to take place, e.g., to add
dictionary encoding to an existing 'char4' column, both 'char4'
and 'dict' must be specified in the options
map.
SET_COLUMN_COMPRESSION
: Modifies the compression setting on the column specified in
value
to the compression type specified in compression_type
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key specified in value
using
the format '(source_column_name [, ...]) references
target_table_name(primary_key_column_name [, ...]) [as
foreign_key_name]'.
DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should be the
foreign_key_name specified when creating the key or the complete
string used to define it.
ADD_PARTITION
: Adds the partition specified in value
,
to either a range-partitioned or manual list-partitioned table.
REMOVE_PARTITION
: Removes the partition specified in value
(and relocates all of its data to the default partition)
from either a range-partitioned or manual list-partitioned table.
DELETE_PARTITION
: Deletes the partition specified in value
(and all of its data) from either a range-partitioned or manual list-partitioned table.
SET_GLOBAL_ACCESS_MODE
: Sets the global access mode (i.e.
locking) for the table specified in tableName
. Specify
the access mode in value
. Valid modes are 'no_access',
'read_only', 'write_only' and 'read_write'.
REFRESH
:
Replays all the table creation commands required to create this
materialized view.
SET_REFRESH_METHOD
: Sets the method by which this materialized view is refreshed to the method
specified in value
- one of 'manual', 'periodic',
'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to the datetime string
specified in value
with format 'YYYY-MM-DD HH:MM:SS'.
Subsequent refreshes occur at the specified time + N * the
refresh period.
SET_REFRESH_PERIOD
: Sets the time interval in seconds at which
to refresh this materialized view to the value specified in
value
. Also, sets the refresh method to periodic if not
already set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: Removes text search attribute from all columns.
SET_STRATEGY_DEFINITION
: Sets the tier strategy for the table and its columns to
the one specified in value
, replacing the existing tier
strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples.
public AlterTableRequest setAction(String action)
action
- Modification operation to be applied
Supported values:
ALLOW_HOMOGENEOUS_TABLES
: No longer supported; action
will be ignored.
CREATE_INDEX
: Creates either a column (attribute) index or chunk skip index, depending on the
specified index_type
, on the column name
specified in value
. If this column already has
the specified index, an error will be returned.
DELETE_INDEX
: Deletes either a column (attribute) index or chunk skip index, depending on the
specified index_type
, on the column name
specified in value
. If this column does not have
the specified index, an error will be returned.
MOVE_TO_COLLECTION
: Moves a table or view into a
collection named value
. If the collection
provided is non-existent, the collection will be
automatically created. If value
is empty, then
the table or view will be top-level.
PROTECTED
: Sets whether the given tableName
should be protected or not. The value
must be either 'true' or 'false'.
RENAME_TABLE
: Renames a table, view or collection to
value
. Has the same naming restrictions as tables.
TTL
:
Sets the time-to-live in minutes of the table,
view, or collection specified in tableName
.
ADD_COLUMN
: Adds the column specified in value
to the table specified in tableName
. Use column_type
and column_properties
in options
to set the column's type and properties,
respectively.
CHANGE_COLUMN
: Changes type and properties of the column
specified in value
. Use column_type
and
column_properties
in options
to set the
column's type and properties, respectively. Note that
primary key and/or shard key columns cannot be changed.
All unchanging column properties must be listed for the
change to take place, e.g., to add dictionary encoding to
an existing 'char4' column, both 'char4' and 'dict' must
be specified in the options
map.
SET_COLUMN_COMPRESSION
: Modifies the compression setting on the column
specified in value
to the compression type
specified in compression_type
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key specified in value
using the format '(source_column_name [, ...]) references
target_table_name(primary_key_column_name [, ...]) [as
foreign_key_name]'.
DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should
be the foreign_key_name specified when creating the key
or the complete string used to define it.
ADD_PARTITION
: Adds the partition specified in value
, to either a range-partitioned or manual list-partitioned table.
REMOVE_PARTITION
: Removes the partition specified in
value
(and relocates all of its data to the
default partition) from either a range-partitioned or manual list-partitioned table.
DELETE_PARTITION
: Deletes the partition specified in
value
(and all of its data) from either a range-partitioned or manual list-partitioned table.
SET_GLOBAL_ACCESS_MODE
: Sets the global access mode
(i.e. locking) for the table specified in tableName
. Specify the access mode in value
.
Valid modes are 'no_access', 'read_only', 'write_only'
and 'read_write'.
REFRESH
: Replays all the table creation commands
required to create this materialized view.
SET_REFRESH_METHOD
: Sets the method by which this materialized view is refreshed to the
method specified in value
- one of 'manual',
'periodic', 'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to the datetime
string specified in value
with format 'YYYY-MM-DD
HH:MM:SS'. Subsequent refreshes occur at the specified
time + N * the refresh period.
SET_REFRESH_PERIOD
: Sets the time interval in seconds at
which to refresh this materialized view to the value
specified in value
. Also, sets the refresh
method to periodic if not already set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: Removes text search attribute from all columns.
SET_STRATEGY_DEFINITION
: Sets the tier strategy for the table and its
columns to the one specified in value
, replacing
the existing tier strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples.
this
to mimic the builder pattern.public String getValue()
action
. For
example, if action
is add_column
, this would be
the column name; while the column's definition would be covered
by the column_type
, column_properties
, column_default_value
, and add_column_expression
in
options
. If action
is ttl
, it would be
the number of minutes for the new TTL. If action
is
refresh
, this field would be blank.public AlterTableRequest setValue(String value)
value
- The value of the modification, depending on action
. For example, if action
is add_column
, this would be the column name; while the
column's definition would be covered by the column_type
, column_properties
, column_default_value
, and add_column_expression
in options
. If action
is ttl
, it
would be the number of minutes for the new TTL. If action
is refresh
, this field would be blank.this
to mimic the builder pattern.public Map<String,String> getOptions()
ACTION
COLUMN_NAME
TABLE_NAME
COLUMN_DEFAULT_VALUE
: When adding a column, set a default value
for existing records. For nullable columns, the default value
will be null, regardless of data type.
COLUMN_PROPERTIES
: When adding or changing a column, set the
column properties (strings, separated by a comma: data,
store_only, text_search, char8, int8 etc).
COLUMN_TYPE
: When adding or changing a column, set the column
type (strings, separated by a comma: int, double, string, null
etc).
COMPRESSION_TYPE
: When setting column compression (set_column_compression
for action
), compression type to
use: none
(to use no compression) or a valid compression
type.
Supported values:
The default value is SNAPPY
.
COPY_VALUES_FROM_COLUMN
: Deprecated. Please use add_column_expression
instead.
RENAME_COLUMN
: When changing a column, specify new column name.
VALIDATE_CHANGE_COLUMN
: When changing a column, validate the
change before applying it. If true
, then validate all
values. A value too large (or too long) for the new type will
prevent any change. If false
, then when a value is too
large or long, it will be truncated.
Supported values:
The default value is TRUE
.
UPDATE_LAST_ACCESS_TIME
: Indicates whether the time-to-live (TTL) expiration countdown timer
should be reset to the table's TTL.
Supported values:
TRUE
: Reset
the expiration countdown timer to the table's configured TTL.
FALSE
: Don't
reset the timer; expiration countdown will continue from where
it is, as if the table had not been accessed.
TRUE
.
ADD_COLUMN_EXPRESSION
: When adding a column, an optional
expression to use for the new column's values. Any valid
expression may be used, including one containing references to
existing columns in the same table.
STRATEGY_DEFINITION
: Optional parameter for specifying the tier strategy for the table and its columns
when action
is set_strategy_definition
,
replacing the existing tier strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples. This
option will be ignored if value
is also specified.
INDEX_TYPE
: Type of index to create, when action
is
create_index
, or to delete, when action
is
delete_index
.
Supported values:
COLUMN
:
Create or delete a column (attribute) index.
CHUNK_SKIP
: Create or delete a chunk skip index.
COLUMN
.
Map
.public AlterTableRequest setOptions(Map<String,String> options)
options
- Optional parameters.
ACTION
COLUMN_NAME
TABLE_NAME
COLUMN_DEFAULT_VALUE
: When adding a column, set a
default value for existing records. For nullable
columns, the default value will be null, regardless of
data type.
COLUMN_PROPERTIES
: When adding or changing a column,
set the column properties (strings, separated by a
comma: data, store_only, text_search, char8, int8 etc).
COLUMN_TYPE
: When adding or changing a column, set the
column type (strings, separated by a comma: int, double,
string, null etc).
COMPRESSION_TYPE
: When setting column compression
(set_column_compression
for action
),
compression type to use: none
(to use no
compression) or a valid compression type.
Supported values:
The default value is SNAPPY
.
COPY_VALUES_FROM_COLUMN
: Deprecated. Please use add_column_expression
instead.
RENAME_COLUMN
: When changing a column, specify new
column name.
VALIDATE_CHANGE_COLUMN
: When changing a column,
validate the change before applying it. If true
,
then validate all values. A value too large (or too
long) for the new type will prevent any change. If
false
, then when a value is too large or long,
it will be truncated.
Supported values:
The default value is TRUE
.
UPDATE_LAST_ACCESS_TIME
: Indicates whether the time-to-live (TTL) expiration
countdown timer should be reset to the table's TTL.
Supported values:
TRUE
:
Reset the expiration countdown timer to the table's
configured TTL.
FALSE
: Don't reset the timer; expiration countdown will
continue from where it is, as if the table had not been
accessed.
TRUE
.
ADD_COLUMN_EXPRESSION
: When adding a column, an
optional expression to use for the new column's values.
Any valid expression may be used, including one
containing references to existing columns in the same
table.
STRATEGY_DEFINITION
: Optional parameter for specifying
the tier strategy for the table and its
columns when action
is set_strategy_definition
, replacing the existing tier
strategy in its entirety. See tier strategy usage for format and tier strategy examples for examples.
This option will be ignored if value
is also
specified.
INDEX_TYPE
: Type of index to create, when action
is create_index
, or to delete, when
action
is delete_index
.
Supported values:
COLUMN
: Create or delete a column (attribute) index.
CHUNK_SKIP
: Create or delete a chunk skip index.
COLUMN
.
Map
.this
to mimic the builder pattern.public org.apache.avro.Schema getSchema()
getSchema
in interface org.apache.avro.generic.GenericContainer
public Object get(int index)
get
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to getIndexOutOfBoundsException
public void put(int index, Object value)
put
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to setvalue
- the value to setIndexOutOfBoundsException
Copyright © 2020. All rights reserved.