Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3791

[Java] "Found null, expecting <Type>" error should specify field to user

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • None
    • None
    • java
    • Provides field name in error message when type issues prevent reading an avro field.

    Description

      When working with Avro and Flink, I've run into errors like this fairly often: 

      java.io.IOException: Failed to deserialize consumer record due to
      ...
      Caused by: org.apache.avro.AvroTypeException: Found null, expecting string
          at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:308) 

      At a glance, this is not particularly useful. I know that some field is getting a null where there is a non-nullable string but in order to find out which one it is I either have to check all possible non-null string fields for null values, look at which columns are changed recently and guess and check, or throw a debugger in and dive down the stack. So far, the last has been the fastest for me.

      Ideally, I would like the error message to tell me which field has the null value so I can fix the problem with high confidence and without the use of a debugger.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ldonoughemdsol Logan Donoughe
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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