[GitHub] incubator-flink pull request: Serialized String comparison, Unicod...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-flink pull request: Serialized String comparison, Unicod...

zentol
Github user zentol commented on the pull request:

    https://github.com/apache/incubator-flink/pull/4#issuecomment-46657696
 
    yes, currently one bit is used to designate that another byte is coming. (this is also what the current code in this PR does)
    this means though, that if you look only at single bytes, (as this loop would do)
    ```
    for (int pos = 0; pos < len && (cmp = (string1[pos] - string2[pos])) == 0; pos++);
    ```
    you wouldnt be able to tell whether you look at a 3 or 2 byte long character. if you want to compare on the pure serialized data bytewise, you have to know at which position you are; since characters may end up 3 bytes long you need 2 bits to flag the position, reducing the payload to 6 bits, into which letters dont fit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---