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

Use ArrayAccessor in Comparison Kernels #2157

Merged
merged 3 commits into from Jul 25, 2022
Merged

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 25, 2022

Which issue does this PR close?

Closes #2135.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@viirya viirya marked this pull request as draft July 25, 2022 03:48
Ok(BooleanArray::from(data))
}};
}
fn compare_op<T: ArrayAccessor, F>(left: T, right: T, op: F) -> Result<BooleanArray>
Copy link
Member Author

Choose a reason for hiding this comment

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

ArrayAccessor allows us to replace macro with generic function like this.

Comment on lines 1848 to 1852
(DataType::Int8, DataType::Int8) => compare_op(
left.as_any().downcast_ref::<Int8Array>().unwrap(),
right.as_any().downcast_ref::<Int8Array>().unwrap(),
|a, b| a == b,
),
Copy link
Member Author

@viirya viirya Jul 25, 2022

Choose a reason for hiding this comment

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

But for some macros which we match array types, seems it doesn't reduce too much duplication, as we still need to match particular array type (which implements ArrayAccessor).

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 25, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2022

Codecov Report

Merging #2157 (a4426e7) into master (19a7189) will increase coverage by 0.00%.
The diff coverage is 97.61%.

@@           Coverage Diff            @@
##           master    #2157    +/-   ##
========================================
  Coverage   82.86%   82.86%            
========================================
  Files         237      237            
  Lines       61296    61426   +130     
========================================
+ Hits        50792    50901   +109     
- Misses      10504    10525    +21     
Impacted Files Coverage Δ
arrow/src/compute/kernels/comparison.rs 93.89% <97.61%> (+1.30%) ⬆️
arrow/src/array/iterator.rs 86.45% <0.00%> (-13.55%) ⬇️
parquet/src/column/reader/decoder.rs 50.00% <0.00%> (-11.34%) ⬇️
arrow/src/util/decimal.rs 86.92% <0.00%> (-4.59%) ⬇️
...row/src/array/builder/string_dictionary_builder.rs 90.64% <0.00%> (-0.72%) ⬇️
arrow/src/array/array_decimal.rs 90.32% <0.00%> (-0.72%) ⬇️
arrow/src/array/array_binary.rs 92.87% <0.00%> (ø)
arrow/src/datatypes/datatype.rs 63.00% <0.00%> (+0.31%) ⬆️
arrow/src/array/array.rs 87.75% <0.00%> (+0.92%) ⬆️
...rquet/src/arrow/record_reader/definition_levels.rs 87.76% <0.00%> (+1.96%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@viirya viirya marked this pull request as ready for review July 25, 2022 06:41
@viirya
Copy link
Member Author

viirya commented Jul 25, 2022

cargo bench --bench comparison_kernels -- --baseline master doesn't see regression.

@jhorstmann
Copy link
Contributor

Nice improvement!

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.

Looks very nice

cc @tustvold

@tustvold tustvold merged commit 4a47ab7 into apache:master Jul 25, 2022
@ursabot
Copy link

ursabot commented Jul 25, 2022

Benchmark runs are scheduled for baseline = e68852c and contender = 4a47ab7. 4a47ab7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@viirya
Copy link
Member Author

viirya commented Jul 25, 2022

Thanks @jhorstmann @alamb @tustvold

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.

Use ArrayAccessor in Comparison Kernels
6 participants