Skip to content

Commit 1469ac7

Browse files
authored
Expose several methods as public (#2612)
* Expose several methods as public * Added comment internal API do not use.
1 parent 1e525e7 commit 1469ac7

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ public static void writeDynamicTypeTag(OutputStream stream, ClickHouseColumn typ
415415
}
416416
}
417417

418+
/**
419+
DO NOT USE - part of internal API that will be changed
420+
*/
418421
public static void serializeArrayData(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
419422
if (value == null) {
420423
writeVarInt(stream, 0);
@@ -441,7 +444,10 @@ public static void serializeArrayData(OutputStream stream, Object value, ClickHo
441444
}
442445
}
443446

444-
private static void serializeTupleData(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
447+
/**
448+
DO NOT USE - part of internal API that will be changed
449+
*/
450+
public static void serializeTupleData(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
445451
//Serialize the tuple to the stream
446452
//The tuple is a list of values
447453
if (value instanceof List) {
@@ -459,7 +465,10 @@ private static void serializeTupleData(OutputStream stream, Object value, ClickH
459465
}
460466
}
461467

462-
private static void serializeMapData(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
468+
/**
469+
DO NOT USE - part of internal API that will be changed
470+
*/
471+
public static void serializeMapData(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
463472
//Serialize the map to the stream
464473
//The map is a list of key-value pairs
465474
Map<?, ?> map = (Map<?, ?>) value;
@@ -600,7 +609,7 @@ private static void serializePrimitiveData(OutputStream stream, Object value, Cl
600609
}
601610
}
602611

603-
private static void serializeInterval(OutputStream stream, ClickHouseColumn column, Object value) throws IOException {
612+
public static void serializeInterval(OutputStream stream, ClickHouseColumn column, Object value) throws IOException {
604613
long v;
605614

606615
if (value instanceof Duration) {
@@ -670,7 +679,7 @@ private static void serializeTime64(OutputStream stream, Object value) throws IO
670679
}
671680
}
672681

673-
private static void serializeEnumData(OutputStream stream, ClickHouseColumn column, Object value) throws IOException {
682+
public static void serializeEnumData(OutputStream stream, ClickHouseColumn column, Object value) throws IOException {
674683
int enumValue = -1;
675684
if (value instanceof String) {
676685
enumValue = column.getEnumConstants().value((String) value);
@@ -691,15 +700,15 @@ private static void serializeEnumData(OutputStream stream, ClickHouseColumn colu
691700
}
692701
}
693702

694-
private static void serializeJSON(OutputStream stream, Object value) throws IOException {
703+
public static void serializeJSON(OutputStream stream, Object value) throws IOException {
695704
if (value instanceof String) {
696705
BinaryStreamUtils.writeString(stream, (String)value);
697706
} else {
698707
throw new UnsupportedOperationException("Serialization of Java object to JSON is not supported yet.");
699708
}
700709
}
701710

702-
private static void serializerVariant(OutputStream out, ClickHouseColumn column, Object value) throws IOException {
711+
public static void serializerVariant(OutputStream out, ClickHouseColumn column, Object value) throws IOException {
703712
int typeOrdNum = column.getVariantOrdNum(value);
704713
if (typeOrdNum != -1) {
705714
BinaryStreamUtils.writeUnsignedInt8(out, typeOrdNum);
@@ -714,7 +723,7 @@ private static void serializerVariant(OutputStream out, ClickHouseColumn column,
714723
private static final ClickHouseColumn GEO_POLYGON_ARRAY = ClickHouseColumn.parse("geopolygin Array(Array(Tuple(Float64, Float64)))").get(0);
715724
private static final ClickHouseColumn GEO_MULTI_POLYGON_ARRAY = ClickHouseColumn.parse("geomultipolygin Array(Array(Array(Tuple(Float64, Float64))))").get(0);
716725

717-
private static void serializeAggregateFunction(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
726+
public static void serializeAggregateFunction(OutputStream stream, Object value, ClickHouseColumn column) throws IOException {
718727
if (column.getAggregateFunction() == ClickHouseAggregateFunction.groupBitmap) {
719728
if (value == null) {
720729
throw new IllegalArgumentException("Cannot serialize null value for aggregate function: " + column.getAggregateFunction());

0 commit comments

Comments
 (0)