File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 2828#include " types.hpp"
2929#include " vector.hpp"
3030
31+ #include < algorithm>
32+
3133namespace datastax { namespace internal { namespace core {
3234
3335class Collection ;
@@ -365,11 +367,15 @@ class UserType : public DataType {
365367 return false ;
366368 }
367369
368- if (fields_.size () != user_type->fields_ .size ()) {
369- return false ;
370- }
371370
372- for (size_t i = 0 ; i < fields_.size (); ++i) {
371+ // UDT's can be considered equal as long as the mutual first fields shared
372+ // between them are equal. UDT's are append only as far as fields go, so a
373+ // newer 'version' of the UDT data type after a schema change event should be
374+ // treated as equivalent in this scenario, by simply looking at the first N
375+ // mutual fields they should share.
376+ size_t min_fields_size = std::min (fields_.size (), user_type->fields_ .size ());
377+
378+ for (size_t i = 0 ; i < min_fields_size; ++i) {
373379 if (fields_[i].name != user_type->fields_ [i].name ||
374380 !fields_[i].type ->equals (user_type->fields_ [i].type )) {
375381 return false ;
You can’t perform that action at this time.
0 commit comments