jianhaozh created STORM-2737:
--------------------------------
Summary: Storm-hive integration ,tuple support null value fields
Key: STORM-2737
URL: https://issues.apache.org/jira/browse/STORM-2737
Project: Apache Storm
Issue Type: Bug
Components: storm-hive
Reporter: jianhaozh
code in the file : org.apache.storm.hive.bolt.mapper.DelimitedRecordHiveMapper
the method mapRecord seems not support not decleared fields,when the tuple does
not contains field,it will throw the null pointer error;
so i had the blow solution:
{code:java}
// Some comments here
@Override
public byte[] mapRecord(Tuple tuple) {
StringBuilder builder = new StringBuilder();
if(this.columnFields != null) {
for(String field: this.columnFields) {
builder.append(tuple.contains(field)?tuple.getValueByField(field) :null);
builder.append(fieldDelimiter);
}
}
return builder.toString().getBytes();
}
{code}
just check contains and put null into it;
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)