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


##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedParquetRecordReader.java:
##########
@@ -446,179 +440,19 @@ private void checkEndOfRowGroup() throws IOException {
       throw new IOException("expecting more rows but reached last block. Read "
         + rowsReturned + " out of " + totalRowCount);
     }
-    List<ColumnDescriptor> columns = requestedSchema.getColumns();
-    List<Type> types = requestedSchema.getFields();
-    columnReaders = new VectorizedColumnReader[columns.size()];
-
-    if (!ColumnProjectionUtils.isReadAllColumns(jobConf)) {
-      //certain queries like select count(*) from table do not have
-      //any projected columns and still have isReadAllColumns as false
-      //in such cases columnReaders are not needed
-      //However, if colsToInclude is not empty we should initialize each 
columnReader
-      if(!colsToInclude.isEmpty()) {
-        for (int i = 0; i < types.size(); ++i) {
-          columnReaders[i] =
-              buildVectorizedParquetReader(
-                  columnTypesList.get(colsToInclude.get(i)), types.get(i),
-                  pages, requestedSchema.getColumns(), 
skipTimestampConversion, writerTimezone, skipProlepticConversion,
-                  legacyConversionEnabled, 0, 0
-              );
-        }
-      }
-    } else {
-      for (int i = 0; i < types.size(); ++i) {
-        columnReaders[i] = 
buildVectorizedParquetReader(columnTypesList.get(i), types.get(i), pages,
-          requestedSchema.getColumns(), skipTimestampConversion, 
writerTimezone, skipProlepticConversion,
-          legacyConversionEnabled, 0, 0);
-      }
-    }
+    // Delegate the (Hive-type-driven) column-reader construction to the 
shared helper so the
+    // LLAP cache-backed consumer can reuse the exact same logic. Behavior is 
unchanged.
+    columnReaders = new ParquetRowGroupDecoder(fileSchema, 
initialDefaults).buildColumnReaders(
+        pages, requestedSchema, columnTypesList, colsToInclude,
+        ColumnProjectionUtils.isReadAllColumns(jobConf), 
skipTimestampConversion, writerTimezone,
+        skipProlepticConversion, legacyConversionEnabled);

Review Comment:
   added a guard with good explanation regarding when it fires and about the 
consequences



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