You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/10/01 09:41:03 UTC

[GitHub] [arrow] pitrou commented on pull request #8312: ARROW-9941: [Python] Better string representation for extension types

pitrou commented on pull request #8312:
URL: https://github.com/apache/arrow/pull/8312#issuecomment-702017880


   The problem is that this won't be visible from C++ code, which will still get `extension<arrow.py_extension_type>`.
   ```python
   >>> ty
   IntegerType(DataType(int64))
   >>> pa.DataType.__str__(ty)
   'extension<arrow.py_extension_type>'
   ```
   
   Solving this requires some collaboration with the C++ side.  I advise you to take a look at [`cpp/src/arrow/python/extension_type.h`](https://github.com/apache/arrow/blob/master/cpp/src/arrow/python/extension_type.h). You'll probably need to override the `ToString` method in `arrow::py::PyExtensionType`. By default it can return the same as `ExtensionType::ToString`, but it can also query a Python attribute on `type_instance` to get a custom string.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org