-
Notifications
You must be signed in to change notification settings - Fork 25.3k
ValuesSourceRegistry Prototype #48758
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
not-napoleon
merged 16 commits into
elastic:feature/extensible-values-source
from
not-napoleon:refactor/aggregator-factories
Nov 25, 2019
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
765a631
Prototype for registry to aggregator factory interaction
not-napoleon 606ea55
Prototype what registering an aggregator looks like, more or less
not-napoleon 3f7aea2
Pass aggregation name to resolve
not-napoleon c4df79f
Future-proof access to registry instance
not-napoleon 268cb9e
Prototype for selecting values source type from the registry
not-napoleon 9c5805e
Merge branch 'feature/extensible-values-source' into refactor/aggrega…
not-napoleon 6f90369
Added a bunch of notes for future me
not-napoleon dccd0aa
Javadoc for register method
not-napoleon 7bb9754
intermediate state cleanup for resolve
not-napoleon 59b0c42
test numeric histogram over dates.
not-napoleon abae55c
Merge branch 'feature/extensible-values-source' into refactor/aggrega…
not-napoleon d2c8fa9
Fix seemantic merge conflict
not-napoleon 67422c0
Merge branch 'feature/extensible-values-source' into refactor/aggrega…
not-napoleon f5a412d
no idea how this broke, but easy fix
not-napoleon 8f90085
Fix failing test
not-napoleon 2fec741
fix checkstyle
not-napoleon 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
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
22 changes: 22 additions & 0 deletions
22
server/src/main/java/org/elasticsearch/search/aggregations/support/AggregatorSupplier.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,22 @@ | ||
/* | ||
* 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.support; | ||
|
||
public interface AggregatorSupplier { | ||
} |
39 changes: 39 additions & 0 deletions
39
.../main/java/org/elasticsearch/search/aggregations/support/HistogramAggregatorSupplier.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,39 @@ | ||
/* | ||
* 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.support; | ||
|
||
import org.elasticsearch.common.Nullable; | ||
import org.elasticsearch.search.DocValueFormat; | ||
import org.elasticsearch.search.aggregations.Aggregator; | ||
import org.elasticsearch.search.aggregations.AggregatorFactories; | ||
import org.elasticsearch.search.aggregations.BucketOrder; | ||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; | ||
import org.elasticsearch.search.internal.SearchContext; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public interface HistogramAggregatorSupplier extends AggregatorSupplier { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each aggregation family will define one of these which wraps the constructor signature for the aggregators that go with that family. |
||
Aggregator build(String name, AggregatorFactories factories, double interval, double offset, | ||
BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound, | ||
@Nullable ValuesSource valuesSource, DocValueFormat formatter, | ||
SearchContext context, Aggregator parent, | ||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException; | ||
} |
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.
I don't love having a no-op interface here, but it gives us a bit of type safety over just passing in any old object. The problem here is that each aggregation family has a unique signature for how it constructs aggregators, so we can't have a common interface that means something. This gives us a type that all those aggregation specific suppliers can inherit from, and we can be reasonably sure that it's a safe cast, since we trust that people aren't cross-registering aggregators. And, if there were a cross-registered aggregator, it wouldn't work anyway, so failing if we detect a bad cast is ok too.
That said, this feels really clunky and I'm open to better options. I spent a lot of time thinking about this problem, and this was the best solution I came up with.