/create/union
URL: http://GPUDB_IP_ADDRESS:GPUDB_PORT/create/union
Performs a union (concatenation) of one or more existing tables or views, the results of which are stored in a new view. It is equivalent to the SQL UNION ALL operator. Non-charN 'string' and 'bytes' column types cannot be included in a union, neither can columns with the property 'store_only'. Though not explicitly unions, intersect and except are also available from this endpoint.
Name |
Type |
Description |
table_name |
string |
Name of the table to be created. Has the same naming restrictions as tables. |
table_names |
array
of
strings |
The list of table names making up the union. Must contain the names of one or more existing tables. |
input_column_names |
array
of
arrays
of
strings |
The list of columns from each of the corresponding input tables. |
output_column_names |
array
of
strings |
The list of names of the columns to be stored in the union. |
options |
map of
strings |
Optional parameters. Default value is an empty map ( {} ).
Supported
Parameters (keys) |
Parameter Description |
collection_name |
Name of a collection which is to contain the union. If the collection provided is non-existent, the collection will be automatically created. If empty, then the union will be a top-level table. Default value is ''. |
materialize_on_gpu |
If 'true' then the columns of the union will be cached on the GPU. Default value is 'false'. The allowed values are:
|
mode |
If 'merge_views' then this operation will merge (i.e. union) the provided views. All 'table_names' must be views from the same underlying base table. Default value is 'union_all'.
Supported
Values |
Description |
union_all |
Retains all rows from the specified tables. |
union |
Retains all unique rows from the specified tables (synonym for 'union_distinct'). |
union_distinct |
Retains all unique rows from the specified tables. |
except |
Retains all unique rows from the first table that do not appear in the second table (only works on 2 tables). |
intersect |
Retains all unique rows that appear in both of the specified tables (only works on 2 tables). |
merge_views |
Merge two or more views (or views of views) of the same base data set into a new view. The resulting view would match the results of a SQL OR operation, e.g., if filter 1 creates a view using the expression 'x = 10' and filter 2 creates a view using the expression 'x <= 10', then the merge views operation creates a new view using the expression 'x = 10 OR x <= 10'. |
|
ttl |
Sets the TTL of the table specified in input parameter table_name. The value must be the desired TTL in minutes. |
persist |
If true then the union will be persisted as a regular table (it will not be automatically cleared unless a ttl is provided, and the table data can be modified in subsequent operations). If false then the union will be a read-only, memory-only temporary table. Default value is 'false'. The allowed values are:
|
|
The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:
Name |
Type |
Description |
status |
String |
'OK' or 'ERROR' |
message |
String |
Empty if success or an error message |
data_type |
String |
'create_union_request' or 'none' in case of an
error |
data |
String |
Empty string |
data_str |
JSON
or
String |
This embedded JSON represents the result of the
/create/union endpoint:
Name |
Type |
Description |
table_name |
string |
Value of input parameter
table_name. |
Empty string in case of an error.
|