capistrant commented on code in PR #19597:
URL: https://github.com/apache/druid/pull/19597#discussion_r3436399842
##########
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 think rejecting ALL with demand to use some other granularity makes more
sense than going through effort to try and support it in granularity virtual
column (if that is even possible).
--
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]