Skip to content

CASSANDRA-21625 Column Comparison with null NPEs for Accord Transaction - #5073

Open
alanwang67 wants to merge 3 commits into
apache:trunkfrom
alanwang67:more-potential-npes
Open

CASSANDRA-21625 Column Comparison with null NPEs for Accord Transaction#5073
alanwang67 wants to merge 3 commits into
apache:trunkfrom
alanwang67:more-potential-npes

Conversation

@alanwang67

Copy link
Copy Markdown
Contributor

The following transaction NPEs, we should instead reject transactions that compare a column with null. IS NULL/IS NOT NULL should be used instead.

BEGIN TRANSACTION
LET row1 = (SELECT * FROM distributed_test_keyspace.accordtbl0 WHERE k=1);
IF row1.v = null THEN
        UPDATE distributed_test_keyspace.accordtbl0 SET v=1 WHERE k=1;
END IF
COMMIT TRANSACTION

patch by Alan Wang;

reviewed by for CASSANDRA-21625

Co-authored-by: Name1
Co-authored-by: Name2

{
super(kind);
Invariants.requireArgument(KINDS.contains(kind), "Kind " + kind + " cannot be used with a value condition");
Invariants.requireArgument(value != null, "Value conditions require a non null comparison value");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be best to do something like value = reference.type().santize(value) or check isNull here... that is just to handle "meaningless emptyness" (legacy concept from thrift days, but it impacts many common types like int)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants