cecemei commented on code in PR #18403:
URL: https://github.com/apache/druid/pull/18403#discussion_r2335306902
##########
processing/src/main/java/org/apache/druid/segment/projections/Projections.java:
##########
@@ -375,13 +379,21 @@ public static ProjectionMatchBuilder
matchQueryVirtualColumn(
// virtual column and underlying expression itself, but this will do for
now
final Granularity virtualGranularity =
Granularities.fromVirtualColumn(queryVirtualColumn);
if (virtualGranularity != null) {
- if
(virtualGranularity.isFinerThan(projection.getEffectiveGranularity())) {
- return null;
- }
// same granularity, replace virtual column directly by remapping it
to the physical column
if (projection.getEffectiveGranularity().equals(virtualGranularity)) {
return matchBuilder.remapColumn(queryVirtualColumn.getOutputName(),
ColumnHolder.TIME_COLUMN_NAME)
.addReferencedPhysicalColumn(ColumnHolder.TIME_COLUMN_NAME);
+ } else if (virtualGranularity.equals(Granularities.NONE)
+ ||
projection.getEffectiveGranularity().equals(Granularities.ALL)) {
+ return null;
Review Comment:
i should be more specific, previous this is using a simple isFinerThan
comparison, which is not safe, because `PT2H` is finer than `PT3H` but the
former can't be mapped to the latter. now we're switching to `canBeMappedTo`,
but it only applies to period gran, so adding this special handling for
`Granularities.NONE` and `Granularities.ALL`.
--
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]