You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/01 08:12:11 UTC
[GitHub] [arrow-rs] viirya opened a new pull request, #3426: Generic bytes dictionary builder
viirya opened a new pull request, #3426:
URL: https://github.com/apache/arrow-rs/pull/3426
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #3425.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060150346
##########
arrow-select/src/take.rs:
##########
@@ -592,7 +592,10 @@ where
let s = array.value(index);
- length_so_far += T::Offset::from_usize(s.as_ref().len()).unwrap();
+ length_so_far += T::Offset::from_usize(
+ <<T as ByteArrayType>::Native as AsRef<[u8]>>::as_ref(s).len(),
+ )
+ .unwrap();
values.extend_from_slice(s.as_ref());
Review Comment:
```suggestion
```suggestion
let s: &[u8] = s.as_ref();
length_so_far += T::Offset::from_usize(s.len()).unwrap();
values.extend_from_slice(s);
```
##########
arrow-select/src/take.rs:
##########
@@ -592,7 +592,10 @@ where
let s = array.value(index);
- length_so_far += T::Offset::from_usize(s.as_ref().len()).unwrap();
+ length_so_far += T::Offset::from_usize(
+ <<T as ByteArrayType>::Native as AsRef<[u8]>>::as_ref(s).len(),
+ )
+ .unwrap();
values.extend_from_slice(s.as_ref());
Review Comment:
```suggestion
let s: &[u8] = s.as_ref();
length_so_far += T::Offset::from_usize(s.len()).unwrap();
values.extend_from_slice(s);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold merged pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
tustvold merged PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060002707
##########
arrow-array/src/builder/generic_bytes_dictionary_builder.rs:
##########
@@ -145,27 +122,32 @@ where
/// ```
pub fn new_with_dictionary(
keys_capacity: usize,
- dictionary_values: &StringArray,
- ) -> Result<Self, ArrowError> {
+ dictionary_values: &GenericByteArray<T>,
+ ) -> Result<Self, ArrowError>
+ where
+ <T as ByteArrayType>::Native: AsRef<<T as ByteArrayType>::Native> + AsRef<[u8]>,
Review Comment:
It took me a long while to work out why this is necessary, and it is because there isn't a blanket implementation of `T: AsRef<T>`.
I wonder if we could add this constraint to `ByteArrayType` directly, and allow removing this constraint?
```
type Native: bytes::ByteArrayNativeType + AsRef<Self::Native> + AsRef<[u8]> + ?Sized;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] viirya commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060149281
##########
arrow-array/src/builder/generic_bytes_dictionary_builder.rs:
##########
@@ -145,27 +122,32 @@ where
/// ```
pub fn new_with_dictionary(
keys_capacity: usize,
- dictionary_values: &StringArray,
- ) -> Result<Self, ArrowError> {
+ dictionary_values: &GenericByteArray<T>,
+ ) -> Result<Self, ArrowError>
+ where
+ <T as ByteArrayType>::Native: AsRef<<T as ByteArrayType>::Native> + AsRef<[u8]>,
Review Comment:
Yea, that works to remove the constraint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] ursabot commented on pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#issuecomment-1369655421
Benchmark runs are scheduled for baseline = 6139d8984ca702fa744aaf3b0b2193dd85468cf7 and contender = 08a976f217610cc8b1dea3375fe577027460ecc3. 08a976f217610cc8b1dea3375fe577027460ecc3 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/75784197aee844ca91b089021ba0f3ff...215237f1c2574a0f96397256c623bc4a/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/088ef1360da944a6b440ee0c55d2215f...9c598bd1632f4ae4b08ee1531feace0b/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/e82a300e58534e6a96f979e4333a4e4f...b34222a0865841028aea265e567aba7f/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/5d0935e42afc49aeb3ab8183029aa2eb...45a28f74a30948ffb053d07e4c1f8564/)
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] viirya commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060152535
##########
arrow-select/src/take.rs:
##########
@@ -592,7 +592,10 @@ where
let s = array.value(index);
- length_so_far += T::Offset::from_usize(s.as_ref().len()).unwrap();
+ length_so_far += T::Offset::from_usize(
+ <<T as ByteArrayType>::Native as AsRef<[u8]>>::as_ref(s).len(),
+ )
+ .unwrap();
values.extend_from_slice(s.as_ref());
Review Comment:
Oh Oh right. I followed the suggestion from the compiler and I did this later. 😅
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] viirya commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060152535
##########
arrow-select/src/take.rs:
##########
@@ -592,7 +592,10 @@ where
let s = array.value(index);
- length_so_far += T::Offset::from_usize(s.as_ref().len()).unwrap();
+ length_so_far += T::Offset::from_usize(
+ <<T as ByteArrayType>::Native as AsRef<[u8]>>::as_ref(s).len(),
+ )
+ .unwrap();
values.extend_from_slice(s.as_ref());
Review Comment:
Oh Oh right. I followed the suggestion from the compiler here but I also did this later. 😅
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3426: Generic bytes dictionary builder
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3426:
URL: https://github.com/apache/arrow-rs/pull/3426#discussion_r1060150478
##########
arrow-select/src/take.rs:
##########
@@ -609,7 +612,7 @@ where
})?;
if array.is_valid(index) {
- let s = array.value(index).as_ref();
+ let s: &[u8] = array.value(index).as_ref();
Review Comment:
Does this technically mean this is an API change? That's kind of unintentional, but not necessarily a problem :sweat_smile:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org