mirror of https://github.com/apache/cassandra
cli support index type enum names
patch by Pavel Yaskevich; reviewed by jbellis for CASSANDRA-1810 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1041834 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
56770fc807
commit
5856ee9e6e
|
|
@ -25,6 +25,7 @@ dev
|
|||
* fix range queries against wrapped range (CASSANDRA-1781)
|
||||
* fix consistencylevel calculations for NetworkTopologyStrategy
|
||||
(CASSANDRA-1804)
|
||||
* cli support index type enum names (CASSANDRA-1810)
|
||||
|
||||
|
||||
0.7.0-rc1
|
||||
|
|
|
|||
|
|
@ -1414,20 +1414,28 @@ public class CliClient extends CliUserHelp
|
|||
*/
|
||||
private IndexType getIndexTypeFromString(String indexTypeAsString)
|
||||
{
|
||||
Integer indexTypeId;
|
||||
IndexType indexType;
|
||||
|
||||
try {
|
||||
indexTypeId = new Integer(indexTypeAsString);
|
||||
try
|
||||
{
|
||||
indexType = IndexType.findByValue(new Integer(indexTypeAsString));
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
throw new RuntimeException("Could not convert " + indexTypeAsString + " into Integer.");
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// if this is not an integer lets try to get IndexType by name
|
||||
indexType = IndexType.valueOf(indexTypeAsString);
|
||||
}
|
||||
catch (IllegalArgumentException ie)
|
||||
{
|
||||
throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.");
|
||||
}
|
||||
}
|
||||
|
||||
indexType = IndexType.findByValue(indexTypeId);
|
||||
|
||||
if (indexType == null) {
|
||||
throw new RuntimeException(indexTypeAsString + " is unsupported.");
|
||||
if (indexType == null)
|
||||
{
|
||||
throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.");
|
||||
}
|
||||
|
||||
return indexType;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class CliTest extends CleanupHelper
|
|||
// please add new statements here so they could be auto-runned by this test.
|
||||
private String[] statements = {
|
||||
"use TestKeySpace;",
|
||||
"create column family CF1 with comparator=UTF8Type and column_metadata=[{ column_name:world, validation_class:IntegerType, index_type:0, index_name:IdxName }, { column_name:world2, validation_class:LongType, index_type:0, index_name:LongIdxName}];",
|
||||
"create column family CF1 with comparator=UTF8Type and column_metadata=[{ column_name:world, validation_class:IntegerType, index_type:0, index_name:IdxName }, { column_name:world2, validation_class:LongType, index_type:KEYS, index_name:LongIdxName}];",
|
||||
"set CF1[hello][world] = 123848374878933948398384;",
|
||||
"get CF1[hello][world];",
|
||||
"set CF1[hello][world2] = 15;",
|
||||
|
|
|
|||
Loading…
Reference in New Issue