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

feat: impl *Assign ops for types in arrow-buffer #5832

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

waynexia
Copy link
Member

@waynexia waynexia commented Jun 2, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

Impl std::ops::*Assign (like AddAssign) for i256, IntervalDayTime and IntervalMonthDayNano.

What changes are included in this PR?

  • new trait impl

The first commit (95da017) contains the plain implementation of AddAssign and SubAssign as examples

Are there any user-facing changes?

Yes

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@github-actions github-actions bot added the arrow Changes to the arrow crate label Jun 2, 2024
@waynexia
Copy link
Member Author

waynexia commented Jun 2, 2024

I run into this on migrating interval types in datafusion. AddAssign and SubAssign are required here

fn increment_decrement<const INC: bool, T: OneTrait + SubAssign + AddAssign>()

@@ -37,6 +37,7 @@ bench = false
bytes = { version = "1.4" }
num = { version = "0.4", default-features = false, features = ["std"] }
half = { version = "2.1", default-features = false }
paste = { version = "1.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid using this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check 33b69f8

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@waynexia
Copy link
Member Author

waynexia commented Jun 2, 2024

The failing integration test seems unrelated

@alamb
Copy link
Contributor

alamb commented Jun 2, 2024

I wonder if we could use the unary_mut kernels in Arrow instead of relying on built in kernels

I spent some more time trying to document them recently here #5798

@tustvold
Copy link
Contributor

tustvold commented Jun 2, 2024

I wonder if we could use the unary_mut kernels in Arrow instead of relying on built in kernels

I don't really follow the connection, these are operations on primitive scalars, not arrays.

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, given the types in question are Copy this doesn't make any difference, but is harmless enough

@waynexia
Copy link
Member Author

waynexia commented Jun 3, 2024

I wonder if we could use the unary_mut kernels in Arrow instead of relying on built in kernels

TIL. Those mut-in-place APIs look good. I believe it can help improve UDF/Plan's implementations. As for increment_decrement, it's a helper over Interval ScalarValue, so binary_mut may not work here.

@tustvold tustvold merged commit 13a26d6 into apache:master Jun 3, 2024
25 of 26 checks passed
@waynexia waynexia deleted the impl-interval-assign branch June 3, 2024 11:29
@waynexia
Copy link
Member Author

waynexia commented Jun 3, 2024

By the way, I noticed that i256's layout is not fixed by #[repr(C)], is that intended? @tustvold

@tustvold
Copy link
Contributor

tustvold commented Jun 3, 2024

Good spot, I thought I had fixed that, but guess I forgot - #5837

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants