Skip to content

Commit

Permalink
Update core/src/execution/datafusion/expressions/scalar_funcs/chr.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Andy Grove <andygrove73@gmail.com>
  • Loading branch information
vaibhawvipul and andygrove authored Jun 12, 2024
1 parent e3ca63c commit 0b22412
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ pub fn chr(args: &[ArrayRef]) -> Result<ArrayRef> {
if integer < 0 {
return Ok("".to_string()); // Return empty string for negative integers
}
let adjusted_integer = if integer >= 0 { integer % 256 } else { integer };
match core::char::from_u32(adjusted_integer as u32) {
match core::char::from_u32((integer % 256) as u32) {
Some(ch) => Ok(ch.to_string()),
None => {
exec_err!("requested character not compatible for encoding.")
Expand Down

0 comments on commit 0b22412

Please sign in to comment.