内置函数

Functions

Name
Description

abs()

Return the absolute value of expr.

Return the arc cosine of expr.

add()

Compute sum of two arguments.

Return the arc sine of expr.

at()

Returns the value of expression from the offset-th row of the ordered partition.

Return the arc tangent of expr If called with one parameter, this function returns the arc tangent of expr. If called with two parameters X and Y, this function returns the arc tangent of Y / X.

Return the arc tangent of Y / X..

avg()

Compute average of values.

Compute average of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute average of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute average of values match specified condition.

Cast string expression to bool.

Return the smallest integer value not less than the expr.

Return the smallest integer value not less than the expr.

This function returns a string resulting from the joining of two or more string values in an end-to-end manner. (To add a separating value during joining, see concat_ws.)

Returns a string resulting from the joining of two or more string value in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument.

cos()

Return the cosine of expr.

cot()

Return the cotangent of expr.

Compute number of values.

Compute count of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute count of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute number of values match specified condition.

Cast timestamp or string expression to date.

Formats the datetime value according to the format string.

day()

Return the day of the month for a timestamp or date.

Return the day of the month for a timestamp or date.

Return the day of week for a timestamp or date.

Return the day of year for a timestamp or date. Returns 0 given an invalid date.

Compute number of distinct values.

Cast string expression to double.

exp()

Return the value of e (the base of natural logarithms) raised to the power of expr.

Returns the value of expr from the first row of the window frame.

Cast string expression to float.

Return the largest integer value not less than the expr.

Used by feature zero, for each string value from specified column of window, join by delimeter. Null values are skipped.

Used by feature zero, split string to list by delimeter. Null values are skipped.

Used by feature zero, split string by delimeter and then split each segment as kv pair, then add each key to output list. Null and illegal segments are skipped.

Used by feature zero, split string by delimeter and then split each segment as kv pair, then add each value to output list. Null and illegal segments are skipped.

Compute the top1 key's ratio.

Return the topN keys sorted by their frequency.

Used by feature zero, for each string value from specified column of window, split by delimeter and add segment to output list. Null values are skipped.

Used by feature zero, for each string value from specified column of window, split by delimeter and then split each segment as kv pair, then add each key to output list. Null and illegal segments are skipped.

Used by feature zero, for each string value from specified column of window, split by delimeter and then split each segment as kv pair, then add each value to output list. Null and illegal segments are skipped.

Return the hour for a timestamp.

Return value.

If input is not null, return input value; else return default value.

If input is not null, return input value; else return default value.

pattern match same as ILIKE predicate

inc()

Return expression + 1.

Cast string expression to int16.

Cast string expression to int32.

Cast string expression to int64.

Check if input value is null, return bool.

Check if input value is null, return bool.

lag()

Returns the value of expression from the offset-th row of the ordered partition.

pattern match same as LIKE predicate

ln()

Return the natural logarithm of expr.

log()

log(base, expr) If called with one parameter, this function returns the natural logarithm of expr. If called with two parameters, this function returns the logarithm of expr to the base.

Return the base-10 logarithm of expr.

Return the base-2 logarithm of expr.

max()

Compute maximum of values.

Compute maximum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute maximum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute maximum of values match specified condition.

Compute maximum of two arguments.

min()

Compute minimum of values.

Compute minimum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute minimum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute minimum of values match specified condition.

Compute minimum of two arguments.

Return the minute for a timestamp.

Return the month part of a timestamp or date.

nvl()

If input is not null, return input value; else return default value.

nvl2(expr1, expr2, expr3) - Returns expr2 if expr1 is not null, or expr3 otherwise.

pow()

Return the value of expr1 to the power of expr2.

Return the value of expr1 to the power of expr2.

Return the nearest integer value to expr (in floating-point format), rounding halfway cases away from zero, regardless of the current rounding mode.

Return the second for a timestamp.

sin()

Return the sine of expr.

Return square root of expr.

Returns 0 if the strings are the same, -1 if the first argument is smaller than the second according to the current sort order, and 1 otherwise.

Return string converted from numeric expression.

Return a substring from string str starting at position pos.

Return a substring from string str starting at position pos.

