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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to