Skip to content

Commit

Permalink
support enum and other custom types(?) for Snowflake AVRO
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal committed Oct 24, 2023
1 parent 7b566b0 commit 4ed74b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 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
2 changes: 1 addition & 1 deletion flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func customTypeToQKind(typeName string) qvalue.QValueKind {
}

func GeoValidate(hexWkb string) error {
log.Infof("Validating geometry shape %s", hexWkb)
log.Debugf("Validating geometry shape %s", hexWkb)
// Decode the WKB hex string into binary
wkb, hexErr := hex.DecodeString(hexWkb)
if hexErr != nil {
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 4ed74b7

Please sign in to comment.