sum()

Compute sum of values.

Compute sum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute sum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Compute sum of values match specified condition.

tan()

Return the tangent of expr.

Cast int64, date or string expression to timestamp.

top()

Compute top k of values and output string separated by comma. The outputs are sorted in desc order.

Compute average of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Compute count of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Compute maximum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Compute minimum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Compute sum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Return the nearest integer that is not greater in magnitude than the expr.

Convert all the characters to uppercase. Note that characters values > 127 are simply returned.

Convert all the characters to uppercase. Note that characters values > 127 are simply returned.

Return the week of year for a timestamp or date.

Return the week of year for a timestamp or date.

Return the year part of a timestamp or date.

Functions Documentation

function abs

Description:

Return the absolute value of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function acos

Description:

Return the arc cosine of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [number]

function add

Description:

Compute sum of two arguments.

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [bool, number]

  • [bool, timestamp]

  • [int16, timestamp]

  • [int32, timestamp]

  • [int64, timestamp]

  • [number, bool]

  • [number, number]

  • [timestamp, bool]

  • [timestamp, int16]

  • [timestamp, int32]

  • [timestamp, int64]

  • [timestamp, timestamp]

function asin

Description:

Return the arc sine of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [number]

function at

Description:

Returns the value of expression from the offset-th row of the ordered partition.

Parameters:

  • offset The number of rows forward from the current row from which to obtain the value.

Example:

value

0

1

2

3

4

Supported Types:

  • [list<bool>, int64]

  • [list<date>, int64]

  • [list<number>, int64]

  • [list<string>, int64]

  • [list<timestamp>, int64]

function atan

Description:

Return the arc tangent of expr If called with one parameter, this function returns the arc tangent of expr. If called with two parameters X and Y, this function returns the arc tangent of Y / X.

Parameters:

  • X

  • Y

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [bool, number]

  • [number]

  • [number, bool]

  • [number, number]

function atan2

Description:

Return the arc tangent of Y / X..

Parameters:

  • X

  • Y

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [bool, number]

  • [number, bool]

  • [number, number]

function avg

Description:

Compute average of values.

Parameters:

  • value Specify value column to aggregate on.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>]

function avg_cate

Description:

Compute average of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • value Specify value column to aggregate on.

  • catagory Specify catagory column to group by.

Example:

value
catagory

0

x

1

y

2

x

3

y

4

x

Supported Types:

  • [list<number>, list<date>]

  • [list<number>, list<int16>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<number>, list<string>]

  • [list<number>, list<timestamp>]

function avg_cate_where

Description:

Compute average of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

Supported Types:

  • [list<number>, list<bool>, list<date>]

  • [list<number>, list<bool>, list<int16>]

  • [list<number>, list<bool>, list<int32>]

  • [list<number>, list<bool>, list<int64>]

  • [list<number>, list<bool>, list<string>]

  • [list<number>, list<bool>, list<timestamp>]

function avg_where

Description:

Compute average of values match specified condition.

Parameters:

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>, list<bool>]

function bool

Description:

Cast string expression to bool.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function ceil

Description:

Return the smallest integer value not less than the expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function ceiling

Description:

Return the smallest integer value not less than the expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function concat

Description:

This function returns a string resulting from the joining of two or more string values in an end-to-end manner. (To add a separating value during joining, see concat_ws.)

Since: 0.1.0

Example:

Supported Types:

  • [...]

function concat_ws

Description:

Returns a string resulting from the joining of two or more string value in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument.

Since: 0.1.0

Example:

Supported Types:

  • [bool, ...]

  • [date, ...]

  • [number, ...]

  • [string, ...]

  • [timestamp, ...]

function cos

Description:

Return the cosine of expr.

Parameters:

  • expr It is a single argument in radians.

Since: 0.1.0

Example:

  • The value returned by cos() is always in the range: -1 to 1.

Supported Types:

  • [number]

function cot

Description:

Return the cotangent of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [number]

function count

Description:

Compute number of values.

Parameters:

  • value Specify value column to aggregate on.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<bool>]

  • [list<date>]

  • [list<number>]

  • [list<row>]

  • [list<string>]

  • [list<timestamp>]

