[ 
https://issues.apache.org/jira/browse/SPARK-59832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

L. C. Hsieh updated SPARK-59832:
--------------------------------
    Docs Text: 
The vectorized Parquet reader now fails with a {{ParquetDecodingException}} on 
corrupt pages whose RLE/bit-packed data (definition and repetition levels, 
dictionary ids, or RLE-encoded booleans) ends early, or has an invalid length, 
bit width or bit-packed run header. Previously such pages could silently return 
wrong values, make the task hang, or allocate a very large buffer. Valid 
Parquet files are not affected.

A few corrupt or non-compliant pages that used to read without an error, and 
gave the right result by chance, now fail:
* Dictionary ids or RLE boolean values that end early, when every row after the 
end of the data is skipped by column index filtering. This was possible since 
Spark 3.3.0; Spark 3.2 also failed on these pages. Selecting rows after the end 
of the data returned wrong values before this change.
* A dictionary-encoded page whose data section is empty, without the bit width 
byte that the Parquet spec requires, when all its non-null rows are skipped, or 
when the dictionary has a single entry. Before this change, every value of such 
a page was read as dictionary id 0.

These pages are now treated as corrupt. By default the query fails. With 
{{spark.sql.files.ignoreCorruptFiles=true}}, Spark skips the rest of such a 
file, starting from the batch that contains the page, and logs a warning.
       Labels: pull-request-available release-notes  (was: 
pull-request-available)

> Fail on truncated input in the vectorized RLE reader
> ----------------------------------------------------
>
>                 Key: SPARK-59832
>                 URL: https://issues.apache.org/jira/browse/SPARK-59832
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.5.8, 4.2.0, 4.3.0, 4.1.3, 4.0.4, 4.4.0
>            Reporter: L. C. Hsieh
>            Assignee: L. C. Hsieh
>            Priority: Minor
>              Labels: pull-request-available, release-notes
>             Fix For: 4.4.0, 4.2.2, 4.1.5, 4.0.6, 4.3.1
>
>
> Follow-up of SPARK-59812. The vectorized RLE/bit-packing hybrid reader 
> (VectorizedRleValuesReader), used for definition/repetition levels, 
> dictionary ids and booleans, does not fail when the encoded data ends before 
> the requested values are read:
> * When readNextGroup() returns false at the end of the stream, the batch read 
> and skip loops silently break, so dictionary ids and levels are only 
> partially read or skipped.
> * readBooleans ignores the return value of readNextGroup(). At the end of the 
> stream currentCount stays 0, so the loop makes no progress and never 
> terminates.
> * readInteger() also ignores the return value of readNextGroup().
> * The length passed to sliceStream(length) for levels, and the PACKED run 
> size `numGroups * bitWidth`, are read from the file without validation.
> The reader should fail with a ParquetDecodingException in these cases, like 
> the other vectorized readers now do.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to