value validator in the cli does not pick up
-------------------------------------------

                 Key: CASSANDRA-3553
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3553
             Project: Cassandra
          Issue Type: Bug
            Reporter: Jackson Chung
            Priority: Minor


the summary is probably confusion, so here is an example:

{noformat}
[default@testks] describe testcf;
    ColumnFamily: testcf
      Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
      Default column value validator: org.apache.cassandra.db.marshal.LongType
      Columns sorted by: org.apache.cassandra.db.marshal.LongType
{noformat}

notice both column and column value are under LongType

in the cli (without assume):

[default@testks] set testcf['foo'][1293843587]=30; 
null
InvalidRequestException(why:(Expected 8 or 0 byte long (2)) 
[testks][testcf][1293843587] failed validation)
        at 
org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:15198)
        at 
org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:858)
        at 
org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:830)
        at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:902)
        at 
org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:216)
        at 
org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:220)
        at org.apache.cassandra.cli.CliMain.main(CliMain.java:346)

so the above so the value cannot be validated, so now lets try to change the 
column name also:

[default@testks] set testcf['foo'][30]=30;               
null
InvalidRequestException(why:(Expected 8 or 0 byte long (2)) 
[testks][testcf][30] failed validation)
        at 
org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:15198)
        at 
org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:858)
        at 
org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:830)
        at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:902)
        at 
org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:216)
        at 
org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:220)
        at org.apache.cassandra.cli.CliMain.main(CliMain.java:346)

now lets set value with 8 characters:

[default@testks] set testcf['foo'][30]=12345678;  
Value inserted.

so that shows column is fine, only the value part is not fine. put it in assume 
or long() works:

[default@testks] assume testcf validator as long;
Assumption for column family 'testcf' added successfully.
[default@testks] set testcf['foo'][30]=30;       
Value inserted.


or (restart to a new session to un-assume):

[default@testks] set testcf['foo'][30]=long(30);         
Value inserted.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to