okalinin commented on a change in pull request #1370: DRILL-5797: Use Parquet 
new reader more often
URL: https://github.com/apache/drill/pull/1370#discussion_r201344111
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetReaderUtility.java
 ##########
 @@ -140,15 +140,87 @@ public static int getIntFromLEBytes(byte[] input, int 
start) {
     return out;
   }
 
+  /**
+   * Map full schema paths in format `a`.`b`.`c` to respective SchemaElement 
objects.
+   *
+   * @param footer Parquet file metadata
+   * @return       schema full path to SchemaElement map
+   */
   public static Map<String, SchemaElement> 
getColNameToSchemaElementMapping(ParquetMetadata footer) {
-    HashMap<String, SchemaElement> schemaElements = new HashMap<>();
+    Map<String, SchemaElement> schemaElements = new HashMap<>();
     FileMetaData fileMetaData = new 
ParquetMetadataConverter().toParquetMetadata(ParquetFileWriter.CURRENT_VERSION, 
footer);
-    for (SchemaElement se : fileMetaData.getSchema()) {
-      schemaElements.put(se.getName(), se);
+
+    Iterator iter = fileMetaData.getSchema().iterator();
+
+    // skip first default 'root' element
+    if (iter.hasNext()) {
 
 Review comment:
   First element in `FileMetaData.getSchema()` is default element named `root`. 
If we don't skip it, map keys would have format:
   `root`.`a`
   `root`.`b`
   etc.
   Correspondingly, comparison with `SchemaPath.toString()` representation 
would need to be implemented with that in mind (`root` part would have to be 
cut anyway). If this is considered to be better approach, I could implement it 
that way indeed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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