luoyuxia commented on code in PR #22267:
URL: https://github.com/apache/flink/pull/22267#discussion_r1152818960
##########
flink-python/pyflink/table/expression.py:
##########
@@ -1487,6 +1487,17 @@ def array_distinct(self) -> 'Expression':
"""
return _binary_op("arrayDistinct")(self)
+ def array_position(self, needle) -> 'Expression':
+ """
+ Returns the position of the first occurrence of element in the given
array as long.
Review Comment:
dito
##########
docs/data/sql_functions.yml:
##########
@@ -634,6 +634,9 @@ collection:
- sql: ARRAY_DISTINCT(haystack)
table: haystack.arrayDistinct()
description: Returns an array with unique elements. If the array itself is
null, the function will return null. Keeps ordering of elements.
+ - sql: ARRAY_POSITION(haystack, needle)
+ table: haystack.arrayPosition(needle)
+ description: Returns the position of the first occurrence of element in
the given array as long. Returns 0 if the given value could not be found in the
array. Returns null if either of the arguments are null. And this is not zero
based, but 1-based index. The first element in the array has index 1.
Review Comment:
The doc need to be updated.
`Returns the position of the first occurrence of element in the given array
as int.`
--
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]