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


##########
src/java/org/apache/cassandra/db/filter/RowFilter.java:
##########
@@ -705,7 +705,7 @@ public boolean isSatisfiedBy(TableMetadata metadata, 
DecoratedKey partitionKey,
                 if (column.type.isCounter())
                 {
                     ByteBuffer foundValue = getValue(metadata, partitionKey, 
row);
-                    if (foundValue == null)
+                    if (foundValue == null || foundValue.remaining() == 0)

Review Comment:
   I am also curious why we have empty bytes rather than `null` in this case... 
this implies that the pattern of
   
   ```
   Cell<?> cell = row.getCell(column);
   return cell == null ? null : cell.buffer();
   ```
   
   is unsafe and has always been wrong... yet this pattern is common...
   
   ```
   $ grep -r 'cell == null ? null : cell.buffer()' src/
   src//java/org/apache/cassandra/db/marshal/MapType.java:            return 
cell == null ? null : cell.buffer();
   src//java/org/apache/cassandra/db/marshal/ListType.java:            return 
cell == null ? null : cell.buffer();
   src//java/org/apache/cassandra/db/marshal/UserType.java:            return 
cell == null ? null : cell.buffer();
   src//java/org/apache/cassandra/db/filter/RowFilter.java:                    
return cell == null ? null : cell.buffer();
   src//java/org/apache/cassandra/index/internal/CassandraIndex.java:           
                    cell == null ? null : cell.buffer()
   ```



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

Reply via email to