zhangxinyao88 opened a new pull request, #59346:
URL: https://github.com/apache/spark/pull/59346

   ### What changes were proposed in this pull request?
   
   Check `start = 0` before handling an empty search pattern in the binary, 
lowercase, and ICU implementations of `instr`.
   
   ### Why are the changes needed?
   
   The documented behavior of `instr` is to return zero when the start position 
is zero. The empty-pattern handling currently runs first and returns 1 instead.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Before this fix, `instr('abc', '', 0, 1)` returns `1`. After this fix, 
it returns `0`, matching the documented behavior.
   
   ### How was this patch tested?
   
   Added regression tests covering four collation groups, empty and nonempty 
input, ASCII and Unicode input, and multiple occurrences, including interpreted 
and generated SQL execution.
   
   The regressions failed before the fix. After the fix, all 58 focused Java 
tests and all 74 `StringExpressionsSuite` tests passed, and the Maven reactor 
succeeded.
   
   Commit: `6b95d5517b9f4dc0f1d69a790aa3abef39b71c47`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6)
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to