prathamesh04 opened a new pull request, #42269:
URL: https://github.com/apache/superset/pull/42269

   ## Summary
   
   Fixes a regression in relative time comparison offset processing where inner 
bounds were incorrectly set to the shifted dates instead of the original period 
dates.
   
   ## Problem
   
   When comparing a partial period (e.g., May 1-28, 2026) with a relative 
offset (e.g., 365 days ago), the comparison query was using the full shifted 
bucket (May 1-31, 2025) instead of the equivalent partial period (May 1-28, 
2025).
   
   This happened because the code set:
   ```python
   query_object_clone.inner_from_dttm = query_object_clone.from_dttm  # shifted
   query_object_clone.inner_to_dttm = query_object_clone.to_dttm      # shifted
   ```
   
   ## Fix
   
   Changed to preserve the original (unshifted) inner bounds:
   ```python
   query_object_clone.inner_from_dttm = outer_from_dttm  # original
   query_object_clone.inner_to_dttm = outer_to_dttm      # original
   ```
   
   ## Example
   
   For date range: `2026-05-01 : 2026-05-28` with offset `365 days ago`:
   
   - **Before:** Comparison uses `2025-05-01 : 2025-05-31` (full May)
   - **After:** Comparison uses `2025-05-01 : 2025-05-28` (equivalent partial 
period)
   
   ## Testing
   
   - Added regression test `test_relative_offset_preserves_inner_bounds`
   - All 55 unit tests in test_query_context_processor.py pass
   - All 6 time_offset mapper tests pass
   
   Closes #40501


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