function count_cate

Description:

Compute count of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • value Specify value column to aggregate on.

  • catagory Specify catagory column to group by.

Example:

value
catagory

0

x

1

y

2

x

3

y

4

x

Supported Types:

  • [list<number>, list<date>]

  • [list<number>, list<int16>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<number>, list<string>]

  • [list<number>, list<timestamp>]

function count_cate_where

Description:

Compute count of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

Supported Types:

  • [list<number>, list<bool>, list<date>]

  • [list<number>, list<bool>, list<int16>]

  • [list<number>, list<bool>, list<int32>]

  • [list<number>, list<bool>, list<int64>]

  • [list<number>, list<bool>, list<string>]

  • [list<number>, list<bool>, list<timestamp>]

function count_where

Description:

Compute number of values match specified condition.

Parameters:

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<date>, list<bool>]

  • [list<number>, list<bool>]

  • [list<string>, list<bool>]

  • [list<timestamp>, list<bool>]

function date

Description:

Cast timestamp or string expression to date.

Since: 0.1.0

Example:

Supported Types:

  • [string]

  • [timestamp]

function date_format

Description:

Formats the datetime value according to the format string.

Example:

Supported Types:

  • [date, string]

  • [timestamp, string]

function day

Description:

Return the day of the month for a timestamp or date.

Since: 0.1.0

