[ https://issues.apache.org/jira/browse/NIFI-7996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pierre Villard resolved NIFI-7996. ---------------------------------- Fix Version/s: 1.13.0 Resolution: Fixed > Conversion with ConvertRecord to avro results in invalid date > ------------------------------------------------------------- > > Key: NIFI-7996 > URL: https://issues.apache.org/jira/browse/NIFI-7996 > Project: Apache NiFi > Issue Type: Bug > Reporter: Denes Arvay > Assignee: Denes Arvay > Priority: Critical > Fix For: 1.13.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Converting a date field to avro using ConvertRecord results to invalid value > if the system's timezone's offset is negative. > System timezone: EST (UTC-5) > Input json: > {code:java} > { "SomeLocalDate": "20170411" } > {code} > Avro schema: > {code:java} > { "fields": [ { > "name": "SomeLocalDate", > "type": [ "null", { "logicalType": "date", "type": "int" } ] > }], > "name": "DateTest", > "namespace": "org.apache.nifi", > "type": "record" > } > {code} > Result: > {code:java} > $ avro-tools tojson ./est-invalid.avro > {"SomeLocalDate":{"int":17266}} > {code} > In this case the days between 1970.01.01. and 2017.04.11. is stored in the > SomeLocalDate field (see [1]), it should be 17267 ([2]). > After investigating the issue it seems that even though {{20170411}} is > parsed to {{2017-04-11T00:00:00 UTC}} it is converted to the system timezone > ({{2017-04-10T19:00:00 EST}}) later and its date value is used. > [1] [https://avro.apache.org/docs/1.8.0/spec.html#Date] > [2] > [https://www.timeanddate.com/date/durationresult.html?d1=1&m1=1&y1=1970&d2=11&m2=04&y2=2017] > -- This message was sent by Atlassian Jira (v8.3.4#803005)