[
https://issues.apache.org/jira/browse/NIFI-7390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Burgess updated NIFI-7390:
-------------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
> Avro writing fails when narrow data type arrives
> ------------------------------------------------
>
> Key: NIFI-7390
> URL: https://issues.apache.org/jira/browse/NIFI-7390
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Environment: Nifi 1.9 but probably other versions
> Reporter: Simon Bence
> Assignee: Simon Bence
> Priority: Major
> Labels: Record
> Fix For: 1.12.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)