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/06/13 01:41:44 UTC

[GitHub] [arrow-rs] HaoYang670 opened a new pull request, #1853: Clean up the test code of `substring` kernel.

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

   Signed-off-by: remzi <13...@gmail.com>
   
   # Which issue does this PR close?
   
   Closes #1801.
   
   # Rationale for this change
   Avoid repeated code.
   More readable.
   Less code is better.
   
   # What changes are included in this PR?
   Use macros.
   Better format.
   
   # Are there any user-facing changes?
   
   No.
   


-- 
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 #1853: Clean up the test code of `substring` kernel.

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


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -445,64 +445,61 @@ mod tests {
     use super::*;
     use crate::datatypes::*;
 
-    #[allow(clippy::type_complexity)]
+    macro_rules! gen_test_cases {
+        ($input:expr, $(($start:expr, $len:expr, $result:expr)), *) => {
+            [
+                $(
+                    ($input.clone(), $start, $len, $result),
+                )*
+            ]
+        };
+    }
+
+    macro_rules! do_test {

Review Comment:
   I think some docstrings explaining what was going on here (specifically what the expectations on `$cases) are would have helped me understand this code



##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -445,64 +445,61 @@ mod tests {
     use super::*;
     use crate::datatypes::*;
 
-    #[allow(clippy::type_complexity)]
+    macro_rules! gen_test_cases {
+        ($input:expr, $(($start:expr, $len:expr, $result:expr)), *) => {
+            [
+                $(
+                    ($input.clone(), $start, $len, $result),
+                )*
+            ]
+        };
+    }
+
+    macro_rules! do_test {
+        ($cases:expr, $array_ty:ty, $substring_fn:ident) => {
+            $cases.into_iter().try_for_each::<_, Result<()>>(

Review Comment:
   I wonder why bother with `try_for_each` and not just use `unwrap()` or `expect()`



-- 
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] codecov-commenter commented on pull request #1853: Clean up the test code of `substring` kernel.

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

   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1853?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 [#1853](https://codecov.io/gh/apache/arrow-rs/pull/1853?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (68ce0bc) into [master](https://codecov.io/gh/apache/arrow-rs/commit/c08e5324d11a8a2b9998d0d625876815f4954968?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c08e532) will **decrease** coverage by `0.04%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1853      +/-   ##
   ==========================================
   - Coverage   83.49%   83.45%   -0.05%     
   ==========================================
     Files         201      201              
     Lines       56903    56745     -158     
   ==========================================
   - Hits        47511    47354     -157     
   + Misses       9392     9391       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1853?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/substring.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9zdWJzdHJpbmcucnM=) | `99.37% <100.00%> (-0.16%)` | :arrow_down: |
   | [arrow/src/buffer/ops.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-YXJyb3cvc3JjL2J1ZmZlci9vcHMucnM=) | `96.77% <0.00%> (ø)` | |
   | [parquet/src/arrow/mod.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvbW9kLnJz) | `44.44% <0.00%> (ø)` | |
   | [parquet\_derive/src/parquet\_field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldF9kZXJpdmUvc3JjL3BhcnF1ZXRfZmllbGQucnM=) | `65.75% <0.00%> (ø)` | |
   | [parquet/src/arrow/array\_reader.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvYXJyYXlfcmVhZGVyLnJz) | | |
   | [...arquet/src/arrow/array\_reader/dictionary\_buffer.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvYXJyYXlfcmVhZGVyL2RpY3Rpb25hcnlfYnVmZmVyLnJz) | | |
   | [parquet/src/arrow/converter.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvY29udmVydGVyLnJz) | | |
   | [parquet/src/arrow/record\_reader.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvcmVjb3JkX3JlYWRlci5ycw==) | | |
   | [parquet/src/arrow/array\_reader/offset\_buffer.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvYXJyYXlfcmVhZGVyL29mZnNldF9idWZmZXIucnM=) | | |
   | [parquet/src/arrow/levels.rs](https://codecov.io/gh/apache/arrow-rs/pull/1853/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-cGFycXVldC9zcmMvYXJyb3cvbGV2ZWxzLnJz) | | |
   | ... and [11 more](https://codecov.io/gh/apache/arrow-rs/pull/1853/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1853?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/1853?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 [c08e532...68ce0bc](https://codecov.io/gh/apache/arrow-rs/pull/1853?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.

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 pull request #1853: Clean up the test code of `substring` kernel.

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

   Sorry for the delay, I'll try to get to this later today if nobody else does, I'm currently on holiday and reviewing large PRs like this on a phone is challenging 😅


-- 
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 #1853: Clean up the test code of `substring` kernel.

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


-- 
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 pull request #1853: Clean up the test code of `substring` kernel.

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

   Blocked by #1852


-- 
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 pull request #1853: Clean up the test code of `substring` kernel.

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

   Never mind. Have a good holiday! 🏝


-- 
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 #1853: Clean up the test code of `substring` kernel.

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


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -445,64 +445,61 @@ mod tests {
     use super::*;
     use crate::datatypes::*;
 
-    #[allow(clippy::type_complexity)]
+    macro_rules! gen_test_cases {
+        ($input:expr, $(($start:expr, $len:expr, $result:expr)), *) => {
+            [
+                $(
+                    ($input.clone(), $start, $len, $result),
+                )*
+            ]
+        };
+    }
+
+    macro_rules! do_test {
+        ($cases:expr, $array_ty:ty, $substring_fn:ident) => {
+            $cases.into_iter().try_for_each::<_, Result<()>>(

Review Comment:
   Great catch! Updated.



-- 
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 #1853: Clean up the test code of `substring` kernel.

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


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -445,64 +445,61 @@ mod tests {
     use super::*;
     use crate::datatypes::*;
 
-    #[allow(clippy::type_complexity)]
+    macro_rules! gen_test_cases {
+        ($input:expr, $(($start:expr, $len:expr, $result:expr)), *) => {
+            [
+                $(
+                    ($input.clone(), $start, $len, $result),
+                )*
+            ]
+        };
+    }
+
+    macro_rules! do_test {

Review Comment:
   Updated!



-- 
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 #1853: Clean up the test code of `substring` kernel.

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


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -445,6 +445,16 @@ mod tests {
     use super::*;
     use crate::datatypes::*;
 
+    /// A helper macro to generate test cases.

Review Comment:
   ❤️ 



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