Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Abandoned
-
None
-
None
-
None
Description
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:
// 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(); }
just check contains and put null into it;