在Cassandra Cluster EVENT_KS Key Space中,我有一个bookTicket1(流),它有列 payload_provider,payload_totalNoTickets。当我尝试使用以下新分析脚本时,
CREATE EXTERNAL TABLE IF NOT EXISTS BusTicketTable
(provider STRING, totalNoTickets STRING, version STRING)
STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
WITH SERDEPROPERTIES (
"cassandra.host" = "127.0.0.1" ,
"cassandra.port" = "9160" ,
"cassandra.ks.name" = "EVENT_KS" ,
"cassandra.ks.username" = "admin" ,
"cassandra.ks.password" = "admin" ,
"cassandra.cf.name" = "bookTicket1" ,
"cassandra.columns.mapping" = ":payload_provider,payload_totalNoTickets, Version" );
它返回错误:
错误:执行Hive脚本时出错。查询返回非零代码:9,原因:FAILED:执行错误,从org.apache.hadoop.hive.ql.exec.DDLTask返回代码1“
答案 0 :(得分:1)
考虑这一行,
"cassandra.columns.mapping" = ":payload_provider,payload_totalNoTickets, Version"
在Cassandra中没有设置密钥。我不确定,但我认为您可能还必须设置密钥,因为行密钥对于Cassandra列族是必需的。
例如为: “cassandra.columns.mapping”=“:key,payload_provider,payload_totalNoTickets,Version”
您可能需要将唯一字段设置为键。