[ 
https://issues.apache.org/jira/browse/NIFI-8023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17271710#comment-17271710
 ] 

Peter Turcsanyi commented on NIFI-8023:
---------------------------------------

Implemented a solution which solves NIFI-7996 without regression in NIFI-6442. 
No test failures in UTC+/- time zones (tested in UTC, EST and CET).

https://github.com/apache/nifi/pull/4781

The concept is based on the followings:
# NiFi internally uses java.sql.Date for date data type (eg. in records) and it 
cannot be changed / refactored easily
# most of the code base uses UTC, eg. DateFormat objects when parsing dates 
from text
# other parts use local TZ for dates, like JDBC drivers
# due to the mismatch between #2 and #3, +/- 1 day can occur when the JVM is 
running in a non-UTC time zone and the data is coming from DB and ends up eg. 
in Json (or vice versa)
# UTC is heavily used so it seemed to be a better option to align the database 
stuff to the rest of the code

Tested with several use cases (in the same time zones as the builds, DBs: 
PostgreSQL, MySQL):
* ConvertRecord: Json to Avro and back to Json (NIFI-7996)
* ConvertRecord: Json/XM/CSV to Json/XM/CSV
* ExecuteSQL, ExecuteSQLRecord to Avro/Json (NIFI-6442)
* QueryDatabaseTable to Avro/Json
* PutSQL, PutDatabaseRecord
* ExecuteSQLRecord + PutDatabaseRecord with Avro/Json

> Test failure after NIFI-7996 commit if system default TZ is CET
> ---------------------------------------------------------------
>
>                 Key: NIFI-8023
>                 URL: https://issues.apache.org/jira/browse/NIFI-8023
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Denes Arvay
>            Assignee: Denes Arvay
>            Priority: Major
>             Fix For: 1.13.0
>
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> After the commit [1] for NIFI-7996 the following two tests fail if the system 
> default timezone is CET (maybe anything UTC+, not verified yet)
> - {{TestJdbcCommon.testConvertToAvroStreamForDateTimeAsLogicalType}}
> - {{TestAvroTypeUtil.testDateConversion}}
> Need to investigate if the tests are wrong or the commit introduced 
> regression.
> [1] 
> https://github.com/apache/nifi/commit/83948db989bf2f682dfa18c56293ec431f546e1c



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to