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

Avro writing fails when narrow data type arrives

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.12.0
    • Extensions
    • Nifi 1.9 but probably other versions

    Description

      We expect a Long during writing the Avro record, but try to write in an Integer and as there is no inheritance between them, it fails with class cast exception.

      The reason we try to write Integer: the incoming number from JSON is parsed by Jackson and unmarshalled based on the value, not the expected schema. If the actual value fits to Integer, it will use that, otherwise it will be a Long. It has no knowledge of the expected schema. In a later point when we consider the input valid (we do allow “narrow number types” both in strict and non strict validation), the Avro specific writer thinks it a Long based on the validation schema and fails to write it.

      Attachments

        Issue Links

          Activity

            People

              simonbence Simon Bence
              simonbence Simon Bence
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m