arina-ielchiieva commented on a change in pull request #1829: DRILL-7096: 
Develop vector for canonical Map<K,V>
URL: https://github.com/apache/drill/pull/1829#discussion_r317076269
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillMapGroupConverter.java
 ##########
 @@ -0,0 +1,111 @@
+/*
+ * 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.drill.exec.store.parquet2;
+
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+import org.apache.drill.exec.physical.impl.OutputMutator;
+import org.apache.drill.exec.server.options.OptionManager;
+import org.apache.drill.exec.store.parquet.ParquetReaderUtility;
+import org.apache.drill.exec.vector.complex.DictVector;
+import org.apache.drill.exec.vector.complex.writer.BaseWriter;
+import org.apache.drill.exec.vector.complex.writer.BaseWriter.DictWriter;
+import org.apache.parquet.io.api.Converter;
+import org.apache.parquet.schema.GroupType;
+import org.apache.parquet.schema.Type;
+
+import java.util.Collections;
+
+class DrillMapGroupConverter extends DrillParquetGroupConverter {
+
+  private final DictWriter writer;
+
+  DrillMapGroupConverter(OutputMutator mutator, DictWriter mapWriter, 
GroupType schema,
+                    OptionManager options, 
ParquetReaderUtility.DateCorruptionStatus containsCorruptedDates) {
+    super(mutator, mapWriter, options, containsCorruptedDates);
+    writer = mapWriter;
+
+    GroupType type = schema.getType(0).asGroupType();
+    Converter innerConverter = new KeyValueGroupConverter(mutator, type, 
options, containsCorruptedDates);
+    converters.add(innerConverter);
+  }
+
+  @Override
+  public void start() {
+    writer.start();
+  }
+
+  @Override
+  public void end() {
+    writer.end();
+  }
+
+  private class KeyValueGroupConverter extends DrillParquetGroupConverter {
+
+    private static final int INDEX_KEY = 0;
+    private static final int INDEX_VALUE = 1;
+
+    KeyValueGroupConverter(OutputMutator mutator, GroupType schema, 
OptionManager options,
+                           ParquetReaderUtility.DateCorruptionStatus 
containsCorruptedDates) {
+      super(mutator, writer, options, containsCorruptedDates);
+
+      Type keyType = schema.getType(INDEX_KEY);
+      if (!keyType.isPrimitive()) {
+        throw new DrillRuntimeException("Map supports primitive key only. 
Found: " + keyType);
 
 Review comment:
   Map or Dict?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to