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

minor: add unit tests for monotonicity.rs #14307

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

buraksenn
Copy link
Contributor

Which issue does this PR close?

Closes #10595

Rationale for this change

These methods are pretty straight forward but they did not have any unit tests. Thus, this PR adds required tests.

What changes are included in this PR?

  • unit tests

Are these changes tested?

  • only change is addition of tests

Are there any user-facing changes?

No

@buraksenn
Copy link
Contributor Author

buraksenn commented Jan 26, 2025

The tests pass on my local env but fail in CI not sure why. I'll try to find the root cause and fix it in a few hours

It seems this my local environment was not printing stack trace for error cases and CI does so error matches did not work. I've pushed the fix I expect it to pass now

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks like an improvement to me -- thank you @buraksenn

upper: f64,
input_sort: SortProperties,
expected: Option<SortProperties>,
expect_err: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have the expected error be a string rather than a bool

Something like

Suggested change
expect_err: bool,
expect_err: Option<&'static str>,

That way we can ensure the errors aren't changing unexpectedly

Copy link
Contributor Author

@buraksenn buraksenn Jan 27, 2025

Choose a reason for hiding this comment

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

It was like that before but due to some issues in CI and local difference, I took a shortcut there but probably should not have done that. Let me properly fix it. Thanks for the review

Copy link
Contributor Author

@buraksenn buraksenn Jan 27, 2025

Choose a reason for hiding this comment

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

Oh, I got it now. I needed to strip_backtrace() before comparing errors. I think I've fixed it now

@buraksenn buraksenn force-pushed the add-unit-tests-to-monotonicity branch from a94b02e to 23edd68 Compare January 27, 2025 22:44
Copy link
Contributor

@berkaysynnada berkaysynnada left a comment

Choose a reason for hiding this comment

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

Thanks @buraksenn, LGTM

"Test '{}' failed: got {:?}, expected {:?}",
tcase.name, a, e
),
(Err(e1), Err(e2)) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice 💯

@berkaysynnada berkaysynnada merged commit e3db359 into apache:main Jan 28, 2025
25 checks passed
@berkaysynnada berkaysynnada deleted the add-unit-tests-to-monotonicity branch January 28, 2025 08:24
descending: false,
nulls_first: false,
}),
expected: exec_err!("Input range of LN contains out-of-domain values"),
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand Test Coverage for ScalarUDF's
3 participants