Skip to content

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

Merged
tustvold merged 3 commits intoapache:masterfrom
waynexia:impl-interval-assign
Jun 3, 2024
Merged

feat: impl *Assign ops for types in arrow-buffer#5832
tustvold merged 3 commits intoapache:masterfrom
waynexia:impl-interval-assign

Conversation

@waynexia
Copy link
Copy Markdown
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

waynexia added 2 commits June 2, 2024 11:41
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
Copy Markdown
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>()

Comment thread arrow-buffer/Cargo.toml Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

waynexia commented Jun 2, 2024

The failing integration test seems unrelated

@alamb
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@waynexia waynexia deleted the impl-interval-assign branch June 3, 2024 11:29
@waynexia
Copy link
Copy Markdown
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
Copy Markdown
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