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

Return an error when a rate aggregation cannot calculate bucket sizes #65429

Merged

Conversation

imotov
Copy link
Contributor

@imotov imotov commented Nov 24, 2020

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

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
@imotov imotov requested a review from not-napoleon November 24, 2020 16:24
@imotov imotov marked this pull request as ready for review November 24, 2020 16:24
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 24, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@imotov imotov removed the WIP label Nov 24, 2020
@imotov imotov requested a review from nik9000 November 24, 2020 16:25
@@ -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) {
Copy link
Member

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) {
Copy link
Member

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.

@imotov imotov requested a review from nik9000 November 25, 2020 02:52
Copy link
Member

@nik9000 nik9000 left a 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!

@imotov imotov removed the request for review from not-napoleon November 25, 2020 14:43
@imotov imotov merged commit a065b6d into elastic:master Nov 25, 2020
imotov added a commit that referenced this pull request Nov 25, 2020
…#65429) (#65502)

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
@imotov imotov deleted the issue-63703-check-rate-interval-compatibility branch November 25, 2020 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rate aggregation doesn't always use the right bucket size
4 participants