Updated on 2026-11-06 GMT+08:00

Value Access Functions

Overview

Value access functions are used to access field values in composite data types (such as Tuple and POJO). They support accessing a single field by name and expanding all subfields. AI DataLake supports the capability of accessing composite type fields using the dot notation in the SQL standard.

For more information, see Value Access Functions.

Application Scenarios

  • Field access: Obtains the value of a specific field from a composite type (such as Tuple and POJO) by name.
  • Field expansion: Expands all direct subtypes of a composite type into independent fields, used to expand nested structures in SELECT queries.

Notes and Constraints

  • The dot access syntax (tableName.compositeType.field) is only applicable to Flink composite types (such as Tuple and POJO) and is not applicable to common scalar fields.
  • The expand operation (tableName.compositeType.*) converts each direct subtype into an independent field. The field name is similar to the original field name, but separated by dollar signs (for example, mypojo$mytuple$f0).
  • The expand operation only expands direct subtypes and does not recursively expand nested composite types.

Syntax Structure

Syntax

Return Type

Description

Example

tableName.compositeType.field

ANY

Returns the value of a field in a Flink composite type (such as Tuple and POJO) by name.

-- Assume that the table myTable contains the ROW type field myRow(field1 INT, field2 STRING).
-- Access the field1 field by name.
SELECT myTable.myRow.field1 FROM myTable; -- Access the field in the nested structure by name.
-- Assume that person is ROW(name STRING, age INT).
SELECT myTable.person.name FROM myTable;

tableName.compositeType.*

ANY

Returns a flattened representation of a Flink composite type (such as Tuple and POJO), converting each direct subtype into an independent field.

In most cases, the flattened field name is similar to the original field name, but uses the dollar sign ($) as the separator (for example, mypojo$mytuple$f0).

-- Assume that the table myTable contains the ROW type field myRow(field1 INT, field2 STRING).
-- All fields in myRow are flattened. The flattened field names are separated by dollar signs ($) (for example, mypojo$mytuple$f0).
SELECT myTable.myRow.* FROM myTable;