izveigor commented on code in PR #5476:
URL: https://github.com/apache/arrow-datafusion/pull/5476#discussion_r1125707089
##########
datafusion/physical-expr/src/expressions/binary/kernels.rs:
##########
@@ -129,6 +141,38 @@ pub(crate) fn bitwise_shift_right(left: ArrayRef, right:
ArrayRef) -> Result<Arr
Int64Array
)
}
+ DataType::UInt8 => {
+ binary_bitwise_array_op!(
+ left,
+ right,
+ |a: u8, b: u8| a.wrapping_shr(b as u32),
+ UInt8Array
+ )
+ }
+ DataType::UInt16 => {
+ binary_bitwise_array_op!(
+ left,
+ right,
+ |a: u16, b: u16| a.wrapping_shr(b as u32),
+ UInt16Array
+ )
+ }
+ DataType::UInt32 => {
+ binary_bitwise_array_op!(
+ left,
+ right,
+ |a: u32, b: u32| a.wrapping_shr(b),
+ UInt32Array
+ )
+ }
+ DataType::UInt64 => {
+ binary_bitwise_array_op!(
+ left,
+ right,
+ |a: u64, b: u64| a.wrapping_shr(b.try_into().unwrap()),
Review Comment:
Maybe, I don't know some aspects of programming in Rust, but I think it is
impossible to return normal error through macros. Anyway, by the behavior of
this function:
https://github.com/apache/arrow-datafusion/blob/main/datafusion/physical-expr/src/expressions/binary/kernels.rs#L60,
I consider that unwrap() in this situation is not a big problem.
--
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]