clickhouse-driver icon indicating copy to clipboard operation
clickhouse-driver copied to clipboard

Fix issues-257

Open mlkui opened this issue 3 years ago • 5 comments

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.

mlkui avatar Feb 01 '22 10:02 mlkui

We should also write test for this fix.

xzkostyan avatar Feb 01 '22 14:02 xzkostyan

When can we expect this to be merged please?

rajnishdahiya avatar Feb 16 '22 08:02 rajnishdahiya

When the test for this change will appear in PR. Otherwise anyone can break this the future.

xzkostyan avatar Feb 16 '22 08:02 xzkostyan

When the test for this change will appear in PR. Otherwise anyone can break this the future.

I will write a test

mlkui avatar Mar 08 '22 06:03 mlkui

Should we expect any tests?

xzkostyan avatar Jun 13 '22 14:06 xzkostyan

Feel free to reopen PR.

xzkostyan avatar Feb 17 '24 20:02 xzkostyan