sadpandajoe commented on code in PR #42054:
URL: https://github.com/apache/superset/pull/42054#discussion_r3593050167


##########
superset/models/helpers.py:
##########
@@ -1912,6 +1913,19 @@ def processing_time_offsets(  # pylint: 
disable=too-many-locals,too-many-stateme
                             outer_from_dttm,
                             outer_to_dttm,
                         )
+                    elif parse_human_timedelta(offset, outer_from_dttm) == 
timedelta():
+                        # get_past_or_future silently returns the source time
+                        # for offsets it cannot parse; querying with an
+                        # unshifted window would present the current period's
+                        # data as the comparison series.
+                        raise QueryObjectValidationError(
+                            _(
+                                "Unable to interpret the time offset: "
+                                "%(offset)s. Use a relative time such as "
+                                '"1 month ago".',
+                                offset=offset,
+                            )
+                        )

Review Comment:
   Valid finding — fixed in 453965c813: the guard (and the grain-less alignment 
probe, which had the same conflation) checks parsedatetime's parse flag via a 
new `is_parseable_human_timedelta` instead of comparing the delta to zero, so 
`0 days ago` renders a self-comparison; regression tests added.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



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