Note: This function equals the [day()](/hybridse/language_guide/functions_and_operators/Files/udfs_8h.md#function-day) function.

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function dayofmonth

Description:

Return the day of the month for a timestamp or date.

Since: 0.1.0

Note: This function equals the [day()](/hybridse/language_guide/functions_and_operators/Files/udfs_8h.md#function-day) function.

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function dayofweek

Description:

Return the day of week for a timestamp or date.

Since: 0.4.0

Note: This function equals the [week()](/hybridse/language_guide/functions_and_operators/Files/udfs_8h.md#function-week) function.

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function dayofyear

Description:

Return the day of year for a timestamp or date. Returns 0 given an invalid date.

Since: 0.1.0

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function distinct_count

Description:

Compute number of distinct values.

Parameters:

  • value Specify value column to aggregate on.

Since: 0.1.0

Example:

value

0

0

2

2

4

Supported Types:

  • [list<bool>]

  • [list<date>]

  • [list<number>]

  • [list<string>]

  • [list<timestamp>]

function double

Description:

Cast string expression to double.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function exp

Description:

Return the value of e (the base of natural logarithms) raised to the power of expr.

Parameters:

  • expr

Since: 0.1.0

Supported Types:

  • [number]

function first_value

Description:

Returns the value of expr from the first row of the window frame.

Supported Types:

function float

Description:

Cast string expression to float.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function floor

Description:

Return the largest integer value not less than the expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function fz_join

Description:

Used by feature zero, for each string value from specified column of window, join by delimeter. Null values are skipped.

Since: 0.1.0

Example:

Supported Types:

  • [list<string>, string]

function fz_split

Description:

Used by feature zero, split string to list by delimeter. Null values are skipped.

Since: 0.1.0

Supported Types:

  • [string, string]

function fz_split_by_key

Description:

Used by feature zero, split string by delimeter and then split each segment as kv pair, then add each key to output list. Null and illegal segments are skipped.

Since: 0.1.0

Supported Types:

  • [string, string, string]

function fz_split_by_value

Description:

Used by feature zero, split string by delimeter and then split each segment as kv pair, then add each value to output list. Null and illegal segments are skipped.

Since: 0.1.0

Supported Types:

  • [string, string, string]

function fz_top1_ratio

Description:

Compute the top1 key's ratio.

Supported Types:

  • [list<date>]

  • [list<number>]

  • [list<string>]

  • [list<timestamp>]

function fz_topn_frequency

Description:

Return the topN keys sorted by their frequency.

Supported Types:

  • [list<date>, list<int32>]

  • [list<number>, list<int32>]

  • [list<string>, list<int32>]

  • [list<timestamp>, list<int32>]

function fz_window_split

Description:

Used by feature zero, for each string value from specified column of window, split by delimeter and add segment to output list. Null values are skipped.

Since: 0.1.0

Supported Types:

  • [list<string>, list<string>]

function fz_window_split_by_key

Description:

Used by feature zero, for each string value from specified column of window, split by delimeter and then split each segment as kv pair, then add each key to output list. Null and illegal segments are skipped.

Since: 0.1.0

Supported Types:

  • [list<string>, list<string>, list<string>]

function fz_window_split_by_value

Description:

Used by feature zero, for each string value from specified column of window, split by delimeter and then split each segment as kv pair, then add each value to output list. Null and illegal segments are skipped.

Since: 0.1.0

Supported Types:

  • [list<string>, list<string>, list<string>]

function hour

Description:

Return the hour for a timestamp.

Since: 0.1.0

Example:

Supported Types:

  • [int64]

  • [timestamp]

function identity

Description:

Return value.

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [date]

  • [number]

  • [string]

  • [timestamp]

function if_null

Description:

If input is not null, return input value; else return default value.

Parameters:

  • input Input value

  • default Default value if input is null

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [date, date]

  • [double, double]

  • [float, float]

  • [int16, int16]

  • [int32, int32]

  • [int64, int64]

  • [string, string]

  • [timestamp, timestamp]

function ifnull

Description:

If input is not null, return input value; else return default value.

Parameters:

  • input Input value

  • default Default value if input is null

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [date, date]

  • [double, double]

  • [float, float]

  • [int16, int16]

  • [int32, int32]

  • [int64, int64]

  • [string, string]

  • [timestamp, timestamp]

function ilike_match

Description:

pattern match same as ILIKE predicate

Parameters:

  • target string to match

  • pattern the glob match pattern

  • escape escape character

Since: 0.4.0

Rules:

  1. Special characters:

    • underscore(_): exact one character

    • precent(%): zero or more characters.

  2. Escape character:

    • backslash() is the default escape character

    • length of must <= 1

    • if is empty, escape feautre is disabled

  3. case insensitive

  4. backslash: sql string literal use backslash() for escape sequences, write '' as backslash itself

  5. if one or more of target, pattern and escape are null values, then the result is null Example:

Supported Types:

  • [string, string]

  • [string, string, string]

function inc

Description:

Return expression + 1.

Since: 0.1.0

Example:

Supported Types:

  • [number]

function int16

Description:

Cast string expression to int16.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function int32

Description:

Cast string expression to int32.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function int64

Description:

Cast string expression to int64.

Since: 0.1.0

Example:

Supported Types:

  • [string]

function is_null

Description:

Check if input value is null, return bool.

Parameters:

  • input Input value

Since: 0.1.0

Supported Types:

  • [bool]

  • [date]

  • [number]

  • [string]

  • [timestamp]

function isnull

Description:

Check if input value is null, return bool.

Parameters:

  • input Input value

Since: 0.1.0

Supported Types:

  • [bool]

  • [date]

  • [number]

  • [string]

  • [timestamp]

function lag

Description:

Returns the value of expression from the offset-th row of the ordered partition.

Parameters:

  • offset The number of rows forward from the current row from which to obtain the value.

Example:

value

0

1

2

3

4

Supported Types:

  • [list<bool>, int64]

  • [list<date>, int64]

  • [list<number>, int64]

  • [list<string>, int64]

  • [list<timestamp>, int64]

function like_match

Description:

pattern match same as LIKE predicate

Parameters:

  • target string to match

  • pattern the glob match pattern

  • escape escape character

Since: 0.4.0

Rules:

  1. Special characters:

    • underscore(_): exact one character

    • precent(%): zero or more characters.

  2. Escape character:

    • backslash() is the default escape character

    • length of must <= 1

    • if is empty, escape feature is disabled

  3. case sensitive

  4. backslash: sql string literal use backslash() for escape sequences, write '' as backslash itself

  5. if one or more of target, pattern and escape are null values, then the result is null Example:

Supported Types:

  • [string, string]

  • [string, string, string]

function ln

Description:

Return the natural logarithm of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function log

Description:

log(base, expr) If called with one parameter, this function returns the natural logarithm of expr. If called with two parameters, this function returns the logarithm of expr to the base.

Parameters:

  • base

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [bool, bool]

  • [bool, date]

  • [bool, number]

  • [bool, string]

  • [bool, timestamp]

  • [number]

  • [number, bool]

  • [number, date]

  • [number, number]

  • [number, string]

  • [number, timestamp]

function log10

Description:

Return the base-10 logarithm of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function log2

Description:

Return the base-2 logarithm of expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function make_tuple

Description:

Supported Types:

  • [...]

function max

Description:

Compute maximum of values.

Parameters:

  • value Specify value column to aggregate on.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<date>]

  • [list<number>]

  • [list<string>]

  • [list<timestamp>]

function max_cate

Description:

Compute maximum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • value Specify value column to aggregate on.

  • catagory Specify catagory column to group by.

Example:

value
catagory

0

x

1

y

2

x

3

y

4

x

Supported Types:

  • [list<number>, list<date>]

  • [list<number>, list<int16>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<number>, list<string>]

  • [list<number>, list<timestamp>]

function max_cate_where

Description:

Compute maximum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

Supported Types:

  • [list<number>, list<bool>, list<date>]

  • [list<number>, list<bool>, list<int16>]

  • [list<number>, list<bool>, list<int32>]

  • [list<number>, list<bool>, list<int64>]

  • [list<number>, list<bool>, list<string>]

  • [list<number>, list<bool>, list<timestamp>]

function max_where

Description:

Compute maximum of values match specified condition.

Parameters:

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>, list<bool>]

function maximum

Description:

Compute maximum of two arguments.

Since: 0.1.0

Supported Types:

  • [bool, bool]

  • [date, date]

  • [double, double]

  • [float, float]

  • [int16, int16]

  • [int32, int32]

  • [int64, int64]

  • [string, string]

  • [timestamp, timestamp]

function min

Description:

Compute minimum of values.

Parameters:

  • value Specify value column to aggregate on.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<date>]

  • [list<number>]

  • [list<string>]

  • [list<timestamp>]

