使用list数据类型将数据从pig插入cassandra失败

oogrdqng  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(398)

我有以下场景:
Cassandra表格:

CREATE TABLE tb_st_test (
  id int,
  email list<text>,
  PRIMARY KEY ((id));

清管器代码:

teste = LOAD 'cql://main/tb_st_test' USING CqlStorage();

testing = FOREACH teste GENERATE $0 as cod, ['emailtest@test.com'] as field:();

insert_test = 
FOREACH testing GENERATE
TOTUPLE(
TOTUPLE('id',cod)
),
TOTUPLE(field);

STORE insert_test INTO 'cql://main/tb_st_test?output_query=UPDATE tb_st_test set email %3D%3F' USING CqlStorage();

这里的想法是读取tb\u st\u test表,获取键值,并更新字段email。但是,当我运行脚本时,会出现以下错误:

后端错误消息

java.io.IOException: org.apache.thrift.transport.TTransportException
        at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:256)
Caused by: org.apache.thrift.transport.TTransportException
        at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
        at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
        at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
        at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:362)
        at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:284)
        at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:191)
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
        at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_prepared_cql3_query(Cassandra.java:1820)
        at org.apache.cassandra.thrift.Cassandra$Client.execute_prepared_cql3_query(Cassandra.java:1805)
        at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:240)

有人知道发生了什么吗?

pkln4tw6

pkln4tw61#

insert\u测试格式错误,因为列表集合格式应该是totuple(toutuple('some email','email2'))。检查https://issues.apache.org/jira/browse/cassandra-5867

相关问题