You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building a CUSTOM secondary index on a column, the custom index class name should be provided.
With cassandra-cli, we can do it like below:
create column family test with
comparator = UTF8Type and
key_validation_class=UTF8Type and
column_metadata = [
{
column_name : col1,
validation_class: UTF8Type,
index_type : CUSTOM,
index_options : {class_name : 'net.abc.MyIndex'}
},
...
];
And in Cassandra, index_options will be checked like below:
if (c.index_type == IndexType.CUSTOM) {
if (c.index_options == null || !c.index_options.containsKey(SecondaryIndex.CUSTOM_INDEX_OPTION_NAME))
throw new InvalidRequestException("Required index option missing: " + SecondaryIndex.CUSTOM_INDEX_OPTION_NAME);
}
In org.apache.cassandra.thrift.ColumnDef, there is a method can set this option.
public ColumnDef setIndex_options(Map<String,String> index_options)
But in Hector, in me.prettyprint.cassandra.service.ThriftColumnDef, seems it doesn't handle the index_options.
public ThriftColumnDef(ColumnDef cd) {
Assert.notNull(cd, "ColumnDef is null");
name = cd.name;
validationClass = cd.validation_class;
indexType = indexTypeFromThrift(cd.index_type);
indexName = cd.index_name;
}
So if we try to build a CUSTOM secondary index with Hector, it will fail and cause an exception.
Exception in thread "main" me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:Required index option missing: class_name)
The text was updated successfully, but these errors were encountered:
When building a CUSTOM secondary index on a column, the custom index class name should be provided.
With
cassandra-cli
, we can do it like below:And in Cassandra,
index_options
will be checked like below:In
org.apache.cassandra.thrift.ColumnDef
, there is a method can set this option.But in Hector, in
me.prettyprint.cassandra.service.ThriftColumnDef
, seems it doesn't handle theindex_options
.So if we try to build a CUSTOM secondary index with Hector, it will fail and cause an exception.
The text was updated successfully, but these errors were encountered: