smiklosovic commented on code in PR #4115:
URL: https://github.com/apache/cassandra/pull/4115#discussion_r2058643906


##########
src/java/org/apache/cassandra/cql3/constraints/ScalarColumnConstraint.java:
##########
@@ -125,11 +127,18 @@ protected void internalEvaluate(AbstractType<?> 
valueType, ByteBuffer columnValu
     @Override
     public void validate(ColumnMetadata columnMetadata) throws 
InvalidConstraintDefinitionException
     {
+        returnType = columnMetadata.type;
+
+        if (!columnMetadata.name.equals(columnName))

Review Comment:
   I think this is a dead code
   
   ````
   cassandra@cqlsh> CREATE TABLE ks.tb6 (id int primary key, val int check val2 
> 5) ;
   cassandra@cqlsh> DESCRIBE ks.tb6;
   
   CREATE TABLE ks.tb6 (
       id int PRIMARY KEY,
       val int CHECK val > 5 -- here it will set it to `val` anyway
   ) 
   ````
   
   Because we are binding it later on, we do not need to check it here.
   
   But at the same time, it would be appropriate to extract this logic closer 
to CQL layer (in Cassandra Java code) because we want to still fail to tell 
user it is invalid.



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