FrankChen021 commented on code in PR #19752:
URL: https://github.com/apache/druid/pull/19752#discussion_r3652471975
##########
processing/src/main/java/org/apache/druid/segment/incremental/OnheapIncrementalIndex.java:
##########
@@ -282,6 +282,20 @@ protected AddToFactsResult addToFacts(
final List<String> parseExceptionMessages = new ArrayList<>();
final AtomicLong totalSizeInBytes = getBytesInMemory();
+ // In clustered mode, derive the clustering values once, up front, and
(when projections exist) materialize any
+ // derived clustering columns into key.dims before projections run so a
projection grouping on one reads the derived
+ // value rather than null (see
OnHeapClusteredBaseTable#materializeDerivedClusteringDims). The computed values
are
+ // reused by the clustered addToFacts below so the clustering derivation
happens exactly once.
+ final Object[] clusteringValues = clusteredBaseTable == null
+ ? null
+ : clusteredBaseTable.prepareClusteringValues(
Review 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]