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. The mode can be set to 'no_access', 'read_only', 'write_only' or 'read_write'.
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 TTL 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.
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 references
target_table(primary_key_column) [ as DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should
be the 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'.
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.
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
: When adding or changing a
column, enter a column name from the same table being
altered to use as a source for the column being
added/changed; values will be copied from this source
column into the new/modified column.
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
.
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
TTL
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.
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
references target_table(primary_key_column) [ as
DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should be the
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'.
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 TTL 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.
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 references
target_table(primary_key_column) [ as DELETE_FOREIGN_KEY
: Deletes a foreign key. The value
should
be the 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'.
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.
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
: When adding or changing a column,
enter a column name from the same table being altered to use as
a source for the column being added/changed; values will be
copied from this source column into the new/modified column.
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
.
public AlterTableRequest setOptions(Map<String,String> options)
options
- Optional parameters.
COLUMN_DEFAULT_VALUE
: When adding a column, set a
default value for existing records.
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
: When adding or changing a
column, enter a column name from the same table being
altered to use as a source for the column being
added/changed; values will be copied from this source
column into the new/modified column.
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
.
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 © 2018. All rights reserved.