-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aatams acoustic qc time zone handling tos7 #744
Comments
@jonescc I don't know if it's a time zone handling issue. The difference is a full 24 hours. Also, the definition of both tables and views seems to be good to me in regards to time handling |
I suspect its related to this:
"PostgreSQL assumes your local time zone for any type containing only date or time. All timezone-aware dates and times are stored internally in UTC . They are converted to local time in the zone specified by the timezone configuration parameter before being displayed to the client." - https://www.postgresql.org/docs/9.1/datatype-datetime.html i.e. date's don't have an associated time zone in postgres (they are relative to server time). This is then being passed through a java process which is time zone sensitive. I suspect the jdbc driver behaviour has changed in the upgrade. For Bene she got a better result (there was actually a problem in production). First thing to check is whether the processing is actually correct on 6-nec-hob/prod or 9-nec-hob. Either way, processing like this (dates/timestamps relative to server time) are dangerous so I'd look at another way of truncating the timestamp to just a date e.g. date_trunc (they're actually being stored as timestamps with time zones) |
@jonescc , xavier initially wrote this harvester. I'm quite confused about all these date issues: atf_acoustic_qc_detections_map tableThe atf_acoustic_qc_detections_map table definition is The query to populate it is: date(min(detection_timestamp)) AS first_detection_date As an example (ran on RC) select first_detection_date from aatams_acoustic_qc.atf_acoustic_qc_detections_map limit 1;
┌────────────────────────┐
│ first_detection_date │
├────────────────────────┤
│ 2009-08-29 14:00:00+00 │
└────────────────────────┘
(1 row) In that case, it's not exactly what we would call a date since there is an hour in it. I'm not sure if it' meant to be this way when Xavier wrote this. However if we run the following query in postgres, we actually get a proper date back: SELECT date('2008-08-18 03:16:03+00');
┌────────────┐
│ date │
├────────────┤
│ 2008-08-18 │
└────────────┘ So first of all I'm already quite surprised of the difference of behaviour between the same query giving different results ran within talend and psql directly. If we replace with date_trunc('day', TIMESTAMP min(detection_timestamp)) AS first_detection_date I'm not sure this is the intendent result. since for example: SELECT date_trunc('day', TIMESTAMP '2008-08-18 03:16:03+00');
┌─────────────────────┐
│ date_trunc │
├─────────────────────┤
│ 2008-08-18 00:00:00 │
└─────────────────────┘
(1 row) |
Yes, I guess I'm assuming that the first date is the date of the first detection relative to the UTC time zone. What's currently happening in RC and 6-nec-hob is that the first date is the date of the first detection relative to the AEST time zone? Is this wrong? I thought all our dates/timestamps etc were meant to be UTC. Either way - yes we need to be clear on what the correct result is and ensure that's what's calculated. |
So looking at this further on 6-nec-hob: In the file (A69-1105-102_5354094_7579005.txt):
In qc_detections_data:
So the dates in the csv file have been assumed to be in the local time zone (i.e. AEST) And the result when creating the view (min/max dates from this) on 6-nec-hob is:
On 9-nec-hob it is:
So looks to me like there are some time zone issues to sort out for TOS5/7 |
@jonescc I'll definitely need your help. This harvester harvests 2 files. A static metadata file, as well as a detection file. I just can't get the right time values output via talend. |
No worries. Looks like its coming in as a string and Xavier was using TalendDate to parse as a date. row4.embargo_date.equals("NA")?null:TalendDate.parseDate("yyyy-MM-ddZ",row4.embargo_date+"+00:00") Means any use of TalendDate.parseDate without doing this is probably suspect. |
should be fixed by #757 |
My bad, TalendDate.parseDate("yyyy-MM-ddZ",row4.embargo_date+"+00:00") doesn't work as using Z only allows +0000. Needs to be X instead of Z or remove the ':'. See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html |
Can we please list all the harvesters that might be impacted? |
done here |
Resolved by #757 |
Running aatams_acoustic_qc on 9-nec-hob gives different results to 6-nec-hob for atf_acoustic_qc_detections_map:
The text was updated successfully, but these errors were encountered: