-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Speed up date_histogram without children #63643
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
3eb94bc
Execute date_histo agg as date_range agg
nik9000 3f99f04
factor out collector
nik9000 6c8cb0b
ordered
nik9000 995ca24
refactor
nik9000 d7becd8
Fixup
nik9000 0a1987d
Better name
nik9000 1258ad4
Experiment
nik9000 da02047
Rework
nik9000 9157f00
Use query
nik9000 20047dc
Super hack
nik9000 e69628e
Shuffle
nik9000 607ae5f
Tests
nik9000 0e68cad
look
nik9000 9754fb0
no looking
nik9000 0750aa8
tests
nik9000 c57c98a
Handle unbounded ranges
nik9000 4021327
Test for max and min
nik9000 7a44c21
Merge branch 'master' into date_histo_as_range
nik9000 73aaa45
Fixup profiler
nik9000 b73df70
Rate agg
nik9000 b7e8dcc
WIP
nik9000 7c18141
Fixup weird formats
nik9000 2d04e35
Feh
nik9000 102e526
Shift
nik9000 e333cbb
Forbidden
nik9000 e2fd164
Moar tests
nik9000 46a1015
test
nik9000 deb5684
Fixup tests
nik9000 de96179
precommit
nik9000 4e9c918
Merge branch 'master' into date_histo_as_range
nik9000 f13a8ae
Drop old extra test
nik9000 6b33247
TODO
nik9000 14b4962
Merge branch 'master' into date_histo_as_range
nik9000 2fd7e53
Don't attempt the optimization if rounding would break it
nik9000 97c35cd
move building
nik9000 6c7eaa1
Computers are hard
nik9000 5b5ac7b
Merge branch 'master' into date_histo_as_range
nik9000 117eb77
Moar javadoc
nik9000 08fee6c
Merge branch 'master' into date_histo_as_range
nik9000 ce640e3
Test cases we can't do it
nik9000 523d420
Fix broken test
nik9000 f1ae980
Zap
nik9000 9da87c5
Words
nik9000 3d3ea19
Coment
nik9000 4291b70
Add fancy query
nik9000 ff41cdb
NOCOMMIT
nik9000 a5f0009
Merge branch 'master' into date_histo_as_range
nik9000 ec5bf41
tests
nik9000 6b5c09a
missing tests
nik9000 9c26fd8
remove!
nik9000 c5b0464
Merge branch 'master' into date_histo_as_range
nik9000 66684f2
I think this is more normal
nik9000 b1c79b2
Merge branch 'master' into date_histo_as_range
nik9000 997e9b9
Feedback
nik9000 9494447
Merge branch 'master' into date_histo_as_range
nik9000 bfb10bd
Merge branch 'master' into date_histo_as_range
nik9000 1e1b1dd
ConstantScoreWeight
nik9000 ca09463
Merge branch 'master' into date_histo_as_range
nik9000 5b5d6cc
Iter
nik9000 fc1444d
Merge branch 'master' into date_histo_as_range
nik9000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
server/src/main/java/org/elasticsearch/search/aggregations/AdaptingAggregator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* | ||
| * Licensed to Elasticsearch under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.elasticsearch.search.aggregations; | ||
|
|
||
| import org.apache.lucene.index.LeafReaderContext; | ||
| import org.apache.lucene.search.ScoreMode; | ||
| import org.elasticsearch.search.internal.SearchContext; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * An {@linkplain Aggregator} that delegates collection to another | ||
| * {@linkplain Aggregator} and then translates its results into the results | ||
| * you'd expect from another aggregation. | ||
| */ | ||
| public abstract class AdaptingAggregator extends Aggregator { | ||
| private final Aggregator delegate; | ||
|
|
||
| public AdaptingAggregator(Aggregator delegate) { | ||
| this.delegate = delegate; | ||
| } | ||
|
|
||
| /** | ||
| * Adapt the result from the collecting {@linkplain Aggregator} into the | ||
| * result expected by this {@linkplain Aggregator}. | ||
| */ | ||
| protected abstract InternalAggregation adapt(InternalAggregation delegateResult); | ||
|
|
||
| @Override | ||
| public final void close() { | ||
| delegate.close(); | ||
| } | ||
|
|
||
| @Override | ||
| public final ScoreMode scoreMode() { | ||
| return delegate.scoreMode(); | ||
| } | ||
|
|
||
| @Override | ||
| public final String name() { | ||
| return delegate.name(); | ||
| } | ||
|
|
||
| @Override | ||
| public final SearchContext context() { | ||
| return delegate.context(); | ||
| } | ||
|
|
||
| @Override | ||
| public final Aggregator parent() { | ||
| return delegate.parent(); | ||
| } | ||
|
|
||
| @Override | ||
| public final Aggregator subAggregator(String name) { | ||
| return delegate.subAggregator(name); | ||
| } | ||
|
|
||
| @Override | ||
| public final LeafBucketCollector getLeafCollector(LeafReaderContext ctx) throws IOException { | ||
| return delegate.getLeafCollector(ctx); | ||
| } | ||
|
|
||
| @Override | ||
| public final void preCollection() throws IOException { | ||
| delegate.preCollection(); | ||
| } | ||
|
|
||
| @Override | ||
| public final void postCollection() throws IOException { | ||
| delegate.postCollection(); | ||
| } | ||
|
|
||
| @Override | ||
| public final InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException { | ||
| InternalAggregation[] delegateResults = delegate.buildAggregations(owningBucketOrds); | ||
| InternalAggregation[] result = new InternalAggregation[owningBucketOrds.length]; | ||
| for (int ordIdx = 0; ordIdx < owningBucketOrds.length; ordIdx++) { | ||
| result[ordIdx] = adapt(delegateResults[ordIdx]); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public final InternalAggregation buildEmptyAggregation() { | ||
| return adapt(delegate.buildEmptyAggregation()); | ||
| } | ||
|
|
||
| @Override | ||
| public final Aggregator[] subAggregators() { | ||
| return delegate.subAggregators(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
On my first read, I thought we might round down to
null. How about: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.
👍