Skip to content

[UUID 5/8] UUID aggregation, group-by and distinct - #18873

Open
xiangfu0 wants to merge 3 commits into
apache:masterfrom
xiangfu0:uuid-split/05-agg-groupby-distinct
Open

[UUID 5/8] UUID aggregation, group-by and distinct#18873
xiangfu0 wants to merge 3 commits into
apache:masterfrom
xiangfu0:uuid-split/05-agg-groupby-distinct

Conversation

@xiangfu0

@xiangfu0 xiangfu0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Parent tracking issue: #16619

What

UUID-aware aggregation and grouping.

Changes

  • DISTINCTCOUNT, DISTINCTCOUNTHLL/HLLPLUS/THETASKETCH/CPCSKETCH/ULL/BITMAP, IntegerTupleSketch, ANY_VALUE
  • no-dictionary single/multi-column group-key generators, UuidToIdMap, BytesDistinctTable, NonScanBasedAggregationOperator

Enables

GROUP BY uuidCol, DISTINCT uuidCol, DISTINCTCOUNT*(uuidCol).

Depends on

#18869 and #18871 (ColumnDataType.UUID).

About this PR / how to review

This is part 5 of 8 splitting #18140 (first-class logical UUID type) into layered PRs, as requested there.

The split is enabled by the v1 design: DataType.UUID has stored type BYTES, so most paths handle it automatically; each PR adds explicit UUID semantics to one subsystem. Head branch lives on xiangfu0/pinot.

This PR is stacked on #18872 (branch uuid-split/04-sse-predicates-cast). Because GitHub PRs to apache must base on master, the Files-changed tab is cumulative (it includes layers 1–5) until the PRs below it merge. Review the commit titled [UUID 5/8] UUID aggregation, group-by and distinct — that is this layer's change. Each parent merge shrinks this diff after a rebase.

Full stack (merge bottom → top)

  1. [UUID 1/8] Add logical UUID type foundation (pinot-spi) #18869 — [UUID 1/8] logical UUID type foundation (pinot-spi)
  2. [UUID 2/8] UUID ingest and segment storage #18870 — [UUID 2/8] UUID ingest and segment storage
  3. [UUID 3/8] UUID result rendering (DataSchema, Arrow/JSON encoders) #18871 — [UUID 3/8] UUID result rendering (DataSchema, Arrow/JSON encoders)
  4. [UUID 4/8] Server-side predicate evaluation for the logical UUID type #18872 — [UUID 4/8] UUID server-side predicates, CAST and transforms
  5. [UUID 5/8] UUID aggregation, group-by and distinct #18873 — [UUID 5/8] UUID aggregation, group-by and distinct
  6. [UUID 6/8] UUID multi-stage engine (planner + runtime) #18874 — [UUID 6/8] UUID multi-stage engine (planner + runtime)
  7. [UUID 7/8] UUID partitioning #18875 — [UUID 7/8] UUID scalar UDFs and partitioning
  8. [UUID 8/8] UUID integration tests, benchmarks and docs #18876 — [UUID 8/8] UUID integration tests, benchmarks and docs

After #18869 lands, PRs 2/4/7 (#18870, #18872, #18875) only depend on it and can be reviewed in parallel; PRs 5/6 (#18873, #18874) also need #18871; PR 8 (#18876) needs #18874.

Full feature description, v1 design contract, scope exclusions, and benchmark numbers: #18140.

@codecov-commenter

codecov-commenter commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 329 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.85%. Comparing base (e51b4e4) to head (2645a89).

Files with missing lines Patch % Lines
...pby/NoDictionarySingleColumnGroupKeyGenerator.java 0.00% 50 Missing ⚠️
...aggregation/function/AggregationFunctionUtils.java 0.00% 30 Missing ⚠️
...upby/NoDictionaryMultiColumnGroupKeyGenerator.java 0.00% 30 Missing ⚠️
.../function/DistinctCountULLAggregationFunction.java 0.00% 26 Missing ⚠️
...nction/DistinctCountBitmapAggregationFunction.java 0.00% 25 Missing ⚠️
...ion/DistinctCountCPCSketchAggregationFunction.java 0.00% 24 Missing ⚠️
.../function/DistinctCountHLLAggregationFunction.java 0.00% 24 Missing ⚠️
...ction/DistinctCountHLLPlusAggregationFunction.java 0.00% 24 Missing ⚠️
...n/DistinctCountThetaSketchAggregationFunction.java 0.00% 24 Missing ⚠️
...e/query/aggregation/groupby/utils/UuidToIdMap.java 0.00% 14 Missing ⚠️
... and 12 more

