Twiink commented on code in PR #45671:
URL: https://github.com/apache/superset/pull/45671#discussion_r4414284062


##########
superset/utils/date_parser.py:
##########
@@ -846,8 +858,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:
   Fixed in d498877b. DATEDIFF now uses get_comparable_bounds for mixed 
aware/naive inputs, preserving the existing wall-clock compatibility rule. 
Added both implicit/explicit DAY tests and a nested DATEADD regression; the 
reported example returns 61 again.



##########
superset/models/helpers.py:
##########
@@ -3282,12 +3290,18 @@ def get_offset_custom_or_inherit(
             # the range against itself, and a 36-hour range would shift by a
             # single day and overlap it. Whole-day ranges resolve to the same
             # instant either way.
-            duration = outer_to_dttm - outer_from_dttm
+            from_comparison, to_comparison = get_comparable_bounds(

Review Comment:
   Fixed in d498877b. get_past_or_future retains the source timezone when 
rebuilding shifted bounds, and parse_human_timedelta uses the same awareness 
for its subtraction. Added year/month/quarter comparison regressions through 
SQL filter generation with Europe/Berlin and an explicit +08:00 offset.



##########
superset/mcp_service/dashboard_scope.py:
##########
@@ -773,23 +774,29 @@ def intersect_time_ranges(scope_range: str, model_range: 
str | None) -> str:
 
     since = _latest(scope_since, model_since)
     until = _earliest(scope_until, model_until)
-    if since is not None and until is not None and since >= until:
-        raise MCPDashboardScopeError(
-            f"the requested time_range {model_range!r} does not overlap the "
-            f"dashboard time range {scope_range!r}.",
-            _ASK_USER,
-        )
+    if since is not None and until is not None:
+        since_comparison, until_comparison = get_comparable_bounds(since, 
until)
+        if since_comparison >= until_comparison:
+            raise MCPDashboardScopeError(
+                f"the requested time_range {model_range!r} does not overlap 
the "
+                f"dashboard time range {scope_range!r}.",
+                _ASK_USER,
+            )
     return f"{_iso(since)} : {_iso(until)}"
 
 
 def _latest(first: datetime | None, second: datetime | None) -> datetime | 
None:
-    candidates = [value for value in (first, second) if value is not None]
-    return max(candidates) if candidates else None
+    if first is None or second is None:
+        return first or second
+    first_comparison, second_comparison = get_comparable_bounds(first, second)
+    return first if first_comparison >= second_comparison else second

Review Comment:
   Fixed in d498877b. Intersections use the destination dataset's 
bound-adjustment function for endpoint selection and overlap validation, rather 
than mixed wall-clock ordering. Mixed selected endpoints are serialized with 
explicit UTC offsets to preserve their meaning when reparsed. Added your 
05:00Z-versus-03:00 example and regressions through the actual dataset request 
rewrite with dataset timezone/Hour Offset settings.



-- 
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]

Reply via email to