From 7c02a59abf18b30db3450812d11bb661e8e5e11e Mon Sep 17 00:00:00 2001 From: Lyfee <1305633643@qq.com> Date: Sun, 19 Mar 2023 08:34:31 +0000 Subject: [PATCH] [bug fix] Fixed errors when convert clickhouse UUID to flink VARCHAR --- .../internal/converter/ClickHouseRowConverter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/flink/connector/clickhouse/internal/converter/ClickHouseRowConverter.java b/src/main/java/org/apache/flink/connector/clickhouse/internal/converter/ClickHouseRowConverter.java index b008467..3b5266f 100644 --- a/src/main/java/org/apache/flink/connector/clickhouse/internal/converter/ClickHouseRowConverter.java +++ b/src/main/java/org/apache/flink/connector/clickhouse/internal/converter/ClickHouseRowConverter.java @@ -26,6 +26,7 @@ import java.sql.Timestamp; import java.time.LocalDate; import java.time.LocalTime; +import java.util.UUID; import static org.apache.flink.connector.clickhouse.internal.converter.ClickHouseConverterUtils.BOOL_TRUE; import static org.apache.flink.connector.clickhouse.util.ClickHouseUtil.toEpochDayOneTimestamp; @@ -117,7 +118,10 @@ protected ClickHouseRowConverter.DeserializationConverter createToInternalConver return val -> TimestampData.fromInstant(((Timestamp) val).toInstant()); case CHAR: case VARCHAR: - return val -> StringData.fromString((String) val); + return val -> + val instanceof UUID + ? StringData.fromString(val.toString()) + : StringData.fromString((String) val); case ARRAY: case MAP: return val -> ClickHouseConverterUtils.toInternal(val, type);