surawut-jirasaktavee opened a new pull request, #59465:
URL: https://github.com/apache/spark/pull/59465

   ### What changes were proposed in this pull request?
   
   This PR changes Example 2 of the `regexp_instr` doctest in `branch-4.0` to 
use the pattern `(\d+)(a|b|m)` with idx `1`. Group 1 `(\d+)` starts at the same 
position as the whole match, so the example returns `1` whether or not `idx` is 
honored.
   
   ### Why are the changes needed?
   
   #59422 (SPARK-60125) makes `regexp_instr` on master return the position of 
the regex group `idx` instead of ignoring it. The `pyspark-connect-old-client` 
job runs the `branch-4.0` PySpark tests against a master server, and the 
current `branch-4.0` example (`\d+(a|b|m)` with idx `1`) expects `1`, while the 
fixed server returns `2`:
   
   ```
   Failed example:
       df.select('*', sf.regexp_instr('str', sf.lit(r'\d+(a|b|m)'), 
sf.lit(1))).show()
   Expected: 1
   Got:      2
   ```
   
   `branch-4.0` keeps its current behavior, so the example needs to give the 
same result under both semantics, as suggested in 
https://github.com/apache/spark/pull/59422#issuecomment-6168809540. SPARK-57348 
handled the `sql_keywords` doctest the same way. This PR should be merged 
before #59422 so that the job does not fail on other PRs.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test and documentation only.
   
   ### How was this patch tested?
   
   Ran the `regexp_instr` doctest examples, including the updated Example 2, 
against PySpark 4.0.4: 4 of 4 passed. With #59422 the example also returns `1`, 
because group 1 `(\d+)` matches `1` at the start of the match `1a`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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