alamb commented on code in PR #5476:
URL: https://github.com/apache/arrow-datafusion/pull/5476#discussion_r1126863158
##########
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:
> but I think it is impossible to return normal error through macros.
I think it is possible (the function the macro is used in has to return a
result)
> 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.
I agree the pre-existing pattern is a reasonable justification for using
unwrap.
Thank you
--
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]