Skip to content

feat(partition): migrate partition chart to v1 chart data API - #41729

Merged
rusackas merged 2 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t4-partition
Jul 3, 2026
Merged

feat(partition): migrate partition chart to v1 chart data API#41729
rusackas merged 2 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t4-partition

Conversation

@rusackas

@rusackas rusackas commented Jul 3, 2026

Copy link
Copy Markdown
Member

SUMMARY

Tier 4 of #41714 (targets remove-legacy-viz-pipeline): migrate the Partition Chart (partition) off explore_json onto /api/v1/chart/data. This was the largest viz.py transform left.

  • New buildQuery.ts mirroring PartitionViz.query_obj: grouped query, is_timeseries only for time-based options, legacy sort-metric append/orderby.
  • transformData ports the full get_data dispatch:
    • not_time/agg_sum/agg_meanlevels_for + nest_values (summed/averaged hierarchy, dim-path names at deeper levels, sorted group indexes);
    • time_series → same nesting with the timestamp prepended as the first level;
    • point_diff/point_factor/point_percentlevels_for_diff (last vs first time grain, pandas fill_value=0 semantics for grouped rows, plain arithmetic at the top level);
    • adv_anallevels_for_time + nest_procs (per-timestamp pivot summed with missing combos filled as 0, rolling mean/sum/std/cumsum with min_periods trimming, contribution row-normalization per level).
  • useLegacyApi: true removed (and the "Legacy" tag dropped).
  • No DB migration: viz_type unchanged; legacy granularity_sqla/time_range handled by extractExtras.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No visual change — same renderer, same data shape, different endpoint.

TESTING INSTRUCTIONS

  • npm run test -- plugins/legacy-plugin-chart-partition — 13 Jest tests covering every time-series option (hierarchy shape and values, mean vs sum, point comparisons incl. missing-side fill, timestamp-first nesting, period analysis with cumsum and contribution, groupby validation, query shapes).
  • Manual: open a saved Partition Chart in each time-series mode; network tab shows POST /api/v1/chart/data; rendering identical.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

Adds a buildQuery mirroring the legacy PartitionViz.query_obj (grouped
query, timeseries only for time-based options, sort-metric handling)
and ports the whole get_data dispatch into a transformData helper:
summed/averaged hierarchies (levels_for + nest_values, including the
plain time-series variant that treats the timestamp as the first
level), first-vs-last period comparisons with pandas fill_value=0
semantics (levels_for_diff), and the period-analysis pivot with
rolling window, cumulative sum and contribution normalization
(levels_for_time + nest_procs). Legacy pre-shaped payloads pass
through untouched.

No DB migration needed: viz_type is unchanged and legacy
granularity_sqla/time_range form data flows through extractExtras.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added api:charts Related to the REST endpoints of charts viz:charts:partition Related to the Partition chart labels Jul 3, 2026
@bito-code-review

bito-code-review Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@github-actions github-actions Bot added plugins and removed viz:charts:partition Related to the Partition chart api:charts Related to the REST endpoints of charts labels Jul 3, 2026
Comment thread superset-frontend/plugins/legacy-plugin-chart-partition/src/buildQuery.ts Outdated
Comment thread superset-frontend/plugins/legacy-plugin-chart-partition/src/buildQuery.ts Outdated
Comment thread superset-frontend/plugins/legacy-plugin-chart-partition/src/transformData.ts Outdated
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.12871% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.94%. Comparing base (907b18a) to head (a6f060f).
⚠️ Report is 4 commits behind head on remove-legacy-viz-pipeline.

Files with missing lines Patch % Lines
...legacy-plugin-chart-partition/src/transformData.ts 89.44% 19 Missing ⚠️
...egacy-plugin-chart-partition/src/transformProps.ts 0.00% 6 Missing ⚠️
...plugins/legacy-plugin-chart-partition/src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           remove-legacy-viz-pipeline   #41729      +/-   ##
==============================================================
+ Coverage                       63.91%   63.94%   +0.03%     
==============================================================
  Files                            2697     2699       +2     
  Lines                          148702   148904     +202     
  Branches                        34331    34400      +69     
==============================================================
+ Hits                            95040    95216     +176     
- Misses                          51912    51938      +26     
  Partials                         1750     1750              
Flag Coverage Δ
javascript 69.56% <87.12%> (+0.04%) ⬆️

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.

The line-engine query_obj partition inherited always ordered by the
sort metric or the first selected metric, ascending unless order_desc;
buildQuery now mirrors that instead of only ordering when descending.
transformData returns an empty hierarchy for empty results like the
legacy endpoint and avoids quadratic row accumulation in period
analysis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rusackas
rusackas merged commit 3e8048b into remove-legacy-viz-pipeline Jul 3, 2026
57 checks passed
@rusackas
rusackas deleted the legacy-viz-t4-partition branch July 3, 2026 07:16
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 8, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 10, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 13, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 14, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 16, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 17, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 23, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 27, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants