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

   ### SUMMARY
   Fixes #42587
   
   Currently, Superset's resampling post-processor (`resample.py`) derives its 
time boundaries solely from `df.index.min()` and `df.index.max()`. When a 
dataset contains sparse data points (e.g., 1 record per day), resampling does 
not pad missing buckets outside the min/max range of existing data, leaving 
large gaps at the start or end of the requested time period.
   
   This PR adds a new **"Fill the entire time range"** option under the 
Resample subsection in `advancedAnalyticsControls`. When enabled, it passes the 
query's resolved time boundaries (`from_dttm` and `to_dttm`) to the backend 
post-processing layer to pad leading and trailing zeroes across the full 
requested time window.
   
   #### Key Changes:
   - **Backend Post-Processing (`resample.py`):** Anchors the DataFrame index 
to `from_dttm` and `to_dttm` prior to resampling, preserving index names 
(`__timestamp`), normalizing cross-timezone boundaries, and gracefully handling 
duplicate timestamps on unpivoted frames.
   - **Server Execution (`query_object.py`):** Resolves `fill_time_range: true` 
into query-level `time_range_start` and `time_range_end` parameters.
   - **Frontend Controls (`advancedAnalyticsControls` & `controlPanel.tsx`):** 
Adds the control checkbox to shared controls (Timeseries, Area, Bar, Mixed 
Timeseries) and Big Number with Trendline charts.
   - **Form Data & Operators (`standardizedFormData.ts` & 
`resampleOperator.ts`):** Emits `fill_time_range` in the post-processing 
payload and preserves state across chart switches.
   - **Documentation & Unit Tests:** Updates `exploring-data.mdx` and adds unit 
test coverage across frontend and backend test suites.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!-- Skip this if not applicable -->
   N/A
   
   ### TESTING INSTRUCTIONS
   1. Create a Time-Series Bar or Area chart with sparse data (e.g., 1 data 
point per day).
   2. Set Time Granularity to `Hourly` and enable **Resample to zero**.
   3. Toggle **Fill the entire time range** under Advanced Analytics -> 
Resample.
   4. Verify that hourly buckets of `0` are padded from `00:00` of the start 
date up to the exclusive end date boundary.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #42587
   - [ ] Required feature flags:
   - [x] 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
   - [x] 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