Skip to content

HIVE-30104: LLAP: read a Parquet footer in one round trip - #6979

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

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

Conversation

@deniskuzZ

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

  • On a footer cache miss, LlapParquetIoImpl.getFooterBuffersFromCache reads the last 64 KB of the file once (S3A's
    default readahead) and caches the footer from that buffer. A footer larger than that is read on its own.
  • The file is opened with the status already fetched (openFile().withFileStatus()), so S3A skips the HEAD that
    open() issues to learn the length.
  • The length, magic and footer index are checked as ParquetFileReader.readFooter checks them, before anything is
    cached.
  • ParquetEncodedDataReader builds the footer ParquetReadOptions once instead of once per split.

Why are the changes needed?

  • A miss used to cost a seek-and-read of the footer length, then a second read of the footer, plus the HEAD from
    open(): three object-store requests where one is enough.
  • ParquetFileReader.readFooter(InputFile, filter) builds read options for a non-Hadoop file on every call, which
    parses the Hadoop default configuration. At TPC-DS 10 TB that was 18.5% of q28's LLAP task time (51,134 splits).
    A footer read of a local file goes from 631 to 43 us.

Does this PR introduce any user-facing change?

No

How was this patch tested?

TestParquetEncodedDataReader:

  • a footer within the tail costs one read; a larger one costs two and matches ParquetFileReader's footer
  • a file too short for Parquet, a missing magic, and a footer index outside the file are refused and not cached

- A footer miss read the footer length from the last 8 bytes, then the footer: two reads, plus the HEAD S3A's
  open() issues to learn the length
- getFooterBuffersFromCache reads the last 64 KB (S3A's default readahead) once and caches the footer from it; a
  footer larger than that is read on its own
- The file is opened with the status already fetched, so S3A skips the HEAD
- The length, magic and footer index are checked as ParquetFileReader.readFooter checks them, before caching
- ParquetEncodedDataReader builds the footer read options once: readFooter(InputFile, filter) built them per split,
  parsing the Hadoop default configuration each time (18.5% of q28's LLAP task time at 10 TB, 51,134 splits); a
  footer read of a local file 631 -> 43 us
- TestParquetEncodedDataReader: one read for a footer within the tail, two for a larger one; a short file, a missing
  magic and a footer index outside the file are refused and not cached
@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.

2 participants