Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated comparison kernels #4739

Closed
wants to merge 4 commits into from
Closed

Conversation

zinking
Copy link

@zinking zinking commented Aug 25, 2023

Which issue does this PR close?

Closes #4733 Remove Deprecated Comparison Kernels

Rationale for this change

What changes are included in this PR?

this is the first part of the change, which updates all tests of the old kernel tests

Are there any user-facing changes?

NO

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 25, 2023
@zinking zinking marked this pull request as ready for review August 29, 2023 08:50
@zinking
Copy link
Author

zinking commented Aug 29, 2023

@tustvold like you suggested, this PR updates all tests in place for the convenience of review. take a look when you have time.

@zinking zinking changed the title remove deprecated comparison kernels Remove deprecated comparison kernels Aug 29, 2023
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines -1708 to +1813
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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -2643,122 +2646,103 @@ mod tests {
);
}

fn test_primitive_dyn_scalar<T: ArrowPrimitiveType>(array: PrimitiveArray<T>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this, I wonder if we need to add new macros, or if the non-macro-ized code might be clearer and easier to follow?

@zinking
Copy link
Author

zinking commented Aug 30, 2023

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.

@tustvold tustvold marked this pull request as draft September 5, 2023 15:03
@tustvold
Copy link
Contributor

tustvold commented Sep 5, 2023

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

@zinking zinking closed this Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Deprecated Comparison Kernels
2 participants