You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/08/10 20:03:42 UTC
[PR] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
rusackas opened a new pull request, #43013:
URL: https://github.com/apache/superset/pull/43013
Follow-up to #41442.
### SUMMARY
The Sunburst chart's null-filtering path groups rows with lodash's `groupBy`, which has to coerce whatever value it's grouping on into a string to use as an object key. That means a SQL NULL and the literal string `"null"` both land under the same `"null"` key and get merged into one group, so which of them survives the "Show Null Values" filter ends up depending on which row happened to land in that group first.
Swapped the grouping to use a `Map` instead of a plain-object accumulator, so keys keep their real type/identity instead of getting stringified. A SQL null and the string `"null"` now always produce two separate tree nodes, and the existing `node.name !== null` filter only removes the actual null one.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A, logic fix covered by unit tests.
### TESTING INSTRUCTIONS
`cd superset-frontend && npx jest plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts`
Added a couple of tests: one column with a SQL null, the literal string `"null"`, and a normal value all present together, confirming they produce three distinct nodes when nulls are shown, and that turning on the filter drops only the real null.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration
- [ ] 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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5246947079
<!-- Bito Reply -->
The observation regarding `Date` object identity in `Map` keys is correct. Since `Map` uses strict equality (`===`), two distinct `Date` instances with the same timestamp will be treated as different keys, leading to incorrect grouping. To resolve this, you should canonicalize `Date` objects into their primitive timestamp values (e.g., `date.getTime()`) before using them as keys in the `groupByValue` function.
**superset-frontend/plugins/plugin-chart-echarts/src/utils/treeBuilder.ts**
```
const key = datum[groupByKey];
const canonicalKey = key instanceof Date ? key.getTime() : key;
const group = groups.get(canonicalKey);
```
--
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #43013:
URL: https://github.com/apache/superset/pull/43013#discussion_r3754030645
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/treeBuilder.ts:
##########
@@ -31,6 +30,30 @@ function getMetricValue(datum: DataRecord, metric: string) {
return typeof datum[metric] === 'number' ? (datum[metric] as number) : 0;
}
+// Groups records by the raw value of `groupByKey`, keyed with a Map instead
+// of a plain object. A plain-object accumulator (e.g. lodash's `groupBy`)
+// has to coerce every key to a string to use it as a property name, so a SQL
+// NULL and the literal string "null" both collapse to the same "null" key
+// and get merged into a single group. A Map keeps them as distinct keys, so
+// null filtering stays deterministic regardless of what else is in the
+// column.
+function groupByValue(
+ data: DataRecord[],
+ groupByKey: string,
+): Map<DataRecordValue, DataRecord[]> {
+ const groups = new Map<DataRecordValue, DataRecord[]>();
+ data.forEach(datum => {
+ const key = datum[groupByKey];
+ const group = groups.get(key);
+ if (group) {
+ group.push(datum);
+ } else {
+ groups.set(key, [datum]);
+ }
+ });
Review Comment:
`groupByValue` uses the raw `DataRecordValue` as a `Map` key. This fixes `null` vs `'null'`, but it changes grouping semantics for `Date` values: `Map` compares `Date` keys by object identity, so two different `Date` instances representing the same timestamp will end up in different groups. Since `DataRecordValue` explicitly allows `Date`, and callers format temporal values via `formatSeriesName(...)`, this can produce duplicated nodes and incorrect rollups for temporal group-bys.
Consider canonicalizing `Date` keys inside `groupByValue` so identical timestamps share the same key instance (while still keeping `null` and `'null'` distinct).
--
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5248063685
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | c8028981935833bcb0c52b09b06e599f78573613 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a7a7ce4b3ba690008076b1e |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-43013--superset-docs-preview.netlify.app](https://deploy-preview-43013--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> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#NYxRCoMwEAXvst9dGmtIbG_QY-xqQsVoQmJQEe_ehdK_Nw9mTkg5zmmFF8ANONPSf2T7cb_7GELcakLdaP3AH6KwF-N_jjuWunDNZcWZJodFMoNLIR7vQUKGLNneaW6ZzFMp1SlruHFwfQE) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-43013--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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #43013:
URL: https://github.com/apache/superset/pull/43013
--
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5285915361
**Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #43013:
URL: https://github.com/apache/superset/pull/43013#discussion_r3754681108
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/treeBuilder.ts:
##########
@@ -31,6 +30,30 @@ function getMetricValue(datum: DataRecord, metric: string) {
return typeof datum[metric] === 'number' ? (datum[metric] as number) : 0;
}
+// Groups records by the raw value of `groupByKey`, keyed with a Map instead
+// of a plain object. A plain-object accumulator (e.g. lodash's `groupBy`)
+// has to coerce every key to a string to use it as a property name, so a SQL
+// NULL and the literal string "null" both collapse to the same "null" key
+// and get merged into a single group. A Map keeps them as distinct keys, so
+// null filtering stays deterministic regardless of what else is in the
+// column.
+function groupByValue(
+ data: DataRecord[],
+ groupByKey: string,
+): Map<DataRecordValue, DataRecord[]> {
+ const groups = new Map<DataRecordValue, DataRecord[]>();
+ data.forEach(datum => {
+ const key = datum[groupByKey];
+ const group = groups.get(key);
+ if (group) {
+ group.push(datum);
+ } else {
+ groups.set(key, [datum]);
+ }
+ });
Review Comment:
Good catch — fixed by canonicalizing `Date` keys to their epoch time in `groupByValue` so identical timestamps from separately-parsed `Date` instances still land in the same group, while `null` and `'null'` stay distinct. Added a regression test.
--
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5249052936
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5245338941
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] fix(sunburst): keep SQL null and literal string "null" as distinct groups [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #43013:
URL: https://github.com/apache/superset/pull/43013#issuecomment-5284078286
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/43013?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 66.07%. Comparing base ([`762fdcc`](https://app.codecov.io/gh/apache/superset/commit/762fdccfdefa26546e06df84f0acf5eb9f85d970?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4bf5655`](https://app.codecov.io/gh/apache/superset/commit/4bf56551bca497afc5dad1990ab5d8f7bfda13a1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #43013 +/- ##
==========================================
- Coverage 66.64% 66.07% -0.58%
==========================================
Files 2866 2866
Lines 162896 162913 +17
Branches 37525 37529 +4
==========================================
- Hits 108568 107649 -919
- Misses 52203 53139 +936
Partials 2125 2125
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/43013/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/43013/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.68% <100.00%> (-0.02%)` | :arrow_down: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/43013/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 Harness](https://app.codecov.io/gh/apache/superset/pull/43013?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