LiangliangSui commented on PR #1565:
URL: https://github.com/apache/incubator-fury/pull/1565#issuecomment-2078502208
> In `MetaStringEncoder.java`, we use `0x08`:
>
> ```java
> boolean stripLastChar = bytes.length * 8 >= totalBits + bitsPerChar;
> if (stripLastChar) {
> bytes[0] = (byte) (bytes[0] | 0x80);
> }
> ```
>
> In `MetaString.java`, we use `0b1`:
>
> ```java
> if (encoding != Encoding.UTF_8) {
> Preconditions.checkArgument(bytes.length > 0);
> this.stripLastChar = (bytes[0] & 0b1) != 0;
> } else {
> this.stripLastChar = false;
> }
> ```
>
> These two are not consistent.
Thanks for pointing out this issue, this is indeed a bug and our unit tests
don't cover it.
`0x80` should also be used in `MetaString`.
```java
if (encoding != Encoding.UTF_8) {
Preconditions.checkArgument(bytes.length > 0);
this.stripLastChar = (bytes[0] & 0x80) != 0;
} else {
this.stripLastChar = false;
}
```
Do you want to submit a PR to fix this issue and add unit tests? @qingoba
--
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]