Abdulrehman-PIAIC80387 opened a new pull request, #42082: URL: https://github.com/apache/superset/pull/42082
### SUMMARY Fixes #40501. Since Superset 6.0, time comparisons using a **relative** offset (e.g. `365 days ago`) on coarse time grains (`month` / `quarter` / `year`) have been snapping the comparison bucket to the full grain boundary. On a partial current period like `2026-05-01 : 2026-05-28` with `month` grain, the `365 days ago` value covered all of May 2025 instead of only the first 28 days. **Regression origin:** #34375 (2025-08) restructured the time-comparison logic in `ExploreMixin.processing_time_offsets` and, in the relative-offset branch, set the inner subquery bounds to the *shifted* range instead of leaving them unset. The parallel date-range-offset branch deliberately sets them to `None` with an inline comment explaining that the extra bounds *"create additional WHERE clauses that conflict with our date range."* The relative-offset branch never got the same treatment. **Fix:** align the relative-offset branch with the date-range branch — set `inner_from_dttm` and `inner_to_dttm` to `None`. Downstream code uses `inner_from_dttm or from_dttm` so this simply defers to the already-shifted outer range instead of layering a second, semantically-different filter. Verified end-to-end at the source-level invariant (regression test locks in the fix so a future contributor cannot revert it silently). ### TESTING INSTRUCTIONS **Manual repro** (matches the issue report): 1. On a time-series chart, set current time range to a **partial** current period, e.g. `2026-05-01 : 2026-05-28` 2. Set time grain to `month` 3. Add a time comparison offset: `365 days ago` 4. Ensure `DATE_RANGE_TIMESHIFTS_ENABLED = False` 5. **Before fix**: comparison value equals sum for full May 2025 (`2025-05-01 : 2025-05-31`) 6. **After fix**: comparison value equals sum for `2025-05-01 : 2025-05-28` **Automated:** ```bash pytest tests/unit_tests/models/test_time_comparison_offset.py -v ``` ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #40501 - [x] Required feature flags: none - [x] Changes UI: no - [x] Includes DB Migration: no - [x] Includes CLI or Node.js commands: no - [x] Breaking change: no — restores 5.0 behavior for partial-period comparisons -- 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]
