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

Uroš Bojanić updated SPARK-48284:
---------------------------------
    Description: 
Currently, UTF8String.indexOf returns 0 when given an empty parameters string, 
and any integer start value.

Examples:

{{"abc".indexOf("", 0);  // returns: 0}}

{{{}"abc".indexOf("", 2);  // returns: 0{}}}{{{}{}}}

{{"abc".indexOf("", 9);  // returns: 0}}

{{{}"abc".indexOf("", -3);  // returns: 0{}}}{{{}{}}}{{{}{}}}


This is not correct, as "start" is not taken into consideration.

Correct behaviour would be:

{{"abc".indexOf("", 0);  // returns: 0}}

{{{}"abc".indexOf("", 2);  // returns: 2{}}}{{{}{}}}

{{"abc".indexOf("", 9);  // returns: -1}}

{{"abc".indexOf("", -3);  // returns: -1}}

  was:Calling UTF8String.indexOf with an empty parameters string, and any 
integer start value.


> Fix UTF8String indexOf behaviour for empty string search
> --------------------------------------------------------
>
>                 Key: SPARK-48284
>                 URL: https://issues.apache.org/jira/browse/SPARK-48284
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.0.0
>            Reporter: Uroš Bojanić
>            Priority: Major
>
> Currently, UTF8String.indexOf returns 0 when given an empty parameters 
> string, and any integer start value.
> Examples:
> {{"abc".indexOf("", 0);  // returns: 0}}
> {{{}"abc".indexOf("", 2);  // returns: 0{}}}{{{}{}}}
> {{"abc".indexOf("", 9);  // returns: 0}}
> {{{}"abc".indexOf("", -3);  // returns: 0{}}}{{{}{}}}{{{}{}}}
> This is not correct, as "start" is not taken into consideration.
> Correct behaviour would be:
> {{"abc".indexOf("", 0);  // returns: 0}}
> {{{}"abc".indexOf("", 2);  // returns: 2{}}}{{{}{}}}
> {{"abc".indexOf("", 9);  // returns: -1}}
> {{"abc".indexOf("", -3);  // returns: -1}}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to