maedhroz commented on code in PR #1962:
URL: https://github.com/apache/cassandra/pull/1962#discussion_r1042488468


##########
src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java:
##########
@@ -160,18 +169,30 @@ protected ModificationStatement 
prepareInternal(TableMetadata metadata,
                 if (def.isClusteringColumn())
                     hasClusteringColumnsSet = true;
 
-                Term.Raw value = columnValues.get(i);
+                Object value = columnValues.get(i);
 
                 if (def.isPrimaryKeyColumn())
                 {
-                    whereClause.add(new 
SingleColumnRelation(columnNames.get(i), Operator.EQ, value));
+                    checkTrue(value instanceof Term.Raw, "value references 
can't be used with primary key columns");
+                    whereClause.add(new 
SingleColumnRelation(columnNames.get(i), Operator.EQ, (Term.Raw) value));
                 }
-                else
+                else if (value instanceof ReferenceValue.Raw)
+                {
+                    ReferenceValue.Raw raw = (ReferenceValue.Raw) value;
+                    ReferenceValue referenceValue = raw.prepare(def, 
bindVariables);
+                    ReferenceOperation operation = new ReferenceOperation(def, 
TxnReferenceOperation.Kind.setterFor(def), null, null, referenceValue);
+                    operations.add(def, operation);
+                }
+                else if (value instanceof Term.Raw)
                 {
-                    Operation operation = new 
Operation.SetValue(value).prepare(metadata, def, !conditions.isEmpty());
+                    Operation operation = new Operation.SetValue((Term.Raw) 
value).prepare(metadata, def, !conditions.isEmpty());
                     operation.collectMarkerSpecification(bindVariables);
                     operations.add(operation);
                 }
+                else
+                {
+                    throw new IllegalStateException();

Review Comment:
   Might not even be necessary if we switch to `Term.Raw` above...



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