amoeba commented on issue #46073:
URL: https://github.com/apache/arrow/issues/46073#issuecomment-2797159259
Thanks @antspy, this is caused by Polars using an Arrow type Arrow JS
doesn't support here. Ideally Arrow JS would support it but for now you can
work around it by specifying the `compat_level` arg to `write_ipc`. In your
case, without this set, Polars uses StringView for the field (which Arrow JS
doesn't support) and with `compat_level` set to `oldest`, Polars will use a
LargeString (which Arrow JS _does_ support).
Can you please try this new code?
```python
@router.get("/df")
def df() -> Response:
"""Returns a sample polars dataframe in ipc format."""
...
buffer = pl.Dataframe({"test": ["a", "b", "c"]}).write_ipc(
None, compression="uncompressed",
compat_level=pl.CompatLevel.oldest()
)
buffer.seek(0)
return Response(
buffer.getvalue(),
media_type="application/octet-stream",
headers={"Content-Type": "application/octet-stream"},
)
```
--
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]