AlenkaF commented on code in PR #45818:
URL: https://github.com/apache/arrow/pull/45818#discussion_r2034608323


##########
python/pyarrow/scalar.pxi:
##########
@@ -847,6 +882,12 @@ cdef class BinaryScalar(Scalar):
         buffer = self.as_buffer()
         return None if buffer is None else buffer.to_pybytes()
 
+    def __bytes__(self):
+        return (self.as_py())
+
+    def __buffer__(self):
+        return(memoryview(self.as_buffer()))

Review Comment:
   This here will be a bit more tricky. We need to go to a lower level and pass 
the pointer to the actual buffer in memory, as well as some metadata. Also the 
method will need to be `__getbuffer__ `. I think we should be able to mostly 
reuse what is defined here: 
https://github.com/apache/arrow/blob/60b5ab9ee0bf070f03cf5c92fe0add0257543dfd/python/pyarrow/io.pxi#L1561-L1584
 with the buffer being `self.as_buffer()`.



-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to