Package com.gpudb.protocol
Class CreateTableRequest
- java.lang.Object
-
- com.gpudb.protocol.CreateTableRequest
-
- All Implemented Interfaces:
org.apache.avro.generic.GenericContainer,org.apache.avro.generic.IndexedRecord
public class CreateTableRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters forGPUdb.createTable.Creates a new table with the given type (definition of columns). The type is specified in
typeIdas either a numerical type ID (as returned byGPUdb.createType) or as a list of columns, each specified as a list of the column name, data type, and any column attributes.Example of a type definition with some parameters:
[ ["id", "int8", "primary_key"], ["dept_id", "int8", "primary_key", "shard_key"], ["manager_id", "int8", "nullable"], ["first_name", "char32"], ["last_name", "char64"], ["salary", "decimal"], ["hire_date", "date"] ]Each column definition consists of the column name (which should meet the standard column naming criteria), the column's specific type (int, long, float, double, string, bytes, or any of the properties map values fromGPUdb.createType), and any data handling, data key, or data replacement properties.A table may optionally be designated to use a replicated distribution scheme, or be assigned: foreign keys to other tables, a partitioning scheme, and/or a tier strategy.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCreateTableRequest.OptionsA set of string constants for theCreateTableRequestparameteroptions.
-
Constructor Summary
Constructors Constructor Description CreateTableRequest()Constructs a CreateTableRequest object with default parameters.CreateTableRequest(String tableName, String typeId, Map<String,String> options)Constructs a CreateTableRequest object with the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Objectget(int index)This method supports the Avro framework and is not intended to be called directly by the user.static org.apache.avro.SchemagetClassSchema()This method supports the Avro framework and is not intended to be called directly by the user.Map<String,String>getOptions()Optional parameters.org.apache.avro.SchemagetSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetTableName()Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.StringgetTypeId()The type for the table, specified as either an existing table's numerical type ID (as returned byGPUdb.createType) or a type definition (as described above).inthashCode()voidput(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.CreateTableRequestsetOptions(Map<String,String> options)Optional parameters.CreateTableRequestsetTableName(String tableName)Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.CreateTableRequestsetTypeId(String typeId)The type for the table, specified as either an existing table's numerical type ID (as returned byGPUdb.createType) or a type definition (as described above).StringtoString()
-
-
-
Constructor Detail
-
CreateTableRequest
public CreateTableRequest()
Constructs a CreateTableRequest object with default parameters.
-
CreateTableRequest
public CreateTableRequest(String tableName, String typeId, Map<String,String> options)
Constructs a CreateTableRequest object with the specified parameters.- Parameters:
tableName- Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. Error for requests with existing table of the same name and type ID may be suppressed by using theNO_ERROR_IF_EXISTSoption.typeId- The type for the table, specified as either an existing table's numerical type ID (as returned byGPUdb.createType) or a type definition (as described above).options- Optional parameters.NO_ERROR_IF_EXISTS: IfTRUE, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. Supported values: The default value isFALSE.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place oftableName. IfIS_RESULT_TABLEisTRUE, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part oftableNameand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created.IS_COLLECTION: [DEPRECATED--please useGPUdb.createSchemato create a schema instead] Indicates whether to create a schema instead of a table. Supported values: The default value isFALSE.IS_REPLICATED: Affects the distribution scheme for the table's data. IfTRUEand the given type has no explicit shard key defined, the table will be replicated. IfFALSE, the table will be sharded according to the shard key specified in the giventypeId, or randomly sharded, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. Supported values: The default value isFALSE.FOREIGN_KEYS: Semicolon-separated list of foreign keys, of the format '(source_column_name [, ...]) references target_table_name(primary_key_column_name [, ...]) [as foreign_key_name]'.FOREIGN_SHARD_KEY: Foreign shard key of the format 'source_column references shard_by_column from target_table(primary_key_column)'.PARTITION_TYPE: Partitioning scheme to use. Supported values:RANGE: Use range partitioning.INTERVAL: Use interval partitioning.LIST: Use list partitioning.HASH: Use hash partitioning.SERIES: Use series partitioning.
PARTITION_KEYS: Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined byPARTITION_DEFINITIONS.PARTITION_DEFINITIONS: Comma-separated list of partition definitions, whose format depends on the choice ofPARTITION_TYPE. See range partitioning, interval partitioning, list partitioning, hash partitioning, or series partitioning for example formats.IS_AUTOMATIC_PARTITION: IfTRUE, a new partition will be created for values which don't fall into an existing partition. Currently only supported for list partitions. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified intableName.CHUNK_SIZE: Indicates the number of records per chunk to be used for this table.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for this table.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for this table.IS_RESULT_TABLE: Indicates whether the table is a memory-only table. A result table cannot contain columns with text_search data-handling, and it will not be retained if the server is restarted. Supported values: The default value isFALSE.STRATEGY_DEFINITION: The tier strategy for the table and its columns.COMPRESSION_CODEC: The default compression codec for this table's columns.LOAD_VECTORS_POLICY: Set startup data loading scheme for the table. Supported values:ALWAYS: Load as much vector data as possible into memory before accepting requests.LAZY: Load the necessary vector data at start, and load the remainder lazily.ON_DEMAND: Load vector data as requests use it.SYSTEM: Load vector data using the system-configured default.
SYSTEM.BUILD_PK_INDEX_POLICY: Set startup primary-key index generation scheme for the table. Supported values:ALWAYS: Generate as much primary key index data as possible before accepting requests.LAZY: Generate the necessary primary key index data at start, and load the remainder lazily.ON_DEMAND: Generate primary key index data as requests use it.SYSTEM: Generate primary key index data using the system-configured default.
SYSTEM.
Map.
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Returns:
- The schema for the class.
-
getTableName
public String getTableName()
Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. Error for requests with existing table of the same name and type ID may be suppressed by using theNO_ERROR_IF_EXISTSoption.- Returns:
- The current value of
tableName.
-
setTableName
public CreateTableRequest setTableName(String tableName)
Name of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. Error for requests with existing table of the same name and type ID may be suppressed by using theNO_ERROR_IF_EXISTSoption.- Parameters:
tableName- The new value fortableName.- Returns:
thisto mimic the builder pattern.
-
getTypeId
public String getTypeId()
The type for the table, specified as either an existing table's numerical type ID (as returned byGPUdb.createType) or a type definition (as described above).- Returns:
- The current value of
typeId.
-
setTypeId
public CreateTableRequest setTypeId(String typeId)
The type for the table, specified as either an existing table's numerical type ID (as returned byGPUdb.createType) or a type definition (as described above).- Parameters:
typeId- The new value fortypeId.- Returns:
thisto mimic the builder pattern.
-
getOptions
public Map<String,String> getOptions()
Optional parameters.NO_ERROR_IF_EXISTS: IfTRUE, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. Supported values: The default value isFALSE.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place oftableName. IfIS_RESULT_TABLEisTRUE, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part oftableNameand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created.IS_COLLECTION: [DEPRECATED--please useGPUdb.createSchemato create a schema instead] Indicates whether to create a schema instead of a table. Supported values: The default value isFALSE.IS_REPLICATED: Affects the distribution scheme for the table's data. IfTRUEand the given type has no explicit shard key defined, the table will be replicated. IfFALSE, the table will be sharded according to the shard key specified in the giventypeId, or randomly sharded, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. Supported values: The default value isFALSE.FOREIGN_KEYS: Semicolon-separated list of foreign keys, of the format '(source_column_name [, ...]) references target_table_name(primary_key_column_name [, ...]) [as foreign_key_name]'.FOREIGN_SHARD_KEY: Foreign shard key of the format 'source_column references shard_by_column from target_table(primary_key_column)'.PARTITION_TYPE: Partitioning scheme to use. Supported values:RANGE: Use range partitioning.INTERVAL: Use interval partitioning.LIST: Use list partitioning.HASH: Use hash partitioning.SERIES: Use series partitioning.
PARTITION_KEYS: Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined byPARTITION_DEFINITIONS.PARTITION_DEFINITIONS: Comma-separated list of partition definitions, whose format depends on the choice ofPARTITION_TYPE. See range partitioning, interval partitioning, list partitioning, hash partitioning, or series partitioning for example formats.IS_AUTOMATIC_PARTITION: IfTRUE, a new partition will be created for values which don't fall into an existing partition. Currently only supported for list partitions. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified intableName.CHUNK_SIZE: Indicates the number of records per chunk to be used for this table.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for this table.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for this table.IS_RESULT_TABLE: Indicates whether the table is a memory-only table. A result table cannot contain columns with text_search data-handling, and it will not be retained if the server is restarted. Supported values: The default value isFALSE.STRATEGY_DEFINITION: The tier strategy for the table and its columns.COMPRESSION_CODEC: The default compression codec for this table's columns.LOAD_VECTORS_POLICY: Set startup data loading scheme for the table. Supported values:ALWAYS: Load as much vector data as possible into memory before accepting requests.LAZY: Load the necessary vector data at start, and load the remainder lazily.ON_DEMAND: Load vector data as requests use it.SYSTEM: Load vector data using the system-configured default.
SYSTEM.BUILD_PK_INDEX_POLICY: Set startup primary-key index generation scheme for the table. Supported values:ALWAYS: Generate as much primary key index data as possible before accepting requests.LAZY: Generate the necessary primary key index data at start, and load the remainder lazily.ON_DEMAND: Generate primary key index data as requests use it.SYSTEM: Generate primary key index data using the system-configured default.
SYSTEM.
Map.- Returns:
- The current value of
options.
-
setOptions
public CreateTableRequest setOptions(Map<String,String> options)
Optional parameters.NO_ERROR_IF_EXISTS: IfTRUE, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. Supported values: The default value isFALSE.CREATE_TEMP_TABLE: IfTRUE, a unique temporary table name will be generated in the sys_temp schema and used in place oftableName. IfIS_RESULT_TABLEisTRUE, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned inQUALIFIED_TABLE_NAME. Supported values: The default value isFALSE.COLLECTION_NAME: [DEPRECATED--please specify the containing schema as part oftableNameand useGPUdb.createSchemato create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created.IS_COLLECTION: [DEPRECATED--please useGPUdb.createSchemato create a schema instead] Indicates whether to create a schema instead of a table. Supported values: The default value isFALSE.IS_REPLICATED: Affects the distribution scheme for the table's data. IfTRUEand the given type has no explicit shard key defined, the table will be replicated. IfFALSE, the table will be sharded according to the shard key specified in the giventypeId, or randomly sharded, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. Supported values: The default value isFALSE.FOREIGN_KEYS: Semicolon-separated list of foreign keys, of the format '(source_column_name [, ...]) references target_table_name(primary_key_column_name [, ...]) [as foreign_key_name]'.FOREIGN_SHARD_KEY: Foreign shard key of the format 'source_column references shard_by_column from target_table(primary_key_column)'.PARTITION_TYPE: Partitioning scheme to use. Supported values:RANGE: Use range partitioning.INTERVAL: Use interval partitioning.LIST: Use list partitioning.HASH: Use hash partitioning.SERIES: Use series partitioning.
PARTITION_KEYS: Comma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined byPARTITION_DEFINITIONS.PARTITION_DEFINITIONS: Comma-separated list of partition definitions, whose format depends on the choice ofPARTITION_TYPE. See range partitioning, interval partitioning, list partitioning, hash partitioning, or series partitioning for example formats.IS_AUTOMATIC_PARTITION: IfTRUE, a new partition will be created for values which don't fall into an existing partition. Currently only supported for list partitions. Supported values: The default value isFALSE.TTL: Sets the TTL of the table specified intableName.CHUNK_SIZE: Indicates the number of records per chunk to be used for this table.CHUNK_COLUMN_MAX_MEMORY: Indicates the target maximum data size for each column in a chunk to be used for this table.CHUNK_MAX_MEMORY: Indicates the target maximum data size for all columns in a chunk to be used for this table.IS_RESULT_TABLE: Indicates whether the table is a memory-only table. A result table cannot contain columns with text_search data-handling, and it will not be retained if the server is restarted. Supported values: The default value isFALSE.STRATEGY_DEFINITION: The tier strategy for the table and its columns.COMPRESSION_CODEC: The default compression codec for this table's columns.LOAD_VECTORS_POLICY: Set startup data loading scheme for the table. Supported values:ALWAYS: Load as much vector data as possible into memory before accepting requests.LAZY: Load the necessary vector data at start, and load the remainder lazily.ON_DEMAND: Load vector data as requests use it.SYSTEM: Load vector data using the system-configured default.
SYSTEM.BUILD_PK_INDEX_POLICY: Set startup primary-key index generation scheme for the table. Supported values:ALWAYS: Generate as much primary key index data as possible before accepting requests.LAZY: Generate the necessary primary key index data at start, and load the remainder lazily.ON_DEMAND: Generate primary key index data as requests use it.SYSTEM: Generate primary key index data using the system-configured default.
SYSTEM.
Map.- Parameters:
options- The new value foroptions.- Returns:
thisto mimic the builder pattern.
-
getSchema
public org.apache.avro.Schema getSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getSchemain interfaceorg.apache.avro.generic.GenericContainer- Returns:
- The schema object describing this class.
-
get
public Object get(int index)
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to get- Returns:
- value of the field with the given index.
- Throws:
IndexOutOfBoundsException
-
put
public void put(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
putin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to setvalue- the value to set- Throws:
IndexOutOfBoundsException
-
-