bito-code-review[bot] commented on PR #42329:
URL: https://github.com/apache/superset/pull/42329#issuecomment-5055344358
<!-- Bito Reply -->
The review comment is correct. In PostgreSQL, `DATE_TRUNC` returns a
`TIMESTAMP` (specifically `TIMESTAMP WITHOUT TIME ZONE`), not `TIMESTAMP WITH
TIME ZONE`. The docstring should be updated to reflect this accurately to avoid
confusion for future maintainers.
To resolve this, update the docstring in
`superset/db_engine_specs/postgres.py` as follows:
```python
"""
Construct a timestamp expression while preserving pure ``DATE``
semantics.
Applying ``DATE_TRUNC`` to a ``DATE`` column implicitly casts the
value to
``TIMESTAMP``, which can trigger unwanted timezone conversion on the
client
and shift the displayed date by a day. To avoid this, the truncated
value is
cast back to ``DATE`` when the source column is a pure ``DATE`` type.
See https://github.com/apache/superset/issues/42254.
"""
```
(Note: The existing docstring in the provided diff already uses `TIMESTAMP`
rather than `TIMESTAMP WITH TIME ZONE`, so it appears the implementation may
have already been corrected or the comment refers to a previous version. Please
verify if your current file content matches the docstring above.)
**superset/db_engine_specs/postgres.py**
```
"""
Construct a timestamp expression while preserving pure ``DATE``
semantics.
Applying ``DATE_TRUNC`` to a ``DATE`` column implicitly casts the
value to
``TIMESTAMP``, which can trigger unwanted timezone conversion on the
client
and shift the displayed date by a day. To avoid this, the truncated
value is
cast back to ``DATE`` when the source column is a pure ``DATE`` type.
See https://github.com/apache/superset/issues/42254.
"""
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]