maedhroz commented on code in PR #2049:
URL: https://github.com/apache/cassandra/pull/2049#discussion_r1061941220
##########
src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java:
##########
@@ -210,13 +230,51 @@ public static ColumnCondition condition(ColumnMetadata
column, FieldIdentifier u
return new UDTFieldCondition(column, udtField, op, terms);
}
+ /*
+ * Don't change or remove entries (and ordinals) or it will break cross
version compatibility
+ * as the ordinals are sent in messages and stored by Accord for in flight
transactions
+ */
+ enum BoundKind
+ {
+ ELEMENT_ACCESS,
+ MULTI_CELL_COLLECTION,
+ MULTI_CELL_UDT,
+ SIMPLE,
+ UDT_FIELD_ACCESS;
+
+ @SuppressWarnings("rawtypes")
+ BoundSerializer serializer()
+ {
+ switch(this)
+ {
+ case ELEMENT_ACCESS:
+ return ElementAccessBound.serializer;
+ case MULTI_CELL_COLLECTION:
+ return MultiCellCollectionBound.serializer;
+ case MULTI_CELL_UDT:
+ return MultiCellUdtBound.serializer;
+ case SIMPLE:
+ return SimpleBound.serializer;
+ case UDT_FIELD_ACCESS:
+ return UDTFieldAccessBound.serializer;
+ default:
+ throw new AssertionError("Shouldn't have an enum with no
serializer");
+ }
+ }
+ }
Review Comment:
Might be simpler to do something like...
```
enum BoundKind
{
ELEMENT_ACCESS(ElementAccessBound.serializer),
MULTI_CELL_COLLECTION(MultiCellCollectionBound.serializer),
MULTI_CELL_UDT(MultiCellUdtBound.serializer),
SIMPLE(SimpleBound.serializer),
UDT_FIELD_ACCESS(UDTFieldAccessBound.serializer);
private final BoundSerializer<Bound> serializer;
@SuppressWarnings("unchecked")
BoundKind(BoundSerializer<? extends Bound> serializer)
{
this.serializer = (BoundSerializer<Bound>) serializer;
}
BoundSerializer<Bound> serializer()
{
return serializer;
}
}
```
--
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]