Skip to main content

distinctCount (Aggregate Function)

This returns the count of distinct occurrences for a given arg.

Syntax​

    <LONG> distinctCount(<INT|LONG|DOUBLE|FLOAT|STRING> arg)

Query Parameters​

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
argThe object for which the number of distinct occurences needs to be counted.INT LONG DOUBLE FLOAT STRINGNoYes

Example​

insert into barStream
select distinctcount(pageID) as count
from fooStream;

distinctcount(pageID) for the following output returns 3 when the available values are as follows.

  • WEB_PAGE_1
  • WEB_PAGE_1
  • WEB_PAGE_2
  • WEB_PAGE_3
  • WEB_PAGE_1
  • WEB_PAGE_2

The three distinct occurrences identified are WEB_PAGE_1, WEB_PAGE_2, and WEB_PAGE_3.