clintropolis commented on code in PR #19597:
URL: https://github.com/apache/druid/pull/19597#discussion_r3438071406
##########
processing/src/main/java/org/apache/druid/data/input/impl/ClusteredValueGroupsBaseTableProjectionSpec.java:
##########
@@ -170,6 +172,73 @@ public DimensionsSpec getDimensionsSpec()
return dimensionsSpec;
}
+ /**
+ * Returns a copy of this spec with a new {@code queryGranularity},
expressed as a
+ * {@link Granularities#GRANULARITY_VIRTUAL_COLUMN_NAME} virtual column
added to {@link #getVirtualColumns()}. A
+ * {@code null}, {@code NONE}, or {@code ALL} granularity is a no-op, so
this returns {@code this} unchanged.
+ * <p>
+ * Idempotent: if the spec already declares a query-granularity virtual
column, that one is authoritative and this is
+ * a no-op. (The compaction path attaches the virtual column up front; the
MSQ generation path then calls this again
+ * with the query-derived granularity, which must not double-add.)
+ */
+ @Override
+ public ClusteredValueGroupsBaseTableProjectionSpec
withQueryGranularity(@Nullable Granularity queryGranularity)
+ {
+ if (queryGranularity == null
+ || Granularities.NONE.equals(queryGranularity)
+ || Granularities.ALL.equals(queryGranularity)
Review Comment:
i'll change this to reject all for now. with projections we support all
granularity on a projection by leaving out a time column, i considered the same
thing for clustered segments but haven't wired it up yet.
--
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]