sadpandajoe commented on code in PR #45671:
URL: https://github.com/apache/superset/pull/45671#discussion_r4366816502
##########
superset/utils/date_parser.py:
##########
@@ -846,8 +862,13 @@ def eval(self) -> datetime:
month=1, day=1, hour=0, minute=0, second=0, microsecond=0
)
if unit == "quarter":
- dttm = (
- pd.Period(pd.Timestamp(dttm),
freq="Q").to_timestamp().to_pydatetime()
+ dttm = dttm.replace(
Review Comment:
Now that a quarter keeps its offset, the parser can hand an aware bound to
code that still assumes naive datetimes. In `get_offset_custom_or_inherit`
(`superset/models/helpers.py` ~L3290), `outer_to_dttm - outer_from_dttm` raises
`TypeError` for `DATETRUNC(DATETIME('2024-05-31T12:00:00+08:00'), QUARTER) :
2024-06-01` with `time_offsets=["inherit"]`, and `outer_from_dttm -
datetime.strptime(offset, "%Y-%m-%d")` does the same for a custom comparison
date; both worked before when the quarter came back naive. The
`instant_time_comparison_range` path above also rebuilds bounds with
`strftime("%Y-%m-%dT%H:%M:%S")`, so a `+08:00` quarter range with a dataset
timezone ends up shifted by the offset in the comparison period. Should these
consumers normalize aware bounds the same way `_get_comparable_bounds` does,
with a test that goes through them?
--
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]