worryg0d commented on code in PR #1942:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1942#discussion_r3085562078


##########
types.go:
##########
@@ -593,21 +597,36 @@ func (r *RegisteredTypes) Copy() *RegisteredTypes {
 
        copy := &RegisteredTypes{}
        copy.init()
+       // Adding default types to the copy so collection type codecs will have 
a pointer to the copy instead of the original.
+       copy.addDefaultTypes()

Review Comment:
   As marshaling/unmarshaling is implemented on `TypeInfo` types, we should 
somehow propagate its behavior from the cluster config. Collection types such 
as `udtCqlType` hold a pointer to `RegisteredTypes` object to know how to 
marshal/unmarshal different types. The problem was that in `NewSession`, where 
we create a copy of the provided `RegisteredTypes` by calling 
`RegisteredTypes.Copy()`, which just initializes a new object and populates 
maps with values from the original map, which includes a pointer to the 
original `RegisteredTypes.`
   
   Fixed it by calling `addDefaultTypes()` on a copy and adding missing 
types/names/aliases to the copy.



-- 
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]

Reply via email to