Skip to content

Introduce DocValuesStatsCollectorManager#15653

Open
gaobinlong wants to merge 2 commits intoapache:mainfrom
gaobinlong:DocValuesStatsCollectorManager
Open

Introduce DocValuesStatsCollectorManager#15653
gaobinlong wants to merge 2 commits intoapache:mainfrom
gaobinlong:DocValuesStatsCollectorManager

Conversation

@gaobinlong
Copy link
Copy Markdown
Contributor

Description

This pr introduces DocValuesStatsCollectorManager and switches TestDocValuesStatsCollector.java to use search concurrency and move away from the deprecated search(Query, Collector) method.

Relates to #12892.

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@github-actions github-actions Bot added this to the 11.0.0 milestone Feb 2, 2026
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Feb 17, 2026
Copy link
Copy Markdown
Contributor

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments and questions, thanks for working on this!

@SuppressWarnings("unchecked")
public S reduce(Collection<DocValuesStatsCollector> collectors) throws IOException {
if (collectors.isEmpty()) {
return null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a potential bug that could cause problems down the line? Could we instead return empty stats? Is it even necessary to have this special case? You could instead just remove this conditional?

@SuppressWarnings({"unchecked", "rawtypes"})
int compareMin(Object a, Object b) {
if (a instanceof Number numA && b instanceof Number numB) {
return Double.compare(numA.doubleValue(), numB.doubleValue());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this could lead to precision loss? is the special number case necessary?

if (a instanceof Number numA && b instanceof Number numB) {
return Double.compare(numA.doubleValue(), numB.doubleValue());
}
return ((Comparable) a).compareTo(b);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as compareMin ?

@@ -55,16 +56,21 @@ public class TestDocValuesStatsCollector extends LuceneTestCase {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also update testDocsWithSortedValues and testDocsWithSortedSetValues?


/**
* A {@link CollectorManager} implementation for {@link DocValuesStatsCollector}.
*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we expand javadocs to include a usage example for users?

@Override
void merge(DocValuesStats<?> other) {
super.merge(other);
if (other instanceof SortedLongDocValuesStats o) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this type of conditional necessary? Does it ever happen that we get a different type than SortedLongDocValuesStats here? This applies to all merge methods.

@github-actions github-actions Bot removed the Stale label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants