@@ -337,31 +337,14 @@ func splitCompositeTypes(name string, typeOpen int32, typeClose int32) []string
337337
338338// Convert long Java style type definition into the short CQL type names.
339339func apacheToCassandraType (t string ) string {
340+ t = strings .Replace (t , apacheCassandraTypePrefix , "" , - 1 )
340341 t = strings .Replace (t , "(" , "<" , - 1 )
341342 t = strings .Replace (t , ")" , ">" , - 1 )
342343 types := strings .FieldsFunc (t , func (r rune ) bool {
343344 return r == '<' || r == '>' || r == ','
344345 })
345- for i := 0 ; i < len (types ); i ++ {
346- class := strings .TrimSpace (types [i ])
347- // UDT fields are represented in format {field id}:{class}, example 66697273745f6e616d65:org.apache.cassandra.db.marshal.UTF8Type
348- // Do not override hex encoded field names
349- idx := strings .Index (class , ":" )
350- class = class [idx + 1 :]
351- val := ""
352- if strings .HasPrefix (class , apacheCassandraTypePrefix ) {
353- act := getApacheCassandraType (class )
354- val = act .String ()
355- switch act {
356- case TypeUDT :
357- i += 2 // skip next two parameters (keyspace and type ID), do not attempt to resolve their type
358- case TypeCustom :
359- val = getApacheCassandraCustomSubType (class )
360- }
361- } else {
362- val = class
363- }
364- t = strings .Replace (t , class , val , - 1 )
346+ for _ , typ := range types {
347+ t = strings .Replace (t , typ , getApacheCassandraType (typ ).String (), - 1 )
365348 }
366349 // This is done so it exactly matches what Cassandra returns
367350 return strings .Replace (t , "," , ", " , - 1 )
@@ -424,16 +407,6 @@ func getApacheCassandraType(class string) Type {
424407 }
425408}
426409
427- // Dedicated function parsing known special subtypes of CQL custom type.
428- // Currently, only vectors are implemented as special custom subtype.
429- func getApacheCassandraCustomSubType (class string ) string {
430- switch strings .TrimPrefix (class , apacheCassandraTypePrefix ) {
431- case "VectorType" :
432- return "vector"
433- }
434- return "custom"
435- }
436-
437410func (r * RowData ) rowMap (m map [string ]interface {}) {
438411 for i , column := range r .Columns {
439412 val := dereference (r .Values [i ])
0 commit comments