From 8eee1afa0c0ed5b3c0567b3e0a6a4f42ac76ab08 Mon Sep 17 00:00:00 2001 From: Kevin Biju Date: Tue, 24 Oct 2023 21:49:30 +0530 Subject: [PATCH] support enum and other custom types(?) for Snowflake AVRO --- flow/connectors/postgres/qrep_query_executor.go | 4 ++-- flow/model/qvalue/avro_converter.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flow/connectors/postgres/qrep_query_executor.go b/flow/connectors/postgres/qrep_query_executor.go index 8c83beeaa5..c7d75c4500 100644 --- a/flow/connectors/postgres/qrep_query_executor.go +++ b/flow/connectors/postgres/qrep_query_executor.go @@ -103,12 +103,12 @@ func (qe *QRepQueryExecutor) fieldDescriptionsToSchema(fds []pgconn.FieldDescrip ctype := postgresOIDToQValueKind(fd.DataTypeOID) if ctype == qvalue.QValueKindInvalid { var err error - ctype = qvalue.QValueKind(qe.customTypeMap[fd.DataTypeOID]) if err != nil { - ctype = qvalue.QValueKindInvalid typeName, ok := qe.customTypeMap[fd.DataTypeOID] if ok { ctype = customTypeToQKind(typeName) + } else { + ctype = qvalue.QValueKindString } } } diff --git a/flow/model/qvalue/avro_converter.go b/flow/model/qvalue/avro_converter.go index 9b8db89d78..52aaa87500 100644 --- a/flow/model/qvalue/avro_converter.go +++ b/flow/model/qvalue/avro_converter.go @@ -1,7 +1,6 @@ package qvalue import ( - "errors" "fmt" "math/big" "time" @@ -123,7 +122,7 @@ func GetAvroSchemaFromQValueKind(kind QValueKind, nullable bool) (*QValueKindAvr AvroLogicalSchema: "string", }, nil default: - return nil, errors.New("unsupported QValueKind type") + return nil, fmt.Errorf("unsupported QValueKind type: %s", kind) } }