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 2022/08/05 03:01:55 UTC

[GitHub] [arrow-rs] HaoYang670 opened a new pull request, #2327: Add more const evaluation for list array

HaoYang670 opened a new pull request, #2327:
URL: https://github.com/apache/arrow-rs/pull/2327

   Signed-off-by: remzi <13...@gmail.com>
   
   # 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 #2311 .
   
   # 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.
   -->
   More constant evaluation is better.
   Less repeated code is better.
   
   # What changes are included in this PR?
   1. Add data type constructor for list array
   2. Add const field `PREFIX` for OffsetSizeTrait
   
   # Are there any user-facing changes?
   No.
   
   <!--
   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] alamb commented on a diff in pull request #2327: Add more const evaluation for list array: `PREFIX` and data type constructor

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2327:
URL: https://github.com/apache/arrow-rs/pull/2327#discussion_r938724839


##########
arrow/src/compute/util.rs:
##########
@@ -351,9 +351,7 @@ pub(super) mod tests {
         T: ArrowPrimitiveType,
         PrimitiveArray<T>: From<Vec<Option<T::Native>>>,
     {
-        use std::any::TypeId;
-
-        let mut offset = vec![0];
+        let mut offset = vec![S::zero()];

Review Comment:
   👍 



##########
arrow/src/array/array_list.rs:
##########
@@ -57,6 +60,16 @@ pub struct GenericListArray<OffsetSize> {
 }
 
 impl<OffsetSize: OffsetSizeTrait> GenericListArray<OffsetSize> {
+    /// The data type constructor of list array.
+    /// The input is the schema of the child array and
+    /// the output is the [`DataType`], List or LargeList.
+    pub const DATA_TYPE_CONSTRUCTOR: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE

Review Comment:
   ```suggestion
       pub const MAKE_DATA_TYPE: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE
   ```
   
   `DATA_TYPE_CONSTRUCTOR` was somewhat hard on my eyes when reading this PR. That being said while I might prefer something like `MAKE_DATA_TYPE` it is only an opinion for your consideration



-- 
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 #2327: Add more const evaluation for `GenericBinaryArray` and `GenericListArray`: add `PREFIX` and data type constructor

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2327:
URL: https://github.com/apache/arrow-rs/pull/2327#issuecomment-1206792932

   Benchmark runs are scheduled for baseline = 3ed0e280d5ee049614b6a6fd19ddad3b8bd117ad and contender = b1e2bd945e8423ab2854179b0ef9cf8d89596027. b1e2bd945e8423ab2854179b0ef9cf8d89596027 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/c020ff7bcc02422cb539d3bc09283886...30ccddb89e43432dbd17f61c1c2bef18/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/a2161481b1c64066832182331810257a...cf4ceb930080485ca9a7713cc644217c/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/08065866a7c446d9b7516fa01c1f7062...f50b2536d13742f996b50ac94677ca78/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/a045aa6d168b4cbfa1803a07e4b09d71...a8d4a57a375b4e649af5cce70d377836/)
   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] alamb commented on pull request #2327: Add more const evaluation for `GenericBinaryArray` and `GenericListArray`: add `PREFIX` and data type constructor

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2327:
URL: https://github.com/apache/arrow-rs/pull/2327#issuecomment-1206785816

   I am going to take this one into Arrow 20 as it is also an API change -- I am hoping one of these releases we'll be able to do a minor one ;)


-- 
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] alamb merged pull request #2327: Add more const evaluation for `GenericBinaryArray` and `GenericListArray`: add `PREFIX` and data type constructor

Posted by GitBox <gi...@apache.org>.
alamb merged PR #2327:
URL: https://github.com/apache/arrow-rs/pull/2327


-- 
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] HaoYang670 commented on a diff in pull request #2327: Add more const evaluation for `GenericBinaryArray` and `GenericListArray`: add `PREFIX` and data type constructor

Posted by GitBox <gi...@apache.org>.
HaoYang670 commented on code in PR #2327:
URL: https://github.com/apache/arrow-rs/pull/2327#discussion_r938760056


##########
arrow/src/array/array_list.rs:
##########
@@ -57,6 +60,16 @@ pub struct GenericListArray<OffsetSize> {
 }
 
 impl<OffsetSize: OffsetSizeTrait> GenericListArray<OffsetSize> {
+    /// The data type constructor of list array.
+    /// The input is the schema of the child array and
+    /// the output is the [`DataType`], List or LargeList.
+    pub const DATA_TYPE_CONSTRUCTOR: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE

Review Comment:
   Thank you for your review @alamb. Personally, I prefer the name `CONSTRUCTOR`, as `ListArray` and `LargeListArray` constructor tags of `DataType`: https://en.wikipedia.org/wiki/Algebraic_data_type#:~:text=A%20general%20algebraic%20data%20type,factors%20of%20the%20product%20type.



-- 
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