pivot and pivot_values parameters in the
options map of /aggregate/groupby or via the SQL
PIVOT function. Visit the Aggregation documentation to review
details on aggregating data.
A pivot operation could be used to convert a table like this:
Phone) specified by the user.
The results of a pivot may be written to a separate
memory-only table using the result_table option.
This table can be persisted (like normal tables) using the
result_table_persist option.
A memory-only table name must adhere to the standard
naming criteria. Each memory-only table
exists within a schema and follows the standard
name resolution rules for tables.
Examples
Customer Phone Numbers
Given a source tablephone_list, which lists each phone number for a
customer as a separate record in the table:
Student Grades
Given a source tableqtr_grade, which lists each student’s quarterly grade
as a separate record in the table:
Limitations
- Pivot values are case sensitive; e.g., a value of
Homewill not match records with values ofHOMEorhome, and it will generate a new column withHomeas the name (or part of the name if an alias was specified). - Pivot values cannot contain commas, making the operation generally inapplicable to data containing them, like JSON, vector, and comma-embedded strings.
- When the
result_tableoption is used, pivot values must meet standard column naming criteria, as they will be used to construct the output table column names. This may prevent the direct pivoting of some data types, like date & UUID (among others), that naturally contain invalid column naming characters. - As the pivot operation is executed via /aggregate/groupby, all Aggregation Limitations also apply.