abhishekagarwal87 commented on a change in pull request #11922:
URL: https://github.com/apache/druid/pull/11922#discussion_r750287308



##########
File path: 
server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java
##########
@@ -364,6 +365,16 @@ private CoordinatorStats doRun(
           dimensionsSpec = null;
         }
 
+        // Create transformSpec to send to compaction task
+        ClientCompactionTaskTransformSpec transformSpec;
+        if (config.getTransformSpec() != null) {
+          transformSpec = new ClientCompactionTaskTransformSpec(
+              config.getTransformSpec().getFilter()
+          );
+        } else {
+          transformSpec = null;
+        }

Review comment:
       ```suggestion
           ClientCompactionTaskTransformSpec transformSpec = null;
           if (config.getTransformSpec() != null) {
             transformSpec = new ClientCompactionTaskTransformSpec(
                 config.getTransformSpec().getFilter()
             );
           } 
   ```

##########
File path: 
server/src/main/java/org/apache/druid/client/indexing/ClientCompactionTaskTransformSpec.java
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.client.indexing;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.query.filter.DimFilter;
+
+import javax.annotation.Nullable;
+import java.util.Objects;
+
+/**
+ * Spec containing transform configs for Compaction Task.
+ * This class mimics JSON field names for fields supported in compaction task 
with
+ * the corresponding fields in {@link 
org.apache.druid.segment.transform.TransformSpec}.
+ * This is done for end-user ease of use. Basically, end-user will use the 
same syntax / JSON structure to set
+ * transform configs for Compaction task as they would for any other ingestion 
task.
+ */
+public class ClientCompactionTaskTransformSpec
+{
+  @Nullable private final DimFilter filter;
+
+  @JsonCreator
+  public ClientCompactionTaskTransformSpec(
+      @JsonProperty("filter") final DimFilter filter
+  )
+  {
+    this.filter = filter;
+  }
+
+  @Nullable
+  public DimFilter getFilter()

Review comment:
       is it missing `JsonProperty` annotation? 

##########
File path: 
server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java
##########
@@ -364,6 +365,16 @@ private CoordinatorStats doRun(
           dimensionsSpec = null;
         }
 
+        // Create transformSpec to send to compaction task
+        ClientCompactionTaskTransformSpec transformSpec;
+        if (config.getTransformSpec() != null) {
+          transformSpec = new ClientCompactionTaskTransformSpec(
+              config.getTransformSpec().getFilter()
+          );
+        } else {
+          transformSpec = null;
+        }

Review comment:
       nit - could be simplified. 




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