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

[GitHub] [arrow-rs] zinking opened a new pull request, #4739: remove deprecated comparison kernels

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

   # 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 #4733 [Remove Deprecated Comparison Kernels](https://github.com/apache/arrow-rs/issues/4733#top)
   
   # 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] zinking closed pull request #4739: Remove deprecated comparison kernels

Posted by "zinking (via GitHub)" <gi...@apache.org>.
zinking closed pull request #4739: Remove deprecated comparison kernels
URL: https://github.com/apache/arrow-rs/pull/4739


-- 
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 #4739: Remove deprecated comparison kernels

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

   Marking this as a draft to make clear it isn't awaiting review, feel free to unmark when you would like me to take another look


-- 
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] zinking commented on pull request #4739: Remove deprecated comparison kernels

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

   I'm okay with removing macros as long as codes are not duplicated everywhere.
   
   I did try to come up with generics to make a corresponding scalar in `test_primitive_dyn_scalar` didn't manage to do it.


-- 
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 #4739: Remove deprecated comparison kernels

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


##########
arrow-ord/src/comparison.rs:
##########
@@ -2643,122 +2646,103 @@ mod tests {
         );
     }
 
-    fn test_primitive_dyn_scalar<T: ArrowPrimitiveType>(array: PrimitiveArray<T>) {

Review Comment:
   I much prefer generics to macros, they are easier to read, debug and maintain...



##########
arrow-ord/src/comparison.rs:
##########
@@ -1641,403 +1789,242 @@ mod tests {
 
     #[test]
     fn test_primitive_array_neq() {
-        cmp_i64!(
-            neq,
-            neq_dyn,
-            vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
-
-        cmp_vec!(
-            neq,
-            neq_dyn,
-            TimestampMillisecondArray,
-            vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
+        test_array_array_op!(crate::cmp::neq, "neq", Int64Array);
+        test_array_array_op!(crate::cmp::neq, "neq", TimestampMillisecondArray);
     }
 
     #[test]
     fn test_primitive_array_neq_scalar() {
-        cmp_i64_scalar!(
-            neq_scalar,
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            8,
-            vec![true, true, false, true, true, true, true, false, true, true]
-        );
+        test_array_scalar_op!(crate::cmp::neq, "neq", Int64Array);
     }
 
     #[test]
     fn test_boolean_array_eq() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = eq_bool(&a, &b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(true), Some(false), Some(true), Some(false), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::eq, "eq")
     }
 
     #[test]
     fn test_boolean_array_neq() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = neq_bool(&a, &b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(false), Some(true), Some(false), Some(true), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::neq, "neq")
     }
 
     #[test]
     fn test_boolean_array_lt() {
-        let a: BooleanArray =
-            vec![Some(true), Some(false), Some(false), Some(true), Some(true), None]
-                .into();
-        let b: BooleanArray =
-            vec![Some(true), Some(true), Some(false), Some(false), None, Some(false)]
-                .into();
-
-        let res: Vec<Option<bool>> = lt_bool(&a, &b).unwrap().iter().collect();
-
-        assert_eq!(
-            res,
-            vec![Some(false), Some(true), Some(false), Some(false), None, None]
-        )
+        test_boolean_array_array_op!(crate::cmp::lt, "lt")

Review Comment:
   I think it would be much easier to follow this if it simply was something like
   
   
   
   ```
   let a = BooleanArray::from(vec![...]);
   let b = BooleanArray::from(vec![...]);
   let expected = BooleanArray::from(vec![...]);
   assert_eq(lt(&a, &b).unwrap(), expected);
   ```



-- 
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 #4739: Remove deprecated comparison kernels

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


##########
arrow-ord/src/comparison.rs:
##########
@@ -1548,79 +1547,228 @@ mod tests {
         };
     }
 
-    #[test]
-    fn test_primitive_array_eq() {
-        cmp_i64!(
-            eq,
-            eq_dyn,
-            vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
-            vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
-            vec![false, false, true, false, false, false, false, true, false, false]
-        );
+    macro_rules! test_array_scalar_op {

Review Comment:
   I know there were test macros before, but perhaps we could take the opportunity to remove them. I find it really hard to follow what these tests are doing now...



-- 
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] zinking commented on pull request #4739: remove deprecated comparison kernels

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

   @tustvold like you suggested, this PR updates all tests in place for the convenience of review. take a look when you have 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