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

Remove ArrowSignedNumericType to Simplify and reduce code duplication in arithmetic kernels #1161

Merged
merged 2 commits into from
Jan 13, 2022

Conversation

jhorstmann
Copy link
Contributor

Which issue does this PR close?

Closes #1160.

Rationale for this change

Reduces some code duplication and hopefully makes the whole file a bit easier to understand.

What changes are included in this PR?

  • unified most of the logic for the simd division / modulo kernels
  • removed ArrowSignedNumericType which was only introduced for a single kernel
  • simplified generic type bounds to require the needed numeric ops

Are there any user-facing changes?

The removal of ArrowSignedNumericType is a breaking change but I don't think there were any usages outside of the arrow crate or even the arithmetic.rs file.

cc @alamb @viirya

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jan 11, 2022
Comment on lines 399 to 402
/// SIMD vectorized version of `divide`.
///
/// The divide kernels need their own implementation as there is a need to handle situations
/// where a divide by `0` occurs. This is complicated by `NULL` slots and padding.
Copy link
Member

Choose a reason for hiding this comment

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

The comment needs to be updated too?

@codecov-commenter
Copy link

Codecov Report

Merging #1161 (60e9479) into master (884c6a6) will increase coverage by 0.04%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1161      +/-   ##
==========================================
+ Coverage   82.55%   82.59%   +0.04%     
==========================================
  Files         173      173              
  Lines       50673    50612      -61     
==========================================
- Hits        41833    41804      -29     
+ Misses       8840     8808      -32     
Impacted Files Coverage Δ
arrow/src/compute/kernels/arithmetic.rs 90.19% <69.23%> (+5.54%) ⬆️
arrow/src/array/transform/mod.rs 85.43% <0.00%> (-0.27%) ⬇️
parquet_derive/src/parquet_field.rs 66.21% <0.00%> (+0.22%) ⬆️
arrow/src/datatypes/datatype.rs 66.80% <0.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 884c6a6...60e9479. Read the comment docs.

@alamb
Copy link
Contributor

alamb commented Jan 12, 2022

This looks great @jhorstmann -- I am sorry I ran out of time today to review Arrow PRs -- i will give this one a careful look tomorrow

@alamb alamb added the api-change Changes to the arrow API label Jan 13, 2022
@alamb
Copy link
Contributor

alamb commented Jan 13, 2022

Marking as an API change due to ArrowSignedNumericType though I agree that it is not likely to matter in practice

One datapoint: the only place I can find it seems to be in a copy of the arrow-rs codebase:

https://sourcegraph.com/search?q=context:global+ArrowSignedNumericType&patternType=literal

Likewise github shows results only from forks / copies of Arrow as well: https://github.com/search?q=ArrowSignedNumericType&type=code

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This looks a lot simpler to me. 👍 very nice -- thank you for the contribution @jhorstmann ❤️

FWIW we are going to try releasing arrow 8.0.0 next week from master next week (as it contains some other breaking changes)

@alamb alamb merged commit 68e5750 into apache:master Jan 13, 2022
@alamb alamb changed the title Simplify and reduce code duplication in arithmetic kernels Remove ArrowSignedNumericType to Simplify and reduce code duplication in arithmetic kernels Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify and reduce code duplication in arithmetic.rs
4 participants