flink
flink copied to clipboard
[FLINK-37924][table]Introduce Built-in Function to Access field or element in the Variant
What is the purpose of the change
Introduce Built-in Function to Access field or element in the Variant
| SQL Function | Table Function | Description |
|---|---|---|
| variant ‘[’ INT ‘]’ | VARIANT.at(INT) | If the VARIANT is an ARRAY value, returns a VARIANT whose value is the element at the specified index. Otherwise, this operation returns NULL |
| variant ‘[’ STRING ‘]’ | VARIANT.at(STRING) | If the VARIANT is a MAP value that has an element with this key, a VARIANT holding the associated value is returned. Otherwise, NULL is returned. |
Brief change log
- Support accessing VARIANT elements using [INT] or VARIANT.at(INT) when the VARIANT contains an ARRAY value in SQL or table expressions.
- Support accessing VARIANT elements using ['STRING'] or VARIANT.at('STRING') when the VARIANT contains a MAP value in SQL or table expressions.
Verifying this change
This change added tests and can be verified as follows:
- Added six new test at
org.apache.flink.table.planner.plan.nodes.exec.stream.VariantSemanticTest
Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with
@Public(Evolving): (no) - The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
- The S3 file system connector: (no)
CI report:
- 43de8ce365b99789cc818e5bc6ceded1dcd60083 Azure: SUCCESS
Bot commands
The @flinkbot bot supports the following commands:@flinkbot run azurere-run the last Azure build