-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Return an error when a rate aggregation cannot calculate bucket sizes #65429
Return an error when a rate aggregation cannot calculate bucket sizes #65429
Conversation
In some cases when the rate aggregation is not a child of a date histogram aggregation, it is not possible to determine the actual size of the date histogram bucket. In this case the rate aggregation now throws an exception. Closes elastic#63703
Pinging @elastic/es-analytics-geo (Team:Analytics) |
@@ -609,16 +609,22 @@ public String toString() { | |||
|
|||
private abstract class TimeUnitPreparedRounding extends PreparedRounding { | |||
@Override | |||
public double roundingSize(long utcMillis, DateTimeUnit timeUnit) { | |||
public double roundingSize(Long utcMillis, DateTimeUnit timeUnit) { | |||
if (timeUnit.isMillisBased == unit.isMillisBased) { |
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.
Any chance you could group this so unit.isMillisBased
is called once? I think it might be a bit easier to read if you juggle the "arms" of the if
statement.
@@ -609,16 +609,22 @@ public String toString() { | |||
|
|||
private abstract class TimeUnitPreparedRounding extends PreparedRounding { | |||
@Override | |||
public double roundingSize(long utcMillis, DateTimeUnit timeUnit) { | |||
public double roundingSize(Long utcMillis, DateTimeUnit timeUnit) { |
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 wonder if it'd be easier to read if there were two methods? I'd kind of feel more comfortable having two just so you don't need auto-boxing. It might not make a huge difference, but in general Rounding
doesn't its best not to allocate stuff. I think this method doesn't have to be so efficient, but still.
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.
LGTM. Thanks for iterating!
In some cases when the rate aggregation is not a child of a date histogram
aggregation, it is not possible to determine the actual size of the date
histogram bucket. In this case the rate aggregation now throws an exception.
Closes #63703