Repository navigation
GH-54957: [Python][Parquet] Translate C++ ParquetException in metadata accessors to prevent process abort - #55244
Open
ishaaaan17 wants to merge 1 commit into
Open
ishaaaan17 wants to merge 1 commit into
ishaaaan17 wants to merge 1 commit into
Conversation
…etadata accessors to prevent process abort Add 'except +' to C++ declarations of statistics(), geo_statistics(), crypto_metadata(), ColumnChunk(), RowGroup(), WriteTo(), and CFileMetaData_Make in libparquet.pxd, and 'except *' to RowGroupMetaData.init and ColumnChunkMetaData.init in _parquet.pxd. Without 'except +', Cython does not generate C++ try/catch wrappers around these methods. When a damaged Parquet footer causes C++ to throw parquet::ParquetException, it triggers std::terminate across the C boundary, aborting the Python interpreter instead of translating into a Python exception.
|
|
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rationale for this change
in the Cython declarations (
libparquet.pxdand_parquet.pxd), the C++ metadata accessors did not haveexcept +. when a damaged Parquet footer makes C++ throwparquet::ParquetException, the exception is not handled, it crosses the C boundary and triggersstd::terminate(the interpreter is aborted), instead of raising a PythonOSError.what changes are included in this PR?
except +to the metadata accessor declarations inpython/pyarrow/includes/libparquet.pxd.except *to the inlineinitmethods inpython/pyarrow/_parquet.pxd.test_damaged_metadata_raises_exception_not_abortinpython/pyarrow/tests/parquet/test_metadata.py.are these changes tested?
yes, i added a regression test in
python/pyarrow/tests/parquet/test_metadata.py.are there any user-facing changes?
no API changes. accessing corrupted metadata now raises
OSError, and does not crash the process.This PR contains a "Critical Fix".
prevents the process from aborting (
std::terminate) on damaged Parquet footers.was ai used for this PR?
PR code and description written by:
reviewed before submission by:
i used an llm assistant to find the missing Cython
except +declarations and to structure the regression test.RowGroupMetaData.column()/ColumnChunkMetaData.statisticsabort the interpreter (uncaughtParquetException->std::terminate) #54957