[ 
https://issues.apache.org/jira/browse/FLINK-32264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hanyu Zheng updated FLINK-32264:
--------------------------------
    Description: 
FIELD Function

Description
The FIELD function returns the position of a value in a list of values (val1, 
val2, val3, ...).

Syntax
The syntax for the FIELD function is:

FIELD( value, ...)
Parameters or Arguments
value
The value to find in the list.
val1, val2, val3, ...
The list of values that is to be searched.
Note
If value is not found in the list of values (val1, val2, val3, ...), the FIELD 
function will return 0.
If value is NULL, the FIELD function will return 0.
If list of values is NULL, return 0.

Example
Let's look at some  FIELD function examples and explore how to use the FIELD 
function.

For example:

 
{code:java}
SELECT FIELD('b', 'a', 'b', 'c', 'd', 'e', 'f');
Result: 2
SELECT FIELD('B', 'a', 'b', 'c', 'd', 'e', 'f');
Result: 2
SELECT FIELD(15, 10, 20, 15, 40);
Result: 3
SELECT FIELD('c', 'a', 'b');
Result: 0
SELECT FIELD('g', '');
Result: 0
SELECT FIELD(null, 'a', 'b', 'c');
Result: 0
SELECT FIELD('a', null);
Result: 0
{code}
see also:

MySQL:[https://www.techonthenet.com/mysql/functions/field.php]

  was:
FIELD Function

Description
The FIELD function returns the position of a value in a list of values (val1, 
val2, val3, ...).

Syntax
The syntax for the FIELD function is:

FIELD( value, val1, val2, val3, ... )
Parameters or Arguments
value
The value to find in the list.
val1, val2, val3, ...
The list of values that is to be searched.
Note
If value is not found in the list of values (val1, val2, val3, ...), the FIELD 
function will return 0.
If value is NULL, the FIELD function will return 0.
If all arguments in the FIELD function are string values, the find is performed 
as string values.
If all arguments in the FIELD function are numeric values, the find is 
performed as numeric values.

Example
Let's look at some  FIELD function examples and explore how to use the FIELD 
function.

For example:

 
{code:java}
SELECT FIELD('b', 'a', 'b', 'c', 'd', 'e', 'f');
Result: 2
SELECT FIELD('B', 'a', 'b', 'c', 'd', 'e', 'f');
Result: 2
SELECT FIELD(15, 10, 20, 15, 40);
Result: 3
SELECT FIELD('c', 'a', 'b');
Result: 0
SELECT FIELD('g', '');
Result: 0
SELECT FIELD(null, 'a', 'b', 'c');
Result: 0
SELECT FIELD('a', null);
Result: 0
{code}
see also:

MySQL:[https://www.techonthenet.com/mysql/functions/field.php]


> Add FIELD support in SQL & Table API
> ------------------------------------
>
>                 Key: FLINK-32264
>                 URL: https://issues.apache.org/jira/browse/FLINK-32264
>             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
>
>
> FIELD Function
> Description
> The FIELD function returns the position of a value in a list of values (val1, 
> val2, val3, ...).
> Syntax
> The syntax for the FIELD function is:
> FIELD( value, ...)
> Parameters or Arguments
> value
> The value to find in the list.
> val1, val2, val3, ...
> The list of values that is to be searched.
> Note
> If value is not found in the list of values (val1, val2, val3, ...), the 
> FIELD function will return 0.
> If value is NULL, the FIELD function will return 0.
> If list of values is NULL, return 0.
> Example
> Let's look at some  FIELD function examples and explore how to use the FIELD 
> function.
> For example:
>  
> {code:java}
> SELECT FIELD('b', 'a', 'b', 'c', 'd', 'e', 'f');
> Result: 2
> SELECT FIELD('B', 'a', 'b', 'c', 'd', 'e', 'f');
> Result: 2
> SELECT FIELD(15, 10, 20, 15, 40);
> Result: 3
> SELECT FIELD('c', 'a', 'b');
> Result: 0
> SELECT FIELD('g', '');
> Result: 0
> SELECT FIELD(null, 'a', 'b', 'c');
> Result: 0
> SELECT FIELD('a', null);
> Result: 0
> {code}
> see also:
> MySQL:[https://www.techonthenet.com/mysql/functions/field.php]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to