Support Questions

Find answers, ask questions, and share your expertise

NPE with InferAvroSchema

avatar
Expert Contributor

I am observing following error for one of my nifi data flow:

o.a.nifi.processors.kite.InferAvroSchema InferAvroSchema[id=9fa25adc-91da-31e3-97ff-d5012c68588c] Failed to infer Avro schema for StandardFlowFileRecord[uuid=a8cf241e-8804-4177-837f-f832657sa596,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1713770110449-11, container=default, section=11], offset=0, length=44],offset=0,name=iSAM_ontEthPort.csv,size=44] due to java.lang.NullPointerException: No content to infer schema: java.lang.NullPointerException: No content to infer schema

java.lang.NullPointerException: No content to infer schema

 

What to make out of it?

1 ACCEPTED SOLUTION

avatar
Master Mentor

@manishg 

Not sure what version of Apache NiFi you are using here.  I would not recommend using the InferAvroSchema processor.  Depending on your use case there may be better options.  Most record reader like (CSVReader) have that ability in infer schema

From the output provided you have a CSV file that is 44 bytes in size.  According to the InferAvroSchema processor documentation:

When inferring from CSV data a "header definition" must be present either as the first line of the incoming data or the "header definition" must be explicitly set in the property "CSV Header Definition". A "header definition" is simply a single comma separated line defining the names of each column. The "header definition" is required in order to determine the names that should be given to each field in the resulting Avro definition.

Does your content here meet the requirements of the InferAvroSchema processor?
Do you see same issue if you try to infer schema via the CSVReader controller service?

These two different components do not infer schema in the same way.   The InferAvroSchema is not part of the Apache NiFi and utilizes the Kite SDK which is no longer being maintained.   

Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt

View solution in original post

1 REPLY 1

avatar
Master Mentor

@manishg 

Not sure what version of Apache NiFi you are using here.  I would not recommend using the InferAvroSchema processor.  Depending on your use case there may be better options.  Most record reader like (CSVReader) have that ability in infer schema

From the output provided you have a CSV file that is 44 bytes in size.  According to the InferAvroSchema processor documentation:

When inferring from CSV data a "header definition" must be present either as the first line of the incoming data or the "header definition" must be explicitly set in the property "CSV Header Definition". A "header definition" is simply a single comma separated line defining the names of each column. The "header definition" is required in order to determine the names that should be given to each field in the resulting Avro definition.

Does your content here meet the requirements of the InferAvroSchema processor?
Do you see same issue if you try to infer schema via the CSVReader controller service?

These two different components do not infer schema in the same way.   The InferAvroSchema is not part of the Apache NiFi and utilizes the Kite SDK which is no longer being maintained.   

Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt