【发布时间】:2016-04-08 03:56:35
【问题描述】:
重新发送对 Cassandra 表的更改后,我在 C# 中遇到了问题。原始主键由两部分组成((person_id),car_id),不足以识别单行,因此键被扩展((person_id),car_id,purchase_date)。
person_id(bigint), car_id(大整数), 购买日期(timeuuid)
在此更改之后,我遇到了一些 java 错误
2016-01-04 14:24:42.2935|ERROR|MyModule|工作时出错 java.lang.RuntimeException:无法在 org.apache.cassandra.db.marshal.CompositeType(org. apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.TimeUUIDType),org.apache.cassandra.db.marshal.UTF8Type)。这可能是由于架构和读取的数据不匹配
我正在使用 datastax 2.7.0.0 并通过我的查询检索一个人的所有记录:
this.storage.GetEntityList<MyEntity>(r => r.PersonId== personid);
public virtual IEnumerable<T> GetEntityList<T>(Expression<Func<T, bool>> predicate)
{
return new Table<T>(this.Session)
.Where(predicate)
.Execute();
}
public class MyEntity
{
[PartitionKey]
[Column("person_id")]
public long PersonId{ get; set; }
[ClusteringKey]
[Column("car_id")]
public long CarId{ get; set; }
[ClusteringKey(1)]
[Column("purchase_date")]
public TimeUuid PurchaseDate{ get; set; }
Ofc 如果我使用带有 SimpleStatement 的 cql 查询数据库,它的工作原理就像一个魅力(ironi),但我不在乎。我想知道为什么我的解决方案失败了。
【问题讨论】: