|
2 | 2 |
|
3 | 3 | import com.clickhouse.client.api.Client; |
4 | 4 | import com.clickhouse.client.api.ClientFaultCause; |
| 5 | +import com.clickhouse.data.ClickHouseAggregateFunction; |
5 | 6 | import com.clickhouse.data.ClickHouseColumn; |
6 | 7 | import com.clickhouse.data.format.BinaryStreamUtils; |
| 8 | +import com.clickhouse.data.value.ClickHouseBitmap; |
| 9 | + |
7 | 10 | import org.slf4j.Logger; |
8 | 11 | import org.slf4j.LoggerFactory; |
9 | 12 |
|
@@ -43,6 +46,9 @@ public static void serializeData(OutputStream stream, Object value, ClickHouseCo |
43 | 46 | case Map: |
44 | 47 | serializeMapData(stream, value, column); |
45 | 48 | break; |
| 49 | + case AggregateFunction: |
| 50 | + serializeAggregateFunction(stream, value, column); |
| 51 | + break; |
46 | 52 | default: |
47 | 53 | serializePrimitiveData(stream, value, column); |
48 | 54 | break; |
@@ -177,6 +183,13 @@ private static void serializePrimitiveData(OutputStream stream, Object value, Cl |
177 | 183 | } |
178 | 184 | } |
179 | 185 |
|
| 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 | + } |
180 | 193 |
|
181 | 194 | public static Integer convertToInteger(Object value) { |
182 | 195 | if (value instanceof Integer) { |
|
0 commit comments