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

   ## Description
   
   Fixes #40501
   
   When using relative time comparison offsets (e.g. "365 days ago"), the inner 
bounds (`inner_from_dttm` / `inner_to_dttm`) were incorrectly set to the 
shifted dates instead of the original unshifted period. This caused 
partial-period comparisons to compare against the full shifted bucket rather 
than the equivalent partial period in the past.
   
   **Before:**
   ```python
   query_object_clone.inner_from_dttm = query_object_clone.from_dttm  # shifted 
date
   query_object_clone.inner_to_dttm = query_object_clone.to_dttm      # shifted 
date
   ```
   
   **After:**
   ```python
   query_object_clone.inner_from_dttm = outer_from_dttm  # original unshifted 
date
   query_object_clone.inner_to_dttm = outer_to_dttm      # original unshifted 
date
   ```
   
   ## Testing
   
   - Added unit test `test_relative_offset_preserves_inner_bounds` verifying 
that inner bounds are set to the original (unshifted) dates when using relative 
offsets.
   - Verified with a 28-day partial period (May 1-28) compared with "365 days 
ago" offset.
   
   Closes #40501
   
   > Re-opened with merge conflicts resolved.


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