Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-2737

Storm-hive integration ,tuple support null value fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Abandoned
    • None
    • None
    • storm-hive
    • 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;

      Attachments

        Activity

          People

            Unassigned Unassigned
            jianhaozh jianhaozh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: