cecemei commented on code in PR #18403:
URL: https://github.com/apache/druid/pull/18403#discussion_r2335541138
##########
processing/src/main/java/org/apache/druid/data/input/impl/AggregateProjectionSpec.java:
##########
@@ -230,12 +234,40 @@ private static ProjectionOrdering
computeOrdering(VirtualColumns virtualColumns,
} else {
final VirtualColumn vc =
virtualColumns.getVirtualColumn(dimension.getName());
final Granularity maybeGranularity =
Granularities.fromVirtualColumn(vc);
- if (granularity == null && maybeGranularity != null) {
- granularity = maybeGranularity;
- timeColumnName = dimension.getName();
- } else if (granularity != null && maybeGranularity != null &&
maybeGranularity.isFinerThan(granularity)) {
- granularity = maybeGranularity;
- timeColumnName = dimension.getName();
+ if (maybeGranularity == null ||
maybeGranularity.equals(Granularities.ALL)) {
+ // no __time in inputs or not supported, skip
+ continue;
+ }
+ if (granularity == null) {
+ if (maybeGranularity.getClass().equals(PeriodGranularity.class)
+ && maybeGranularity.getTimeZone().equals(DateTimeZone.UTC)
+ && ((PeriodGranularity) maybeGranularity).getOrigin() == null) {
+ granularity = maybeGranularity;
+ timeColumnName = dimension.getName();
+ continue;
+ } else {
+ // we don't allow:
+ // 1. virtual column on __time if there's no grouping on __time
+ // 2. non-UTC or non-epoch origin period granularity
+ throw InvalidInput.exception(
+ "cannot use granularity[%s] on column[%s] as projection time
column",
+ maybeGranularity,
+ dimension.getName()
+ );
Review Comment:
actually realized non-UTC vc would just be treated as regular grouping
column, for `PT2H` and `PT3H`, it'd just choose the finer one `PT2H`.
--
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]