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

David Handermann updated NIFI-15268:
------------------------------------
    Fix Version/s: 2.7.0
       Resolution: Fixed
           Status: Resolved  (was: Patch Available)

> QueryRecord (with AvroReader/AvroRecordSetWriter) breaks with union of fixed
> ----------------------------------------------------------------------------
>
>                 Key: NIFI-15268
>                 URL: https://issues.apache.org/jira/browse/NIFI-15268
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Christiaan Biesterbosch
>            Assignee: Pierre Villard
>            Priority: Major
>             Fix For: 2.7.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {code:java}
> {
>   "type": "record",
>   "name": "Foo",
>   "fields": [
>     {
>       "name": "bar",
>       "type": [
>         {"type": "fixed", "name": "Bytes4", "size": 4},
>         {"type": "fixed", "name": "Bytes8", "size": 8}
>       ]
>     }
>   ]
> }{code}
> With the above schema and the AvroRecordSetWriter also configured with this 
> schema (not inherit), this will produce the following error if a record with 
> a "Bytes8" is encountered:
> {code:java}
> ERROR QueryRecord[id=..] Unable to query FlowFile[filename=..] due to 
> org.apache.nifi.processor.exception.ProcessException: IOException thrown from 
> QueryRecord[id=..]: java.io.IOException: Writing result records failed
> - Caused by: java.io.IOException: Writing result records failed
> - Caused by: 
> org.apache.nifi.serialization.record.util.IllegalTypeConversionException: 
> Cannot convert Object[] of length 8 to FIXED(4) for field 'bar': {}{code}
> I think that when AvroReader reads the records, it "erases" the knowledge 
> that the bytes are a fixed length. Then when AvroRecordSetWriter is 
> serialising that data, it looks for a type in the union that matches "bytes" 
> and lands on the first fixed instead of the second.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to