Mola-maker opened a new issue, #53500:
URL: https://github.com/apache/arrow/issues/53500

   ### Describe the bug
   
   Parquet metadata and schema equality can terminate the Python interpreter 
when the other operand is `None`. For example, checking 
`metadata.row_group(0).column(0).statistics == None` causes SIGSEGV instead of 
returning `False`.
   
   The `equals()` methods accept a typed Cython object without rejecting 
`None`, then access its native pointer. `FileMetaData.equals()` already uses 
`other not None`; the other five metadata/schema classes do not.
   
   ### Reproducer
   
   Run in an isolated Python process:
   
   ```python
   import pyarrow as pa
   import pyarrow.parquet as pq
   
   sink = pa.BufferOutputStream()
   pq.write_table(pa.table({"value": [1, 2, 3]}), sink)
   metadata = pq.read_metadata(pa.BufferReader(sink.getvalue()))
   statistics = metadata.row_group(0).column(0).statistics
   print(statistics == None)  # process exits with SIGSEGV
   ```
   
   The same result occurs with `.equals(None)`, row-group metadata, 
column-chunk metadata, and column schemas. On Arch Linux / CPython 3.14.8, 
`ParquetSchema` comparison also crashes. On Ubuntu / CPython 3.12.14 it happens 
to return `False`. This was reproduced with PyArrow 26.0.0 and with the current 
main `_parquet` extension built from source at 
`9b34c4a6a8856212b885f6a1e934795af04f3192` against the matching 26.0.0 SDK.
   
   Expected: normal equality with `None` returns `False`; explicit 
`.equals(None)` rejects the invalid argument with `TypeError`, consistently 
with `FileMetaData`.
   
   ### Existing work checked
   
   Open PRs #51161 and #51163 change other Parquet entry points (constructors, 
sorting, binary types). Their current patches do not change these five 
`equals()` methods. Searches for metadata/schema/statistics comparison and 
None-related open PRs found no overlapping fix.
   
   ### Component(s)
   
   Python, Parquet
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to