❗ There is a different number of reports uploaded between BASE (e51b4e4) and HEAD (2645a89). Click for more details.

HEAD has 16 uploads less than BASE
Flag BASE (e51b4e4) HEAD (2645a89)
unittests1 1 0
unittests 2 1
java-25 5 1
temurin 5 1
integration 3 0
integration1 1 0
integration2 1 0
custom-integration1 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #18873       +/-   ##
=============================================
- Coverage     66.65%   38.85%   -27.80%     
+ Complexity     1423     1416        -7     
=============================================
  Files          3443     3444        +1     
  Lines        218632   218904      +272     
  Branches      34793    34872       +79     
=============================================
- Hits         145726    85061    -60665     
- Misses        61192   126085    +64893     
+ Partials      11714     7758     -3956     
Flag Coverage Δ
custom-integration1 ?
integration ?
integration1 ?
integration2 ?
java-25 38.85% <0.00%> (-27.80%) ⬇️
temurin 38.85% <0.00%> (-27.80%) ⬇️
unittests 38.85% <0.00%> (-27.80%) ⬇️
unittests1 ?
unittests2 38.85% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch 7 times, most recently from b5e8bc6 to 64cb941 Compare July 7, 2026 07:08
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch 11 times, most recently from ab8f6a0 to adf9c85 Compare July 14, 2026 08:03
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch 10 times, most recently from 47f5a6d to 6e5e246 Compare July 21, 2026 08:10
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch 3 times, most recently from 5dbed17 to 474fae5 Compare July 27, 2026 00:20
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch from 474fae5 to ac891db Compare July 28, 2026 08:02
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch 6 times, most recently from 3db5958 to 364e42a Compare August 7, 2026 09:28
xiangfu0 and others added 3 commits August 7, 2026 22:00
Adds UUID handling to the predicate evaluators, so =, !=, IN, NOT IN and range
predicates work against a UUID column on both the raw and the dictionary path.

UUID follows the pattern TIMESTAMP already uses: a logical type whose stored
type does the work. The literal is parsed to its 16-byte stored form once, when
the evaluator is built, and from there the existing BYTES evaluators apply --
no per-value conversion in the scan loop.

The dictionary path needs no UUID branch: Dictionary#getStoredValue returns hex
for a UUID column and indexOf(String) hex-decodes, so the existing String-keyed
lookup is already correct. PredicateUtils renders the literal to that hex form
for those String-typed lookup APIs.

Split into apache#19181 (CAST), apache#19182 (bloom filter pruning) and apache#19183 (transform
functions); this PR is now just the predicate evaluators.
The UUID branch accepted several input forms via UuidUtils.toBytes(Object),
which was inconsistent with every other branch -- they each cast to one type.

The input is in fact deterministic. GroupByDataTableReducer runs every column
through ColumnDataType#convert immediately before calling isMatch, and convert
returns UuidUtils.toUUID(...) for UUID, so the value is always a
java.util.UUID. The other reduce path cannot deliver a UUID here at all:
getConvertedKey has no UUID case and throws for it.

Adds testHavingFilterOnUuidColumn, which pins the contract -- this line was
previously untested in either direction. Verified it reaches the UUID branch
rather than passing vacuously.
Part 5/8 of splitting apache#18140 (logical UUID type). Rebased onto latest master; stacked on uuid-split/04-sse-predicates-cast.

Downstream references use the UuidKey class merged in apache#18869.
@xiangfu0
xiangfu0 force-pushed the uuid-split/05-agg-groupby-distinct branch from 364e42a to 2645a89 Compare August 8, 2026 09:36
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.

2 participants