feat:implement sql style 'find_in_set' string function#8328
feat:implement sql style 'find_in_set' string function#8328alamb merged 4 commits intoapache:mainfrom
Conversation
alamb
left a comment
There was a problem hiding this comment.
Thank you for the contribution @Syleechan -- this PR seems pretty mysql specific and maybe it belong in a downstream system given:
- There is already a function like
array_contains - DataFusion isn't trying to replicate the full function library of existing databases
| - **delim**: the string to find in str to split str. | ||
| - **count**: The number of times to search for the delimiter. Can be both a positive or negative number. | ||
|
|
||
| ### `find_in_set` |
There was a problem hiding this comment.
What do you think about using one of the existing array union functions instead? What about array_contains?
There was a problem hiding this comment.
Thanks @alamb . I have checked that the array functions input args type are different from the string function find_in_set.Actually, we use calcite to transfer to datafusion to compute data, and calcite also has array_contains, array_position functions.But Calcite take them as different functions, array functions process array input args and string functions process string input args.
https://calcite.apache.org/docs/reference.html#:~:text=ARRAY_POSITION(array%2C%20element)
https://calcite.apache.org/docs/reference.html#:~:text=FIND_IN_SET(matchStr%2C%20textStr)
these are calcite style functions in the reference.
Ted-Jiang
left a comment
There was a problem hiding this comment.
LGTM, thx @Syleechan. @alamb this is the last str_func user case in our system, but we want to introduce more array_func, @Syleechan could you plz help list the need list.
# Conflicts: # datafusion/expr/src/built_in_function.rs
|
Thanks again @Syleechan |
Which issue does this PR close?
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_find-in-set:~:text=FIND_IN_SET(str%2Cstrlist)
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?