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_r317073646
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetReaderUtility.java
 ##########
 @@ -713,4 +715,63 @@ public static boolean 
containsComplexColumn(ParquetMetadata footer, List<SchemaP
     }
     return false;
   }
+
+  /**
+   * Converts list of {@link OriginalType}s to list of {@link 
org.apache.drill.common.types.TypeProtos.MajorType}s.
+   * <b>NOTE</b>: current implementation cares about {@link OriginalType#MAP} 
only
+   * converting it to {@link 
org.apache.drill.common.types.TypeProtos.MinorType#DICT}.
+   * Other original types are converted to {@code null}.
+   *
+   * @param originalTypes list of Parquet's types
+   * @return list containing either {@code null} or type with minor
+   *         type {@link 
org.apache.drill.common.types.TypeProtos.MinorType#DICT} values
+   */
+  public static List<TypeProtos.MajorType> getComplexTypes(List<OriginalType> 
originalTypes) {
+    List<TypeProtos.MajorType> result = new ArrayList<>();
+    if (originalTypes == null) {
+      return result;
+    }
+    for (OriginalType type : originalTypes) {
+      if (type == OriginalType.MAP) {
+        TypeProtos.MajorType drillType = TypeProtos.MajorType.newBuilder()
+            .setMinorType(TypeProtos.MinorType.DICT)
+            .setMode(TypeProtos.DataMode.OPTIONAL)
+            .build();
+        result.add(drillType);
+      } else {
+        result.add(null);
+      }
+    }
+
+    return result;
+  }
+
+  /**
+   * Checks whether group field matches pattern for Logical Map type:
+   *
+   * <map-repetition> group <name> (MAP) {
 
 Review comment:
   Use proper html formatting.

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