Version:

Create TypeΒΆ

Creates a new type in GPUdb describing the layout or schema of a table. The type definition is a JSON string describing the fields (i.e. columns) of the type. Each field consists of a name and a data type. Supported data types are: double, float, int, long, string, and bytes. In addition one or more properties can be specified for each column which customize the memory usage and query availability of that column. Note that some properties are mutually exclusive--i.e. they cannot be specified for any given column simultaneously. One example of mutually exclusive properties are data and store_only.

To set a primary key on one or more columns include the property 'primary_key' on the desired column_names. If a primary key is specified then GPUdb enforces a uniqueness constraint in that only a single object can exist with a given primary key. When inserting data into a table with a primary key, depending on the parameters in the request, incoming objects with primary keys that match existing objects will either overwrite (i.e. update) the existing object or will be skipped and not added into the set.

Example of a type definition with some of the parameters:

{"type":"record",
"name":"point",
"fields":[{"name":"msg_id","type":"string"},
                {"name":"x","type":"double"},
                {"name":"y","type":"double"},
                {"name":"TIMESTAMP","type":"double"},
                {"name":"source","type":"string"},
                {"name":"group_id","type":"string"},
                {"name":"OBJECT_ID","type":"string"}]
}

Properties:

{"group_id":["store_only"],
"msg_id":["store_only","text_search"]
}

Input Parameter Description

Name Type Description
type_definition string a JSON string describing the columns of the type to be registered.
label string A user-defined description string which can be used to differentiate between tables and types with otherwise identical schemas.
properties map of arrays of strings

Each key-value pair specifies the properties to use for a given column where the key is the column name. All keys used must be relevant column names for the given table. Specifying any property overrides the default properties for that column (which is based on the column's data type). Default value is an empty map ( {} ).

Allowed Values Description
data Default property for all numeric and string type columns; makes the column available for GPU queries.
text_search Valid only for 'string' columns. Enables full text search for string columns. Can be set independently of data and store_only.
store_only Persist the column value but do not make it available to queries (e.g. Filter by Box)-i.e. it is mutually exclusive to the 'data' property. Any 'bytes' type column must have a 'store_only' property. This property reduces system memory usage.
disk_optimized Works in conjunction with the 'data' property for string columns. This property reduces system disk usage by disabling reverse string lookups. Queries like Filter, Filter by List, and Filter by Value work as usual but Aggregate Unique, Aggregate Group By and Get Records by Column are not allowed on columns with this property.
timestamp Valid only for 'long' columns. Indicates that this field represents a timestamp and will be provided in milliseconds since the Unix epoch: 00:00:00 Jan 1 1970.
char1 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 1 character. This property cannot be combined with text_search
char2 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 2 characters. This property cannot be combined with text_search
char4 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 4 characters. This property cannot be combined with text_search
char8 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 8 characters. This property cannot be combined with text_search
char16 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 16 characters. This property cannot be combined with text_search
char32 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 32 characters. This property cannot be combined with text_search
char64 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 64 characters. This property cannot be combined with text_search
char128 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 128 characters. This property cannot be combined with text_search
char256 This property provides optimized memory, disk and query performance for string columns. Strings with this property must be no longer than 256 characters. This property cannot be combined with text_search
int8 This property provides optimized memory and query performance for int columns. Ints with this property must be between -128 and +127 (inclusive)
int16 This property provides optimized memory and query performance for int columns. Ints with this property must be between -32768 and +32767 (inclusive)
ipv4 This property provides optimized memory, disk and query performance for string columns representing IPv4 addresses (i.e. 192.168.1.1). Strings with this property must be of the form: A.B.C.D where A, B, C and D are in the range of 0-255.
primary_key This property indicates that this column will be part of (or the entire) primary key.
shard_key This property indicates that this column will be part of (or the entire) shard key.
options map of strings Optional parameters. Default value is an empty map ( {} ).

Output Parameter Description

Name Type Description
type_id string A GPUdb identifier representing the created type. This type_id can be used in subsequent calls to create a table
type_definition string Value of input parameter type_definition.
label string Value of input parameter label.
properties map of arrays of strings Value of input parameter properties.