Functions

The following functions are supported in StreamSQL in StreamOps

Function
Description
Example

now()

Returns the current UTC timestamp in millis

select now() from topic

substring(value, from, to)

Returns a substring of a string or value from an index

select substring(name, 0, 10) from topic

length(value)

Returns the length of a string value or a value converted to a string

select length(name) from topic

concat

Joins two more values together

select concat(name, timestamp, location) from logins

upper

Returns a string value in uppercase

select upper(name) from topic

lower

Returns a string value in lowercase

select lower(name) from topic

left(value, n)

Returns the left most n characters from a string value. If the string is less than n then all characters will be returned

select left(name, 4) from topic

right(value, n)

Returns the right most n characters from a string value. If the string is less than n, then all characters will be returned.

select right(name, 4) from topic

geohash(lat, location, precision)

Returns the precision value geohash of the given x and y coordinates.

select geohash(user.lat, user.long, 6) from topic

coalesce(a, b, ...)

Returns the first non null value in a list.

select coalesce(firstname, lastname, "noname") from topic

count(*)

Returns the aggregate count across a grouping

select count(*) from topic

avg(a)

Returns the avg of a measure across a grouping

select avg(price) from products

max(a)

Returns the max of a measure across a grouping

select max(price) from products

min(a)

Returns the min of a measure across a grouping

select min(price) from products

sum(a)

Returns the sum of a measure across a grouping

select sum(amount) from transactions

Last updated