Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-5891

NiFi record serde throws NPE when decimal field has null value

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.9.0
    • Core Framework
    • None
    • RHEL 7.5
      Open JDK 1.8

    Description

      When an incoming record has a null decimal field, NiFiRecordSerDe (
      org.apache.hive.streaming) throws an NPE when trying to create a HiveDecimal. This causes the PutHive3Streaming processor to skip the record and log a warning.
       
      The lines:

      val = HiveDecimal.create(record.getAsDouble(fieldName));
      

      should be changed to something along the lines of:

      Double d = record.getAsDouble(fieldName);
      val = d == null ? null : HiveRecord.create(d);

      The bug is insidious and occurs during Auto-unboxing.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              korir Gideon Korir
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: