tlm365 commented on code in PR #13752:
URL: https://github.com/apache/datafusion/pull/13752#discussion_r1888548911
##########
datafusion/functions/src/unicode/initcap.rs:
##########
@@ -149,13 +162,16 @@ fn initcap_string(input: Option<&str>) -> Option<String> {
let mut prev_is_alphanumeric = false;
for c in s.chars() {
- let transformed = if prev_is_alphanumeric {
- c.to_ascii_lowercase()
+ if prev_is_alphanumeric {
+ for lc in c.to_lowercase() {
+ result.push(lc);
+ }
} else {
- c.to_ascii_uppercase()
- };
- result.push(transformed);
- prev_is_alphanumeric = c.is_ascii_alphanumeric();
+ for uc in c.to_uppercase() {
+ result.push(uc);
+ }
+ }
Review Comment:
@goldmedal thanks for reviewing
> Does this change slow down the ASCII-only case? If yes, maybe we can
consider keeping a faster path for ASCII-only cases. (like
https://github.com/apache/datafusion/issues/12306)
Seems like keeping a fast path for ASCII-only cases is beneficial. I will
check and update it soon.
--
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]