Skip to content

fix(examples): correct chart metadata - #43810

Merged
villebro merged 4 commits into
apache:masterfrom
villebro:fix/legacy-timeseries-granularity-x-axis
Sep 4, 2026
Merged

fix(examples): correct chart metadata#43810
villebro merged 4 commits into
apache:masterfrom
villebro:fix/legacy-timeseries-granularity-x-axis

Conversation

@villebro

@villebro villebro commented Sep 3, 2026

Copy link
Copy Markdown
Member

SUMMARY

Corrects stale bundled example metadata for ECharts time-series charts that were storing the temporal column in legacy granularity / granularity_sqla metadata instead of x_axis.

This updates the affected USA birth names, World Bank, Sales Dashboard, Slack Dashboard, and Video Game Sales chart YAML files. It also updates the Python example definitions that generate the same metadata, with separate non_echarts_defaults and echarts_x_axis_defaults so the intended metadata shape is clear at each call site.

This also fixes the stale x_axis_forma typo to x_axis_time_format for the Top 10 name share examples.

I also fixed the Featured Charts Gantt dataset metadata by clearing its catalog; it was the only bundled example dataset with catalog: examples, which makes PostgreSQL try to query a catalog/database named examples.

I checked the migration path before keeping this as an examples-only fix. Persisted charts that go through the legacy viz migration are already covered by superset/migrations/shared/migrate_viz/base.py, which maps granularity_sqla to x_axis for migrated charts with an x-axis control. A later migration, 2023-07-18_15-30_863adcf72773_delete_obsolete_druid_nosql_slice_parameters.py, also removes obsolete granularity keys from saved slice params and query contexts. If we find production ECharts metadata with this exact stale shape, we can add a runtime shim separately.

BEFORE

See Trends and Top 10 Girls Names charts rendering incorrectly:

image

The Gantt chart dataset reference is incorrect, causing a query error:

image

AFTER

Trends and Top 10 Girls Names charts now render correctly:

image

Gantt also renders correctly:

image

TESTING INSTRUCTIONS

  • pytest tests/unit_tests/examples/utils_test.py -q
  • venv/bin/python -m compileall -q superset/examples/birth_names.py superset/examples/world_bank.py tests/unit_tests/examples/utils_test.py
  • pre-commit run

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@bito-code-review

bito-code-review Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c724cf

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 90c39fd..90c39fd
    • superset-frontend/src/explore/actions/hydrateExplore.test.ts
    • superset-frontend/src/explore/store.test.tsx
    • superset-frontend/src/explore/store.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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

@netlify

netlify Bot commented Sep 3, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 90c39fd
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a98eca1330fe40008036f30
😎 Deploy Preview https://deploy-preview-43810--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.

@villebro
villebro marked this pull request as draft September 3, 2026 03:44
Comment thread superset-frontend/src/explore/store.ts Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current implementation in handleDeprecatedControls blindly copies granularity to x_axis for ECharts timeseries charts, which causes issues when granularity is a time grain (e.g., 'P1D') rather than a column name.

To resolve this, you should validate that the granularity value is a valid column name before assigning it to x_axis. Since handleDeprecatedControls does not have access to the datasource metadata, a common approach is to check if the value looks like a time grain (e.g., starts with 'P') or to ensure it is not one of the known time grain strings.

Here is a suggested fix for superset-frontend/src/explore/store.ts:

  if (
    formData.viz_type &&
    echartsTimeseriesVizTypes.has(formData.viz_type) &&
    !('x_axis' in formData) &&
    formData.granularity &&
    !formData.granularity.startsWith('P') // Exclude time grains like P1D
  ) {
    formData.x_axis = formData.granularity;
  }

There are no other comments on this PR to address.

superset-frontend/src/explore/store.ts

