maedhroz commented on code in PR #4175: URL: https://github.com/apache/cassandra/pull/4175#discussion_r2144172628
########## src/java/org/apache/cassandra/service/accord/txn/TxnCondition.java: ########## @@ -289,54 +291,99 @@ public boolean applies(TxnData data) FilteredPartition partition = reference.getPartition(data); boolean exists = partition != null && !partition.isEmpty(); - Row row = null; - if (exists) + if (reference.column() != null + && !reference.column().isPartitionKey()) { - row = reference.getRow(partition); - exists = row != null && !row.isEmpty(); - } - - if (exists && reference.selectsColumn()) - { - ColumnData columnData = reference.getColumnData(row); - - if (columnData == null) + Row row = null; + if (exists) { - exists = false; + row = reference.getRow(partition); + exists = row != null && !row.isEmpty(); } - else if (columnData.column().isComplex()) + + if (exists && reference.selectsColumn()) { - if (reference.isElementSelection() || reference.isFieldSelection()) + ColumnData columnData = reference.getColumnData(row); + + if (columnData == null) + { + exists = false; + } + else if (columnData.column().isComplex()) + { + if (reference.isElementSelection()) + { + Cell<?> cell = (Cell<?>) columnData; + exists = !cell.isTombstone(); + // Collections don't support NULL but meangingless null types are supported, so byte[0] is allowed! + // This is NULL when touched, so need to still check each value + if (exists) + { + CollectionType<?> type = (CollectionType<?>) reference.column().type.unwrap(); + switch (type.kind) + { + case MAP: + { + exists = !type.nameComparator().isNull(cell.path().get(0)); Review Comment: I haven't thought about this in a while, but can we just reject the txn if we use a meaningless key? If we can't, then agree... `map[null]` on a map w/ `int` keys is nonsense and should evaluate to `true` on `IS NULL` -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org