Skip to content

fix: extend zero-fill resampling to the full query time range - #42678

Open
AadityaAnand wants to merge 3 commits into
apache:masterfrom
AadityaAnand:fix/resample-full-time-range
Open

fix: extend zero-fill resampling to the full query time range#42678
AadityaAnand wants to merge 3 commits into
apache:masterfrom
AadityaAnand:fix/resample-full-time-range

Conversation

@AadityaAnand

Copy link
Copy Markdown

Summary

This PR fixes an issue where enabling Resample to zero only generated zero-filled buckets between the first and last data points returned by the query, rather than across the entire selected query time range.

The implementation propagates the resolved query time boundaries (from_dttm and to_dttm) into the pandas post-processing resampling step. When zero-fill resampling is enabled, the resampling now generates buckets for the full query time range, filling any missing intervals with 0.

Changes

  • Pass the resolved query time range (from_dttm and to_dttm) from QueryObject to the resampling post-processing step.
  • Extend zero-fill resampling to cover the entire selected query time range instead of only the range between existing data points.
  • Preserve the existing behavior when no query time range is available.
  • Leave all other resampling methods unchanged.
  • Add unit tests covering:
    • Single data point within the selected time range.
    • Missing data at the beginning of the range.
    • Missing data at the end of the range.
    • Missing data throughout the range.
    • Regression case verifying existing behavior when no query time range is provided.

Root Cause

The existing implementation relied on pandas.DataFrame.resample(...).asfreq(fill_value=0), which only generates buckets between the first and last timestamps present in the data. As a result, leading and trailing gaps within the selected query time range were never filled.

Testing

  • Added unit tests for the new zero-fill behavior.
  • Verified backward compatibility when no query time range is supplied.
  • Confirmed that non-zero-fill resampling behavior remains unchanged.

@dosubot dosubot Bot added the explore:time Related to the time filters in Explore label Aug 3, 2026
@bito-code-review

bito-code-review Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #e75cf8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: bd534aa..bd534aa
    • superset/common/query_object.py
    • superset/utils/pandas_postprocessing/resample.py
    • tests/unit_tests/pandas_postprocessing/test_resample.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/utils/pandas_postprocessing/resample.py Outdated
Comment thread superset/utils/pandas_postprocessing/resample.py Outdated
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.76471% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.47%. Comparing base (50c84f2) to head (7e520f1).

Files with missing lines Patch % Lines
superset/utils/pandas_postprocessing/resample.py 13.33% 13 Missing ⚠️
superset/common/query_object.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42678      +/-   ##
==========================================
- Coverage   65.54%   65.47%   -0.07%     
==========================================
  Files        2819     2815       -4     
  Lines      160372   160043     -329     
  Branches    36617    36473     -144     
==========================================
- Hits       105111   104785     -326     
+ Misses      53206    53192      -14     
- Partials     2055     2066      +11     
Flag Coverage Δ
hive 38.06% <11.76%> (?)
mysql 57.90% <11.76%> (-0.01%) ⬇️
postgres 57.95% <11.76%> (-0.01%) ⬇️
presto 39.99% <11.76%> (?)
python 59.32% <11.76%> (+0.07%) ⬆️
sqlite 57.58% <11.76%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 7e520f1
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a721eda5ced9e00089e7c10
😎 Deploy Preview https://deploy-preview-42678--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@AadityaAnand AadityaAnand changed the title Fix resample to zero across full query time range fix: extend zero-fill resampling to the full query time range Aug 4, 2026
@bito-code-review

bito-code-review Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #efdee5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: bd534aa..a9ec51d
    • superset/utils/pandas_postprocessing/resample.py
    • tests/unit_tests/pandas_postprocessing/test_resample.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

explore:time Related to the time filters in Explore size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants