Skip to content

Commit 9812103

Browse files
committed
Including support for bitmap serialization
1 parent f3a4ab8 commit 9812103

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

client-v2/src/main/java/com/clickhouse/client/api/internal/SerializerUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
import com.clickhouse.client.api.Client;
44
import com.clickhouse.client.api.ClientFaultCause;
5+
import com.clickhouse.data.ClickHouseAggregateFunction;
56
import com.clickhouse.data.ClickHouseColumn;
67
import com.clickhouse.data.format.BinaryStreamUtils;
8+
import com.clickhouse.data.value.ClickHouseBitmap;
9+
710
import org.slf4j.Logger;
811
import org.slf4j.LoggerFactory;
912

@@ -43,6 +46,9 @@ public static void serializeData(OutputStream stream, Object value, ClickHouseCo
4346
case Map:
4447
serializeMapData(stream, value, column);
4548
break;
49+
case AggregateFunction:
50+
serializeAggregateFunction(stream, value, column);
51+
break;
4652
default:
4753
serializePrimitiveData(stream, value, column);
4854
break;
@@ -177,6 +183,13 @@ private static void serializePrimitiveData(OutputStream stream, Object value, Cl
177183
}
178184
}
179185

186+
private static void serializeAggregateFunction(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
187+
if (column.getAggregateFunction() == ClickHouseAggregateFunction.groupBitmap) {
188+
BinaryStreamUtils.writeBitmap(stream, (ClickHouseBitmap) value);
189+
} else {
190+
throw new UnsupportedOperationException("Unsupported aggregate function: " + column.getAggregateFunction());
191+
}
192+
}
180193

181194
public static Integer convertToInteger(Object value) {
182195
if (value instanceof Integer) {

0 commit comments

Comments
 (0)