Christiaan Biesterbosch created NIFI-15268:
----------------------------------------------
Summary: 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
{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)