You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Simon Bence (Jira)" <ji...@apache.org> on 2020/05/06 15:01:00 UTC

[jira] [Updated] (NIFI-7390) Avro writing fails when narrow data type arrives

     [ https://issues.apache.org/jira/browse/NIFI-7390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Bence updated NIFI-7390:
------------------------------
    Status: Patch Available  (was: In Progress)

https://github.com/apache/nifi/pull/4256

> 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: 10m
>  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)