This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch cassandra-6.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-6.0 by this push:
new f4fd1fbd00 PaxosV1MultiNodeTableWalkTest Failure - CAS on static
column w/empty bytes
f4fd1fbd00 is described below
commit f4fd1fbd0030baa1ca26bc30286214d59f1cbc31
Author: Minal Kyada <[email protected]>
AuthorDate: Fri Aug 21 12:09:27 2026 -0700
PaxosV1MultiNodeTableWalkTest Failure - CAS on static column w/empty bytes
patch by Minal Kyada; reviewed by Blake Eggleston, David Capwell for
CASSANDRA-21505
---
.../cassandra/harry/model/ASTSingleTableModel.java | 18 +++++++++++-------
.../org/apache/cassandra/cql3/ast/Conditional.java | 5 +++++
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git
a/test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
b/test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
index b3835c299c..7cf1892e8e 100644
--- a/test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
+++ b/test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java
@@ -935,10 +935,10 @@ public class ASTSingleTableModel
if (!where.lhs.type().equals(where.rhs.type()))
throw new UnsupportedOperationException("For now where clause
must always have matching types: given " + where.lhs.type() + ' ' +
where.rhs.type());
ByteBuffer lhs = where.lhs instanceof ReferenceExpression
- ? (ByteBuffer) extract((ReferenceExpression)
where.lhs, lets)
+ ? (ByteBuffer) extract((ReferenceExpression)
where.lhs, lets, who == Who.cas && where.kind.isEqualityBased())
: eval(where.lhs);
ByteBuffer rhs = where.rhs instanceof ReferenceExpression
- ? (ByteBuffer) extract((ReferenceExpression)
where.rhs, lets)
+ ? (ByteBuffer) extract((ReferenceExpression)
where.rhs, lets, who == Who.cas && where.kind.isEqualityBased())
: eval(where.rhs);
switch (who)
{
@@ -980,10 +980,14 @@ public class ASTSingleTableModel
}
}
- // Either ByteBuffer (cell) or ByteBuffer[] (row)
private static Object extract(ReferenceExpression expr, Map<String,
SelectResult> lets)
{
- Object result = extract0(expr, lets);
+ return extract(expr, lets, false);
+ }
+
+ private static Object extract(ReferenceExpression expr, Map<String,
SelectResult> lets, boolean preserveEmpty)
+ {
+ Object result = extract0(expr, lets, preserveEmpty);
if (result instanceof SelectResult)
{
var rows = ((SelectResult) result).rows;
@@ -993,14 +997,14 @@ public class ASTSingleTableModel
}
// o can be Map<String, SelectResult> (lets), SelectResult (row),
ByteBuffer (cell)
- private static Object extract0(ReferenceExpression expr, @Nullable Object
o)
+ private static Object extract0(ReferenceExpression expr, @Nullable Object
o, boolean preserveEmpty)
{
if (o == null) return null;
if (expr instanceof Reference)
{
Reference ref = (Reference) expr;
for (var symbol : ref.path)
- o = extract0(symbol, o);
+ o = extract0(symbol, o, preserveEmpty);
return o;
}
else if (expr instanceof Symbol)
@@ -1017,7 +1021,7 @@ public class ASTSingleTableModel
if (result.rows.length == 0)
return null;
ByteBuffer bb = result.rows[0][result.columns.indexOf(symbol)];
- if (bb != null && symbol.type().isNull(bb))
+ if (!preserveEmpty && bb != null && symbol.type().isNull(bb))
bb = null;
return bb;
}
diff --git a/test/unit/org/apache/cassandra/cql3/ast/Conditional.java
b/test/unit/org/apache/cassandra/cql3/ast/Conditional.java
index 2246ad0b3e..a891cfdba9 100644
--- a/test/unit/org/apache/cassandra/cql3/ast/Conditional.java
+++ b/test/unit/org/apache/cassandra/cql3/ast/Conditional.java
@@ -83,6 +83,11 @@ public interface Conditional extends Expression
this.value = value;
}
+ public boolean isEqualityBased()
+ {
+ return this == EQUAL || this == NOT_EQUAL;
+ }
+
public boolean test(AbstractType<?> type, ByteBuffer a, ByteBuffer
b)
{
int rc = type.compare(a, b);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]