Hey all,

Following up on the resource exhaustion point in the security posture
thread, I'd like to gauge interest in a small addition to the Parquet page
index.

In Hardwood, we've been exploring how to bound a read's memory, so that a
file from an untrusted source fails cleanly instead of exhausting the heap,
which matters in particular in shared environments. Today a reader can
enforce such a bound before decompressing and decoding a page, but not
before fetching it (or at least its header, at the cost of a round trip per
page).

The page index already gets us most of the way: it gives each data page's
value count (from first_row_index, or for repeated columns from the
optional level histograms) and, since 2.10, its decoded BYTE_ARRAY bytes
(unencoded_byte_array_data_bytes). What's missing is a data page's
uncompressed_page_size, which is only in its page header, and the
uncompressed size of a column chunk's dictionary page, which has no entry
in the OffsetIndex. The only up-front figure,
ColumnMetaData.total_uncompressed_size, covers a whole column chunk, which
is too coarse to control a read page by page.

If the OffsetIndex carried those two, a reader could, together with the
existing optional statistics, bound what every page will allocate from
footer and index alone, and plan or reject a read before fetching any page.

The new fields would be optional at first. A reader enforcing a bound would
treat them as binding and fail the read if a page needs more than it
declares. If a later version required writers to emit them, such a reader
could also reject files written to that version that lack them.

Would this be something the community is interested in? Perhaps this could
also be part of the ongoing modular footer work (apache/parquet-format#622)?

Best,

--Gunnar

Reply via email to