abhishekrb19 commented on code in PR #14187:
URL: https://github.com/apache/druid/pull/14187#discussion_r1183134209


##########
.github/scripts/unit_tests_script.sh:
##########
@@ -62,8 +62,8 @@ then
   node_modules/.bin/diff-test-coverage \
   --coverage "**/target/site/jacoco/jacoco.xml" \
   --type jacoco \
-  --line-coverage 50 \
-  --branch-coverage 50 \
+  --line-coverage 1 \

Review Comment:
   Is this change intentional?



##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryUtils.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.sql.calcite.planner;
+
+import org.apache.calcite.util.Pair;
+import org.apache.druid.sql.calcite.rel.DruidQuery;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility class for queries
+ */
+public class QueryUtils
+{
+
+  private QueryUtils()
+  {
+  }
+
+  /**
+   * Builds the mappings for queryColumn to outputColumn
+   * @param fieldMapping The field mappigns

Review Comment:
   ```suggestion
      * @param fieldMapping The field mappings
   ```



##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryUtils.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.sql.calcite.planner;
+
+import org.apache.calcite.util.Pair;
+import org.apache.druid.sql.calcite.rel.DruidQuery;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility class for queries
+ */
+public class QueryUtils
+{
+
+  private QueryUtils()
+  {
+  }
+
+  /**
+   * Builds the mappings for queryColumn to outputColumn
+   * @param fieldMapping The field mappigns
+   * @param druidQuery The Druid query
+   * @return Mappings for queryColumn to outputColumn
+   */
+  public static List<ColumnMapping> buildColumnMappings(

Review Comment:
   It'd be great if we can add a few UTs for this public method.



##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryHandler.java:
##########
@@ -355,6 +355,7 @@ public void 
cleanup(QueryHandler.EnumeratorIterator<Object[]> iterFromMake)
    * Construct a {@link PlannerResult} for an 'explain' query from a {@link 
RelNode}
    */
   protected PlannerResult planExplanation(
+      final RelRoot relRoot,

Review Comment:
   can we update the javadoc to include info about the new param?



##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/QueryUtils.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.sql.calcite.planner;
+
+import org.apache.calcite.util.Pair;
+import org.apache.druid.sql.calcite.rel.DruidQuery;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility class for queries
+ */
+public class QueryUtils
+{
+
+  private QueryUtils()
+  {
+  }
+
+  /**
+   * Builds the mappings for queryColumn to outputColumn
+   * @param fieldMapping The field mappigns
+   * @param druidQuery The Druid query
+   * @return Mappings for queryColumn to outputColumn
+   */
+  public static List<ColumnMapping> buildColumnMappings(
+      final List<Pair<Integer, String>> fieldMapping,
+      final DruidQuery druidQuery
+  )
+  {
+    final List<ColumnMapping> columnMappings = new ArrayList<>();
+    for (final Pair<Integer, String> entry : fieldMapping) {
+      final String queryColumn = 
druidQuery.getOutputRowSignature().getColumnName(entry.getKey());
+      final String outputColumns = entry.getValue();

Review Comment:
   Since we can only have one output column, this variable should be singular 
`outputColumn`, right? 



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