viirya commented on code in PR #552:
URL: https://github.com/apache/datafusion-comet/pull/552#discussion_r1636880101
##########
core/src/execution/datafusion/expressions/scalar_funcs/chr.rs:
##########
@@ -44,10 +44,15 @@ pub fn chr(args: &[ArrayRef]) -> Result<ArrayRef> {
.iter()
.map(|integer: Option<i64>| {
integer
- .map(|integer| match core::char::from_u32(integer as u32) {
- Some(integer) => Ok(integer.to_string()),
- None => {
- exec_err!("requested character too large for
encoding.")
+ .map(|integer| {
+ if integer < 0 {
+ return Ok("".to_string()); // Return empty string for
negative integers
+ }
+ match core::char::from_u32((integer % 256) as u32) {
Review Comment:
We probably need to add a test case for it.
--
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]