You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Flink Jira Bot (Jira)" <ji...@apache.org> on 2023/09/08 22:36:00 UTC

[jira] [Updated] (FLINK-32706) Add SPLIT(STRING) support in SQL & Table API

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

Flink Jira Bot updated FLINK-32706:
-----------------------------------
    Labels: pull-request-available stale-assigned  (was: pull-request-available)

I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help the community manage its development. I see this issue is assigned but has not received an update in 30 days, so it has been labeled "stale-assigned".
If you are still working on the issue, please remove the label and add a comment updating the community on your progress.  If this issue is waiting on feedback, please consider this a reminder to the committer/reviewer. Flink is a very active project, and so we appreciate your patience.
If you are no longer working on the issue, please unassign yourself so someone else may work on it.


> Add SPLIT(STRING) support in SQL & Table API
> --------------------------------------------
>
>                 Key: FLINK-32706
>                 URL: https://issues.apache.org/jira/browse/FLINK-32706
>             Project: Flink
>          Issue Type: Improvement
>            Reporter: Hanyu Zheng
>            Assignee: Hanyu Zheng
>            Priority: Major
>              Labels: pull-request-available, stale-assigned
>
> SPLIT Function
> Description
> Splits a string into an array of substrings, based on a delimiter.
> Syntax
> The syntax for the SPLIT function is:
> {code:java}
> SPLIT(col1, delimiter){code}
> Splits a string into an array of substrings based on a delimiter. If the delimiter is not found, then the original string is returned as the only element in the array. If the delimiter is empty, then all characters in the string are split. If either, string or delimiter, are NULL, then a NULL value is returned.
> If the delimiter is found at the beginning or end of the string, or there are contiguous delimiters, then an empty space is added to the array.
> Example
> Let's look at some  function examples and explore how to use the SPLIT function.
> For example:
>  
> {code:java}
> SELECT SPLIT('abcdefg', 'c');
> Result: ['ab', 'defg']
> {code}
> see also:
> 1. ksqlDB Split function
> ksqlDB provides a scalar function named {{SPLIT}} which splits a string into an array of substrings based on a delimiter.
> Syntax: {{SPLIT(string, delimiter)}}
> For example: {{SPLIT('a,b,c', ',')}} will return {{{}['a', 'b', 'c']{}}}.
> [https://docs.ksqldb.io/en/0.8.1-ksqldb/developer-guide/ksqldb-reference/scalar-functions/#split]
> 2. Apache Hive Split function
> Hive offers a function named {{split}} which splits a string around a specified delimiter and returns an array of strings.
> Syntax: {{array<string> split(string str, string pat)}}
> For example: {{split('a,b,c', ',')}} will return {{{}["a", "b", "c"]{}}}.
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
> 3. Spark SQL Split function
> Spark SQL also offers a function named {{{}split{}}}, similar to the one in Hive.
> Syntax: {{split(str, pattern[, limit])}}
> Here, {{limit}} is an optional parameter to specify the maximum length of the returned array.
> For example: {{split('oneAtwoBthreeC', '[ABC]', 2)}} will return {{{}["one", "twoBthreeC"]{}}}.
> [https://spark.apache.org/docs/latest/api/sql/index.html#split]
> 4. Presto Split function
> Presto offers a function named {{split}} which splits a string around a regular expression and returns an array of strings.
> Syntax: {{array<varchar> split(string str, string regex)}}
> For example: {{split('a.b.c', '\.')}} will return {{{}["a", "b", "c"]{}}}.
> [https://prestodb.io/docs/current/functions/string.html]



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