File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 28
28
#include " types.hpp"
29
29
#include " vector.hpp"
30
30
31
+ #include < algorithm>
32
+
31
33
namespace datastax { namespace internal { namespace core {
32
34
33
35
class Collection ;
@@ -365,11 +367,15 @@ class UserType : public DataType {
365
367
return false ;
366
368
}
367
369
368
- if (fields_.size () != user_type->fields_ .size ()) {
369
- return false ;
370
- }
371
370
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) {
373
379
if (fields_[i].name != user_type->fields_ [i].name ||
374
380
!fields_[i].type ->equals (user_type->fields_ [i].type )) {
375
381
return false ;
You can’t perform that action at this time.
0 commit comments