To take advantage of Smart Acceleration, Eager Aggregation, and other performance enhancements native to Arcadia Engine, you must create analytical views.
This article describes how to create partition-based analytical views. For sequence-based analytical views, see CREATE ANALYTICAL VIEW; Sequence-Based.
This topic contains the following sections:
The CREATE ANALYTICAL VIEW
command has the following syntax.
CREATE ANALYTICAL VIEW [if not exists] database_name.analytical_view_name
[COMMENT table_comment]
[PARTITIONED BY (column_name, ... )]
STORED AS PARQUET
[LOCATION location]
AS select_statement;
The actual statement that describes the structure of the analytical view:
SELECT columns FROM table [WHERE conditions] [GROUP BY g_columns] [ORDER BY o_columns ASC|DESC]
PARTITIONED BY
columns must be the final columns in the
SELECT
list. We recommend that you partition analytical views on the
same columns as the underlying tables. Arcadia Engine detects changes in base table
partitions and updates corresponding analytical view partitions, thereby imaking an
incremental analytical view refresh possible.AS select_statement
mandatory clause defines the structure of the
analytical view.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);