kgyrtkirk commented on code in PR #16665:
URL: https://github.com/apache/druid/pull/16665#discussion_r1657082630
##########
sql/src/test/java/org/apache/druid/sql/calcite/util/TestDataBuilder.java:
##########
@@ -960,6 +967,178 @@ public static SpecificSegmentsQuerySegmentWalker
createMockWalker(
.build(),
arraysIndex
);
+
+ attachIndexesForDrillTestDatasources(querySegmentWalker, tmpDir);
Review Comment:
this will load these datasources for all testcases...do we really want that?
##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQDrillWindowQueryTest.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.msq.exec;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.apache.druid.guice.DruidInjectorBuilder;
+import
org.apache.druid.msq.exec.MSQDrillWindowQueryTest.DrillWindowQueryMSQComponentSupplier;
+import org.apache.druid.msq.sql.MSQTaskSqlEngine;
+import org.apache.druid.msq.test.CalciteMSQTestsHelper;
+import org.apache.druid.msq.test.ExtractResultsFactory;
+import org.apache.druid.msq.test.MSQTestOverlordServiceClient;
+import org.apache.druid.msq.test.MSQTestTaskActionClient;
+import org.apache.druid.msq.test.VerifyMSQSupportedNativeQueriesPredicate;
+import org.apache.druid.query.groupby.TestGroupByBuffers;
+import org.apache.druid.server.QueryLifecycleFactory;
+import org.apache.druid.sql.calcite.DrillWindowQueryTest;
+import org.apache.druid.sql.calcite.QueryTestBuilder;
+import org.apache.druid.sql.calcite.SqlTestFrameworkConfig;
+import org.apache.druid.sql.calcite.TempDirProducer;
+import org.apache.druid.sql.calcite.run.SqlEngine;
+import org.apache.druid.sql.calcite.util.SqlTestFramework;
+
[email protected](DrillWindowQueryMSQComponentSupplier.class)
+public class MSQDrillWindowQueryTest extends DrillWindowQueryTest
+{
+ public static class DrillWindowQueryMSQComponentSupplier extends
SqlTestFramework.StandardComponentSupplier
Review Comment:
isn't this class a copy of `UnionQueryMSQComponentSupplier` ?
can't you reuse an existing one? it would be great to reduce duplication
instead of adding new copies...
##########
sql/src/test/java/org/apache/druid/sql/calcite/util/TestDataBuilder.java:
##########
@@ -960,6 +967,178 @@ public static SpecificSegmentsQuerySegmentWalker
createMockWalker(
.build(),
arraysIndex
);
+
+ attachIndexesForDrillTestDatasources(querySegmentWalker, tmpDir);
+ return querySegmentWalker;
+ }
+
+ private static void
attachIndexesForDrillTestDatasources(SpecificSegmentsQuerySegmentWalker
segmentWalker, File tmpDir)
+ {
+ attachIndexForDrillTestDatasource(segmentWalker,
CalciteTests.TBL_WITH_NULLS_PARQUET, tmpDir);
+ attachIndexForDrillTestDatasource(segmentWalker,
CalciteTests.SML_TBL_PARQUET, tmpDir);
+ attachIndexForDrillTestDatasource(segmentWalker,
CalciteTests.ALL_TYPES_UNIQ_PARQUET, tmpDir);
+ attachIndexForDrillTestDatasource(segmentWalker,
CalciteTests.FEW_ROWS_ALL_DATA_PARQUET, tmpDir);
+ attachIndexForDrillTestDatasource(segmentWalker,
CalciteTests.T_ALL_TYPE_PARQUET, tmpDir);
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ private static void attachIndexForDrillTestDatasource(
+ SpecificSegmentsQuerySegmentWalker segmentWalker,
+ String dataSource,
+ File tmpDir
+ )
+ {
+ final QueryableIndex queryableIndex =
getQueryableIndexForDrillDatasource(dataSource, tmpDir);
+
+ segmentWalker.add(
+ DataSegment.builder()
+ .dataSource(dataSource)
+ .interval(Intervals.ETERNITY)
+ .version("1")
+ .shardSpec(new NumberedShardSpec(0, 0))
+ .size(0)
+ .build(),
+ queryableIndex);
+ }
+
+ public static QueryableIndex getQueryableIndexForDrillDatasource(String
datasource, File parentTempDir)
+ {
+ final IncrementalIndexSchema indexSchema = new
IncrementalIndexSchema.Builder()
+ .withDimensionsSpec(getDimensionSpecForDrillDatasource(datasource))
+ .withRollup(false)
+ .build();
+ Iterable<InputRow> inputRowsForDrillDatasource =
getInputRowsForDrillDatasource(datasource);
+ return IndexBuilder
+ .create()
+ .tmpDir(new File(parentTempDir, datasource))
+
.segmentWriteOutMediumFactory(OffHeapMemorySegmentWriteOutMediumFactory.instance())
+ .schema(indexSchema)
+ .rows(inputRowsForDrillDatasource)
+ .buildMMappedIndex();
+ }
+
+ private static DimensionsSpec getDimensionSpecForDrillDatasource(String
datasource)
Review Comment:
I don't think its beneficial to have these things decomposed this way
it would be better to introduce an object which describes a table and give
access to these things; and that could also take up the name of the table :)
##########
sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java:
##########
@@ -573,6 +591,18 @@ public void testDatabaseMetaDataTables() throws
SQLException
Pair.of("TABLE_SCHEM", "druid"),
Pair.of("TABLE_TYPE", "TABLE")
),
+ row(
+ Pair.of("TABLE_CAT", "druid"),
+ Pair.of("TABLE_NAME", CalciteTests.T_ALL_TYPE_PARQUET),
+ Pair.of("TABLE_SCHEM", "druid"),
+ Pair.of("TABLE_TYPE", "TABLE")
+ ),
Review Comment:
I don't really see the benefit of loading all those drill related datasets
for every test; they are not used in other tests
--
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]