function min_cate

Description:

Compute minimum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • value Specify value column to aggregate on.

  • catagory Specify catagory column to group by.

Example:

value
catagory

0

x

1

y

2

x

3

y

4

x

Supported Types:

  • [list<number>, list<date>]

  • [list<number>, list<int16>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<number>, list<string>]

  • [list<number>, list<timestamp>]

function min_cate_where

Description:

Compute minimum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

1

true

y

4

true

x

3

true

y

Supported Types:

  • [list<number>, list<bool>, list<date>]

  • [list<number>, list<bool>, list<int16>]

  • [list<number>, list<bool>, list<int32>]

  • [list<number>, list<bool>, list<int64>]

  • [list<number>, list<bool>, list<string>]

  • [list<number>, list<bool>, list<timestamp>]

function min_where

Description:

Compute minimum of values match specified condition.

Parameters:

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>, list<bool>]

function minimum

Description:

Compute minimum of two arguments.

Since: 0.1.0

Supported Types:

  • [bool, bool]

  • [date, date]

  • [double, double]

  • [float, float]

  • [int16, int16]

  • [int32, int32]

  • [int64, int64]

  • [string, string]

  • [timestamp, timestamp]

function minute

Description:

Return the minute for a timestamp.

Since: 0.1.0

Example:

Supported Types:

  • [int64]

  • [timestamp]

function month

Description:

Return the month part of a timestamp or date.

Since: 0.1.0

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function nvl

Description:

If input is not null, return input value; else return default value.

Parameters:

  • input Input value

  • default Default value if input is null

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [date, date]

  • [double, double]

  • [float, float]

  • [int16, int16]

  • [int32, int32]

  • [int64, int64]

  • [string, string]

  • [timestamp, timestamp]

function nvl2

Description:

nvl2(expr1, expr2, expr3) - Returns expr2 if expr1 is not null, or expr3 otherwise.

Parameters:

  • expr1 Condition expression

  • expr2 Return value if expr1 is not null

  • expr3 Return value if expr1 is null

Since: 0.2.3

Example:

