Version:

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.

Input Parameter Description

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:

  • true
  • false
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:

  • true
  • false

Output Parameter Description

Name Type Description
table_name string Value of input parameter table_name.