[
https://issues.apache.org/jira/browse/CALCITE-7468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18073016#comment-18073016
]
Julian Hyde commented on CALCITE-7468:
--------------------------------------
While you're doing the fix, remove the check for null values at the top of the
{{splitPart}} function. Because the function is strict, null arguments are not
possible.
Also, the behavior when the delimiter is the empty string is incorrect. The test
{code:java}assertThat(SqlFunctions.splitPart("abc", "", 1), is(""));{code}
is wrong and (based on my tests on Postgres) should read
{code:java}assertThat(SqlFunctions.splitPart("abc", "", 1), is("abc"));{code}
> The SPLIT_PART implementation is incorrect for regex patterns
> -------------------------------------------------------------
>
> Key: CALCITE-7468
> URL: https://issues.apache.org/jira/browse/CALCITE-7468
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.41.0
> Reporter: Mihai Budiu
> Priority: Minor
>
> SPLIT_PART(string, delimiter, n) is supposed to interpret the delimiter as a
> string, but the actual implementation uses String.split which treats it as a
> regex. Thus the results are wrong for a delimiter such as '.'
--
This message was sent by Atlassian Jira
(v8.20.10#820010)