【发布时间】:2016-02-20 02:57:43
【问题描述】:
我在 cassandra (v. 2.2.3) 中有下表
cqlsh> DESCRIBE TABLE historian.timelines;
CREATE TABLE historian.timelines (
assetid uuid,
tslice int,
...
value map<text, text>,
PRIMARY KEY ((assetid, tslice), ...)
) WITH CLUSTERING ORDER BY (deviceid ASC, paramid ASC, fts DESC)
...
;
我想通过 Apache Spark (v. 1.5.0) 通过以下 java sn-p 提取数据(使用 cassandra spark connector v. 1.5.0 和 cassandra driver core v. 2.2.0 RC3):
// Initialize Spark SQL Context
CassandraSQLContext sqlContext = new CassandraSQLContext(jsc.sc());
sqlContext.setKeyspace(keyspace);
DataFrame df = sqlContext.sql("SELECT * FROM " + tableName +
" WHERE assetid = '085eb9c6-8a16-11e5-af63-feff819cdc9f' LIMIT 2");
df.show();
此时访问上述show 方法时出现以下错误:
cannot resolve '(assetid = cast(085eb9c6-8a16-11e5-af63-feff819cdc9f as double))' due to data type mismatch:
differing types in '(assetid = cast(085eb9c6-8a16-11e5-af63-feff819cdc9f as double))' (uuid and double).;
因此,Spark SQL 似乎没有将 assetid 输入解释为 UUID。我可以做些什么来处理 Spark SQL 查询中的 cassandra UUID 类型?
谢谢!
【问题讨论】: