Weโre excited to introduce some fresh functions to enhance your data manipulation. Check them out!
Aggregation Functionsโ
- corr:
corr(table, field1, field2)
โ Pearson correlation coefficient. - string_agg:
string_agg(expression, sep: separator)
โ Concatenate expression values. - percentile_cont:
percentile_cont(expression, percentile)
โ Value at a given percentile (interpolated). - percentile_disc:
percentile_disc(expression, percentile)
โ Value at a specific percentile (discrete). - min_by:
min_by(table, value, by)
โ Fetch value from the row with minimum in another field. - max_by:
max_by(table, value, by)
โ Grab value from the row with maximum in another field.
Time Intelligence Functionsโ
- date_format:
date_format(datetime, format)
โ Format dates easily. - from_unixtime:
from_unixtime(number)
โ Convert Unix timestamp to datetime. - last_day:
last_day(datetime, date_part)
โ Get the last day of a period.
Text Functionsโ
- find:
find(text, substring)
โ Locate a substring. - left/right/mid:
left(text, length)
,right(text, length)
,mid(text, start, length)
โ Extract from left, right, or mid. - len/lpad/rpad:
len(text)
,lpad(text, length, pad_string)
,rpad(text, length, pad_string)
โ Length, left/right padding. - lower/upper:
lower(text)
,upper(text)
โ Change case of text. - trim/ltrim/rtrim:
trim(text)
,ltrim(text)
,rtrim(text)
โ Remove whitespace from sides. - regexp_extract/match/replace:
regexp_extract(text, regex, ...)
,regexp_match(text, regex)
,regexp_replace(text, regex, substitute)
โ Regex operations on text. - replace:
replace(text, old_substring, new_substring)
โ Replace all occurrences of a substring. - split_part:
split_part(text, delimiter, part_number)
โ Split text and return a specific part.
Window Functionsโ
- first_value:
first_value(expression)
โ Value from the first row. - last_value:
last_value(expression)
โ Value from the last row. - nth_value:
nth_value(expression, N)
โ Value from the nth row. - ntile:
ntile(n)
โ Divides rows into ranked groups. - percent_rank:
percent_rank()
โ Calculates the relative percentile rank of a value.
โญ Learn more: You can see all AQL functions in our cheatsheet.
Got questions or feedback? Weโd love to hear from you! Your input helps us make Holistics better every day. ๐