lukasz-antoniak commented on code in PR #1828:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1828#discussion_r1818857839
##########
helpers.go:
##########
@@ -236,19 +274,48 @@ func splitCompositeTypes(name string) []string {
}
func apacheToCassandraType(t string) string {
- t = strings.Replace(t, apacheCassandraTypePrefix, "", -1)
t = strings.Replace(t, "(", "<", -1)
t = strings.Replace(t, ")", ">", -1)
types := strings.FieldsFunc(t, func(r rune) bool {
return r == '<' || r == '>' || r == ','
})
- for _, typ := range types {
- t = strings.Replace(t, typ,
getApacheCassandraType(typ).String(), -1)
+ skip := 0
+ for _, class := range types {
+ class = strings.TrimSpace(class)
+ if !isDigitsOnly(class) {
+ // vector types include dimension (digits) as second
type parameter
+ // UDT fields are represented in format {field
id}:{class}, example
66697273745f6e616d65:org.apache.cassandra.db.marshal.UTF8Type
+ if skip > 0 {
+ skip -= 1
+ continue
+ }
+ idx := strings.Index(class, ":")
+ class = class[idx+1:]
+ act := getApacheCassandraType(class)
+ val := act.String()
+ switch act {
+ case TypeUDT:
+ val = "udt"
+ skip = 2 // skip next two parameters (keyspace
and type ID), do not attempt to resolve their type
+ case TypeCustom:
+ val = getApacheCassandraCustomSubType(class)
Review Comment:
Vector type is implemented as special custom type and not top level type in
the
[protocol](https://github.com/datastax/go-cassandra-native-protocol/blob/main/specs/native_protocol_v5.spec#L822).
`getApacheCassandraType` handles only top level types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]