chaubold commented on code in PR #13454:
URL: https://github.com/apache/arrow/pull/13454#discussion_r909411136


##########
python/pyarrow/types.pxi:
##########
@@ -902,6 +902,19 @@ cdef class ExtensionType(BaseExtensionType):
         """
         return ExtensionArray
 
+    def scalar_as_py(self, scalar):
+        """Convert scalar to a Python type.
+
+        This method can be overridden in subclasses to customize what type
+        scalars are converted to. Implementations should handle the case
+        where the scalar argument is ``None``.

Review Comment:
   I am curious about your intention to leave the `None` handling to the 
subclasses.
   
   Would you like to allow returning custom values (along the lines of 
`numpy.NaN`) in the case that the value is `None`? Or should `None` always stay 
`None` because Arrow actually is more explicit with its missing value handling 
and is able to differentiate between e.g. `None` and `NaN` for double columns. 
If the latter is preferred, then I'd suggest to move the `None` handling to 
`Scalar.as_py()` and only invoke `scalar_as_py` for existing values.



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