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

   
   
   ### What changes were proposed in this pull request?
   The behavior of `StringToMap` expression accepts third and second parameters 
as regular expressions, as per the 
[docs](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.str_to_map.html).
 For collated strings we handle regular expressions through collation aware 
regex flags with `java.regex`. In this PR the behavior for collated strings was 
adjusted to work with these flags - the current implementation is not 
regex-aware.
   
   
   ### Why are the changes needed?
   To fix a correctness issue with collated version of `StringToMap`.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, the collated behavior of `StringToMap` was changed. The following query 
returns different results:
   ```sql
   select str_to_map('a:b,c:d' collate utf8_lcase, ',', '[:]+')
   -- current behavior: Map('a:b,c:d' -> null)
   -- new behavior: Map('a' -> 'b', 'c' -> 'd')
   ```
   
   
   ### How was this patch tested?
   New tests in this PR and existing tests.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


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