Skip to content

Commit

Permalink
add some log
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Jun 6, 2024
1 parent 268e1cd commit 3d3b447
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

package org.opensearch.search.aggregations.metrics;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.index.SortedSetDocValues;
Expand Down Expand Up @@ -81,6 +83,8 @@
*/
public class CardinalityAggregator extends NumericMetricsAggregator.SingleValue {

private static final Logger logger = LogManager.getLogger(CardinalityAggregator.class);

private final int precision;
private final ValuesSource valuesSource;

Expand Down Expand Up @@ -279,6 +283,7 @@ public void close() {
@Override
public void collect(int doc, long owningBucketOrd) throws IOException {
delegate.collect(doc, owningBucketOrd);
logger.debug("collect doc {}", doc);

DisiWrapper top = queue.top();
int curTopDoc = top.doc;
Expand All @@ -288,6 +293,8 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
top = queue.updateTop();
} while (queue.size() > 1 && top.doc == curTopDoc);
}

logger.debug("after pruning top doc {}", top.doc);
// after pruning, queue top doc will exceed current doc
// but in the scoring process, we have a contract that every iteration or nextDoc
// iterator: 0 - 1 - 2 - 3 - ...
Expand Down

0 comments on commit 3d3b447

Please sign in to comment.