paleolimbot commented on PR #431:
URL: https://github.com/apache/arrow-nanoarrow/pull/431#issuecomment-2067530671

   
   > Users might want to influence how for example a map or interval type is 
converted to python)
   
   Right now that's a little awkward, but possible:
   
   ```python
   import nanoarrow as na
   import pyarrow as pa
   from nanoarrow import iterator
   import decimal
   
   decimals = pa.array([decimal.Decimal("1.234")], pa.decimal128(10, 3))
   
   class CustomIterator(iterator.PyIterator):
       def _decimal_iter(self, offset, length):
           for item in super()._decimal_iter(offset, length):
               yield None if item is None else float(item)
   
   list(CustomIterator.get_iterator(decimals))
   #> [1.234]
   ```
   
   > I personally would punt on this problem of custom conversion for now
   
   Agreed! I think I've scoped it now to the basic usage of `if 
schema.extension and schema.extension.name == ...`.
   
   > (we don't even support this in pyarrow at the moment)
   
   I'm not sure exactly where it is used, but you can add a custom `Scalar` 
subclass that overrides `as_py()`?
   
   


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