You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/12/26 03:10:03 UTC

[incubator-doris] branch master updated: [fix](spark-load) fix Roaring64Map big-endian read/write in de/serialization (#7480)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ab60c5e  [fix](spark-load) fix Roaring64Map big-endian read/write in de/serialization (#7480)
ab60c5e is described below

commit ab60c5eb5956a7ea21101ea4519b8a893800054e
Author: Xiang Wei <we...@gmail.com>
AuthorDate: Sun Dec 26 11:09:50 2021 +0800

    [fix](spark-load) fix Roaring64Map big-endian read/write in de/serialization (#7480)
    
    See #7479
    This bug is triggered when the bitmap exceeds 32 bits.
---
 .../src/main/java/org/apache/doris/common/io/Roaring64Map.java      | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/io/Roaring64Map.java b/fe/fe-common/src/main/java/org/apache/doris/common/io/Roaring64Map.java
index 5a20138..bf35f5a 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/io/Roaring64Map.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/io/Roaring64Map.java
@@ -1322,7 +1322,8 @@ public class Roaring64Map {
         Codec.encodeVarint64(highToBitmap.size(), out);
 
         for (Map.Entry<Integer, BitmapDataProvider> entry : highToBitmap.entrySet()) {
-            out.writeInt(entry.getKey().intValue());
+            // serialized in little end for BE cpp read in case of bugs when the value is larger than 32bits
+            out.writeInt(Integer.reverseBytes(entry.getKey().intValue()));
             entry.getValue().serialize(out);
         }
     }
@@ -1356,7 +1357,8 @@ public class Roaring64Map {
 
         long nbHighs = Codec.decodeVarint64(in);
         for (int i = 0; i < nbHighs; i++) {
-            int high = in.readInt();
+            // keep the same behavior with little-end serialize
+            int high = Integer.reverseBytes(in.readInt());
             RoaringBitmap provider = new RoaringBitmap();
             provider.deserialize(in);
             highToBitmap.put(high, provider);

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org