jorisvandenbossche commented on pull request #12467:
URL: https://github.com/apache/arrow/pull/12467#issuecomment-1075489604


   > I think so! This example is probably better
   
   That example indeed nicely shows that it is possible. 
   I suppose one thing that confused me is that `new_extension_type(..)` rather 
creates a new *instance* of a given type, and not a new type itself (and thus 
this allows you to create instances of a given extension type with different 
metadata).
   
   > It isn't all that straightforward to do (the way I've implemented it in R) 
and I'm not sure I like how it's implemented (but I'm also not sure how to make 
it better).
   
   I think the fact that you already determine the serialized metadata upfront 
in R is fine / nice (the fact that in Python this is C++ calling back into 
python is kind of a complication, as the metadata could be known at the point 
when instantiating the python extension type instance).  
   One thing I was wondering: the reason you can't define a `.Serialize` method 
on the QuantizedType that can hold this logic to create the serialized metadata 
(instead of doing that inside `new_extension_type( ..., extension_metadata=... 
)`), is that this class instance is only created after the underlying C++ 
extension type, for which you already need the serialized metadata? It's not 
possible to first initialize the QuantizedType object, and let that call 
Serialize to then create the underlying C++ object? (disclaimer: I know nothing 
about R classes :))
   
    


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