[
https://issues.apache.org/jira/browse/NIFI-8476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard resolved NIFI-8476.
----------------------------------
Resolution: Feedback Received
Apache NiFi 1.x is no longer maintained and no new release is planned on the
1.x release line. Marking as resolved as part of a cleanup operation. Please
open a new one with an updated description if this is still relevant for NiFi
2.x.
> ConverRecord JSON to AVRO with logicalType date fails
> -----------------------------------------------------
>
> Key: NIFI-8476
> URL: https://issues.apache.org/jira/browse/NIFI-8476
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.13.2
> Reporter: Christian Danner
> Priority: Major
> Attachments: avro_date_test.xml
>
>
> I setup an example Flow (Template) that transforms a JSON to AVRO Binary
> using the ConvertRecords while using JSONTreeReader and AVROSetWriter. Once I
> get JSON data as type INT and logicalType date passed to the processor, I get
> the result 0.
> Idk what I am doing wrong, so I attached the Flow I used.
> Generate Flowfile:
> Custom Text:
> {code:java}
> {"DOCNUM":"0000000012345678","ERSDA":20210426,"LAEDA":18743}
> {code}
> avro.schema:
> {code:java}
> {
> "type": "record",
> "name": "MAT",
> "fields": [{
> "name": "DOCNUM",
> "size": 16,
> "type": [
> "null",
> "string"
> ],
> "default": null,
> "doc": "NA"
> }, {
> "name": "ERSDA",
> "size": 8,
> "type": [
> "null", {
> "type": "int",
> "logicalType": "date"
> }
> ],
> "default": null,
> "doc": "NA"
> }, {
> "name": "LAEDA",
> "size": 8,
> "type": [
> "null", {
> "type": "int",
> "logicalType": "date"
> }
> ],
> "default": null,
> "doc": "NA"
> }
> ]
> }
> {code}
> Result:
> Flowfile Viewer (formatted):
> {code:java}
> [ {
> "DOCNUM" : "0000000012345678",
> "ERSDA" : "1970-01-01",
> "LAEDA" : "1970-01-01"
> } ]
> {code}
> avro-tools
> {code:java}
> avro-tools tojson ~/3a3c1a8e-5fda-4c67-a62c-bb9aacbcef1d
> {"DOCNUM":{"string":"0000000012345678"},"ERSDA":{"int":0},"LAEDA":{"int":0}}
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)