sadpandajoe commented on code in PR #45671:
URL: https://github.com/apache/superset/pull/45671#discussion_r4417557883
##########
superset/common/query_object.py:
##########
@@ -782,11 +784,54 @@ def exec_post_processing(self, df: DataFrame) ->
DataFrame:
func = extra_ops[operation]
options = post_process.get("options", {})
if operation == "resample":
- options = self._resolve_resample_options(options)
+ options = self._resolve_resample_options(options, df)
df = func(df, **options)
return df
- def _resolve_resample_options(self, options: dict[str, Any]) -> dict[str,
Any]:
+ def _resample_display_bound(
+ self, bound: datetime | None, df: DataFrame
+ ) -> datetime | None:
+ """Align explicit instants with a datasource's normalized display
frame."""
+ if (
+ bound is None
+ or bound.utcoffset() is None
+ or self.datasource is None
+ or getattr(df.index, "tz", None) is not None
Review Comment:
With Hour Offset set and a timezone-aware index (for example a `TIMESTAMPTZ`
column with no dataset timezone), `normalize_dttm_col` adds the offset to the
values but keeps the index aware, and this early return skips the matching
shift for the bound. For `DATETRUNC(DATETIME('2024-05-31T12:00:00+08:00'),
QUARTER) : 2024-07-01T00:00:00+08:00` with Hour Offset 8 and an hourly
`fill_time_range`, padding starts at `2024-03-31 16:00Z` while the data sits in
the shifted frame, so the filled range is eight hours off from the SQL filter.
Should the aware-index case apply the offset to the bound as well, or is it
intentionally left out?
--
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]