Fix: normalize datetime values to strings in unit tests#4696
Fix: normalize datetime values to strings in unit tests#4696georgesittas merged 1 commit intomainfrom
Conversation
df850d4 to
bd49e17
Compare
| query: | ||
| rows: | ||
| - id: id1 | ||
| agg_timestamp_col: ["2024-01-02T15:00:00.000000"] |
There was a problem hiding this comment.
Would the same output comparison work properly if we compared an equivalent datetime value from a different string? E.g `2024-01-02T15:00:00.00" or one based on a different timezone that results in the same time?
Ideally we'd normalize all datetime types into a common representation at a common timezone (?)
There was a problem hiding this comment.
I think so, there's a test for this: https://github.com/TobikoData/sqlmesh/blob/f87d3f0a6dad639584a4b70540ac19010c0ca92c/tests/core/test_test.py#L1220
There was a problem hiding this comment.
This looks like it's on the same timezone from a quick look, I was referring to a scenario such as :
inputs:
...
time_col: "2020-01-01 05:00:00+05"
outputs:
...
time_col: "2020-01-01 00:00:00+00"
this test should be correct, right? But if it's a string comparison (or at best, normalized to a certain precision with zeroes) then it'd fail
There was a problem hiding this comment.
I don't think that we encourage specifying time zones in the timestamp values (in the sense that it's unsupported).
The +zone syntax is only mentioned in relation to the execution_time variable in the docs, and I think that was intentional at the time.
Fixes the issue discussed in this Slack thread: https://tobiko-data.slack.com/archives/C044BRE5W4S/p1749046530513469