curioustien commented on code in PR #45549:
URL: https://github.com/apache/arrow/pull/45549#discussion_r1962806783
##########
python/pyarrow/_parquet.pyx:
##########
@@ -739,6 +749,9 @@ cdef class SortingColumn:
cdef class RowGroupMetaData(_Weakrefable):
"""Metadata for a single row group."""
+ def __init__(self):
+ raise TypeError(f"Can't instantiate internal class
{self.__class__.__name__}")
+
def __cinit__(self, FileMetaData parent, int index):
if index < 0 or index >= parent.num_row_groups:
raise IndexError('{0} out of bounds'.format(index))
Review Comment:
@pitrou After searching around, I found that `__cinit__` is called before
`__init__`. The main reason why the approach in this PR worked for some classes
like `Statistics` `ParquetLogicalType` but not for `RowGroupMetaData` was that
those classes had an empty `__cinit__`
```python
def __cinit__(self):
pass
```
Meanwhile, `RowGroupMetaData` had actual logic and parameters for its
`__cinit__`. Since `__cinit__` is always called before `__init__`, the current
approach in this PR won't work for all the cases. The only solution that I can
think of right now is to convert these `__cinit__` into empty ones and have a
dedicated method to do the initialization in python.
What do you think? Any other suggestions?
--
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]