You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zhongyujiang (via GitHub)" <gi...@apache.org> on 2025/09/11 12:47:34 UTC
[PR] fix: correct type mismatch in BinaryEncoder write [iceberg-python]
zhongyujiang opened a new pull request, #2460:
URL: https://github.com/apache/iceberg-python/pull/2460
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
Some fsspec write implementations expect the input data to be `bytes`, such as in JuiceFS: https://github.com/juicedata/juicefs/blob/main/sdk/python/juicefs/juicefs/juicefs.py#L514.
But currently, some places in `BinaryEncoder` use `bytearray`, which can cause exceptions when writing the manifest.
```text
raise TypeError(f"a bytes-like object is required, not '{type(data).__name__}'")
TypeError: a bytes-like object is required, not 'bytearray'
```
I ran into this issue while adding Juice filesystem support, so this PR fixes the data type written by `BinaryEncoder` to `bytes` in order to resolve it.
Currently, `pyiceberg.io.OutputStream.write` is also annotated to accept data of type `bytes.`
## Are these changes tested?
It seems that the filesystems currently supported in pyiceberg do not strictly require the write input to be of type `bytes`, so I didn’t add a test. I tested this on our internal Juice filesystem, and it works.
## Are there any user-facing changes?
No
<!-- In the case of user-facing changes, please add the changelog label. -->
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix: correct type mismatch in BinaryEncoder write [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #2460:
URL: https://github.com/apache/iceberg-python/pull/2460
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org