You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Pierre Villard (Jira)" <ji...@apache.org> on 2025/11/27 12:18:00 UTC

[jira] [Updated] (NIFI-15268) QueryRecord (with AvroReader/AvroRecordSetWriter) breaks with union of fixed

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

Pierre Villard updated NIFI-15268:
----------------------------------
    Assignee: Pierre Villard
      Status: Patch Available  (was: Open)

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