[
https://issues.apache.org/jira/browse/NIFI-13963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Stieglitz updated NIFI-13963:
------------------------------------
Description:
This is a back port of the fix introduced in NIFI-13843 for 2.x. This bug
apparently was introduced in 1.26.0 in NIFI-13090 (which was a back port of
NIFI-12480 for 2.x which probably was the cause of both NIFI-13843 and
NIFI-13362) with the changes to _AbstractJsonRowRecordReader_ in method
_createRecordFromRawValue_ which included a serialized form of the schema even
with unknown fields in the following lines:
{code:java}
final SerializedForm serializedForm =
SerializedForm.of(fieldNode::toString, "application/json");
return new MapRecord(childSchema, childValues, serializedForm);
}{code}
Apparently the _WriteJsonResult_ which _JsonRecordSetWriter_ returns always had
the ability to write out the serialized form of the JSON as seen in method
_writeRecord_
{code:java}
if (isUseSerializeForm(record, writeSchema)) {
final String serialized = (String)
record.getSerializedForm().get().getSerialized();
generator.writeRawValue(serialized);
return;
}{code}
but it seems it never did since the _AbstractJsonRowRecordReader_ never
returned a serialized form of the JSON until 1.26.0. This explains how
[~mosermw] in a comment on NIFI-13843 was able to see no issues when using
nifi-record-serialization-services-nar-{*}1.25.0{*} for JsonTreeReader and
nifi-record-serialization-services-nar-{*}1.26.0{*} for JsonRecordSetWriter but
only saw issues with nifi-record-serialization-services-nar-{*}1.26.0{*} for
JsonTreeReader and nifi-record-serialization-services-nar-{*}1.26.0{*} for
JsonRecordSetWriter
was:
This is a back port of the fix introduced in NIFI-13843 for 2.x. This bug
apparently was introduced in 1.26.0 in NIFI-13090 (which was a back port of
NIFI-12480 for 2.x which probably was the cause of both NIFI-13843 and
NIFI-13362) with the changes to _AbstractJsonRowRecordReader_ in method
_createRecordFromRawValue_ which included a serialized form of the schema even
with unknown fields in the following lines:
{code:java}
final SerializedForm serializedForm =
SerializedForm.of(fieldNode::toString, "application/json");
return new MapRecord(childSchema, childValues, serializedForm);
}{code}
Apparently the _WriteJsonResult_ which _JsonRecordSetWriter_ returns always had
the ability to write out the serialized form of the JSON as seen in method
_writeRecord_
{code:java}
if (isUseSerializeForm(record, writeSchema)) {
final String serialized = (String)
record.getSerializedForm().get().getSerialized();
generator.writeRawValue(serialized);
return;
}{code}
but it seems it never did since the _AbstractJsonRowRecordReader_ never
returned a serialized form of the JSON until 1.26.0. This explains how
[~mosermw] in a comment on NIFI-13843 was able to see no issues when using
nifi-record-serialization-services-nar-{*}1.25.0{*} for JsonTreeReader and
nifi-record-serialization-services-nar-{*}1.26.0{*} for JsonRecordSetWriter but
only saw issues with nifi-record-serialization-services-nar-{*}1.26.0{*} for
JsonTreeReader and nifi-record-serialization-services-nar-{*}1.26.0{*} for
JsonRecordSetWriter
> Unknown fields not dropped by JSON Writer as expected by specified schema
> -------------------------------------------------------------------------
>
> Key: NIFI-13963
> URL: https://issues.apache.org/jira/browse/NIFI-13963
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.26.0, 1.27.0, 1.28.0
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Major
>
> This is a back port of the fix introduced in NIFI-13843 for 2.x. This bug
> apparently was introduced in 1.26.0 in NIFI-13090 (which was a back port of
> NIFI-12480 for 2.x which probably was the cause of both NIFI-13843 and
> NIFI-13362) with the changes to _AbstractJsonRowRecordReader_ in method
> _createRecordFromRawValue_ which included a serialized form of the schema
> even with unknown fields in the following lines:
> {code:java}
> final SerializedForm serializedForm =
> SerializedForm.of(fieldNode::toString, "application/json");
> return new MapRecord(childSchema, childValues, serializedForm);
> }{code}
> Apparently the _WriteJsonResult_ which _JsonRecordSetWriter_ returns always
> had the ability to write out the serialized form of the JSON as seen in
> method _writeRecord_
> {code:java}
> if (isUseSerializeForm(record, writeSchema)) {
> final String serialized = (String)
> record.getSerializedForm().get().getSerialized();
> generator.writeRawValue(serialized);
> return;
> }{code}
> but it seems it never did since the _AbstractJsonRowRecordReader_ never
> returned a serialized form of the JSON until 1.26.0. This explains how
> [~mosermw] in a comment on NIFI-13843 was able to see no issues when using
> nifi-record-serialization-services-nar-{*}1.25.0{*} for JsonTreeReader and
> nifi-record-serialization-services-nar-{*}1.26.0{*} for JsonRecordSetWriter
> but only saw issues with nifi-record-serialization-services-nar-{*}1.26.0{*}
> for JsonTreeReader and nifi-record-serialization-services-nar-{*}1.26.0{*}
> for JsonRecordSetWriter
--
This message was sent by Atlassian Jira
(v8.20.10#820010)