Supported Types:

  • [bool, bool, bool]

  • [bool, date, date]

  • [bool, double, double]

  • [bool, float, float]

  • [bool, int16, int16]

  • [bool, int32, int32]

  • [bool, int64, int64]

  • [bool, string, string]

  • [bool, timestamp, timestamp]

  • [date, bool, bool]

  • [date, date, date]

  • [date, double, double]

  • [date, float, float]

  • [date, int16, int16]

  • [date, int32, int32]

  • [date, int64, int64]

  • [date, string, string]

  • [date, timestamp, timestamp]

  • [number, bool, bool]

  • [number, date, date]

  • [number, double, double]

  • [number, float, float]

  • [number, int16, int16]

  • [number, int32, int32]

  • [number, int64, int64]

  • [number, string, string]

  • [number, timestamp, timestamp]

  • [string, bool, bool]

  • [string, date, date]

  • [string, double, double]

  • [string, float, float]

  • [string, int16, int16]

  • [string, int32, int32]

  • [string, int64, int64]

  • [string, string, string]

  • [string, timestamp, timestamp]

  • [timestamp, bool, bool]

  • [timestamp, date, date]

  • [timestamp, double, double]

  • [timestamp, float, float]

  • [timestamp, int16, int16]

  • [timestamp, int32, int32]

  • [timestamp, int64, int64]

  • [timestamp, string, string]

  • [timestamp, timestamp, timestamp]

function pow

Description:

Return the value of expr1 to the power of expr2.

Parameters:

  • expr1

  • expr2

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [bool, number]

  • [number, bool]

  • [number, number]

function power

Description:

Return the value of expr1 to the power of expr2.

Parameters:

  • expr1

  • expr2

Since: 0.1.0

Example:

Supported Types:

  • [bool, bool]

  • [bool, number]

  • [number, bool]

  • [number, number]

function round

Description:

Return the nearest integer value to expr (in floating-point format), rounding halfway cases away from zero, regardless of the current rounding mode.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function second

Description:

Return the second for a timestamp.

Since: 0.1.0

Example:

Supported Types:

  • [int64]

  • [timestamp]

function sin

Description:

Return the sine of expr.

Parameters:

  • expr It is a single argument in radians.

Since: 0.1.0

Example:

  • The value returned by sin() is always in the range: -1 to 1.

Supported Types:

  • [number]

function sqrt

Description:

Return square root of expr.

Parameters:

  • expr It is a single argument in radians.

Since: 0.1.0

Example:

Supported Types:

  • [number]

function strcmp

Description:

Returns 0 if the strings are the same, -1 if the first argument is smaller than the second according to the current sort order, and 1 otherwise.

Since: 0.1.0

Example:

Supported Types:

  • [string, string]

function string

Description:

Return string converted from numeric expression.

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [date]

  • [number]

  • [timestamp]

function substr

Description:

Return a substring from string str starting at position pos.

Parameters:

  • str

  • pos define the begining of the substring.

Since: 0.1.0

Note: This function equals the [substr()](/hybridse/language_guide/functions_and_operators/Files/udfs_8h.md#function-substr) function.

Example:

  • If pos is positive, the begining of the substring is pos charactors from the start of string.

  • If pos is negative, the beginning of the substring is pos characters from the end of the string, rather than the beginning.

Supported Types:

  • [string, int32]

  • [string, int32, int32]

function substring

Description:

Return a substring from string str starting at position pos.

Parameters:

  • str

  • pos define the begining of the substring.

Since: 0.1.0

Note: This function equals the [substr()](/hybridse/language_guide/functions_and_operators/Files/udfs_8h.md#function-substr) function.

Example:

  • If pos is positive, the begining of the substring is pos charactors from the start of string.

  • If pos is negative, the beginning of the substring is pos characters from the end of the string, rather than the beginning.

Supported Types:

  • [string, int32]

  • [string, int32, int32]

function sum

Description:

Compute sum of values.

Parameters:

  • value Specify value column to aggregate on.

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>]

  • [list<timestamp>]

function sum_cate

Description:

Compute sum of values grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • value Specify value column to aggregate on.

  • catagory Specify catagory column to group by.

Example:

value
catagory

0

x

1

y

2

x

3

y

4

x

Supported Types:

  • [list<number>, list<date>]

  • [list<number>, list<int16>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<number>, list<string>]

  • [list<number>, list<timestamp>]

function sum_cate_where

Description:

Compute sum of values matching specified condition grouped by category key and output string. Each group is represented as 'K:V' and separated by comma in outputs and are sorted by key in ascend order.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

Supported Types:

  • [list<number>, list<bool>, list<date>]

  • [list<number>, list<bool>, list<int16>]

  • [list<number>, list<bool>, list<int32>]

  • [list<number>, list<bool>, list<int64>]

  • [list<number>, list<bool>, list<string>]

  • [list<number>, list<bool>, list<timestamp>]

function sum_where

Description:

Compute sum of values match specified condition.

Parameters:

  • value Specify value column to aggregate on.

  • condition Specify condition column.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<number>, list<bool>]

