pitrou commented on code in PR #13821:
URL: https://github.com/apache/arrow/pull/13821#discussion_r947660830
##########
python/pyarrow/_parquet.pyx:
##########
@@ -1435,6 +1435,19 @@ cdef class ParquetReader(_Weakrefable):
.ReadColumn(column_index, &out))
return pyarrow_wrap_chunked_array(out)
+ def close(self):
+ if not self.closed:
+ with nogil:
+ handle = <shared_ptr[CInputStream]>self.rd_handle
+ check_status(handle.get().Close())
+
+ @property
+ def closed(self):
+ with nogil:
+ handle = <shared_ptr[CInputStream]>self.rd_handle
+ closed = handle.get().closed()
+ return closed
Review Comment:
I'm not sure the explicit cast is needed. However, you should check that
`rd_handle` is not a null pointer. Something like (untested):
```suggestion
if self.rd_handle == NULL:
return True
with nogil:
closed = self.rd_handle.get().closed()
return closed
```
--
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]