From c888481ce71d21c074d7084c40d5372c2897fcc8 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Tue, 13 Feb 2024 04:09:26 +0530 Subject: [PATCH] set correct avro schema for clickhouse date --- flow/model/qvalue/avro_converter.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flow/model/qvalue/avro_converter.go b/flow/model/qvalue/avro_converter.go index d49697ca7d..74bbf3b855 100644 --- a/flow/model/qvalue/avro_converter.go +++ b/flow/model/qvalue/avro_converter.go @@ -85,6 +85,13 @@ func GetAvroSchemaFromQValueKind(kind QValueKind, targetDWH QDWHType, precision if kind == QValueKindTime { return "string", nil } + if kind == QValueKindDate { + return AvroSchemaField{ + Name: "date", + Type: "int", + LogicalType: "date", + }, nil + } return "long", nil } return "string", nil @@ -267,7 +274,7 @@ func (c *QValueAvroConverter) ToAvroValue() (interface{}, error) { } } - if c.Nullable && c.TargetDWH == QDWHTypeBigQuery { + if c.Nullable { return goavro.Union("int.date", t), nil } return t, nil