Transform Functions
NOTE
Verification Status: Tested and Verified against rekuiper engine with live telemetry stream load on 2026-10-01 17:54:40 UTC.
Scorecard: 11 Verified, 0 Unsupported, 0 Broken:
- Verified (11):
cast,convert_tz,to_seconds,encode(base64),decode(base64),compress(zlib/gzip/flate/zstd),decompress(zlib/gzip/flate/zstd),trunc,chr,hex2dec,dec2hex.
Transform functions convert data types, encode payloads, and apply compression algorithms.
CAST
cast(col, dataType)Converts a value to the specified target data type. Supported target types include: bigint, float, string, boolean, bytea, and datetime.
Cast to datetime
When casting a value to datetime, the engine applies the following conversion rules:
- If the input is already a
datetimevalue, the function returns the value directly. - If the input is
bigintorfloat, the function interprets the number as milliseconds since January 1, 1970 00:00:00 UTC. - If the input is
string, the function parses the format into adatetimevalue. For supported time formats, refer to TimeFormats. - Conversions from other types are not supported.
CONVERT_TZ
convert_tz(col, "Asia/Shanghai")Converts a timestamp to the specified target time zone. Specify time zones using the IANA Time Zone Database format. The default time zone is UTC. Specify Local to apply the host system time zone.
NOTE
In Alpine Linux containers, you must install the tzdata package (for example, apk add tzdata) to provide time zone database files.
TO_SECONDS
to_seconds(col)Converts col to a datetime value and returns Unix epoch time as the number of elapsed seconds since January 1, 1970 00:00:00 UTC.
ENCODE
encode(col, encodeType)Encodes binary or string payload data into a string representation using the specified encoding scheme. Currently, the engine supports "base64".
DECODE
decode(col, encodeType)Decodes an encoded string into its original representation using the specified decoding scheme. Currently, the engine supports "base64".
COMPRESS
compress(input, method)Compresses an input string or binary payload using the specified algorithm. Supported methods include 'zlib', 'gzip', 'flate', and 'zstd'.
DECOMPRESS
decompress(input, method)Decompresses compressed payload data using the specified algorithm. Supported methods include 'zlib', 'gzip', 'flate', and 'zstd'.
TRUNC
trunc(dec, int)Truncates the decimal number dec to the number of decimal places specified by int. If the second argument is less than 0, the function uses 0. If greater than 34, the function uses 34. The function removes trailing zeros from the result.
CHR
chr(col)Returns the ASCII character corresponding to the specified integer code.
HEX2DEC
hex2dec(col)Converts a hexadecimal string into its decimal integer value. The argument must be a string. Values such as "0x10" or "10" convert to integer 16.
DEC2HEX
dec2hex(col)Converts a decimal integer into a hexadecimal string with a "0x" prefix. For example, integer 16 converts to "0x10".