doc-exports/docs/dli/sqlreference/dli_08_0101.html
Su, Xiaomeng 04d4597cf3 dli_sqlreference_0511_version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2023-11-02 14:34:08 +00:00

5.5 KiB

Other Functions

Array Functions

Table 1 Array functions

Function

Return Data Type

Description

CARDINALITY(ARRAY)

INT

Return the element count of an array.

ELEMENT(ARRAY)

-

Return the sole element of an array with a single element. If the array contains no elements, null is returned. If the array contains multiple elements, an exception is reported.

Example:

The returned number of elements in the array is 3.

insert into temp select CARDINALITY(ARRAY[TRUE, TRUE, FALSE]) from source_stream;

HELLO WORLD is returned.

insert into temp select ELEMENT(ARRAY['HELLO WORLD']) from source_stream;

Attribute Access Functions

Table 2 Attribute access functions

Function

Return Data Type

Description

tableName.compositeType.field

-

Select a single field, use the name to access the field of Apache Flink composite types, such as Tuple and POJO, and return the value.

tableName.compositeType.*

-

Select all fields, and convert Apache Flink composite types, such as Tuple and POJO, and all their direct subtypes into a simple table. Each subtype is a separate field.