if (
    formData.viz_type &&
    echartsTimeseriesVizTypes.has(formData.viz_type) &&
    !('x_axis' in formData) &&
    formData.granularity &&
    !formData.granularity.startsWith('P') // Exclude time grains like P1D
  ) {
    formData.x_axis = formData.granularity;
  }

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.39%. Comparing base (52a4cb6) to head (e649ce9).
⚠️ Report is 25 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43810      +/-   ##
==========================================
+ Coverage   79.36%   79.39%   +0.02%     
==========================================
  Files        2893     2893              
  Lines      167614   167740     +126     
  Branches    38816    38825       +9     
==========================================
+ Hits       133026   133169     +143     
+ Misses      32088    32071      -17     
  Partials     2500     2500              
Flag Coverage Δ
hive 37.78% <0.00%> (-0.02%) ⬇️
mysql 57.50% <100.00%> (-0.02%) ⬇️
postgres 57.54% <100.00%> (-0.02%) ⬇️
presto 39.67% <50.00%> (-0.02%) ⬇️
python 83.86% <100.00%> (+0.04%) ⬆️
sqlite 57.23% <100.00%> (-0.01%) ⬇️
unit 74.34% <0.00%> (+0.03%) ⬆️

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.

@villebro villebro changed the title fix(explore): hydrate legacy timeseries x-axis WIP fix(explore): hydrate legacy timeseries x-axis Sep 3, 2026
@villebro
villebro force-pushed the fix/legacy-timeseries-granularity-x-axis branch from 90c39fd to 6b27674 Compare September 3, 2026 15:00
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Sep 3, 2026
@villebro
villebro force-pushed the fix/legacy-timeseries-granularity-x-axis branch from 6b27674 to c9aeeb0 Compare September 3, 2026 15:20
@villebro villebro changed the title WIP fix(explore): hydrate legacy timeseries x-axis WIP fix(examples): correct chart metadata Sep 3, 2026
@villebro
villebro marked this pull request as ready for review September 3, 2026 15:37
@villebro villebro changed the title WIP fix(examples): correct chart metadata fix(examples): correct chart metadata Sep 3, 2026

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #4cf9c8

Actionable Suggestions - 1
  • tests/unit_tests/examples/utils_test.py - 1
Review Details
  • Files reviewed - 10 · Commit Range: c9aeeb0..c9aeeb0
    • superset/examples/birth_names.py
    • superset/examples/featured_charts/datasets/project_management.yaml
    • superset/examples/usa_births_names/charts/Genders_by_State.yaml
    • superset/examples/usa_births_names/charts/Top_10_Boy_Name_Share.yaml
    • superset/examples/usa_births_names/charts/Top_10_Girl_Name_Share.yaml
    • superset/examples/usa_births_names/charts/Trends.yaml
    • superset/examples/world_bank.py
    • superset/examples/world_health/charts/Growth_Rate.yaml
    • superset/examples/world_health/charts/World_s_Pop_Growth.yaml
    • tests/unit_tests/examples/utils_test.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 an incremental AI Review.

  • /review full - 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 tests/unit_tests/examples/utils_test.py Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Sep 3, 2026

@madhushreeag madhushreeag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@bito-code-review

bito-code-review Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1f82ef

Actionable Suggestions - 0
Review Details
  • Files reviewed - 8 · Commit Range: c9aeeb0..e649ce9
    • superset/examples/sales_dashboard/charts/Quarterly_Sales_By_Product_Line.yaml
    • superset/examples/sales_dashboard/charts/Revenue_by_Deal_Size.yaml
    • superset/examples/slack_dashboard/charts/Messages_per_Channel.yaml
    • superset/examples/video_game_sales/charts/Top_10_Games_Proportion_of_Sales_in_Markets.yaml
    • superset/examples/video_game_sales/charts/Total_Sales_per_Market_Grouped_by_Genre.yaml
    • tests/unit_tests/examples/utils_test.py
    • superset/examples/birth_names.py
    • superset/examples/world_bank.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 an incremental AI Review.

  • /review full - 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

@villebro
villebro merged commit 0636ac4 into apache:master Sep 4, 2026
75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants