mirror of https://github.com/apache/cassandra
Allow custom types in CLI's assume command
patch by xedin; reviewed by slebresne for CASSANDRA-4081
This commit is contained in:
parent
b85d44a25b
commit
7326ba8879
|
|
@ -14,6 +14,7 @@
|
|||
* ensure that directory is selected for compaction for user-defined
|
||||
tasks and upgradesstables (CASSANDRA-3985)
|
||||
* fix NPE on invalid CQL delete command (CASSANDRA-3755)
|
||||
* allow custom types in CLI's assume command (CASSANDRA-4081)
|
||||
|
||||
|
||||
1.0.8
|
||||
|
|
|
|||
|
|
@ -301,8 +301,8 @@ truncateStatement
|
|||
;
|
||||
|
||||
assumeStatement
|
||||
: ASSUME columnFamily assumptionElement=Identifier 'AS' defaultType=Identifier
|
||||
-> ^(NODE_ASSUME columnFamily $assumptionElement $defaultType)
|
||||
: ASSUME columnFamily assumptionElement=Identifier 'AS' entityName
|
||||
-> ^(NODE_ASSUME columnFamily $assumptionElement entityName)
|
||||
;
|
||||
|
||||
consistencyLevelStatement
|
||||
|
|
|
|||
|
|
@ -1491,17 +1491,25 @@ public class CliClient
|
|||
AbstractType comparator;
|
||||
|
||||
// Could be UTF8Type, IntegerType, LexicalUUIDType etc.
|
||||
String defaultType = statement.getChild(2).getText();
|
||||
String defaultType = CliUtils.unescapeSQLString(statement.getChild(2).getText());
|
||||
|
||||
try
|
||||
{
|
||||
comparator = Function.valueOf(defaultType.toUpperCase()).getValidator();
|
||||
comparator = TypeParser.parse(defaultType);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ConfigurationException e)
|
||||
{
|
||||
String functions = Function.getFunctionNames();
|
||||
sessionState.out.println("Type '" + defaultType + "' was not found. Available: " + functions);
|
||||
return;
|
||||
try
|
||||
{
|
||||
comparator = Function.valueOf(defaultType.toUpperCase()).getValidator();
|
||||
}
|
||||
catch (Exception ne)
|
||||
{
|
||||
String functions = Function.getFunctionNames();
|
||||
sessionState.out.println("Type '" + defaultType + "' was not found. Available: " + functions
|
||||
+ " Or any class which extends o.a.c.db.marshal.AbstractType.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// making string representation look property e.g. o.a.c.db.marshal.UTF8Type
|
||||
|
|
|
|||
Loading…
Reference in New Issue