clintropolis commented on code in PR #19061:
URL: https://github.com/apache/druid/pull/19061#discussion_r2897738820


##########
multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -1824,9 +1832,20 @@ private static Function<Set<DataSegment>, 
Set<DataSegment>> addCompactionStateTo
     );
 
     DimensionsSpec dimensionsSpec = dataSchema.getDimensionsSpec();
-    CompactionTransformSpec transformSpec = 
TransformSpec.NONE.equals(dataSchema.getTransformSpec())
-                                            ? null
-                                            : 
CompactionTransformSpec.of(dataSchema.getTransformSpec());
+
+    // if the clustered by requires virtual columns, preserve them here so 
that we can rebuild during compaction
+    CompactionTransformSpec transformSpec;
+    if (clusterBy == null || clusterBy.getVirtualColumnMap().isEmpty()) {
+      transformSpec = TransformSpec.NONE.equals(dataSchema.getTransformSpec())
+                      ? null
+                      : 
CompactionTransformSpec.of(dataSchema.getTransformSpec());
+    } else {
+      transformSpec = new CompactionTransformSpec(
+          dataSchema.getTransformSpec().getFilter(),
+          VirtualColumns.create(clusterBy.getVirtualColumnMap().values())

Review Comment:
   the new use allows them to be used as intermediary columns to aid in the 
sorting/clustering, but not saved in the final segment, basically the MSQ 
compaction equivalent of writing SQL replace queries like in this test 
https://github.com/apache/druid/pull/19061/changes#diff-207e886c7791d20d886d23425945203683100878b45eb070547d23ff9ed516deR172
   



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