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


##########
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:
   Thanks for following these consumers through. Fixed in 4e58c08: 
inherit/custom comparison offsets now use the same comparable-bound 
normalization as range validation. Rebuilding instant-comparison expressions 
uses isoformat() so explicit offsets survive. Added tests through the real 
datasource offset method and through year/month/week/inherited comparison 
parsing into get_time_filter SQL, including mixed bounds and different explicit 
offsets.
   
   Local validation: 322 tests passed. Two unrelated Windows failures were 
reproduced on the prior PR source and deselected in the final run (longdouble 
behavior and the MCP chart UTC import). Ruff passed, Pylint scored 10/10, and 
Linux-target mypy passed for all six changed Python files. The new commit's 
remote CI results have not yet been confirmed.



##########
superset/utils/date_parser.py:
##########
@@ -763,8 +777,10 @@ def get_since_until(  # pylint: 
disable=too-many-arguments,too-many-locals,too-m
 
                 _since, _until = map(datetime_eval, since_and_until)
 
-    if _since and _until and _since > _until:
-        raise ValueError(_("From date cannot be larger than to date"))
+    if _since and _until:
+        since_comparison, until_comparison = _get_comparable_bounds(_since, 
_until)

Review Comment:
   Fixed in 4e58c08. Intersection selection and overlap validation now share 
the parser's mixed-bound comparison rule, while preserving the selected 
endpoints' original offsets. Your quarter : now example intersects successfully 
with 2024-05-01 : 2024-06-01. Added direct tests of the real MCP function for 
both argument orders, aware-only ordering by instant, disjoint ranges, and open 
bounds.



##########
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:
   Fixed in 4e58c08: aware bounds are converted to naive UTC even without a 
dataset timezone, before applying any legacy Hour Offset. Added tests that 
execute the generated filter against TEXT timestamps in an in-memory SQLite 
database, checking inclusive start and exclusive end boundaries with no 
timezone and with an invalid timezone fallback.



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