kgyrtkirk commented on code in PR #16854:
URL: https://github.com/apache/druid/pull/16854#discussion_r1711017603


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java:
##########
@@ -105,8 +108,20 @@ public QueryDefinition makeQueryDefinition(
 
     final int firstStageNumber = Math.max(minStageNumber, 
queryDefBuilder.getNextStageNumber());
     final WindowOperatorQuery queryToRun = (WindowOperatorQuery) 
originalQuery.withDataSource(dataSourcePlan.getNewDataSource());
-    final int maxRowsMaterialized;
 
+    // Get segment granularity from query context, and create ShuffleSpec and 
RowSignature to be used for the final window stage.

Review Comment:
   from this comment I think this has nothing to do with this being a window 
query; this should be move to somewhere else



##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java:
##########
@@ -119,6 +125,20 @@ public WindowOperatorQueryFrameProcessor(
     for (int i = 0; i < frameReader.signature().size(); i++) {
       typeStrategies[i] = 
frameReader.signature().getColumnType(i).get().getNullableStrategy();
     }
+
+    // Get virtual columns to be added to the frame writer.
+    this.partitionBoostVirtualColumn = new 
SettableLongVirtualColumn(QueryKitUtils.PARTITION_BOOST_COLUMN);
+    final List<VirtualColumn> frameWriterVirtualColumns = new ArrayList<>();
+    frameWriterVirtualColumns.add(partitionBoostVirtualColumn);
+
+    final VirtualColumn segmentGranularityVirtualColumn =
+        QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query);
+
+    if (segmentGranularityVirtualColumn != null) {
+      frameWriterVirtualColumns.add(segmentGranularityVirtualColumn);
+    }
+
+    this.frameWriterVirtualColumns = 
VirtualColumns.create(frameWriterVirtualColumns);

Review Comment:
   I think this should be remove from here as it seems like a cross cutting 
aspect
   The same lines are present in other `QueryKit` classes
   
   could you refactor these changes out from all `QueryKit` classes and place 
them at a common place?



-- 
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]

Reply via email to