Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.2.0
-
None
-
None
Description
When creating a GrokReader, I specified an expression of:
%{SYSLOGBASE}%{GREEDYDATA:message}
And I left the default schema strategy of "use fields from grok expression".
This resulted in an NPE:
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at org.apache.nifi.serialization.record.RecordField.<init>(RecordField.java:50)
at org.apache.nifi.serialization.record.RecordField.<init>(RecordField.java:33)
at org.apache.nifi.grok.GrokReader.createRecordSchema(GrokReader.java:150)
at org.apache.nifi.grok.GrokReader.preCompile(GrokReader.java:136)
This appears to be because I didn't specify a name for SYSLOGBASE, since I was expecting it to see what SYSLOGBASE expands to and then use and named fields under that. If we don't want to support that expansion, then we should at least validate that all parts of the Grok expression have a name.
Next I changed to using a schema defined in an AvroSchemaRegistry and referencing it by name, but I still got the above exception because the preCompile method always attempts to create a RecordSchema from the GrokExpression, even if you selected a different strategy.
Attachments
Issue Links
- links to