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


##########
python/pyarrow/types.pxi:
##########
@@ -902,6 +902,22 @@ 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.
+
+        Parameters
+        ----------
+        scalar : pyarrow.ExtensionScalar
+          The scalar to be converted to a Python object.
+
+        Returns
+        -------
+        Scalar value as a native Python object.
+        """
+        return scalar.as_py()

Review Comment:
   I was talking about the docstring - this is always passed a not-None 
`pyarrow.Scalar` subclass corresponding to the extension type, right? 



##########
python/pyarrow/types.pxi:
##########
@@ -902,6 +902,18 @@ 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.
+
+        Parameters
+        ----------
+        scalar : pyarrow.ExtensionScalar
+          The scalar to be converted to a Python object.
+        """
+        return scalar.as_py() if scalar is not None else None

Review Comment:
   What I meant was, this method is always passed the Scalar of the storage 
type, right? Not of the Extension type? 



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