Skip to content

Add (simd) modulus op#317

Merged
alamb merged 4 commits intoapache:masterfrom
flock-lab:mod
Jun 4, 2021
Merged

Add (simd) modulus op#317
alamb merged 4 commits intoapache:masterfrom
flock-lab:mod

Conversation

@gangliao
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

#98
apache/datafusion#99

Rationale for this change

What changes are included in this PR?

support modulus operations.

Are there any user-facing changes?

no.

@gangliao
Copy link
Copy Markdown
Contributor Author

After this PR is merged, I will submit a new PR to arrow-datafusion in order to support the modulus clause in SQL.

@gangliao
Copy link
Copy Markdown
Contributor Author

@jorgecarleitao First-time contributors need a maintainer to approve running workflows.

let null_bit_buffer =
combine_option_bitmap(left.data_ref(), right.data_ref(), left.len())?;

let buffer = if let Some(b) = &null_bit_buffer {
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.

It might be better to check if the null count > 0, as there could be a buffer even though all values are non-null

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2021

Codecov Report

❌ Patch coverage is 78.69822% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.59%. Comparing base (c863a2c) to head (2d55a0d).

Files with missing lines Patch % Lines
arrow/src/compute/kernels/arithmetic.rs 78.69% 36 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
+ Coverage   82.52%   82.59%   +0.06%     
==========================================
  Files         162      162              
  Lines       44007    44344     +337     
==========================================
+ Hits        36316    36624     +308     
- Misses       7691     7720      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread arrow/src/compute/kernels/arithmetic.rs Outdated
Comment thread arrow/src/error.rs Outdated
Copy link
Copy Markdown
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 great to me @gangliao -- I am sorry I did not have a chance to review this carefully previously.

I reviewed all test cases carefully and they look good. Very impressive work 👍

let a = Int32Array::from(vec![15, 15, 8, 1, 9]);
let b = Int32Array::from(vec![5, 6, 8, 9, 1]);
let c = modulus(&a, &b).unwrap();
assert_eq!(0, c.value(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.

It is possible to compare the c in fewer lines using something like assert_eq!(c, Int32Array:from(vec![3. 0, 2, 3, 4]), which also has the advantage if ensuring that c.len() == 5. This way is fine too

Comment thread arrow/src/compute/kernels/arithmetic.rs
@gangliao
Copy link
Copy Markdown
Contributor Author

gangliao commented Jun 4, 2021

Can anyone merge this PR so that I can proceed with other PR in arrow-datafusion? @alamb @jorgecarleitao

@alamb alamb merged commit 0a16574 into apache:master Jun 4, 2021
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Jun 4, 2021

Sorry @gangliao !

alamb pushed a commit that referenced this pull request Jun 4, 2021
* Add (simd) modulus op

* fix typo

* fix feature = "simd"

* revert ModulusByZero
alamb added a commit that referenced this pull request Jun 5, 2021
* Add (simd) modulus op

* fix typo

* fix feature = "simd"

* revert ModulusByZero

Co-authored-by: Gang Liao <gangliao@umd.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants