hanyuzheng7 opened a new pull request, #23176:
URL: https://github.com/apache/flink/pull/23176

   ## What is the purpose of the change
   This is an implementation of FIELD
   The FIELD function returns the position of a value in a list of values 
(val...). 
   The list support mixed data type.
   
   ## Brief change log
   FIELD for Table API and SQL
   
   Syntax:
   `FIELD(value, val...)`
   
   Arguments:
   value: The value to find in the list.
   val... : The list of values that is to be searched.
   
   Returns:
   If value is not found in the list of values (val...), the FIELD function 
will return 0.
   If value is NULL, the FIELD function will return 0.
   If list of values is NULL or EMPTY, return 0.
   
   Examples:
   
   ```
   SELECT FIELD('b', 'a', 'b', 'c', 'd', 'e', 'f');
   Result: 2
   SELECT FIELD(ARRAY[1, 2, 3], 1, 'b', 'c', ARRAY[1, 2, 3], 'e', 'f');
   Result: 4
   SELECT FIELD(15, 10, 20, 15, 40);
   Result: 3
   SELECT FIELD('c', 2.1, 'b');
   Result: 0
   SELECT FIELD('g', '');
   Result: 0
   SELECT FIELD(null, 'a', 2, 'c');
   Result: 0
   SELECT FIELD('a', null);
   Result: 0
   ```
   
   See also:
   
MySQL:https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_field
   
   ## Verifying this change
   - This change added tests in CollectionFunctionsITCase.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / no)
     - The serializers: (yes / no / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / no / 
don't know)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
     - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs 
/ not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to