Skip to content

Commit

Permalink
support enum and other custom types(?) for Snowflake AVRO (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Oct 24, 2023
1 parent df876a0 commit 3b17895
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flow/connectors/postgres/qrep_query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions flow/model/qvalue/avro_converter.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package qvalue

import (
"errors"
"fmt"
"math/big"
"time"
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 3b17895

Please sign in to comment.