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

   Title: fix(charts): keep full-range time comparison working when the shifted 
period has no data
   
   ### SUMMARY
   
   With **Show full range for time shift** on, a chart fails with a 500 when 
the shifted period has no rows. Fixes #45783.
   
   An empty offset result becomes a one-row NaN placeholder, the full-range 
outer join keeps it, and `_coalesce_offset_index` fails subtracting a 
`DateOffset` from the all-NaN column. This change outer-joins only when the 
offset series has a timestamp. An empty comparison has nothing to extend, so it 
uses the left join and gives the same result as with the option off.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   before
   <img width="980" height="856" alt="before" 
src="https://github.com/user-attachments/assets/1ac2c024-c1fd-453b-80a8-ad5f849b8457";
 />
   
   after
   <img width="980" height="856" alt="after" 
src="https://github.com/user-attachments/assets/4c662dd8-3d43-4670-9674-07c4814b64c7";
 />
   
   ### TESTING INSTRUCTIONS
   
   - `pytest tests/unit_tests/common/test_time_shifts.py -k 
test_join_offset_dfs_empty_offset_df`: the full-range case fails on `master` 
and passes with this change.
   - Line Chart with a time grain, Time shift `1 week ago` with no data a week 
earlier, full range on: before, "Data error"; after, the chart renders.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #45783
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


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