function tan

Description:

Return the tangent of expr.

Parameters:

  • expr It is a single argument in radians.

Since: 0.1.0

Example:

Supported Types:

  • [number]

function timestamp

Description:

Cast int64, date or string expression to timestamp.

Since: 0.1.0

Supported string style:

  • yyyy-mm-dd

  • yyyymmdd

  • yyyy-mm-dd hh:mm:ss Example:

Supported Types:

  • [date]

  • [string]

function top

Description:

Compute top k of values and output string separated by comma. The outputs are sorted in desc order.

Parameters:

  • value Specify value column to aggregate on.

  • k Fetch top n keys.

Since: 0.1.0

Example:

value

0

1

2

3

4

Supported Types:

  • [list<date>, list<int32>]

  • [list<date>, list<int64>]

  • [list<number>, list<int32>]

  • [list<number>, list<int64>]

  • [list<string>, list<int32>]

  • [list<string>, list<int64>]

  • [list<timestamp>, list<int32>]

  • [list<timestamp>, list<int64>]

function top_n_key_avg_cate_where

Description:

Compute average of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

  • n Fetch top n keys.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

5

true

z

6

false

z

Supported Types:

  • [list<number>, list<bool>, list<date>, list<int32>]

  • [list<number>, list<bool>, list<date>, list<int64>]

  • [list<number>, list<bool>, list<int16>, list<int32>]

  • [list<number>, list<bool>, list<int16>, list<int64>]

  • [list<number>, list<bool>, list<int32>, list<int32>]

  • [list<number>, list<bool>, list<int32>, list<int64>]

  • [list<number>, list<bool>, list<int64>, list<int32>]

  • [list<number>, list<bool>, list<int64>, list<int64>]

  • [list<number>, list<bool>, list<string>, list<int32>]

  • [list<number>, list<bool>, list<string>, list<int64>]

  • [list<number>, list<bool>, list<timestamp>, list<int32>]

  • [list<number>, list<bool>, list<timestamp>, list<int64>]

function top_n_key_count_cate_where

Description:

Compute count of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

  • n Fetch top n keys.

Example:

value
condition
catagory

0

true

x

1

true

y

2

false

x

3

true

y

4

false

x

5

true

z

6

true

z

Supported Types:

  • [list<number>, list<bool>, list<date>, list<int32>]

  • [list<number>, list<bool>, list<date>, list<int64>]

  • [list<number>, list<bool>, list<int16>, list<int32>]

  • [list<number>, list<bool>, list<int16>, list<int64>]

  • [list<number>, list<bool>, list<int32>, list<int32>]

  • [list<number>, list<bool>, list<int32>, list<int64>]

  • [list<number>, list<bool>, list<int64>, list<int32>]

  • [list<number>, list<bool>, list<int64>, list<int64>]

  • [list<number>, list<bool>, list<string>, list<int32>]

  • [list<number>, list<bool>, list<string>, list<int64>]

  • [list<number>, list<bool>, list<timestamp>, list<int32>]

  • [list<number>, list<bool>, list<timestamp>, list<int64>]

function top_n_key_max_cate_where

Description:

Compute maximum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

  • n Fetch top n keys.

Example:

value
condition
catagory

0

true

x

1

false

y

2

false

x

3

true

y

4

true

