dcapwell commented on code in PR #4175:
URL: https://github.com/apache/cassandra/pull/4175#discussion_r2100635113


##########
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:
   im still not 100% sold on this, here is the test that hits this
   
   ```
   map<int, int>
   
   IF row.map[<empty>] IS NULL -- returns true as the key is "null".  The data 
has map[<empty>] -> 42
   IF row.map[42] IS NULL -- returns true if the value is <empty>
   ```



-- 
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

Reply via email to