belliottsmith commented on code in PR #4175: URL: https://github.com/apache/cassandra/pull/4175#discussion_r2116595084
########## 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 don't think we have a particularly good principled behaviour we can implement here, but I think treating empty as NULL wherever it is safe to do so, and unsafe to treat it as a raw value, is perhaps as good as we can get. -- 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