You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clickhouse-client/src/main/java/com/clickhouse/client/data/ClickHouseBitmap.java
+37-21Lines changed: 37 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -177,11 +177,16 @@ public void serialize(ByteBuffer buffer) {
177
177
}
178
178
179
179
byte[] bytes = bas.toByteArray();
180
-
for (inti = 4; i > 0; i--) {
181
-
buffer.put(bytes[i]);
180
+
if (Roaring64NavigableMap.SERIALIZATION_MODE == Roaring64NavigableMap.SERIALIZATION_MODE_PORTABLE) {
181
+
// In Roaring64NavigableMap SERIALIZATION_MODE_PORTABLE mode, binary serialization data consistent with the CRoaring. No other special processing is required
182
+
buffer.put(bytes, 0, size);
183
+
} else {
184
+
for (inti = 4; i > 0; i--) {
185
+
buffer.put(bytes[i]);
186
+
}
187
+
buffer.putInt(0);
188
+
buffer.put(bytes, 5, size - 5);
182
189
}
183
-
buffer.putInt(0);
184
-
buffer.put(bytes, 5, size - 5);
185
190
} catch (IOExceptione) {
186
191
thrownewIllegalStateException("Failed to serialize given bitmap", e);
187
192
}
@@ -362,18 +367,23 @@ public static ClickHouseBitmap deserialize(DataInputStream in, ClickHouseDataTyp
362
367
b.deserialize(flip(newBuffer(len).put(bytes)));
363
368
rb = ClickHouseBitmap.wrap(b, innerType);
364
369
} else {
365
-
// TODO implement a wrapper of DataInput to get rid of byte array here
366
-
bytes[0] = (byte) 0; // always unsigned
367
-
// read map size in big-endian byte order
368
-
for (inti = 4; i > 0; i--) {
369
-
bytes[i] = in.readByte();
370
+
if (Roaring64NavigableMap.SERIALIZATION_MODE == Roaring64NavigableMap.SERIALIZATION_MODE_PORTABLE) {
371
+
// In Roaring64NavigableMap SERIALIZATION_MODE_PORTABLE mode, binary serialization data consistent with the CRoaring
372
+
in.readFully(bytes, 0 ,len);
373
+
} else {
374
+
// TODO implement a wrapper of DataInput to get rid of byte array here
0 commit comments