abstractdog commented on code in PR #6793:
URL: https://github.com/apache/hive/pull/6793#discussion_r4217414628


##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetRowGroupDecoder.java:
##########
@@ -0,0 +1,273 @@
+/*
+ * 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.hadoop.hive.ql.io.parquet.vector;
+
+import java.io.IOException;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
+import org.apache.parquet.ParquetRuntimeException;
+import org.apache.parquet.column.ColumnDescriptor;
+import org.apache.parquet.column.page.PageReadStore;
+import org.apache.parquet.schema.GroupType;
+import org.apache.parquet.schema.InvalidSchemaException;
+import org.apache.parquet.schema.MessageType;
+import org.apache.parquet.schema.PrimitiveType;
+import org.apache.parquet.schema.Type;
+
+/**
+ * Reusable, stateless helper that builds the {@link VectorizedColumnReader} 
array for one Parquet
+ * row group, given an already-read {@link PageReadStore}. The logic here was 
lifted verbatim from
+ * {@link VectorizedParquetRecordReader} so that both the row-by-split reader 
and the LLAP
+ * cache-backed consumer ({@code ParquetEncodedDataConsumer}) can share a 
single, behavior-preserving
+ * implementation of the Hive-type-driven Parquet column-reader construction.
+ *
+ * <p>The instance only carries the {@code fileSchema} (used for the 
schema-evolution check). All
+ * per-row-group state lives in the supplied {@link PageReadStore}.
+ */
+public class ParquetRowGroupDecoder {
+
+  private static final int MAP_DEFINITION_LEVEL_MAX = 3;

Review Comment:
   ack, added also a comment to explain how different layouts can exist
   
   the layout could be one of the following (not added to code, only here):
   
   ```
   // canonical
   optional group m (MAP) {            // 1 field
     repeated group key_value {        // 2 fields  <- the walk stops here
       required binary key (STRING);
       optional int32 value;
     }
   }
   
   // names may differ in existing data; key and value are taken by position
   optional group m (MAP) {            // 1 field
     repeated group map {              // 2 fields  <- stops here
       required binary str (STRING);
       required int32 num;
     }
   }
   
   // MAP_KEY_VALUE written in place of MAP, with no MAP-annotated group above 
it
   optional group m (MAP_KEY_VALUE) {  // 1 field
     repeated group map {              // 2 fields  <- stops here
       required binary key (STRING);
       optional int32 value;
     }
   }
   ```



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

Reply via email to