我正在使用DSE 3.1.2 我正在使用Pig将一些预处理结果存储到cql中,我已经创建了一个表并启动了我的脚本它可以处理少量数据,当增加几个记录时它没有存储到cassandra中,只有90%或输出存入cassandra。
这是我的脚本
SET default_parallel 10;
result = foreach PreprocUDF generate Primary1,Primary2,col3,col4;
finalresult = foreach result generate TOTUPLE(TOTUPLE('Primary1',PreprocUDF::Primary1),TOTUPLE('Primary2',PreprocUDF::Primary2)),TOTUPLE(PreprocUDF::col3,PreprocUDF::col4);
store finalresult into 'cql://conflux/tbl_test?output_query=update+conflux.tbl_test+set+col3+%3D+%3F+,col4+%3D+%3F' using CqlStorage();
现在我收到了以下错误 并且90%的记录被倾倒到cassandra
ERROR - 2014-04-29 01:53:49.590; org.apache.hadoop.security.UserGroupInformation; PriviledgedActionException as:sarrajen cause:java.io.IOException: java.io.IOException: InvalidRequestException(why:Expected 8 or 0 byte long (4))
WARN - 2014-04-29 01:53:49.590; org.apache.hadoop.mapred.Child; Error running child
java.io.IOException: java.io.IOException: InvalidRequestException(why:Expected 8 or 0 byte long (4))
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.runPipeline(PigGenericMapReduce.java:465)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.processOnePackageOutput(PigGenericMapReduce.java:428)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.reduce(PigGenericMapReduce.java:408)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce$Reduce.reduce(PigGenericMapReduce.java:262)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:176)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:652)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:420)
at org.apache.hadoop.mapred.Child$4.run(Child.java:266)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.mapred.Child.main(Child.java:260)
Caused by: java.io.IOException: InvalidRequestException(why:Expected 8 or 0 byte long (4))
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:248)
Caused by: InvalidRequestException(why:Expected 8 or 0 byte long (4))
at org.apache.cassandra.thrift.Cassandra$execute_prepared_cql3_query_result.read(Cassandra.java:42694)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_prepared_cql3_query(Cassandra.java:1724)
at org.apache.cassandra.thrift.Cassandra$Client.execute_prepared_cql3_query(Cassandra.java:1709)
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:232)
INFO - 2014-04-29 01:53:49.764; org.apache.hadoop.mapred.Task; Runnning cleanup for the task
如果我手动插入cassandra,它执行的lat记录工作正常。
如果我将最终结果转储到CFS
,一切正常store result into '/testop'
Output(s):
Successfully stored 56347 records in: "/testop"
我还尝试将数据转储到CFS,然后从CFS转储到Cassandra DB,这对我有用。请让我知道我错在哪里。我用CQL创建了具有复合键的表soo我想我们不需要给任何比较器和验证器,因为我已经为coloumns指定了数据类型。
store result into '/testop'
x = load '/testop' as (Primary1:chararray,Primary2:long,col3:chararray,col4:long);
finalresult = foreach x generate TOTUPLE(TOTUPLE('Primary1',Primary1),TOTUPLE('Primary2',Primary2)),TOTUPLE(col3,col4);
store finalresult into 'cql://conflux/tbl_test?output_query=update+conflux.tbl_test+set+col3+%3D+%3F+,col4+%3D+%3F' using CqlStorage();
现在这很好用。
请告诉我错误的地方。
答案 0 :(得分:0)
引起的错误:InvalidRequestException(why:预期8或0字节长(4)) 说长输入数据格式是错误的。输入字段中有一些不良数据。
您可以检查UDF以查看如何以正确的格式准备数据
答案 1 :(得分:0)
将Cassandra中的数据类型从BigInt更改为varint解决了上述问题。