fitzee commented on PR #40005:
URL: https://github.com/apache/superset/pull/40005#issuecomment-4416962284
Thanks for the review — both points are already handled by the current
implementation.
**Point 1 (sparse combinations being reintroduced):** Restoration only runs
for metrics that are entirely absent from the post-pivot DataFrame. The
`missing` set is:
```python
missing = {m for m in expected_metrics if m not in existing_metrics}
```
A metric only enters `missing` if it has zero surviving columns after the
pivot. If a metric has data for even one category, it appears in
`existing_metrics` and is skipped entirely.
`test_pivot_combine_sparse_metrics_no_spurious_extra_columns` covers this
directly: `metric1` has data only for category A, `metric2` only for B —
neither is restored because both survive the pivot in some form.
**Point 2 (column assignment ordering):** Ordering is deterministic via
`keys_dict: dict[tuple[Any, ...], None]`. Python dicts preserve insertion order
since 3.7, and we iterate `for key in keys_dict` (not a set, which was the
prior issue). Pandas column assignment in that order is stable in pandas 2.x,
so explicit reindexing would be redundant.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]