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:
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.
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.
Allow homogeneous tables within a collection.
Manage a table's columns--a column can be added, removed, or have its type and properties modified.
Set or unset compression for a column.
Modifier and Type | Class and Description |
---|---|
static class |
AlterTableRequest.Action
Modification operation to be applied
Supported values:
ALLOW_HOMOGENEOUS_TABLES : Sets whether homogeneous tables are allowed
in the given collection. |
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
: Sets whether homogeneous
tables are allowed in the given collection. This action
is only valid if tableName
is a collection. The
value
must be either 'true' or 'false'.
CREATE_INDEX
: Creates an index on the column name specified in
value
. If this column is already indexed, an
error will be returned.
DELETE_INDEX
: Deletes an existing index on the column name specified in
value
. If this column does not have indexing
turned on, an error will be returned.
MOVE_TO_COLLECTION
: Moves a table into a collection
value
.
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
.
MEMORY_TTL
: Sets the time-to-live in minutes for the
individual chunks of the columns of the table, view, or
collection specified in tableName
to free their
memory if unused longer than the given time. Specify an
empty string to restore the global memory_ttl setting and
a value of '-1' for an infinite timeout.
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
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key 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.
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 - one of
'manual', 'periodic', 'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to datetime string
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. Also, sets the
refresh method to periodic if not alreay set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: remove text_search
attribute from all columns, if exists.
value
- The value of the modification. May be a column name,
'true' or 'false', a TTL, or the global access mode
depending on action
.options
- Optional parameters.
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
: please see
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 need to
update the last_access_time.
Supported values:
The default value is TRUE
.
ADD_COLUMN_EXPRESSION
: expression for new column's
values (optional with add_column). Any valid expressions
including existing columns.
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
: Sets whether homogeneous tables are
allowed in the given collection. This action is only valid if
tableName
is a collection. The value
must be
either 'true' or 'false'.
CREATE_INDEX
: Creates an index on the column name specified in value
. If this column is already indexed, an error will be
returned.
DELETE_INDEX
: Deletes an existing index on the column name specified in value
. If this column does not have indexing turned on, an
error will be returned.
MOVE_TO_COLLECTION
: Moves a table into a collection value
.
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
.
MEMORY_TTL
: Sets the time-to-live in minutes for the individual
chunks of the columns of the table, view, or collection
specified in tableName
to free their memory if unused
longer than the given time. Specify an empty string to restore
the global memory_ttl setting and a value of '-1' for an
infinite timeout.
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
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key 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.
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 - one of
'manual', 'periodic', 'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to datetime string 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. Also, sets the refresh
method to periodic if not alreay set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: remove text_search attribute
from all columns, if exists.
public AlterTableRequest setAction(String action)
action
- Modification operation to be applied
Supported values:
ALLOW_HOMOGENEOUS_TABLES
: Sets whether homogeneous
tables are allowed in the given collection. This action
is only valid if tableName
is a collection. The
value
must be either 'true' or 'false'.
CREATE_INDEX
: Creates an index on the column name specified in
value
. If this column is already indexed, an
error will be returned.
DELETE_INDEX
: Deletes an existing index on the column name specified in
value
. If this column does not have indexing
turned on, an error will be returned.
MOVE_TO_COLLECTION
: Moves a table into a collection
value
.
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
.
MEMORY_TTL
: Sets the time-to-live in minutes for the
individual chunks of the columns of the table, view, or
collection specified in tableName
to free their
memory if unused longer than the given time. Specify an
empty string to restore the global memory_ttl setting and
a value of '-1' for an infinite timeout.
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
.
DELETE_COLUMN
: Deletes the column specified in value
from the table specified in tableName
.
CREATE_FOREIGN_KEY
: Creates a foreign key 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.
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 - one of
'manual', 'periodic', 'on_change'.
SET_REFRESH_START_TIME
: Sets the time to start periodic
refreshes of this materialized view to datetime string
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. Also, sets the
refresh method to periodic if not alreay set.
REMOVE_TEXT_SEARCH_ATTRIBUTES
: remove text_search
attribute from all columns, if exists.
this
to mimic the builder pattern.public String getValue()
action
.public AlterTableRequest setValue(String value)
value
- The value of the modification. May be a column name,
'true' or 'false', a TTL, or the global access mode
depending on action
.this
to mimic the builder pattern.public Map<String,String> getOptions()
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
: please see 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 need to update the
last_access_time.
Supported values:
The default value is TRUE
.
ADD_COLUMN_EXPRESSION
: expression for new column's values
(optional with add_column). Any valid expressions including
existing columns.
Map
.public AlterTableRequest setOptions(Map<String,String> options)
options
- Optional parameters.
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
: please see
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 need to
update the last_access_time.
Supported values:
The default value is TRUE
.
ADD_COLUMN_EXPRESSION
: expression for new column's
values (optional with add_column). Any valid expressions
including existing columns.
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 © 2019. All rights reserved.