You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "cecemei (via GitHub)" <gi...@apache.org> on 2025/08/04 16:05:09 UTC

Re: [PR] add support for filtered projections (druid)

cecemei commented on code in PR #18342:
URL: https://github.com/apache/druid/pull/18342#discussion_r2250434651


##########
processing/src/main/java/org/apache/druid/data/input/impl/AggregateProjectionSpec.java:
##########
@@ -146,6 +163,7 @@ public boolean equals(Object o)
     }
     AggregateProjectionSpec that = (AggregateProjectionSpec) o;
     return Objects.equals(name, that.name)
+           && Objects.equals(filter, that.filter)

Review Comment:
   Is it intentional `timeColumnName` is not included in equals/ hashCode/ toString method, but `ordering` is? Both are derived so seems like not needed.



##########
processing/src/main/java/org/apache/druid/segment/AggregateProjectionMetadata.java:
##########
@@ -219,7 +233,7 @@ public Schema(
       }
       this.timeColumnName = timeColumnName;
       this.timeColumnPosition = foundTimePosition;
-      this.granularity = granularity == null ? Granularities.ALL : granularity;
+      this.effectiveGranularity = granularity == null ? Granularities.ALL : granularity;

Review Comment:
   i think we're expecting the same size/ ordering bwteen groupingColumns and OrderBy between line 223 and 224, this assumption is guaranteed from `ProjectionsSpec` but not obvious here, maybe worth adding some checks. 



##########
processing/src/main/java/org/apache/druid/segment/AggregateProjectionMetadata.java:
##########
@@ -219,7 +233,7 @@ public Schema(
       }
       this.timeColumnName = timeColumnName;
       this.timeColumnPosition = foundTimePosition;
-      this.granularity = granularity == null ? Granularities.ALL : granularity;
+      this.effectiveGranularity = granularity == null ? Granularities.ALL : granularity;

Review Comment:
   also it seems like this `effectiveGranularity` and `orderingWithTimeSubstitution` logic is very similar to the `computeOrdering` function, maybe it could be merged?



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org