Bug description
PR #32290 (fix for #32042) changed PartitionViz.nest_values (superset/viz.py) to return name as an array of the full ancestor path for any node at depth ≥ 2 (e.g. ["category_val", "subcategory_val", "sub_subcategory_val"]), instead of a plain string leaf label:
return [
{
"name": [*dims, i], # was previously just `i`
"val": dim_level[i],
"children": self.nest_values(levels, level + 1, metric, dims + [i]),
}
for i in ...
]
That change was necessary and correct on the backend side, but the frontend renderer, superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.ts, was never updated to match. It still treats node.name as a plain string everywhere it's consumed:
n.name = n.data.name; // now sometimes an array
...
root.sort((a, b) => {
...
return b.name > a.name ? 1 : -1; // array > array does string coercion
});
...
`<td>${n.name}</td>` // tooltip cell — array gets Array.prototype.toString()'d
...
.text(d => d.disp ? `${d.name}: ${d.disp}` : d.name) // on-chart segment label
...
d.color = colorFn(d.name, sliceId); // categorical color key
Since JS silently stringifies an array via Array.prototype.toString() (comma-joined) wherever it's interpolated into a template literal, every node at depth ≥ 2 renders its entire ancestor chain instead of just its own value.
How to reproduce the bug
Minimal SQL reproduction (works against any engine — pure literals, no real table needed). Register this as a virtual dataset (SQL Lab -> "Save as dataset"), then build a Partition Chart on it with metric SUM(val) and Levels = category, subcategory, sub_subcategory:
SELECT 'B' AS category, 'B1' AS subcategory, NULL AS sub_subcategory, 2 AS val
UNION ALL
SELECT 'A' AS category, 'A1' AS subcategory, 'A1a' AS sub_subcategory, 1 AS val
UNION ALL
SELECT 'A' AS category, 'A1' AS subcategory, 'A1b' AS sub_subcategory, 1 AS val
Look at the 3rd-level segments (children of A1).
Screenshot from a real Superset instance (6.1.0), built from the exact SQL above — note the positioning here is correct (this instance already has a separate, unrelated layout bug patched, filed as #43727), but the labels read the full ancestor path:
After applying the suggested fix below, the same chart, same data:
Expected results
A segment for sub_subcategory = "A1a" (under category = "A", subcategory = "A1") should be labeled A1a.
Actual results
The segment is labeled A,A1,A1a — the full comma-joined ancestor path. With more dimensions this gets long, repetitive, and at a glance looks like categories are duplicated or misattributed (it's easy to mistake this for the chart mis-nesting categories, since parent names appear to "leak" into every descendant's own label).
It also affects sibling sort order (comparing joined-path strings instead of each node's own value) and the color key (nodes are now colored by their full path rather than their own value, an unintended side effect of the same regression).
Root cause
PartitionDataNode.name is typed as string in Partition.ts, but the backend contract changed to sometimes send string[]. No consumer of node.name in this file was updated to handle both shapes.
Suggested fix
Normalize name to its own leaf value immediately after it's read from data, before the sort/tooltip/label/color code runs — a single-point fix that corrects all four consumers at once:
root.eachAfter(n => {
n.disp = n.data.val;
n.value = n.disp < 0 ? -n.disp : n.disp;
n.weight = n.value;
n.name = n.data.name;
// ... existing date-node handling, unchanged ...
});
root.each(n => {
if (Array.isArray(n.name)) n.name = n.name[n.name.length - 1];
});
root.sort((a, b) => { /* unchanged, now compares plain strings again */ });
We verified this normalization against a real 12,907-node production tree: zero arrays remained after the fix, and every node's displayed name matched the correct leaf value from the original backend payload.
We already have this patched locally (build-time transform on the compiled bundle) and are happy to turn it into a proper PR against Partition.ts if useful.
Superset version
6.1.0 (present in any version that includes PR #32290, i.e. 5.0.0+)
Python version
3.12
Node version
Not applicable (frontend-only bug)
Browser
Chrome
Additional context
Related: #32042 / PR #32290, which introduced this regression as a side effect of an otherwise-correct backend fix. Separately, we also found and reported an unrelated, pre-existing layout/positioning bug in the same chart (#43727) that produces a superficially similar "categories look mixed up" symptom — worth checking both if you're touching this component.
Checklist
Bug description
PR #32290 (fix for #32042) changed
PartitionViz.nest_values(superset/viz.py) to returnnameas an array of the full ancestor path for any node at depth ≥ 2 (e.g.["category_val", "subcategory_val", "sub_subcategory_val"]), instead of a plain string leaf label:That change was necessary and correct on the backend side, but the frontend renderer,
superset-frontend/plugins/legacy-plugin-chart-partition/src/Partition.ts, was never updated to match. It still treatsnode.nameas a plain string everywhere it's consumed:Since JS silently stringifies an array via
Array.prototype.toString()(comma-joined) wherever it's interpolated into a template literal, every node at depth ≥ 2 renders its entire ancestor chain instead of just its own value.How to reproduce the bug
Minimal SQL reproduction (works against any engine — pure literals, no real table needed). Register this as a virtual dataset (SQL Lab -> "Save as dataset"), then build a Partition Chart on it with metric
SUM(val)and Levels =category,subcategory,sub_subcategory:Look at the 3rd-level segments (children of
A1).Screenshot from a real Superset instance (6.1.0), built from the exact SQL above — note the positioning here is correct (this instance already has a separate, unrelated layout bug patched, filed as #43727), but the labels read the full ancestor path:
After applying the suggested fix below, the same chart, same data:
Expected results
A segment for
sub_subcategory = "A1a"(undercategory = "A",subcategory = "A1") should be labeledA1a.Actual results
The segment is labeled
A,A1,A1a— the full comma-joined ancestor path. With more dimensions this gets long, repetitive, and at a glance looks like categories are duplicated or misattributed (it's easy to mistake this for the chart mis-nesting categories, since parent names appear to "leak" into every descendant's own label).It also affects sibling sort order (comparing joined-path strings instead of each node's own value) and the color key (nodes are now colored by their full path rather than their own value, an unintended side effect of the same regression).
Root cause
PartitionDataNode.nameis typed asstringinPartition.ts, but the backend contract changed to sometimes sendstring[]. No consumer ofnode.namein this file was updated to handle both shapes.Suggested fix
Normalize
nameto its own leaf value immediately after it's read fromdata, before the sort/tooltip/label/color code runs — a single-point fix that corrects all four consumers at once:We verified this normalization against a real 12,907-node production tree: zero arrays remained after the fix, and every node's displayed name matched the correct leaf value from the original backend payload.
We already have this patched locally (build-time transform on the compiled bundle) and are happy to turn it into a proper PR against
Partition.tsif useful.Superset version
6.1.0 (present in any version that includes PR #32290, i.e. 5.0.0+)
Python version
3.12
Node version
Not applicable (frontend-only bug)
Browser
Chrome
Additional context
Related: #32042 / PR #32290, which introduced this regression as a side effect of an otherwise-correct backend fix. Separately, we also found and reported an unrelated, pre-existing layout/positioning bug in the same chart (#43727) that produces a superficially similar "categories look mixed up" symptom — worth checking both if you're touching this component.
Checklist