jorisvandenbossche commented on code in PR #34980:
URL: https://github.com/apache/arrow/pull/34980#discussion_r1173545030


##########
python/pyarrow/table.pxi:
##########
@@ -1450,8 +1450,129 @@ cdef _sanitize_arrays(arrays, names, schema, metadata,
             converted_arrays.append(item)
     return converted_arrays
 
+cdef class _Tabular(_PandasConvertible):
+    """Internal: An interface for common operations on tabular objects."""
 
-cdef class RecordBatch(_PandasConvertible):
+    def __init__(self):
+        raise TypeError("This object is not instantiable, "
+                        "use a subclass instead.")
+
+    def __repr__(self):
+        if not self._is_initialized():
+            raise ValueError("This object's internal pointer is NULL, do not "

Review Comment:
   Yes, you can have a table object that no longer is being backed by Arrow 
data when doing `df = table.to_pandas(self_destruct=True)`. This check and 
error then prevents getting a segfault when just printing `table` (calling any 
other method on it will still segfault)
   
   This options seems to have no effect for RecordBatch (I assume this is 
because the RecordBatch.to_pandas method converts the batch into a Table and 
then calls Table.to_pandas, so even though the Table C++ object is destructed, 
the original RecordBatch still owns that data)



-- 
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