ekovacs commented on a change in pull request #3282: NIFI-5983: handling parse
problems in recordReader implementations
URL: https://github.com/apache/nifi/pull/3282#discussion_r253749325
##########
File path:
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroRecordReader.java
##########
@@ -33,14 +35,21 @@
@Override
public Record nextRecord(final boolean coerceTypes, final boolean
dropUnknownFields) throws IOException, MalformedRecordException {
- GenericRecord record = nextAvroRecord();
- if (record == null) {
- return null;
+ try {
+ GenericRecord record = nextAvroRecord();
+ if (record == null) {
+ return null;
+ }
+
+ final RecordSchema schema = getSchema();
+ final Map<String, Object> values =
AvroTypeUtil.convertAvroRecordToMap(record, schema);
+ return new MapRecord(schema, values);
+ } catch (IOException e) {
+ throw e;
+ } catch (MalformedRecordException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new MalformedRecordException(String.format("Error while
getting next record. Root cause: %s", Throwables.getRootCause(e).getMessage()),
e);
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services