0

我有一个 MR 作业,它写入多行,每行一列。虽然我为列名传递了一个非空值,但我得到了以下异常

java.io.IOException: InvalidRequestException(why:column name must not be empty) at org.apache.cassandra.hadoop.ColumnFamilyRecordWriter$RangeClient.run(ColumnFamilyRecordWriter.java:307) Caused by: InvalidRequestException(why:column name must not be空)在 org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:1035) 在 org.apache.cassandra 的 org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:19477) .thrift.Cassandra$Client.batch_mutate(Cassandra.java:1009) 在 org.apache.cassandra.hadoop.ColumnFamilyRecordWriter$RangeClient.run(ColumnFamilyRecordWriter.java:299)

我在这里想念什么吗?

这是我写的减速器 -

public static class SampleReducer extends Reducer>{ static Logger logger = LoggerFactory.getLogger(AndroidEthnicityMap.class);

            @Override
            protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException ,InterruptedException {
                    String tStr[] = key.toString().split("__");
                    logger.info("The string to be reduced is " + key.toString());
                    String appid = tStr[0];
                    String columnName = tStr[1];
                    String columnValue = "{}";
                    if(values.iterator().hasNext())
                            columnValue = values.iterator().next().toString();



                    ByteBuffer bbcn = ByteBufferUtil.bytes(columnName);
                    ByteBuffer bbcv = ByteBufferUtil.bytes(columnValue);
                    ByteBuffer bbkey = ByteBufferUtil.bytes(appid);

                    Mutation m = new Mutation();
                    m.setColumn_or_supercolumn(new ColumnOrSuperColumn());
                    Column c = new Column();
                    c.setName(ByteBufferUtil.bytes(columnName));
                    c.setValue(ByteBufferUtil.bytes(columnValue));
                    c.setTimestamp(System.currentTimeMillis());
                    m.column_or_supercolumn.setColumn(c);

                    Mutation[] marray = new Mutation[]{m};
                    context.write(ByteBufferUtil.bytes(appid), Arrays.asList(marray));

            }
    }
4

2 回答 2

1

“空”表示“非空,零长度”。这不是有效的列名。

于 2012-10-09T14:18:15.540 回答
0

Add logs to you reducer to see all column names it transwer to context. It seem you column family is an empty string. Log all the datam not only colName

于 2013-04-28T06:35:24.397 回答