clickhouse-driver
clickhouse-driver copied to clipboard
Fix issues-257
This PR is related to Issue-257(https://github.com/mymarilyn/clickhouse-driver/issues/257)
The bug in #257 should be caused by:
if self.offset_naive:
ts = ts.tz_localize(None)
not executing where self.offset_naiveis is False when timezone is explicitly specified in table defination:
# Use column's timezone if it's specified.
if spec and spec[-1] == ')':
tz_name = spec[1:-2]
offset_naive = False
Instead of using ONLY self.offset_naive flag to determine whether ts = ts.tz_localize(None) should be performed or not, we should also check if ts.dtype and self.datetime_dtype is the same. If they are not the same, then ts = ts.tz_localize(None) must be performed or the fixed ts.to_numpy('datetime64[ns]') will return wrong result.
We should also write test for this fix.
When can we expect this to be merged please?
When the test for this change will appear in PR. Otherwise anyone can break this the future.
When the test for this change will appear in PR. Otherwise anyone can break this the future.
I will write a test
Should we expect any tests?
Feel free to reopen PR.