Skip to content

HIVE-30115: Parquet: an empty projection reads the whole file schema - #6840

Open
deniskuzZ wants to merge 1 commit into
apache:masterfrom
deniskuzZ:HIVE-30115
Open

deniskuzZ wants to merge 1 commit into
apache:masterfrom
deniskuzZ:HIVE-30115

Conversation

@deniskuzZ

@deniskuzZ deniskuzZ commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

  • Request no column for a projection with no column, in both DataWritableReadSupport helpers (vectorized getRequestedSchema, init)
  • The whole-file-schema fallback was added by HIVE-10975 as a workaround for Parquet 1.8.0 rejecting an empty schema ("ParquetReadSupport doesn't support empty field to construct a group type") and copied into the vectorized helper by HIVE-17696. PARQUET-363 (1.8.2, 1.9.0) allows an empty requested schema for row counting; Hive is on 1.18.1. RCFile, ORC and LLAP already read no column for an empty projection

Why are the changes needed?

  • count(*) and partition-only reads read every column of the file and decode none of them. On LLAP the empty projection carried the table's nested columns, so count(*) declined the native path to the fallback reader (parquet_llap_counters.q: HDFS_BYTES_READ 18,616 -> 0, ROWS_EMITTED 2098)
  • Bug-Fix: a vectorized read of only row lineage columns failed with IndexOutOfBoundsException: Index 2 out of bounds for length 2 in ParquetRowGroupDecoder.buildColumnReaders. The lineage columns were appended to the whole file schema but to an empty colsToInclude, and the two are paired by position

Does this PR introduce any user-facing change?

No

How was this patch tested?

  • TestDataWritableReadSupport#testNoProjectedColumnRequestsNoColumn (both helpers)
  • parquet_llap_counters.q: count(*) with no projected column on the LLAP native path
  • row_lineage.q: a read of only row lineage columns; fails with the IndexOutOfBoundsException on master
  • Row mode: the existing parquet_partitioned.q (SELECT part, COUNT(0) ... GROUP BY part, vectorization off) now reads with an empty schema

@Aggarwal-Raghav

Aggarwal-Raghav commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

LGTM +1, pending tests

Before Patch, Tested the query on local setup and after its working ✅

Caused by: java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.util.Objects.checkIndex(Objects.java:385)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.checkEndOfRowGroup(VectorizedParquetRecordReader.java:462)
	at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.nextBatch(VectorizedParquetRecordReader.java:421)
	at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:359)
	at org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:99)
	at org.apache.iceberg.mr.hive.vector.HiveBatchIterator.advance(HiveBatchIterator.java:92)
	at org.apache.iceberg.mr.hive.vector.HiveBatchIterator.hasNext(HiveBatchIterator.java:200)
	at org.apache.iceberg.mr.mapreduce.IcebergRecordReader.nextKeyValue(IcebergRecordReader.java:98)
	at org.apache.iceberg.mr.hive.vector.HiveIcebergVectorizedRecordReader.next(HiveIcebergVectorizedRecordReader.java:48)
	at org.apache.iceberg.mr.hive.vector.HiveIcebergVectorizedRecordReader.next(HiveIcebergVectorizedRecordReader.java:34)

@deniskuzZ
deniskuzZ marked this pull request as ready for review October 27, 2026 00:00
- Both DataWritableReadSupport helpers fell back to the whole file schema when no column was projected: the HIVE-10975 workaround for Parquet 1.8.0 rejecting an empty schema, copied by HIVE-17696; PARQUET-363 (1.8.2, 1.9.0) allows it
- Request no column instead: count(*) and partition-only reads stop reading columns they never decode; on LLAP count(*) takes the native path (parquet_llap_counters.q: HDFS_BYTES_READ 18,616 -> 0)
- Fixes the vectorized read of only row lineage columns: they were appended to the whole schema but paired with colsToInclude by position (IndexOutOfBoundsException)
@deniskuzZ deniskuzZ changed the title HIVE-30115: Iceberg: vectorized Parquet read of only row-lineage columns fails HIVE-30115: Parquet: an empty projection reads the whole file schema Oct 27, 2026
@deniskuzZ
deniskuzZ requested a review from abstractdog October 27, 2026 00:26
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants