github-advanced-security[bot] commented on code in PR #17699:
URL: https://github.com/apache/druid/pull/17699#discussion_r1943239331


##########
server/src/test/java/org/apache/druid/sql/calcite/util/datasets/NumFoo.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.util.datasets;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.data.input.InputRowSchema;
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.DoubleDimensionSchema;
+import org.apache.druid.data.input.impl.FloatDimensionSchema;
+import org.apache.druid.data.input.impl.LongDimensionSchema;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.CountAggregatorFactory;
+import org.apache.druid.query.aggregation.DoubleSumAggregatorFactory;
+import org.apache.druid.query.aggregation.FloatSumAggregatorFactory;
+import 
org.apache.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public class NumFoo extends MapBasedTestDataset
+{
+  protected NumFoo()
+  {
+    this("numfoo");
+  }
+
+  public NumFoo(String name)
+  {
+    super(name);
+  }
+
+  public final InputRowSchema getInputRowSchema()
+  {
+    return new InputRowSchema(
+        new TimestampSpec(TIMESTAMP_COLUMN, "iso", null),
+        new DimensionsSpec(
+            ImmutableList.<DimensionSchema>builder()
+                .addAll(
+                    DimensionsSpec.getDefaultSchemas(
+                        ImmutableList.of(
+                            "dim1",
+                            "dim2",
+                            "dim3",
+                            "dim4",
+                            "dim5",
+                            "dim6"
+                        )
+                    )
+                )
+                .add(new DoubleDimensionSchema("dbl1"))
+                .add(new DoubleDimensionSchema("dbl2"))
+                .add(new FloatDimensionSchema("f1"))
+                .add(new FloatDimensionSchema("f2"))
+                .add(new LongDimensionSchema("l1"))
+                .add(new LongDimensionSchema("l2"))
+                .build()
+        ),
+        null
+    );
+  }
+
+  @Override
+  public List<AggregatorFactory> getMetrics()
+  {
+    return ImmutableList.of(
+        new CountAggregatorFactory("cnt"),
+        new FloatSumAggregatorFactory("m1", "m1"),
+        new DoubleSumAggregatorFactory("m2", "m2"),
+        new HyperUniquesAggregatorFactory("unique_dim1", "dim1")
+    );
+  }
+
+  public List<Map<String, Object>> getRawRows()
+  {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [MapBasedTestDataset.getRawRows](1); it is advisable 
to add an Override annotation.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/8663)



##########
sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java:
##########
@@ -962,17 +987,115 @@
 
     @Provides
     @LazySingleton
-    public SpecificSegmentsQuerySegmentWalker 
specificSegmentsQuerySegmentWalker(final Injector injector, Builder builder)
+    public SpecificSegmentsQuerySegmentWalker 
specificSegmentsQuerySegmentWalker(
+        @Named("empty") SpecificSegmentsQuerySegmentWalker walker, Builder 
builder,
+        List<TestDataSet> testDataSets)
     {
-      SpecificSegmentsQuerySegmentWalker walker = 
builder.componentSupplier.createQuerySegmentWalker(
-          injector.getInstance(QueryRunnerFactoryConglomerate.class),
-          injector.getInstance(JoinableFactoryWrapper.class),
-          injector
-      );
       builder.resourceCloser.register(walker);
+      if (testDataSets.isEmpty()) {
+        builder.componentSupplier.addSegmentsToWalker(walker);
+      } else {
+        for (TestDataSet testDataSet : testDataSets) {
+          walker.add(testDataSet, 
builder.componentSupplier.getTempDirProducer().newTempFolder());
+        }
+      }
+
       return walker;
     }
 
+    @Provides
+    @LazySingleton
+    public List<TestDataSet> buildCustomTables(ObjectMapper objectMapper, 
TempDirProducer tdp,

Review Comment:
   ## Useless parameter
   
   The parameter 'tdp' is never used.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/8666)



##########
server/src/test/java/org/apache/druid/sql/calcite/util/datasets/NumFoo.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.util.datasets;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.data.input.InputRowSchema;
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.DoubleDimensionSchema;
+import org.apache.druid.data.input.impl.FloatDimensionSchema;
+import org.apache.druid.data.input.impl.LongDimensionSchema;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.CountAggregatorFactory;
+import org.apache.druid.query.aggregation.DoubleSumAggregatorFactory;
+import org.apache.druid.query.aggregation.FloatSumAggregatorFactory;
+import 
org.apache.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public class NumFoo extends MapBasedTestDataset
+{
+  protected NumFoo()
+  {
+    this("numfoo");
+  }
+
+  public NumFoo(String name)
+  {
+    super(name);
+  }
+
+  public final InputRowSchema getInputRowSchema()

Review Comment:
   ## Missing Override annotation
   
   This method overrides [MapBasedTestDataset.getInputRowSchema](1); it is 
advisable to add an Override annotation.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/8664)



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