Skip to content

[Bug](function) add ndv decimalv2 support - #61546

Merged
BiteTheDDDDt merged 1 commit into
apache:masterfrom
BiteTheDDDDt:fix_0320
Mar 20, 2026
Merged

[Bug](function) add ndv decimalv2 support#61546
BiteTheDDDDt merged 1 commit into
apache:masterfrom
BiteTheDDDDt:fix_0320

Conversation

@BiteTheDDDDt

@BiteTheDDDDtBiteTheDDDDt commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

This pull request focuses on improving support for the DECIMALV2 data type in aggregate functions and updating related regression tests to ensure correctness. The most important changes are grouped below:

Aggregate Function Support

  • Added TYPE_DECIMALV2 to the supported types for the approx_count_distinct aggregate function in aggregate_function_approx_count_distinct.cpp, enabling this function to work with DECIMALV2 columns.

Regression Test Enhancements

  • Updated the output in test_decimalv2.out to reflect higher precision for DECIMALV2 values, showing results with more decimal places to match the new behavior.
  • Added a new test case in test_decimalv2.groovy to verify the correct behavior of the ndv (number of distinct values) aggregate function on DECIMALV2 columns.

CopilotAI review requested due to automatic review settings March 20, 2026 04:09
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@BiteTheDDDDt

Copy link
Copy Markdown
ContributorAuthor

run buildall

CopilotAI left a comment

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.

Pull request overview

Adds backend support for ndv/approx_count_distinct over DECIMALV2 inputs and extends the Nereids regression suite to validate the behavior.

Changes:

  • Enable approx_count_distinct/ndv for TYPE_DECIMALV2 in BE aggregate function factory registration.
  • Add a Nereids regression query select ndv(c2) for a decimalv2 column and update the expected output accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
regression-test/suites/nereids_p0/datatype/test_decimalv2.groovyAdds a regression assertion for ndv(decimalv2) on a small dataset.
regression-test/data/nereids_p0/datatype/test_decimalv2.outUpdates golden output to include the new ndv result (and regenerated decimalv2 display formatting).
be/src/exprs/aggregate/aggregate_function_approx_count_distinct.cppRegisters TYPE_DECIMALV2 as an allowed argument type for approx_count_distinct/ndv.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage52.79% (19846/37594)
Line Coverage36.31% (185369/510562)
Region Coverage32.56% (143601/440973)
Branch Coverage33.74% (62820/186214)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.38% (26267/36797)
Line Coverage54.21% (275854/508852)
Region Coverage51.49% (229135/445024)
Branch Coverage52.89% (98751/186702)

@HappenLeeHappenLee left a comment

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.

LGTM

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Mar 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.67% (26373/36797)
Line Coverage54.52% (277441/508852)
Region Coverage51.88% (230898/445024)
Branch Coverage53.22% (99360/186702)

@BiteTheDDDDt
BiteTheDDDDt merged commit 42e9f65 into apache:masterMar 20, 2026
37 of 39 checks passed
github-actionsBot pushed a commit that referenced this pull request Mar 20, 2026
This pull request focuses on improving support for the `DECIMALV2` data
type in aggregate functions and updating related regression tests to
ensure correctness. The most important changes are grouped below:
### Aggregate Function Support
* Added `TYPE_DECIMALV2` to the supported types for the
`approx_count_distinct` aggregate function in
`aggregate_function_approx_count_distinct.cpp`, enabling this function
to work with `DECIMALV2` columns.
### Regression Test Enhancements
* Updated the output in `test_decimalv2.out` to reflect higher precision
for `DECIMALV2` values, showing results with more decimal places to
match the new behavior.
* Added a new test case in `test_decimalv2.groovy` to verify the correct
behavior of the `ndv` (number of distinct values) aggregate function on
`DECIMALV2` columns.
github-actionsBot pushed a commit that referenced this pull request Mar 20, 2026
This pull request focuses on improving support for the `DECIMALV2` data
type in aggregate functions and updating related regression tests to
ensure correctness. The most important changes are grouped below:
### Aggregate Function Support
* Added `TYPE_DECIMALV2` to the supported types for the
`approx_count_distinct` aggregate function in
`aggregate_function_approx_count_distinct.cpp`, enabling this function
to work with `DECIMALV2` columns.
### Regression Test Enhancements
* Updated the output in `test_decimalv2.out` to reflect higher precision
for `DECIMALV2` values, showing results with more decimal places to
match the new behavior.
* Added a new test case in `test_decimalv2.groovy` to verify the correct
behavior of the `ndv` (number of distinct values) aggregate function on
`DECIMALV2` columns.
yiguolei pushed a commit that referenced this pull request Mar 20, 2026
Cherry-picked from #61546
Co-authored-by: Pxl <xl@selectdb.com>
yiguolei pushed a commit that referenced this pull request Mar 21, 2026
Cherry-picked from #61546
Co-authored-by: Pxl <xl@selectdb.com>
@yiguoleiyiguolei mentioned this pull request Mar 27, 2026
HappenLee pushed a commit to HappenLee/incubator-doris that referenced this pull request Mar 31, 2026
This pull request focuses on improving support for the `DECIMALV2` data
type in aggregate functions and updating related regression tests to
ensure correctness. The most important changes are grouped below:
### Aggregate Function Support
* Added `TYPE_DECIMALV2` to the supported types for the
`approx_count_distinct` aggregate function in
`aggregate_function_approx_count_distinct.cpp`, enabling this function
to work with `DECIMALV2` columns.
### Regression Test Enhancements
* Updated the output in `test_decimalv2.out` to reflect higher precision
for `DECIMALV2` values, showing results with more decimal places to
match the new behavior.
* Added a new test case in `test_decimalv2.groovy` to verify the correct
behavior of the `ndv` (number of distinct values) aggregate function on
`DECIMALV2` columns.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.0.5-mergeddev/4.1.0-mergednot-merge/4.0reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@BiteTheDDDDt@hello-stephen@mrhhsg@HappenLee@yiguolei