The create analytical view
command has the following syntax. Note that PARTITIONED BY
columns must be the final columns in the SELECT
list.
CREATE ANALYTICAL VIEW [if not exists] db_name.analytical_view_name [COMMENT table_comment]
[PARTITIONED BY (column_name, …)]
STORED AS PARQUET
AS select_statement;
Here is an example usage of create analytical view
. Note the select(...)
statement becomes associated with the analytical view.
create analytical view events_aview
stored as parquet
as (select count(*), platform, sdk_version
from events
group by platform, sdk_version);