This feature is currently in alpha. If you want to try it out or have any questions, submit a ticket to the support team.
Built-in Common UDFs
Data Type Conversion Function
The pfSQLcast function is used to convert a value from one data type to another. Currently, it supports 6 data types, including INT32, INT64, FLOAT, DOUBLE, STRING, and BOOLEAN.
The syntax of the cast function is:
cast function takes two parameters, the first one is the field name, and the second one is the target data type. The target data type is specified by the to keyword, and it can be one of the following values:
- “int32”
- “int64”
- “float”
- “double”
- “string”
- “boolean”
Const Value Function
The pfSQLconst function is used to return a constant value. The syntax of the const function is:
const function takes two parameters, the first one is the constant value, and the second one is the data type of the constant value. The data type is specified by the type keyword, and it can be one of the following values:
- “int32”
- “int64”
- “float”
- “double”
- “string”
- “boolean”
const function:
int32 with value 1.
Built-in Math UDFs
Currently, pfSQL supports the following mathmatical functions. The behavior of these mathmatical functions is identical to the behavior of the corresponding functions in the Java Math standard library.
The syntax of the mathmatical functions is:
Limitations
- The UDF only support in SELECT statement, we are working on it to extend the UDF to WHERE and other statements.
- The UDF only support passing full path of single field in SELECT statement yet.