Skip to main content
Version: 1.0.0

Functions

Functions can calculate a value for every input row.

length​

length(value) returns the length of a string or array:

select {name, tagCount: length(tags)} from 'customers.json'

For other value types, it returns 0. length takes exactly one argument.

trimLeft​

trimLeft(pattern, value) repeatedly removes a literal pattern from the beginning of a string:

select {code: trimLeft('SKU-', rawCode)} from 'products.json'

For SKU-SKU-1042, the result is 1042.

trimRight​

trimRight(pattern, value) repeatedly removes a literal pattern from the end of a string:

select {path: trimRight('/', rawPath)} from 'pages.json'

Both trim functions take exactly two arguments in the order pattern, value. An empty or unmatched pattern leaves the value unchanged. Patterns are literal strings, not regular expressions.

For functions that summarize many rows, see Aggregation.