Skip to content

Commit

Permalink
set correct avro schema for clickhouse date
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Feb 12, 2024
1 parent e7dbab2 commit c888481
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flow/model/qvalue/avro_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c888481

Please sign in to comment.