description |
---|
This document contains the list of all the transformation functions supported by Pinot SQL. |
Function |
---|
ADD(col1, col2, col3...) |
SUB(col1, col2) |
MULT(col1, col2, col3...) |
DIV(col1, col2) |
MOD(col1, col2) |
ABS(col1) |
CEIL(col1) |
FLOOR(col1) |
EXP(col1) |
LN(col1) |
SQRT(col1) |
Rounds value to a specified number of decimal places |
Multiple string functions are supported out of the box from release-0.5.0 .
Function |
---|
UPPER(col) |
LOWER(col) |
REVERSE(col) |
SUBSTR(col, startIndex, endIndex) |
CONCAT(col1, col2, seperator) |
TRIM(col) |
LTRIM(col) |
RTRIM(col) |
LENGTH(col) |
STRPOS(col, find, N) |
STARTSWITH(col, prefix) |
REPLACE(col, find, substitute) |
RPAD(col, size, pad) |
LPAD(col, size, pad) |
CODEPOINT(col) |
CHR(codepoint) |
regexpExtract(value, regexp) |
regexpReplace(input, matchRegexp, replaceRegexp, matchStartPos, occurrence, flag) |
remove(input, search) |
urlEncoding(string) |
urlDecoding(string) |
fromBase64(string) |
toUtf8(string) |
isSubnetOf(ipPrefix, ipAddress) |
Date time functions allow you to perform transformations on columns that contain timestamps or dates.
Function |
---|
TIMECONVERT(col, fromUnit, toUnit) |
DATETIMECONVERT(columnName, inputFormat, outputFormat, outputGranularity) |
DATETRUNC |
ToEpoch<TIME_UNIT>(timeInMillis) |
ToEpoch<TIME_UNIT>Rounded(timeInMillis, bucketSize) |
ToEpoch<TIME_UNIT>Bucket(timeInMillis, bucketSize) |
FromEpoch<TIME_UNIT> |
FromEpoch<TIME_UNIT>Bucket(timeIn<Time_UNIT>, bucketSizeIn<Time_UNIT>) |
ToDateTime(timeInMillis, pattern[, timezoneId]) |
FromDateTime(dateTimeString, pattern) |
round(timeValue, bucketSize) |
now() |
ago() |
timezoneHour(timeZoneId) |
timezoneMinute(timeZoneId) |
year(tsInMillis) |
year(tsInMillis, timeZoneId) |
yearOfWeek(tsInMillis) |
yearOfWeek(tsInMillis, timeZoneId) |
quarter(tsInMillis) |
quarter(tsInMillis, timeZoneId) |
month(tsInMillis) |
month(tsInMillis, timeZoneId) |
week(tsInMillis) |
week(tsInMillis, timeZoneId) |
dayOfYear(tsInMillis) |
dayOfYear(tsInMillis, timeZoneId) |
day(tsInMillis) |
day(tsInMillis, timeZoneId) |
dayOfWeek(tsInMillis) |
dayOfWeek(tsInMillis, timeZoneId) |
hour(tsInMillis) |
hour(tsInMillis, timeZoneId) |
minute(tsInMillis) |
minute(tsInMillis, timeZoneId) |
second(tsInMillis) |
second(tsInMillis, timeZoneId) |
millisecond(tsInMillis) |
millisecond(tsInMillis, timeZoneId) |
These functions can only be used in Pinot SQL queries.
Function |
---|
JSONEXTRACTSCALAR(jsonField, 'jsonPath', 'resultsType', [defaultValue]) |
JSONEXTRACTKEY(jsonField, 'jsonPath') |
EXTRACT(dateTimeField FROM dateTimeExpression) |
These functions can be used for column transformation in table ingestion configs.
Function |
---|
JSONFORMAT(object) |
JSONPATH(jsonField, 'jsonPath') |
JSONPATHLONG(jsonField, 'jsonPath', [defaultValue]) |
JSONPATHDOUBLE(jsonField, 'jsonPath', [defaultValue]) |
JSONPATHSTRING(jsonField, 'jsonPath', [defaultValue]) |
JSONPATHARRAY(jsonField, 'jsonPath') |
JSONPATHARRAYDEFAULTEMPTY(jsonField, 'jsonPath') |
Function |
---|
SHA(bytesCol) |
SHA256(bytesCol) |
SHA512(bytesCol) |
MD5(bytesCol) |
toBase64(bytesCol) |
fromUtf8(bytesCol) |
All of the functions mentioned till now only support single value columns. You can use the following functions to do operations on multi-value columns.
Function |
---|
ARRAYLENGTH |
MAP_VALUE |
VALUEIN |
Pinot supports Geospatial queries on columns containing text-based geographies. For more details on the queries and how to enable them, see Geospatial.
Pinot supports pattern matching on text-based columns. Only the columns mentioned as text columns in table config can be queried using this method. For more details on how to enable pattern matching, see Text search support.