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 2021/06/23 05:27:52 UTC

[GitHub] [arrow-rs] Jimexist opened a new pull request #492: concatenating single element array shortcut

Jimexist opened a new pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492


   # Which issue does this PR close?
   
   concatenating single element array shortcut
   
   Closes #.
   
   # Rationale for this change
   
   no need to any work when the given array is single element
   
   # 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] Jimexist commented on a change in pull request #492: concatenating single element array shortcut

Posted by GitBox <gi...@apache.org>.
Jimexist commented on a change in pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492#discussion_r656836314



##########
File path: arrow/src/compute/kernels/concat.rs
##########
@@ -57,6 +57,9 @@ pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
         return Err(ArrowError::ComputeError(
             "concat requires input of at least one array".to_string(),
         ));
+    } else if arrays.len() == 1 {
+        let array = arrays[0];
+        return Ok(array.slice(0, array.len()));

Review comment:
       sadly `Array` isn't cloneable




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] Jimexist commented on a change in pull request #492: concatenating single element array shortcut

Posted by GitBox <gi...@apache.org>.
Jimexist commented on a change in pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492#discussion_r656836767



##########
File path: arrow/src/compute/kernels/concat.rs
##########
@@ -57,6 +57,9 @@ pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
         return Err(ArrowError::ComputeError(
             "concat requires input of at least one array".to_string(),
         ));
+    } else if arrays.len() == 1 {
+        let array = arrays[0];
+        return Ok(array.slice(0, array.len()));

Review comment:
       if the param were passing in as `ArrayRef` then it's possible but it's just pure ref.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] codecov-commenter commented on pull request #492: concatenating single element array shortcut

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492#issuecomment-866546109


   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#492](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (dad8d16) into [master](https://codecov.io/gh/apache/arrow-rs/commit/4c7d4189e72901a78fb4f4250c11421241dd9e13?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4c7d418) will **increase** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/arrow-rs/pull/492/graphs/tree.svg?width=650&height=150&src=pr&token=pq9V9qWZ1N&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master     #492   +/-   ##
   =======================================
     Coverage   82.65%   82.65%           
   =======================================
     Files         165      165           
     Lines       45524    45536   +12     
   =======================================
   + Hits        37628    37640   +12     
     Misses       7896     7896           
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [arrow/src/compute/kernels/concat.rs](https://codecov.io/gh/apache/arrow-rs/pull/492/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9jb25jYXQucnM=) | `100.00% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4c7d418...dad8d16](https://codecov.io/gh/apache/arrow-rs/pull/492?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] Dandandan commented on a change in pull request #492: concatenating single element array shortcut

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492#discussion_r656789000



##########
File path: arrow/src/compute/kernels/concat.rs
##########
@@ -57,6 +57,9 @@ pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
         return Err(ArrowError::ComputeError(
             "concat requires input of at least one array".to_string(),
         ));
+    } else if arrays.len() == 1 {
+        let array = arrays[0];
+        return Ok(array.slice(0, array.len()));

Review comment:
       You might be able to do something like `Ok(Array.clone())` instead?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] jorgecarleitao commented on a change in pull request #492: concatenating single element array shortcut

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #492:
URL: https://github.com/apache/arrow-rs/pull/492#discussion_r656842481



##########
File path: arrow/src/compute/kernels/concat.rs
##########
@@ -57,6 +57,9 @@ pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
         return Err(ArrowError::ComputeError(
             "concat requires input of at least one array".to_string(),
         ));
+    } else if arrays.len() == 1 {
+        let array = arrays[0];
+        return Ok(array.slice(0, array.len()));

Review comment:
       fwiw, this is because if it was clonable, it could not be a trait object. `.slice(0, array.len())` is fine imo.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-rs] alamb merged pull request #492: concatenating single element array shortcut

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


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org