Skip to content

Conversation

@vinaykpud
Copy link
Contributor

  1. Made changes in the partial_agg_optimizer.rs, to take the function name instead of just name, bcz it can be alias depending on the Physical plan. So e.fun().name() will get the correct name
  2. Changes in CompositeAggregator.java to handle when we have sourceConfig.fieldType is script filedType
  3. Changes in CardinalityAggregator.java to recognize names like dc(UserID)[hll_registers]
  4. Changes in SearchEngineResultConversionUtils.java to handle aggregator of type CardinalityAggregator

Description

[Describe what this change achieves]

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

❌ Gradle check result for e2e7b4e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

docCount = ((InternalValueCount) subAgg).getValue();
}
if (aggregator instanceof CardinalityAggregator) {
docCount = ((InternalCardinality) subAgg).getValue();
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems incorrect. Cardinality is an approximation and can't replace doc count.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I havent dived deep on this much, just did whats needed to fix the error for the query.

this was added for queries like this were failing ie where we group by some string

query="source=hits | where MobilePhoneModel != '' | stats dc(UserID) as u by MobilePhoneModel | sort - u | head 10"

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it we should figure out why agg_for_doc_count column is not coming in the response from datafusion instead of replacing with distinct count of a different column.

This can also cause issues with merging results at Coordinator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is group by for distinct count, in this case we are not adding agg_for_doc_count column in the calcite plan

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

❌ Gradle check result for a51bd10: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@Override
public InternalAggregation convertRow(Map<String, Object[]> shardResult, int row, SearchContext searchContext) {
Object[] hlls = shardResult.get(name);
Object[] hlls = shardResult.get(name + "[hll_registers]");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you try queries with Alias on distinct cardinality and filtering on the alias ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this also required without your SQL changes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this was required after my SQL changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dint we already cover this type of queries in Integ test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants