-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Simplify percentile_cont for 0/1 percentiles #18837
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
Conversation
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add some tests in sqllogictest https://github.com/apache/datafusion/tree/main/datafusion/sqllogictest
It should run some SQL queries that this optimization is applicable, and we first ensure the result is expected, and also do a EXPLAIN to ensure such optimization is applied.
In fact, we can move most of the test coverage to sqllogictests, instead of unit tests here. The reason is:
- SQL tests are simpler to maintain
- The SQL interface is more stable, while internal APIs may change frequently. As a result, good test coverage here can easily get lost during refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the unit tests along with the new sql test in the sqllogictest. Should I remove the unit tests or is it okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove the unit tests if they duplicate the sqllogictests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove the unit tests if they duplicate the sqllogictests
+1 unless there are something can't be covered by slt tests
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
Jefffrey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up. Have a few suggestions to simplify the code
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove the unit tests if they duplicate the sqllogictests
|
Thanks @kumarUjjawal |
Which issue does this PR close?
percentile_contto min/max when percentile is 0 or 1 #18108Rationale for this change
Literal 0/1 percentiles don’t need percentile buffering; using min/max keeps results identical.
What changes are included in this PR?
Are these changes tested?
Added tests
Are there any user-facing changes?