Arguments:

  • value is any numeric value.

Return value:

Return value type is double.

Examples:

  1. SELECT payment_type, avg(amount) FROM transactions;
cash_or_cardavg
cash22.1
card27.4
null18.02

count

count() or count(*) - counts rows irrespective of underlying data.

Arguments:

Return value:

Return value type is long.

Examples:

  • Count of rows in the transactions table.
  1. SELECT count() FROM transactions;
count
100
  • Count of rows in the transactions table aggregated by payment_type value.
  1. SELECT payment_type, count() FROM transactions;
cash_or_cardcount
cash25
card70
null5

:::note

null values are aggregated with count().

:::

haversine_dist_deg(lat, lon, ts) - calculates the traveled distance for a series of latitude and longitude points.

Arguments:

  • lat is the latitude expressed as degrees in decimal format (double)
  • is the longitude expressed as degrees in decimal format (double)
  • ts is the timestamp for the data point

Return value type is double.

Examples:

ksum

ksum(value) - adds values ignoring missing data (e.g null values). Values are added using the

. This is only beneficial for floating-point values such as float or double.

Arguments:

  • value is any numeric value.

Return value:

Return value type is the same as the type of the argument.

Examples:

  1. SELECT ksum(a)
  2. FROM (SELECT rnd_double() a FROM long_sequence(100));

max(value) - returns the highest value ignoring missing data (e.g null values).

Arguments:

Return value:

Return value type is the same as the type of the argument.

Examples:

  1. SELECT max(amount) FROM transactions;
min
55.3
  1. SELECT payment_type, max(amount) FROM transactions;
cash_or_cardamount
cash31.5
card55.3
null29.2

min

- returns the lowest value ignoring missing data (e.g null values).

  • value is any numeric value

Return value:

Return value type is the same as the type of the argument.

Examples:

min
12.5
  1. SELECT payment_type, min(amount) FROM transactions;

nsum(value) - adds values ignoring missing data (e.g null values). Values are added using the . This is only beneficial for floating-point values such as float or double.

Arguments:

  • value is any numeric value.

Return value:

Return value type is the same as the type of the argument.

Examples:

  1. SELECT nsum(a)
  2. FROM (SELECT rnd_double() a FROM long_sequence(100));
nsum
49.5442334742831

sum

sum(value) - adds values ignoring missing data (e.g null values).

Arguments:

  • value is any numeric value.

Return value:

Return value type is the same as the type of the argument.

Examples:

  1. SELECT sum(quantity) FROM transactions;
sum
100
itemcount
apple53
orange47

sum does not perform overflow check. To avoid overflow, you can cast the argument to wider type.

  1. SELECT sum(cast(a AS LONG)) FROM table;