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


##########
quidem-ut/pom.xml:
##########
@@ -488,6 +492,11 @@
             <version>0.9.3</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.kgyrtkirk.datasets</groupId>
+            <artifactId>kttm-nested</artifactId>
+            <version>0.1</version>
+        </dependency>

Review Comment:
   this seems like an odd way to get this test file...



##########
quidem-ut/src/main/java/org/apache/druid/quidem/KttmNestedComponentSupplier.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.quidem;
+
+import com.google.inject.Injector;
+import org.apache.druid.data.input.ResourceInputSource;
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.LongDimensionSchema;
+import org.apache.druid.data.input.impl.StringDimensionSchema;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.NestedDataTestUtils;
+import org.apache.druid.query.QueryRunnerFactoryConglomerate;
+import org.apache.druid.segment.AutoTypeColumnSchema;
+import org.apache.druid.segment.IndexBuilder;
+import org.apache.druid.segment.IndexSpec;
+import org.apache.druid.segment.QueryableIndex;
+import org.apache.druid.segment.TestIndex;
+import org.apache.druid.segment.incremental.IncrementalIndex;
+import org.apache.druid.segment.incremental.IncrementalIndexSchema;
+import org.apache.druid.segment.join.JoinableFactoryWrapper;
+import 
org.apache.druid.segment.writeout.OffHeapMemorySegmentWriteOutMediumFactory;
+import org.apache.druid.server.SpecificSegmentsQuerySegmentWalker;
+import org.apache.druid.sql.calcite.TempDirProducer;
+import 
org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
+import org.apache.druid.timeline.DataSegment;
+import org.apache.druid.timeline.partition.NumberedShardSpec;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+public class KttmNestedComponentSupplier extends StandardComponentSupplier
+{
+  public KttmNestedComponentSupplier(TempDirProducer tempDirProducer)
+  {
+    super(tempDirProducer);
+  }
+
+  @Override
+  public SpecificSegmentsQuerySegmentWalker 
createQuerySegmentWalker(QueryRunnerFactoryConglomerate conglomerate,
+      JoinableFactoryWrapper joinableFactory, Injector injector)
+  {
+    SpecificSegmentsQuerySegmentWalker walker = 
super.createQuerySegmentWalker(conglomerate, joinableFactory, injector);
+    QueryableIndex idx = makeKttmIndex(tempDirProducer.newTempFolder());
+
+    walker.add(
+        DataSegment.builder()
+            .dataSource("kttm_nested")
+            .interval(Intervals.of("2019-08-25/2019-08-26"))
+            .version("1")
+            .shardSpec(new NumberedShardSpec(0, 0))
+            .size(0)
+            .build(),
+        idx
+    );
+    return walker;
+  }
+
+  public static QueryableIndex makeKttmIndex(File tmpDir)
+  {
+    try {
+      final File directory = new File(tmpDir, 
StringUtils.format("kttm-index-%s", UUID.randomUUID()));
+      final IncrementalIndex index = makeKttmNestedIndex();
+      TestIndex.INDEX_MERGER.persist(index, directory, IndexSpec.DEFAULT, 
null);
+      return TestIndex.INDEX_IO.loadIndex(directory);
+    }
+    catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static IncrementalIndex makeKttmNestedIndex()
+  {
+    final List<DimensionSchema> dimensions = Arrays.asList(
+        new StringDimensionSchema("session"),
+        new StringDimensionSchema("number"),
+        new AutoTypeColumnSchema("event", null),
+        new AutoTypeColumnSchema("agent", null),
+        new StringDimensionSchema("client_ip"),
+        new StringDimensionSchema("geo_ip"),

Review Comment:
   this doesn't really match the way the web-console detects KTTM nested data, 
which calls geo_ip a json, so this should be 'auto' type schema? also language 
is an array in the external file, maybe it should also be 'auto' to ingest as 
an array since we are trying to push towards using arrays in typical use cases 
instead of mvds? 



-- 
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: commits-unsubscr...@druid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to