public class AlterTableRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.alterTable(AlterTableRequest)
.
Apply various modifications to a table or collection. Available modifications include:
Creating or deleting an index on a particular column. This can speed up
certain search queries (such as GPUdb.getRecordsRaw(GetRecordsRequest)
, GPUdb.deleteRecords(DeleteRecordsRequest)
, GPUdb.updateRecordsRaw(RawUpdateRecordsRequest)
) when using
expressions containing equality or relational operators on indexed columns.
This only applies to tables.
Setting the time-to-live (TTL). This can be applied to tables, views, or collections. When applied to collections, every table & view within the collection will have its TTL set to the given value.
Making a table protected or not. Protected tables have their TTLs set to not automatically expire. This can be applied to tables, views, and collections.
Allowing homogeneous tables within a collection. Managing a table's columns--a column can be added or removed, or have its type modified.
Modifier and Type | Class and Description |
---|---|
static class |
AlterTableRequest.Action
Modification operation to be applied
Supported values:
CREATE_INDEX :
Creates an index on the column name specified in value . |
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:
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.
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'.
PROTECTED
: Sets whether the given tableName
should be protected or not. The value
must be
either 'true' or 'false'.
TTL
:
Sets the TTL of the table, view, or collection specified
in tableName
. The value
must be the
desired TTL in minutes.
ADD_COLUMN
: Add a column value
to the table. set
the column properties in options
DELETE_COLUMN
: Delete a column value
from the
table
CHANGE_COLUMN
: Change properties of a column value
in the table. set the column properties in options
RENAME_TABLE
: Rename a table, view or collection to
value
. Has the same naming restrictions as tables.
value
- The value of the modification. May be a column name,
'true' or 'false', or a TTL depending on action
.options
- Optional parameters.
COLUMN_DEFAULT_VALUE
: when adding a column: set a
default value, for existing data.
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).
VALIDATE_CHANGE_COLUMN
: Validate the type change before
applying column_change request. Default is true
(if option is missing). 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
.
COPY_VALUES_FROM_COLUMN
: when adding or changing a
column: enter column name - from where to copy values.
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()
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.
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'.
PROTECTED
: Sets whether the given tableName
should be
protected or not. The value
must be either 'true' or
'false'.
TTL
: Sets the
TTL of the table, view, or collection specified in tableName
. The value
must be the desired TTL in
minutes.
ADD_COLUMN
: Add a column value
to the table. set the
column properties in options
DELETE_COLUMN
: Delete a column value
from the table
CHANGE_COLUMN
: Change properties of a column value
in
the table. set the column properties in options
RENAME_TABLE
: Rename a table, view or collection to value
. Has the same naming restrictions as tables.
public AlterTableRequest setAction(String action)
action
- Modification operation to be applied
Supported values:
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.
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'.
PROTECTED
: Sets whether the given tableName
should be protected or not. The value
must be
either 'true' or 'false'.
TTL
:
Sets the TTL of the table, view, or collection specified
in tableName
. The value
must be the
desired TTL in minutes.
ADD_COLUMN
: Add a column value
to the table. set
the column properties in options
DELETE_COLUMN
: Delete a column value
from the
table
CHANGE_COLUMN
: Change properties of a column value
in the table. set the column properties in options
RENAME_TABLE
: Rename a table, view or collection to
value
. Has the same naming restrictions as tables.
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', or a TTL 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 data.
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).
VALIDATE_CHANGE_COLUMN
: Validate the type change before
applying column_change request. Default is true
(if
option is missing). 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
.
COPY_VALUES_FROM_COLUMN
: when adding or changing a column:
enter column name - from where to copy values.
public AlterTableRequest setOptions(Map<String,String> options)
options
- Optional parameters.
COLUMN_DEFAULT_VALUE
: when adding a column: set a
default value, for existing data.
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).
VALIDATE_CHANGE_COLUMN
: Validate the type change before
applying column_change request. Default is true
(if option is missing). 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
.
COPY_VALUES_FROM_COLUMN
: when adding or changing a
column: enter column name - from where to copy values.
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 © 2017. All rights reserved.