Aggregate Functions in Analytical Views

Arcadia Engine's analytical views support aggregate functions.

Arcadia Engine supports these Impala aggregate functions in Analytical Views: 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(). See Impala Aggregate Functions.

Analytical Views also support Arcadia's proprietary NDVP(), BOOLEAN_AND(), BOOLEAN_OR(), and GCDO(), as well as user-defined functions.

Enabling Aggregate 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.

Using Aggregate Functions in Analytical Views

The following steps demonstrate how to implement an aggregate that uses the NDV() function.

  1. Create an analytical view:
    create analytical view aview1 stored as parquet 
      as select name, ndv(event_id) from events group by name;
  2. Refresh the analytical view:
    refresh analytical view aview1;
  3. Check the query routing:
    explain select ndv(event_id) from events;
    'REWR :''SELECT ndv_bigint_finalize('_c1') 'ndv(event_id)' FROM default.aview1 aview1'