[
https://issues.apache.org/jira/browse/FLINK-32263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736961#comment-17736961
]
Jark Wu edited comment on FLINK-32263 at 6/26/23 2:44 AM:
----------------------------------------------------------
You can follow the way of
[{{jsonArrayAgg}}|https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java#L915]
which is defined as a static method. Users can call it in this way:
{code}
orders.select(ELT(lit(1), $("f0")));
{code}
was (Author: jark):
You can follow the way of
[{{jsonArrayAgg}}|https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java#L915]
which is defined as a static method. Users can calling it in this way:
{code}
orders.select(ELT(lit(1), $("f0")));
{code}
> Add ELT support in SQL & Table API
> ----------------------------------
>
> Key: FLINK-32263
> URL: https://issues.apache.org/jira/browse/FLINK-32263
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / Planner
> Affects Versions: 1.18.0
> Reporter: Bonnie Varghese
> Assignee: Hanyu Zheng
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.18.0
>
>
> Implement the elt function to extract the n-th input value from a list of
> inputs.
> Description:
> The elt function in the ETL pipeline extracts the value at the n-th position
> from a list of input values. It is similar to array indexing, where the first
> element is at position 1. This function provides a convenient way to retrieve
> specific elements from a list of inputs.
> Syntax:
>
> {code:java}
> elt[n: int, *inputs: str] -> str or None{code}
>
> Arguments:
> n: The index of the input value to extract. It should be a positive integer.
> *inputs: Variable-length arguments representing the list of inputs.
> Returns:
> The value at the n-th position in the list of inputs. If the index exceeds
> the length of the array, the function returns NULL.
> Examples:
> Retrieving the second element from a list of strings:
> {code:java}
> elt(2, 'scala', 'java')
> Output: 'java'{code}
> Retrieving the second element from a list of mixed types:
> {code:java}
> result = elt(2, 'a', 1)
> Output: 1{code}
> See also:
>
> spark:[https://spark.apache.org/docs/latest/api/sql/index.html#elt]
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)