-
Notifications
You must be signed in to change notification settings - Fork 177
Support using decimal as span literals #4717
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Yuanchun Shen <[email protected]>
| } | ||
|
|
||
| @Test | ||
| public void testBinWithDecimalSpan() throws IOException { |
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.
is span(@timestamp, 0.5d) supported with this PR? please add an IT for that
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.
Please note that the following items are not in scope as they were not supported:
- decimal + time unit. E.g. | timechart span=0.95d
- decimal for span used in stats. E.g. | stats span(value, 9.5)
What exception will be thrown in above PPLs, please add IT or UT for them.
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.
-
Added a unit test for the error in the first use case
-
Restore support to the second case:
- decimal for span used in stats. E.g. | stats span(value, 9.5)
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
| assertThrows( | ||
| SyntaxCheckException.class, | ||
| () -> plan("source=t | stats count by span(@timestamp, 2.5y)")); | ||
| assertTrue(t2.getMessage().contains("[y] is not a valid term at this part of the query")); |
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.
"[y] is not a valid term" is a confusing error message since user can use span(@timestamp, 1y)
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.
Fixed. The error message becomes Span length [2.5y] is invalid: floating-point time intervals are not supported.
Signed-off-by: Yuanchun Shen <[email protected]>
Description
This PR restores support for decimal in span literals for bin commad.
E.g. It makes the following queries possible
source=events_null | bin cpu_usage span=7.5 | stats count() by cpu_usage| stats span(value, 9.5)Please note that the following items are not in scope as they were not supported:
| timechart span=0.95dRelated Issues
Resolves #4631
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.