x

5

true

z

6

false

z

Supported Types:

  • [list<number>, list<bool>, list<date>, list<int32>]

  • [list<number>, list<bool>, list<date>, list<int64>]

  • [list<number>, list<bool>, list<int16>, list<int32>]

  • [list<number>, list<bool>, list<int16>, list<int64>]

  • [list<number>, list<bool>, list<int32>, list<int32>]

  • [list<number>, list<bool>, list<int32>, list<int64>]

  • [list<number>, list<bool>, list<int64>, list<int32>]

  • [list<number>, list<bool>, list<int64>, list<int64>]

  • [list<number>, list<bool>, list<string>, list<int32>]

  • [list<number>, list<bool>, list<string>, list<int64>]

  • [list<number>, list<bool>, list<timestamp>, list<int32>]

  • [list<number>, list<bool>, list<timestamp>, list<int64>]

function top_n_key_min_cate_where

Description:

Compute minimum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

  • n Fetch top n keys.

Example:

value
condition
catagory

0

true

x

1

true

y

2

false

x

3

true

y

4

false

x

5

true

z

6

true

z

Supported Types:

  • [list<number>, list<bool>, list<date>, list<int32>]

  • [list<number>, list<bool>, list<date>, list<int64>]

  • [list<number>, list<bool>, list<int16>, list<int32>]

  • [list<number>, list<bool>, list<int16>, list<int64>]

  • [list<number>, list<bool>, list<int32>, list<int32>]

  • [list<number>, list<bool>, list<int32>, list<int64>]

  • [list<number>, list<bool>, list<int64>, list<int32>]

  • [list<number>, list<bool>, list<int64>, list<int64>]

  • [list<number>, list<bool>, list<string>, list<int32>]

  • [list<number>, list<bool>, list<string>, list<int64>]

  • [list<number>, list<bool>, list<timestamp>, list<int32>]

  • [list<number>, list<bool>, list<timestamp>, list<int64>]

function top_n_key_sum_cate_where

Description:

Compute sum of values matching specified condition grouped by category key. Output string for top N keys in descend order. Each group is represented as 'K:V' and separated by comma.

Parameters:

  • catagory Specify catagory column to group by.

  • value Specify value column to aggregate on.

  • condition Specify condition column.

  • n Fetch top n keys.

Example:

value
condition
catagory

0

true

x

1

true

y

2

false

x

3

true

y

4

false

x

5

true

z

6

true

z

Supported Types:

  • [list<number>, list<bool>, list<date>, list<int32>]

  • [list<number>, list<bool>, list<date>, list<int64>]

  • [list<number>, list<bool>, list<int16>, list<int32>]

  • [list<number>, list<bool>, list<int16>, list<int64>]

  • [list<number>, list<bool>, list<int32>, list<int32>]

  • [list<number>, list<bool>, list<int32>, list<int64>]

  • [list<number>, list<bool>, list<int64>, list<int32>]

  • [list<number>, list<bool>, list<int64>, list<int64>]

  • [list<number>, list<bool>, list<string>, list<int32>]

  • [list<number>, list<bool>, list<string>, list<int64>]

  • [list<number>, list<bool>, list<timestamp>, list<int32>]

  • [list<number>, list<bool>, list<timestamp>, list<int64>]

function truncate

Description:

Return the nearest integer that is not greater in magnitude than the expr.

Parameters:

  • expr

Since: 0.1.0

Example:

Supported Types:

  • [bool]

  • [number]

function ucase

Description:

Convert all the characters to uppercase. Note that characters values > 127 are simply returned.

Since: 0.4.0

Example:

Supported Types:

  • [string]

function upper

Description:

Convert all the characters to uppercase. Note that characters values > 127 are simply returned.

Since: 0.4.0

Example:

Supported Types:

  • [string]

function week

Description:

Return the week of year for a timestamp or date.

Since: 0.1.0

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function weekofyear

Description:

Return the week of year for a timestamp or date.

Since: 0.1.0

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

function year

Description:

Return the year part of a timestamp or date.

Since: 0.1.0

Example:

Supported Types:

  • [date]

  • [int64]

  • [timestamp]

Last updated