value <NUMERIC>, percentage [<NUMERIC NOT NULL> | <ARRAY<NUMERIC NOT NULL> NOT NULL>], frequency <INTEGER_NUMERIC>
(INTEGER_NUMERIC: TINYINT, SMALLINT, INTEGER, BIGINT)
(NUMERIC: INTEGER_NUMERIC, FLOAT, DOUBLE, DECIMAL)
返回将 STRING2, STRING3, … 与分隔符 STRING1 连接起来的字符串。在要连接的字符串之间添加分隔符。
如果 STRING1 为
NULL
,则返回
NULL
。与 concat() 相比,concat_ws() 会自动跳过
NULL
参数。
例如
concat_ws('~', 'AA', Null(STRING), 'BB', '', 'CC')
返回
"AA~BB~~CC"
.
返回二进制等于 integer 的 ASCII 字符。如果整数 integer 大于 255,我们先将整数 integer 对 255 取模数,
并返回模数的 CHR。如果整数为
NULL
,则返回
NULL
。例如
chr(97)
返回
a
,
chr(353)
返回
a
,
ascii(CAST(NULL AS VARCHAR))
返回
NULL
。
使用提供的字符集 string(‘US-ASCII’,‘ISO-8859-1’,‘UTF-8’,‘UTF-16BE’,‘UTF-16LE’,‘UTF-16’)解码第一个参数 binary 为字符串。
如果任一参数为空,则结果也将为空。
使用提供的字符集 string2(‘US-ASCII’,‘ISO-8859-1’,‘UTF-8’,‘UTF-16BE’,‘UTF-16LE’,‘UTF-16’)将字符串 string1 编码。
如果任一参数为空,则结果也将为空。
从 URL 返回指定的部分。string2 的有效值包括“HOST”,“PATH”,“QUERY”,“REF”,“PROTOCOL”,“AUTHORITY”,“FILE”和“USERINFO”。
如果有任一参数为
NULL
,则返回
NULL
。例如
parse_url('http://facebook.com/path1/p.php?k1=v1&k2=v2#Ref1', 'HOST')
返回
'facebook.com'
。
还可以通过提供关键词 string3 作为第三个参数来提取 QUERY 中特定键的值。例如
parse_url('http://facebook.com/path1/p.php?k1=v1&k2=v2#Ref1', 'QUERY', 'k1')
返回
'v1'
。
Unquotes JSON value, unescapes escaped special characters (’"’, ‘', ‘/’, ‘b’, ‘f’, ’n’, ‘r’, ’t’, ‘u’ hex hex hex hex), and returns the result as a string. If the argument is NULL, returns NULL. If the value does not start and end with double quotes or if it starts and ends with double quotes but is not a valid JSON string literal, the value is passed through unmodified.
FlinkSQL>SET'table.local-time-zone'='Europe/Berlin';-- 返回 25201
FlinkSQL>SELECTUNIX_TIMESTAMP('1970-01-01 08:00:01.001','yyyy-MM-dd HH:mm:ss.SSS');-- 返回 1
FlinkSQL>SELECTUNIX_TIMESTAMP('1970-01-01 08:00:01.001 +0800','yyyy-MM-dd HH:mm:ss.SSS X');-- 返回 25201
FlinkSQL>SELECTUNIX_TIMESTAMP('1970-01-01 08:00:01.001 +0800','yyyy-MM-dd HH:mm:ss.SSS');-- 返回 -9223372036854775808
FlinkSQL>SELECTUNIX_TIMESTAMP('1970-01-01 08:00:01.001','yyyy-MM-dd HH:mm:ss.SSS X');
Converts an epoch seconds or epoch milliseconds to a TIMESTAMP_LTZ, the valid precision is 0 or 3, the 0 represents TO_TIMESTAMP_LTZ(epochSeconds, 0), the 3 represents TO_TIMESTAMP_LTZ(epochMilliseconds, 3). If no precision is provided, the default precision is 3. If any input is null, the function will return null.
与 COALESCE 或 CASE WHEN 相比,此函数返回的数据类型在是否为空方面非常明确。返回的类型是两个参数的公共类型,但只有在 null_replacement 可为空时才能为可空类型。
该函数允许将可空的列传递到使用 NOT NULL 约束声明的函数或表中。
例如 IFNULL(nullable_column, 5) 一定不返回 NULL。
返回 value 被转换为类型 type 的新值。CAST错误会抛出异常并导致作业失败。为了处理错误,在使用可能失败的 CAST 操作时,例如 STRING 转换为 INT,建议使用 TRY_CAST 替代。
如果开启了 “table.exec.legacy-cast-behaviour”,CAST 行为将变得与 TRY_CAST 一致。
例如, CAST(‘42’ AS INT) 返回 42; CAST(NULL AS STRING) 返回字符串类型的 NULL; CAST(’non-number’ AS INT) 抛出异常且作业失败。
返回输入表达式的数据类型的字符串表示。默认情况下返回的字符串是一个摘要字符串,可能会为了可读性而省略某些细节。
如果 force_serializable 设置为 TRUE,则字符串表示可以持久化保存在 catalog 中的完整数据类型。
请注意,特别是匿名的内联数据类型没有可序列化的字符串表示。在这种情况下返回 NULL。
Returns an ARRAY that contains the elements from array1 that are not in array2, without duplicates. If no elements remain after excluding the elements in array2 from array1, the function returns an empty ARRAY. If one or both arguments are NULL, the function returns NULL. The order of the elements from array1 is kept.
Returns an array of substrings by splitting the input string based on the given delimiter. If the delimiter is not found in the string, the original string is returned as the only element in the array. If the delimiter is empty, every character in the string is split. If the string or delimiter is null, a null value is returned. If the delimiter is found at the beginning or end of the string, or there are contiguous delimiters, then an empty string is added to the array.
Returns a literal describing an arbitrary, unvalidated list of column names. Passing a list of columns
can be useful for parameterizing a function. In particular, it enables declaring the on_time argument
for process table functions (PTFs).
Creates a structured object from a list of key-value pairs.
This function creates an instance of a structured type identified by the given class name.
The structured type is created by providing alternating key-value pairs where keys must be
string literals and values can be arbitrary expressions.
Note: The class name is only used for distinguishing two structured types with identical fields.
Structured types are internally handled with suitable data structures. Thus, serialization and equality checks are managed by the system.
In Table API and UDF calls, the system will attempt to resolve the class name to an actual implementation class.
In this case the class name needs to be present in the user classpath. If resolution fails, Row.class is used as a fallback.
-- Creates a User object with complex fields "name", "age", and "address"
OBJECT_OF('com.example.User','name','Bob','age',21,'address',OBJECT_OF('com.example.Address','street','primary','city','Berlin'))
将窗口分区中的所有数据按照顺序划分为 n 个分组,返回分配给各行数据的分组编号(从 1 开始,最大为 n)。
如果不能均匀划分为 n 个分组,则剩余值从第 1 个分组开始,为每一分组分配一个。
比如某个窗口分区有 6 行数据,划分为 4 个分组,则各行的分组编号为:1,1,2,2,3,4。
默认情况下或使用关键字ALL,返回输入行中表达式所组成的数组,并且如果没有输入行,则返回 NULL。使用 DISTINCT 则对所有值去重后计算。
默认情况下NULL 值不会被忽略,使用 IGNORE NULLS 忽略 NULL 值。
目前尚不支持 ORDER BY 子句。
通过将 key-value 聚合到单个 JSON 对象中,构建 JSON 对象字符串。
键表达式必须返回不为空的字符串。值表达式可以是任意的,包括其他 JSON 函数。
如果值为 NULL,则 ON NULL 行为定义了要执行的操作。如果省略,默认情况下假定为 NULL ON NULL。
项目表达式可以是任意的,包括其他 JSON 函数。如果值为 NULL,则 ON NULL 行为定义了要执行的操作。如果省略,默认情况下假定为 ABSENT ON NULL。
此函数目前不支持 OVER windows、未绑定的 session windows 或 hop windows。
-- '["Apple","Banana","Orange"]'
SELECTJSON_ARRAYAGG(product)FROMorders columnName(The field name that exists in the table) | columnIndex(a positive integer starting from 1)
By default, values and expressions are mapped to a function’s arguments based on the position in the function call,
for example f(42, true). All functions in both SQL and Table API support position-based arguments.
If the function declares a static signature, named arguments are available as a convenient alternative.
The framework is able to reorder named arguments and consider optional arguments accordingly, before passing them
into the function call. Thus, the order of arguments doesn’t matter when calling a function and optional arguments
don’t have to be provided.
In DESCRIBE FUNCTION and documentation a static signature is indicated by the => assignment operator,
for example f(left => INT, right => BOOLEAN). Note that not every function supports named arguments. Named
arguments are not available for signatures that are overloaded, use varargs, or any other kind of input type strategy.
User-defined functions with a single eval() method usually qualify for named arguments.