[
https://issues.apache.org/jira/browse/NIFI-15268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041384#comment-18041384
]
ASF subversion and git services commented on NIFI-15268:
--------------------------------------------------------
Commit 18efc3153d314a4b4a6fca070b1a3df58d3837c7 in nifi's branch
refs/heads/main from Pierre Villard
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=18efc3153d ]
NIFI-15268 Fixed Avro union fixed-size schema field selection (#10573)
Signed-off-by: David Handermann <[email protected]>
> 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: 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)