andygrove commented on code in PR #4914:
URL: https://github.com/apache/datafusion-comet/pull/4914#discussion_r3603692190
##########
native/spark-expr/src/conversion_funcs/string.rs:
##########
@@ -254,6 +254,28 @@ where
pruned_float_str.parse::<F>().ok()
}
+/// Parse the boolean literals Spark accepts in a string-to-boolean cast,
returning
+/// `None` for anything else.
+///
+/// Trimming before comparing is equivalent to trimming afterwards: ASCII case
folding
+/// never turns a whitespace character into a non-whitespace one, or vice
versa.
+#[inline]
+fn parse_utf8_to_boolean(value: &str) -> Option<bool> {
+ let trimmed = value.trim();
Review Comment:
Added a `TODO(#4959)` marker at the `value.trim()` call and filed
https://github.com/apache/datafusion-comet/issues/4959 to track `trimAll`
parity. Did not enshrine the pre-existing behavior in tests.
##########
native/spark-expr/src/conversion_funcs/string.rs:
##########
@@ -1989,6 +2015,38 @@ mod tests {
}
}
+ #[test]
+ fn test_parse_utf8_to_boolean() {
Review Comment:
Added `"ñ"` (2 bytes, hits the `"no"` arm) and `"trñ"` (4 bytes, hits the
`"true"` arm) to the invalid list.
--
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]