You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Weijun-H (via GitHub)" <gi...@apache.org> on 2023/02/25 17:34:54 UTC

[GitHub] [arrow-rs] Weijun-H opened a new pull request, #3763: Implement concat_elements_dyn kernel

Weijun-H opened a new pull request, #3763:
URL: https://github.com/apache/arrow-rs/pull/3763

   # 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 #1755
   
   # 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.
   -->
   Explained in #1755
   
   # 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 merged pull request #3763: Implement concat_elements_dyn kernel

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763


-- 
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 #3763: Implement concat_elements_dyn kernel

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#discussion_r1118709665


##########
arrow-string/src/concat_elements.rs:
##########
@@ -156,10 +158,35 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
     Ok(unsafe { builder.build_unchecked() }.into())
 }
 
+pub fn concat_elements_dyn(
+    left: &dyn Array,
+    right: &dyn Array,
+) -> Result<ArrayRef, ArrowError> {
+    if left.data_type() != right.data_type() {
+        return Err(ArrowError::ComputeError(format!(
+            "Cannot concat arrays of different types: {} != {}",
+            left.data_type(),
+            right.data_type()
+        )));
+    }
+    match (left.data_type(), right.data_type()) {

Review Comment:
   Perhaps we could also handle when the arrays are both `LargeUtf8`? Otherwise this is not all that different from the normal kernel?



-- 
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] Weijun-H commented on a diff in pull request #3763: Implement concat_elements_dyn kernel

Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on code in PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#discussion_r1119800287


##########
arrow-string/src/concat_elements.rs:
##########
@@ -156,10 +158,35 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
     Ok(unsafe { builder.build_unchecked() }.into())
 }
 
+pub fn concat_elements_dyn(
+    left: &dyn Array,
+    right: &dyn Array,
+) -> Result<ArrayRef, ArrowError> {
+    if left.data_type() != right.data_type() {
+        return Err(ArrowError::ComputeError(format!(
+            "Cannot concat arrays of different types: {} != {}",
+            left.data_type(),
+            right.data_type()
+        )));
+    }
+    match (left.data_type(), right.data_type()) {

Review Comment:
   Certainly, you are correct. I plan to address LargeUtf8 at a later time.



-- 
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 #3763: Implement concat_elements_dyn kernel

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#discussion_r1124307991


##########
arrow-string/src/concat_elements.rs:
##########
@@ -156,6 +158,93 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
     Ok(unsafe { builder.build_unchecked() }.into())
 }
 
+pub fn concat_element_binary<Offset: OffsetSizeTrait>(
+    left: &GenericBinaryArray<Offset>,
+    right: &GenericBinaryArray<Offset>,
+) -> Result<GenericBinaryArray<Offset>, ArrowError> {
+    if left.len() != right.len() {

Review Comment:
   I think this logic can be combined into a `concat_element_bytes` I'll see what I can come up with in a follow on PR



-- 
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 #3763: Implement concat_elements_dyn kernel

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#discussion_r1123415261


##########
arrow-string/src/concat_elements.rs:
##########
@@ -156,10 +158,35 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
     Ok(unsafe { builder.build_unchecked() }.into())
 }
 
+pub fn concat_elements_dyn(
+    left: &dyn Array,
+    right: &dyn Array,
+) -> Result<ArrayRef, ArrowError> {
+    if left.data_type() != right.data_type() {
+        return Err(ArrowError::ComputeError(format!(
+            "Cannot concat arrays of different types: {} != {}",
+            left.data_type(),
+            right.data_type()
+        )));
+    }
+    match (left.data_type(), right.data_type()) {
+        (DataType::Utf8, DataType::Utf8) => {
+            let left = left.as_any().downcast_ref::<StringArray>().unwrap();
+            let right = right.as_any().downcast_ref::<StringArray>().unwrap();
+            Ok(Arc::new(concat_elements_utf8(left, right).unwrap()))
+        }

Review Comment:
   ```suggestion
           }
           (DataType::LargeUtf8, DataType::LargeUtf8) => {
               let left = left.as_any().downcast_ref::<LargeStringArray>().unwrap();
               let right = right.as_any().downcast_ref::<LargeStringArray>().unwrap();
               Ok(Arc::new(concat_elements_utf8(left, right).unwrap()))
           }
   ```



-- 
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 #3763: Implement concat_elements_dyn kernel

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#issuecomment-1453356362

   Benchmark runs are scheduled for baseline = 661bbad8f817613c9bd5cab8616dcfaa37858865 and contender = f8abb047519e2be6044882ef4469ffcd8b6e7c56. f8abb047519e2be6044882ef4469ffcd8b6e7c56 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/2d2c330789b641d182230b5be1da9458...f129e2d705514c9c9b608df618ddf336/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/4cf3e475247a4d8db5d1cddda5751f1c...b81bc0e3a788489394744a69a4687bf7/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/fe5ac7e879294f46886b05291c62fd01...1f38bfdd33a74542877a35329d02aae3/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/ecb13bfaa7e940eba88aa03adf599d36...168d2e0688dc4f13929044a7e643150a/)
   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] Weijun-H commented on a diff in pull request #3763: Implement concat_elements_dyn kernel

Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on code in PR #3763:
URL: https://github.com/apache/arrow-rs/pull/3763#discussion_r1120941333


##########
arrow-string/src/concat_elements.rs:
##########
@@ -156,10 +158,35 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
     Ok(unsafe { builder.build_unchecked() }.into())
 }
 
+pub fn concat_elements_dyn(
+    left: &dyn Array,
+    right: &dyn Array,
+) -> Result<ArrayRef, ArrowError> {
+    if left.data_type() != right.data_type() {
+        return Err(ArrowError::ComputeError(format!(
+            "Cannot concat arrays of different types: {} != {}",
+            left.data_type(),
+            right.data_type()
+        )));
+    }
+    match (left.data_type(), right.data_type()) {

Review Comment:
   Do I need to write a separate concat function for `LargeUtf8` or is it unnecessary since `concat_elements_utf8` can already handle `LargeUtf8`?
   
   
   
   



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