-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Star Tree] [Search] Resolving Date histogram with metric aggregation using star-tree #16674
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 all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6f433eb
data histogram temp changes
6dc0b06
Avoid extending LeafCollectors
sandeshkr419 3752f0b
Revert "Avoid extending LeafCollectors"
sandeshkr419 19ed898
Introduce interefaces for nested aggregations
sandeshkr419 e02aa00
fix sub precompute class assingment
sandeshkr419 50c2090
Removed dimension field hard-coding
sandeshkr419 1d919b1
fix date comparison
sandeshkr419 a2dac71
adding tests
sandeshkr419 89ac458
fix star tree filter
sandeshkr419 8a13839
adding date histogram tests
sandeshkr419 0a49353
refactoring and documentation
sandeshkr419 d01d49f
add support for min, max, value_count aggregator
sandeshkr419 ae25233
add support for avg aggregation
sandeshkr419 fc1a9ae
fix avg aggregator and spotless
sandeshkr419 5424e92
fix max, min agregator
sandeshkr419 9308de4
add tests for date histogram with all metric aggregators
sandeshkr419 4393bd8
add request parsing tests
sandeshkr419 16806ba
removed dead code, support for term query within date histograms, inc…
sandeshkr419 d4218b8
test coverage + support for multiple metric aggregations within date …
sandeshkr419 a819dfe
add test case +changelog
sandeshkr419 92415c4
change simple sum to kahan summation in sum, avg aggregator
sandeshkr419 c54f86d
fix forbidden api error and rebase
sandeshkr419 61644ca
fix query parsing
sandeshkr419 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
75 changes: 75 additions & 0 deletions
75
server/src/main/java/org/opensearch/search/aggregations/StarTreeBucketCollector.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,75 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.aggregations; | ||
|
||
import org.apache.lucene.util.FixedBitSet; | ||
import org.opensearch.common.annotation.ExperimentalApi; | ||
import org.opensearch.index.compositeindex.datacube.startree.index.StarTreeValues; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Collector for star tree aggregation | ||
* This abstract class exposes utilities to help avoid traversing star-tree multiple times and | ||
* collect relevant metrics across nested aggregations in a single traversal | ||
* @opensearch.internal | ||
*/ | ||
@ExperimentalApi | ||
public abstract class StarTreeBucketCollector { | ||
|
||
protected final StarTreeValues starTreeValues; | ||
protected final FixedBitSet matchingDocsBitSet; | ||
protected final List<StarTreeBucketCollector> subCollectors = new ArrayList<>(); | ||
|
||
public StarTreeBucketCollector(StarTreeValues starTreeValues, FixedBitSet matchingDocsBitSet) throws IOException { | ||
this.starTreeValues = starTreeValues; | ||
this.matchingDocsBitSet = matchingDocsBitSet; | ||
this.setSubCollectors(); | ||
} | ||
|
||
public StarTreeBucketCollector(StarTreeBucketCollector parent) throws IOException { | ||
this.starTreeValues = parent.getStarTreeValues(); | ||
this.matchingDocsBitSet = parent.getMatchingDocsBitSet(); | ||
this.setSubCollectors(); | ||
} | ||
|
||
/** | ||
* Sets the sub-collectors to track nested aggregators | ||
*/ | ||
public void setSubCollectors() throws IOException {}; | ||
|
||
/** | ||
* Returns a list of sub-collectors to track nested aggregators | ||
*/ | ||
public List<StarTreeBucketCollector> getSubCollectors() { | ||
return subCollectors; | ||
} | ||
|
||
/** | ||
* Returns the tree values to iterate | ||
*/ | ||
public StarTreeValues getStarTreeValues() { | ||
return starTreeValues; | ||
} | ||
|
||
/** | ||
* Returns the matching docs bitset to iterate upon the star-tree values based on search query | ||
*/ | ||
public FixedBitSet getMatchingDocsBitSet() { | ||
return matchingDocsBitSet; | ||
} | ||
|
||
/** | ||
* Collects the star tree entry and bucket ordinal to update | ||
* The method implementation should identify the metrics to collect from that star-tree entry to the specified bucket | ||
*/ | ||
public abstract void collectStarTreeEntry(int starTreeEntry, long bucket) throws IOException; | ||
} |
32 changes: 32 additions & 0 deletions
32
server/src/main/java/org/opensearch/search/aggregations/StarTreePreComputeCollector.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,32 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.aggregations; | ||
|
||
import org.apache.lucene.index.LeafReaderContext; | ||
import org.opensearch.index.codec.composite.CompositeIndexFieldInfo; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This interface is used to pre-compute the star tree bucket collector for each segment/leaf. | ||
* It is utilized by parent aggregation to retrieve a StarTreeBucketCollector which can be used to | ||
* pre-compute the associated aggregation along with its parent pre-computation using star-tree | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public interface StarTreePreComputeCollector { | ||
/** | ||
* Get the star tree bucket collector for the specified segment/leaf | ||
*/ | ||
StarTreeBucketCollector getStarTreeBucketCollector( | ||
LeafReaderContext ctx, | ||
CompositeIndexFieldInfo starTree, | ||
StarTreeBucketCollector parentCollector | ||
) throws IOException; | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.