-
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
Decode max and min optimization more carefully #52336
Conversation
Fixes the the no-query optimization for `min` and `max` aggregations for `date_nanos` fields by delegating decoding dates "through" their `resolution` member. Closes elastic#52220
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
@@ -98,7 +98,7 @@ public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, | |||
if (pointConverter != null) { | |||
Number segMax = findLeafMaxValue(ctx.reader(), pointField, pointConverter); | |||
if (segMax != null) { | |||
/** |
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.
This was a javadoc comment in an invalid spot for javadoc.
@@ -799,21 +815,6 @@ public void testMinShortcutRandom() throws Exception { | |||
(v) -> DoublePoint.decodeDimension(v, 0)); | |||
} | |||
|
|||
private void testMinCase(IndexSearcher searcher, |
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.
This isn't used any more.
@@ -889,12 +890,17 @@ private Aggregator mockAggregator() { | |||
return config; | |||
} | |||
|
|||
private ValuesSourceConfig<ValuesSource.Numeric> mockDateValuesSourceConfig(String fieldName, boolean indexed) { | |||
private ValuesSourceConfig<ValuesSource.Numeric> mockDateValuesSourceConfig(String fieldName, boolean indexed, |
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.
There is a ton more ceremony here because resolution
is only set when you call build
. Bleh.
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
assertNull( | ||
MinAggregator.getPointReaderOrNull( | ||
mockSearchContext(new MatchAllDocsQuery()), | ||
mockAggregator(), | ||
mockDateValuesSourceConfig("number", true) | ||
mockDateValuesSourceConfig("number", true, randomFrom(DateFieldMapper.Resolution.values())) |
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'm a little uncomfortable using a randomization for coverage here. I'd rather loop over the possible resolution values like we loop over the possible numeric types above.
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.
Sure!
Thanks @not-napoleon ! |
Fixes the the no-query optimization for `min` and `max` aggregations for `date_nanos` fields by delegating decoding dates "through" their `resolution` member. Closes elastic#52220
Fixes the the no-query optimization for `min` and `max` aggregations for `date_nanos` fields by delegating decoding dates "through" their `resolution` member. Closes elastic#52220
Fixes the the no-query optimization for
min
andmax
aggregationsfor
date_nanos
fields by delegating decoding dates "through" theirresolution
member.Closes #52220