You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/04/22 22:14:10 UTC
[PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
sadpandajoe opened a new pull request, #39575:
URL: https://github.com/apache/superset/pull/39575
### SUMMARY
Follow-up to #39073. That PR fixed the Word Cloud secondary-sort issue on Druid by adding an independent `sort_by_series` control, and shipped a DB migration (`fd0c8583b46d`) to set `sort_by_series=true` on every existing `word_cloud` slice so their legacy ordering was preserved.
The same backward-compatibility guarantee can be achieved with two small code changes — making the fix cherry-pickable onto release branches without dragging along the intermediate migrations that would otherwise need to come with it.
**Changes:**
- `controlPanel.tsx`: `sort_by_series` default flips from `false` → `true`. New charts now match the pre-fix behavior (series `ORDER BY` appended). Users opt out for the Druid TopN fast path by unchecking the box.
- `buildQuery.ts`: series-sort check becomes `sort_by_series !== false` so legacy charts rendered on dashboards — where Explore's control-state hydration does not run and the param is `undefined` in `form_data` — still get the legacy ordering.
- `controlPanel.test.ts`: locks the `default: true` invariant against future accidental flips that would break legacy charts.
- Migration `fd0c8583b46d` is deleted entirely — no downstream migration referenced it, so the Alembic chain is unaffected.
**Why replace the migration with code?** For JSON-blob params like `slice.params`, a migration is only strictly required when "field absent" doesn't have a well-defined meaning in the reader. Here we can define `undefined → true` at read time and get the same outcome without touching any row in the DB.
**Trade-off:** new charts default to the slow (legacy) ordering, matching pre-#39073 behavior. The original PR's new-chart fast-path default is deferred; users can still opt in per-chart. This is the right call for cherry-pickability — the fix (the opt-out box) is available to everyone, the new default isn't.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable — no visual change to the word cloud rendering or control panel beyond the default checkbox state.
### TESTING INSTRUCTIONS
Frontend unit tests:
```bash
cd superset-frontend
npm run test -- plugins/plugin-chart-word-cloud/test/buildQuery.test.ts --no-coverage
npm run test -- plugins/plugin-chart-word-cloud/test/controlPanel.test.ts --no-coverage
```
Manual:
1. **Existing chart** — open any pre-existing word cloud chart. Verify it renders with the same ordering as before (series sort applied). Inspect the `/api/v1/chart/data` payload for a legacy chart on a dashboard: the `orderby` array should include the series sort even though the saved `params` has no `sort_by_series` key.
2. **New chart** — create a new word cloud. The "Sort by series" checkbox should be **checked** by default. The generated query should contain `ORDER BY <series> ASC`.
3. **Opt-out (Druid fast path)** — uncheck "Sort by series", save. Reload the chart. Saved params should contain `"sort_by_series": false` and the query should have no series `ORDER BY`.
### ADDITIONAL INFORMATION
- [x] Has associated issue: follow-up to #39073 / #39072
- [ ] Required feature flags:
- [x] Changes UI (checkbox default only)
- [ ] Includes DB Migration — this PR **removes** the migration from #39073
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #39575:
URL: https://github.com/apache/superset/pull/39575#discussion_r3132740887
##########
superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.tsx:
##########
@@ -41,12 +41,13 @@ const config: ControlPanelConfig = {
config: {
type: 'CheckboxControl',
label: t('Sort by series'),
- default: false,
+ default: true,
description: t(
'Sort results by series name in ascending order. ' +
'When combined with "Sort by metric", this acts as a tiebreaker ' +
- 'for equal metric values. Adding this sort may reduce query ' +
- 'performance on some databases.',
+ 'for equal metric values. Disabling this on Druid enables the ' +
+ 'TopN query optimization and can significantly speed up ' +
+ 'high-cardinality queries.',
Review Comment:
I don't think we need to mention Druid here. I would keep the original description
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #39575:
URL: https://github.com/apache/superset/pull/39575#issuecomment-4308111196
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | d85e710bd417924702329518de80aeb1dc02d6fa |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69ea8926c3a99d0008f72b99 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-39575--superset-docs-preview.netlify.app](https://deploy-preview-39575--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-39575--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #39575:
URL: https://github.com/apache/superset/pull/39575
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39575:
URL: https://github.com/apache/superset/pull/39575#issuecomment-4300336798
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39575?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 63.97%. Comparing base ([`6c88fca`](https://app.codecov.io/gh/apache/superset/commit/6c88fcacfa4cee67786c5232036e930099a19d36?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`f1c12aa`](https://app.codecov.io/gh/apache/superset/commit/f1c12aa5e64589404bc3791ba175aa6edb205d00?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #39575 +/- ##
==========================================
- Coverage 64.47% 63.97% -0.50%
==========================================
Files 2564 2564
Lines 133560 133559 -1
Branches 31032 31031 -1
==========================================
- Hits 86114 85450 -664
- Misses 45936 46601 +665
+ Partials 1510 1508 -2
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.88% <ø> (ø)` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.51% <ø> (?)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.66% <ø> (ø)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.74% <ø> (-1.14%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.15% <ø> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/39575/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39575?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39575:
URL: https://github.com/apache/superset/pull/39575#issuecomment-4308580772
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #39575:
URL: https://github.com/apache/superset/pull/39575#discussion_r3133813853
##########
superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.tsx:
##########
@@ -41,12 +41,13 @@ const config: ControlPanelConfig = {
config: {
type: 'CheckboxControl',
label: t('Sort by series'),
- default: false,
+ default: true,
description: t(
'Sort results by series name in ascending order. ' +
'When combined with "Sort by metric", this acts as a tiebreaker ' +
- 'for equal metric values. Adding this sort may reduce query ' +
- 'performance on some databases.',
+ 'for equal metric values. Disabling this on Druid enables the ' +
+ 'TopN query optimization and can significantly speed up ' +
+ 'high-cardinality queries.',
Review Comment:
Fixed in d85e710bd4 — reverted to the original description.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39575:
URL: https://github.com/apache/superset/pull/39575#issuecomment-4300291000
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] refactor(chart): replace word cloud sort_by_series migration with code defaults [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39575:
URL: https://github.com/apache/superset/pull/39575#issuecomment-4300649605
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org