Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitwise: support left/right shift using the native wrapping api #2741

Closed
liukun4515 opened this issue Sep 15, 2022 · 3 comments · Fixed by #4148
Closed

bitwise: support left/right shift using the native wrapping api #2741

liukun4515 opened this issue Sep 15, 2022 · 3 comments · Fixed by #4148
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers

Comments

@liukun4515
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

The current of rust
https://doc.rust-lang.org/std/num/struct.Wrapping.html#

wrapping_shl and wrapping_shr is not stable.

the shift bit must be u32 data type

part of #2702

Now we just implement this use value.wrapping_shl(u32), after the feature is stable, we can replace them.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@liukun4515 liukun4515 added the enhancement Any new improvement worthy of a entry in the changelog label Sep 15, 2022
@liukun4515 liukun4515 changed the title bitwise: support left/right shift bitwise: support left/right shift using the native wrapping api Sep 15, 2022
@alamb
Copy link
Contributor

alamb commented Apr 24, 2023

As part of apache/datafusion#6098 I found this ticket. It turns out DataFusion has these functions implemented:

https://github.com/apache/arrow-datafusion/blob/655f2a84d86a45267ecdfde1860d3748309f270f/datafusion/physical-expr/src/expressions/binary/kernels.rs#L93-L239

Thus I think it would be fairly straightforward to implement shl and shr in arrow-rs by using the DataFusion implementations and following the example of the existing kernels in https://docs.rs/arrow/latest/arrow/compute/kernels/bitwise/fn.bitwise_or.html

The tricky bit will be to cast the arguments to u32 (rather than use the same primitive type)

Marking this is a good first issue as the patterns are relatively set

@alamb alamb added good first issue Good for newcomers arrow Changes to the arrow crate labels Apr 24, 2023
@Weijun-H
Copy link
Contributor

If nobody is currently working on this, I would be happy to take it on.

@alamb
Copy link
Contributor

alamb commented Apr 27, 2023

Thank you @Weijun-H

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants