This page describes how to use functions in Lenses SQL Processors.
This section describes how to use AGGREGATE functions in Lenses SQL.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes how to use ARRAY functions in Lenses SQL Processors.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes how to use HEADER functions in Lenses SQL Processors.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes the JSON functions in Lenses SQL.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes how to use NULL functions in Lenses SQL Processors.
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes how to use obfuscation functions in Lenses SQL Processors.
Loading...
Loading...
This page describes the AVG function in Lenses SQL.
Returns the average of the values in a group. It ignores the null value. It can be used with numeric input only.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
sample code:
Output:
This page describes the COLLECT_UNIQUE function in Lenses SQL.
Returns an array of unique values in which each value in the input set is assigned to an element of the array.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
Sample code:
Output:
This page describes the BOTTOMK function in Lenses SQL.
Returns the last K lowest ranked values. The ranking is based on how many times a value has been seen.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
Sample code:
Output:
This page describes the MAXK function in Lenses SQL.
Returns the N largest values of a numExpr.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
Sample code:
Output:
This page describes the FIRST function in Lenses SQL.
Returns the first item seen in a group.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
Sample code:
Output:
This page describes the COUNT function in Lenses SQL.
Returns the number of records returned by a query or the records in a group as a result of a GROUP BY
statement.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the MINK function in Lenses SQL.
Returns the N smallest values of an numExpr.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the SUM function in Lenses SQL.
Returns the sum of all the values, in the expression. It can be used with numeric input only. Null values are ignored.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the MAXK_UNIQUE function in Lenses SQL.
Returns the N smallest unique values of a numExpr.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the LAST function in Lenses SQL.
Returns the last item seen in a group.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the MINK_UNIQUE function in Lenses SQL.
Returns the N smallest unique values of a numExpr.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describe the COLLECT function in Lenses SQL.
Returns an array in which each value in the input set is assigned to an element of the array.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|
Sample code:
Output:
This page describes the ELEMENT_OF function in Lenses SQL.
Return the element of array
at index.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the FLATTEN function in Lenses SQL.
Flatten an array of arrays into an array.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the IN_ARRAY function in Lenses SQL.
Check if element
is an element of array.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ | ✓ |
✓ |
✓ | ✓ | ✓ |
✓ |
✓ |
✓ |
✓ | ✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes how to use date and time functions in Lenses SQL Processors.
Every Date Math expression starts with a base date or time followed by the addition or subtraction of one or more durations.
The base date or time (from here onward) is derived from a field in a table or a function such as now()
or yesterday()
that generates datetime values.
The shorthand syntax is a unit value followed by a unit symbol. The symbols are:
y (year)
M (month)
w (week)
d (day)
h (hour)
m (minute)
s (second)
This page describes the ZIP function in Lenses SQL.
Zip two or more arrays into a single one.
Example: ZIP([1, 2], 'x', [3, 4, 5], 'y')
will be evaluated to [{ x: 1, y: 3 }, { x: 2, y: 4 }]
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TOPK function in Lenses SQL.
Returns the K highest ranked values. The ranking is based on how many times a value has been seen.
Available in:
Processor (stateless) | Processors (stateful) | SQL Studio |
---|---|---|
Sample code:
Output:
This page describes the CONVERT_DATETIME function in Lenses SQL.
Converts the string format of a date [and time] to another using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the DATE function in Lenses SQL.
Builds a local date value from a long or int value. This function can also be used with no parameters to return the current ISO date.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the REPEAT function in Lenses SQL.
Build an array repeating element
n
times.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the SIZEOF function in Lenses SQL.
Returns the number of elements in an array.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the ZIP_ALL function in Lenses SQL.
Zip two or more arrays into a single one, returning null
s when an array is not long enough.
Example: ZIP_ALL([1, 2], 'x', [3, 4, 5], 'y')
will be evaluated to [{ x: 1, y: 3 }, { x: 2, y: 4 }, { x: null, y: 5 }]
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the EXTRACT_TIME function in Lenses SQL.
Extracts the time portion of a timestamp-micros or timestamp-millis returning a time-millis or time-micros value depending on the timestamp precision.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FORMAT_TIME function in Lenses SQL.
Returns a string representation of a time value according to a given pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FORMAT_DATE function in Lenses SQL.
Returns a string representation of a date value according to a given pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FORMAT_TIMESTAMP function in Lenses SQL.
Returns a string representation of a timestamp value according to a given pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the EXTRACT_DATE function in Lenses SQL.
Extracts the date portion of a timestamp-micros or timestamp-millis returning a date value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the DATETIME function in Lenses SQL.
Provides the current ISO date and time.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the MONTH function in Lenses SQL.
Builds a timestamp-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_DATE function in Lenses SQL.
Builds a date value given a date string representation and a date pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the HOUR function in Lenses SQL.
Extracts the hour component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the MINUTE function in Lenses SQL.
Extracts the minute component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the MONTH_TEXT function in Lenses SQL.
Returns the month name.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_TIMESTAMP_MILLIS function in Lenses SQL.
Builds a timestamp-millis value given a datetime string representation and a date time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_TIME_MICROS function in Lenses SQL.
Builds a time-micros value given a time string representation and a time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TIMESTAMP function in Lenses SQL.
Returns a timestamp for a given date and time at a specific zone id.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_TIMESTAMP_MICROS function in Lenses SQL.
Builds a timestamp-micros value given a datetime string representation and a date time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes the TIMESTAMP_MILLIS function in Lenses SQL.
Builds a timestamp-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TIME_MICROS function in Lenses SQL.
Builds a time-micros value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TO_DATE function in Lenses SQL.
Converts a string representation of a date into epoch value using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the PARSE_TIME_MILLIS function in Lenses SQL.
Builds a time-millis value given a time string representation and a time pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TIME_MILLIS function in Lenses SQL.
Builds a time-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TIMESTAMP_MICROS function in Lenses SQL.
Builds a timestamp-micros value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the SECOND function in Lenses SQL.
Extracts the second component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TO_DATETIME function in Lenses SQL.
Converts a string representation of a datetime into epoch value using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TOMORROW function in Lenses SQL.
Returns the current date time plus 1 day.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TO_TIMESTAMP function in Lenses SQL.
Converts a string representation of a date into epoch value using the pattern provided.
Converts a string using a pattern to a date and time type.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the HEADERASLONG function in Lenses SQL.
Returns the value of the record header key as a LONG value.
Available in:
Processors | SQL Studio |
---|---|
This page describes the HEADERASINT function in Lenses SQL.
Returns the value of the record header key as an INT value.
Available in:
Processors | SQL Studio |
---|---|
This page describes the HEADERASSTRING function in Lenses SQL.
Returns the value of the record header key as a STRING value.
Available in:
Processors | SQL Studio |
---|---|
This page describes the YESTERDAY function in Lenses SQL.
Returns the current date time minus 1 day.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the JSON_EXTRACT_FIRST function in Lenses SQL.
Interprets ‘pattern’ as a Json path pattern and applies it to ‘json_string’, returning the first match, as a string containing valid json. Examples for the pattern parameter: “$.a”, “$[‘a’]”, “$[0]”, “$.points[?(@[‘id’]==‘i4’)].x”, “$[‘points’][?(@[‘y’] >= 3)].id”, “$.conditions[?(@ == false)]”
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the YEAR function in Lenses SQL.
Extracts the year component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the HEADERASFLOAT function in Lenses SQL.
Returns the value of the record header key as a FLOAT value.
Available in:
Processors | SQL Studio |
---|---|
This page describes the HEADERASDOUBLE function in Lenses SQL.
Returns the value of the record header key as a DOUBLE value.
Available in:
Processors | SQL Studio |
---|---|
This page describes the JSON_EXTRACT_ALL function in Lenses SQL.
Interprets ‘pattern’ as a Json path pattern and applies it to ‘json_string’, returning all matches, as an array of strings containing valid json. Examples for the pattern parameter: “$.a”, “$[‘a’]”, “$[0]”, “$.points[?(@[‘id’]==‘i4’)].x”, “$[‘points’][?(@[‘y’] >= 3)].id”, “$.conditions[?(@ == false)]”
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes how to use numeric functions in Lenses SQL Processors.
This page describes the ATAN function in Lenses SQL.
Returns the trigonometric arc tangent of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the ACOS function in Lenses SQL.
Returns the trigonometric arc cosine of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the ASIN function in Lenses SQL.
Returns the trigonometric arc sine of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the HEADERKEYS function in Lenses SQL.
Returns all the header keys for the current record.
Available in:
Processors | SQL Studio |
---|
This page describes the CBRT function in Lenses SQL.
Returns the cube root of numExpr.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the ABS function in Lenses SQL.
Returns the absolute value of an expression
that evaluates to a number type.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
| The remainder operator (%) computes the remainder after dividing its first operand by its second i.e. | ✓ | ✓ |
| Divides one number by another (an arithmetic operator) i.e. | ✓ | ✓ |
| Subtracts one number from another (an arithmetic operator) i.e. | ✓ | ✓ |
| Multiplies one number with another (an arithmetic operator) i.e. | ✓ | ✓ |
| Adds one number to another (an arithmetic operator) i.e. | ✓ | ✓ |
| Returns the negative of the value of a numeric expression (a unary operator) i.e. | ✓ | ✓ |
✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes the DEGRESS function in Lenses SQL.
Converts the input expression to degrees.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FLOOR function in Lenses SQL.
Returns the largest value not greater than the argument.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the COS function in Lenses SQL.
Returns the trigonometric cosine of an expression.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the MIN function in Lenses SQL.
Returns the minimum element from an arbitrary number of given elements.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the COSH function in Lenses SQL.
Returns the hyperbolic cosine of an expression.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the CEIL function in Lenses SQL.
Returns the absolute value of an expression.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
\
This page describes the MOD function in Lenses SQL.
Alias for %
.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the RADIANS function in Lenses SQL.
Converts the input expression to radians.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the RANDINT function in Lenses SQL.
Returns a random integer.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the POW function in Lenses SQL.
Returns numExp1 raised to the numExp2 power.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the ROUND function in Lenses SQL.
Returns the closest integer of an expression
, with ties rounding towards positive infinity.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the SIN function in Lenses SQL.
Returns the hyperbolic sine of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the SINH function in Lenses SQL.
Returns the hyperbolic sine of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the SQRT function in Lenses SQL.
Returns the square root of numExpr.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the NEG function in Lenses SQL.
Returns the negative value of an expression
it has to evaluate to a number type.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the MAX function in Lenses SQL.
Returns the maximum element from an arbitrary number of given elements.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TANH function in Lenses SQL.
Returns the hyperbolic tangent of an expression.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the DISTANCE function in Lenses SQL.
Calculates the distance between two points using the haversine method.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the SIGN function in Lenses SQL.
Returns +1 if a value is positive or -1 if a value is negative.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
We use the function to emulate a negative value in this function.
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes the COALESCE function in Lenses SQL.
Returns the first non-null expression in the expression list.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
In case you want to know more about nullability scenarios, see here
.
This page describes the AS_NON_NULLABLE function in Lenses SQL.
Returns the provided value with its type changed from the original type to its non-nullable version.
Available in:
Processors | SQL Studio |
---|---|
using case:
Output:
In case you want to know more about nullability scenarios, see here
.
This page describes the TAN function in Lenses SQL.
Returns the trigonometric tangent of an expression.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the ISNULL function in Lenses SQL.
Returns true if the input is null; false otherwise.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the ISNOTNULL function in Lenses SQL.
Returns true if the input is not null; false otherwise.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the MASK function in Lenses SQL.
Alias for ANONYMIZE.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the AS_NULLABLE function in Lenses SQL.
Returns the provided value with its type changed from the original type to its nullable version.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
In case you want to know more about nullability scenarios, see here
.
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
This page describes the ANONYMIZE function in Lenses SQL.
Obfuscates the entire string input.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
✓
✓