[ https://issues.apache.org/jira/browse/FLINK-32264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Weijie Guo updated FLINK-32264: ------------------------------- Affects Version/s: 2.1.0 (was: 1.18.0) > 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: 2.1.0 > Reporter: Bonnie Varghese > Assignee: Hanyu Zheng > Priority: Major > Labels: pull-request-available, stale-assigned > Fix For: 2.0.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://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_field -- This message was sent by Atlassian Jira (v8.20.10#820010)