Skip to content

Commit

Permalink
fix data field parsing; use advanceExact()
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <[email protected]>
  • Loading branch information
sandeshkr419 committed Jan 29, 2025
1 parent 1420e07 commit 89310be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
this.hardBounds = hardBounds;
// TODO: Stop using null here
this.valuesSource = valuesSourceConfig.hasValues() ? (ValuesSource.Numeric) valuesSourceConfig.getValuesSource() : null;
this.fieldName = valuesSourceConfig.hasValues()
? ((ValuesSource.Numeric.FieldData) valuesSourceConfig.getValuesSource()).getIndexFieldName()
this.fieldName = (valuesSource instanceof ValuesSource.Numeric.FieldData)
? ((ValuesSource.Numeric.FieldData) valuesSource).getIndexFieldName()
: null;
this.formatter = valuesSourceConfig.format();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@

import static java.util.Collections.emptyList;
import static org.opensearch.search.aggregations.InternalOrder.isKeyOrder;
import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;

/**
* Aggregate all docs that contain numeric terms
Expand Down Expand Up @@ -210,7 +209,7 @@ public void setSubCollectors() throws IOException {

@Override
public void collectStarTreeEntry(int starTreeEntry, long owningBucketOrd) throws IOException {
if (valuesIterator.advance(starTreeEntry) == NO_MORE_DOCS) {
if (valuesIterator.advanceExact(starTreeEntry) == false) {
return;

Check warning on line 213 in server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/aggregations/bucket/terms/NumericTermsAggregator.java#L213

Added line #L213 was not covered by tests
}
long dimensionValue = valuesIterator.nextValue();
Expand Down

0 comments on commit 89310be

Please sign in to comment.