paleolimbot commented on issue #35531:
URL: https://github.com/apache/arrow/issues/35531#issuecomment-1561118107
> Or, whether such conversion should be supported or rather an error should
be raised.
I think you could do both via `schema=None` as the default? That's the case
most of the time anyway ("just get me this array").
```python
class Integerish:
def __arrow_c_array__(self, schema=None):
if schema is not None and :
raise ValueError("Only default export supported")
return make_array_capsule(self), make_int_schema_capsule()
```
Of course, if `schema` happens to be the correct type this will still error.
In R/nanoarrow I also have `infer_nanoarrow_schema()` (the type the array
*would* be if it were requested) so a consumer that, say, only supports signed
integer types can choose the appropriate signed type if `___arrow_c_schema__()`
returns an unsigned one. A producer like pyarrow can cast no problem (more
minimal producers would probably just error).
--
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]