运行时异常:未知比较器'CompositeType'



我需要在Cassandra ColumnFamily中创建CompositeColumns。

每个列值将存储如下内容-

user-id   column1
123      (Column1-Value  Column1-SchemaName  LastModifiedDate)

与列 2 和其他列相同。所以我决定选择这样的东西——

以下是列的说明-

ByteType for Column-Value
UTF8Type for Column-SchemaName
DateType for LastModifiedDate

我像这样创建了下面的列系列-

create column family USER_DATA
with key_validation_class = 'UTF8Type'
and comparator = 'CompositeType(ByteType,UTF8Type,DateType)'
and default_validation_class = 'UTF8Type'
and gc_grace = 86400
and column_metadata = [ {column_name : 'lmd', validation_class : DateType}];

让我知道这是否是创建上述列系列的正确方法?

但是一旦我尝试执行上述列,我总是收到以下错误。

[default@userks]     create column family USER_DATA
...         with key_validation_class = 'UTF8Type'
...         and comparator = 'CompositeType(ByteType,UTF8Type,DateType)'
...         and default_validation_class = 'UTF8Type'
...         and gc_grace = 86400
...         and column_metadata = [ {column_name : 'lmd', validation_class : DateType}];
java.lang.RuntimeException: Unknown comparator 'CompositeType(ByteType,UTF8Type,DateType)'. Available functions: bytes, integer, long, int, lexicaluui
d, timeuuid, utf8, ascii, double, countercolumn.

有人可以帮我解决这个问题吗?

更新:-

刚刚发现该错误,我忘了在 ByteType 中添加额外的s

以下是专栏家族-

create column family USER_DATA
with key_validation_class = 'UTF8Type'
and comparator = 'CompositeType(BytesType,UTF8Type,DateType)'
and default_validation_class = 'UTF8Type'
and gc_grace = 86400
and column_metadata = [ {column_name : 'lmd', validation_class : DateType}];

下面是我得到的错误。

[default@beprofileks]     create column family USER_DATA
...         with key_validation_class = 'UTF8Type'
...         and comparator = 'CompositeType(BytesType,UTF8Type,DateType)'
...         and default_validation_class = 'UTF8Type'
...         and gc_grace = 86400
...         and column_metadata = [ {column_name : 'lmd', validation_class : DateType}];
java.lang.RuntimeException: org.apache.cassandra.db.marshal.MarshalException: cannot parse 'lmd' as hex bytes

它应该是BytesType,而不是ByteType

CompositeType(BytesType,UTF8Type,DateType)

另一个问题是lmd不是比较器CompositeType(BytesType,UTF8Type,DateType)的有效列名。例如,有效名称为 aa00:string:2013-09-19

最新更新