feat: allow clustered segments to create projection grouped by a vc derived clustered column - #19752
Conversation
… clustered column
FrankChen021
left a comment
There was a problem hiding this comment.
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 1 |
| P2 | 0 |
| P3 | 0 |
| Total | 1 |
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 1 |
| P2 | 0 |
| P3 | 0 |
| Total | 1 |
The derived clustering value now reaches projection grouping keys, but projection filters and aggregators still read the raw input row.
Reviewed 4 of 4 changed files.
This is an automated review by Codex GPT-5.6-Sol
| // reused by the clustered addToFacts below so the clustering derivation happens exactly once. | ||
| final Object[] clusteringValues = clusteredBaseTable == null | ||
| ? null | ||
| : clusteredBaseTable.prepareClusteringValues( |
There was a problem hiding this comment.
[P1] Expose derived values to projection filters and aggregators
The derived clustering value is only encoded into key.dims, so it fixes grouping but remains invisible to the projection's filter and aggregator selectors, which read the raw InputRow through the projection's own virtual-column factory. For example, a filtered projection that groups on derived region and filters region = us-east-1 is accepted, but the matcher sees the absent top-level field as null and drops every matching row; an aggregator reading a derived numeric clustering column likewise receives null. This can produce incomplete projection results. Please make these selectors consume the derived value too, or reject such projection specifications.
Description
Eagerly derive clustered columns during indexing and if the spec has projections materialize the clustered columns for each row so if a projection being built groups on a VC derived clustering column, the grouping value is available to the indexer. Before this change, if you tried to do ingestion with a vc derived clustering column that was then used for a grouping column in a projection, the projection would register null for all rows for that grouping column because it wasn't available at build time.
Release note
N/A. part of larger Druid 39 release note on clustered segment improvements
Key changed/added classes in this PR
OnHeapClusteredBaseTableOnHeapIncrementalIndexThis PR has: