forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sandesh Kumar <[email protected]>
- Loading branch information
1 parent
deb0e0a
commit ca12366
Showing
13 changed files
with
220 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
45 changes: 45 additions & 0 deletions
45
...c/main/java/org/opensearch/search/aggregations/startree/OriginalOrStarTreeAggregator.java
This file contains 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,45 @@ | ||
/* | ||
* 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.startree; | ||
|
||
import org.apache.lucene.index.LeafReaderContext; | ||
import org.opensearch.search.aggregations.Aggregator; | ||
import org.opensearch.search.aggregations.AggregatorFactories; | ||
import org.opensearch.search.aggregations.CardinalityUpperBound; | ||
import org.opensearch.search.aggregations.InternalAggregation; | ||
import org.opensearch.search.aggregations.LeafBucketCollector; | ||
import org.opensearch.search.aggregations.bucket.BucketsAggregator; | ||
import org.opensearch.search.aggregations.bucket.SingleBucketAggregator; | ||
import org.opensearch.search.internal.SearchContext; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
public class OriginalOrStarTreeAggregator extends BucketsAggregator implements SingleBucketAggregator { | ||
|
||
|
||
public OriginalOrStarTreeAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, CardinalityUpperBound bucketCardinality, Map<String, Object> metadata) throws IOException { | ||
super(name, factories, context, parent, bucketCardinality, metadata); | ||
} | ||
|
||
@Override | ||
protected LeafBucketCollector getLeafCollector(LeafReaderContext ctx, LeafBucketCollector sub) throws IOException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException { | ||
return new InternalAggregation[0]; | ||
} | ||
|
||
@Override | ||
public InternalAggregation buildEmptyAggregation() { | ||
return null; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...java/org/opensearch/search/aggregations/startree/OriginalOrStarTreeAggregatorFactory.java
This file contains 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,49 @@ | ||
/* | ||
* 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.startree; | ||
|
||
import org.opensearch.index.query.QueryShardContext; | ||
import org.opensearch.search.aggregations.Aggregator; | ||
import org.opensearch.search.aggregations.AggregatorFactories; | ||
import org.opensearch.search.aggregations.AggregatorFactory; | ||
import org.opensearch.search.aggregations.CardinalityUpperBound; | ||
import org.opensearch.search.aggregations.bucket.terms.TermsAggregator; | ||
import org.opensearch.search.aggregations.bucket.terms.TermsAggregatorFactory; | ||
import org.opensearch.search.internal.SearchContext; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class OriginalOrStarTreeAggregatorFactory extends AggregatorFactory { | ||
|
||
List<StarTreeAggregatorFactory> starTreeAggregatorFactories; | ||
TermsAggregatorFactory originalAggregatorFactory; | ||
|
||
public OriginalOrStarTreeAggregatorFactory( | ||
String aggregationName, | ||
QueryShardContext queryShardContext, | ||
AggregatorFactory parent, | ||
AggregatorFactories.Builder subFactoriesBuilder, | ||
Map<String, Object> metadata, | ||
List<StarTreeAggregatorFactory> starTreeAggregatorFactories, | ||
TermsAggregatorFactory originalAggregatorFactory | ||
) throws IOException { | ||
super(aggregationName, queryShardContext, parent, subFactoriesBuilder, metadata); | ||
this.starTreeAggregatorFactories = starTreeAggregatorFactories; | ||
this.originalAggregatorFactory = originalAggregatorFactory; | ||
} | ||
|
||
@Override | ||
protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, CardinalityUpperBound cardinality, Map<String, Object> metadata) throws IOException { | ||
TermsAggregator originalAggregator = (TermsAggregator) this.originalAggregatorFactory.createInternal(searchContext, parent, cardinality, metadata); | ||
this.starTreeAggregatorFactories.get(0).setOriginalAggregator(originalAggregator); | ||
return this.starTreeAggregatorFactories.get(0).createInternal(searchContext, parent, cardinality, metadata); | ||
} | ||
} |
This file contains 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 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 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.