Arcadia Engine supports all Impala aggregate functions in Analytical Views, including APPX_MEDIAN()
, AVG()
, COUNT()
, GROUP_CONCAT()
, MAX()
, MIN()
, NDV()
, SAMPLE()
, STDDEV()
, STDDEV_SAMP()
, STDDEV_POP()
, SUM()
, VARIANCE()
, VARIANCE_SAMP()
, VARIANCE_POP()
, VAR_SAMP()
, and VAR_POP()
.
Analytical Views also support Arcadia's proprietary BOOLEAN_AND()
, BOOLEAN_OR()
, and GCDO()
, as well as user-defined functions.
To enable aggregate functions in the analytical view, simply add them to the 'select list' of the analytical view. Queries that contain these aggregate functions are automatically routed to the analytical view, provided they meet the necessary conditions.
The following steps demonstrate how to implement an aggregate that uses the ndv()
function.
create analytical view aview1 stored as parquet as select name, ndv(event_id) from events group by name;
refresh analytical view aview1;
explain select ndv(event_id) from events; 'REWR :''SELECT ndv_bigint_finalize('_c1') 'ndv(event_id)' FROM default.aview1 aview1'