Other Functions

Array Functions

Table 1 Array functions

Function

Returned Data Type

Description

CARDINALITY(ARRAY)

INT

Returns the number of elements in an array.

ELEMENT(ARRAY)

-

Returns 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.

Precautions

None

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

Returned Data Type

Description

tableName.compositeType.field

-

Selects a single field, uses the name to access the field of Apache Flink composite types, such as Tuple and POJO, and returns the value.

tableName.compositeType.*

-

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

Precautions

None

Example

None