bito-code-review[bot] commented on PR #40004:
URL: https://github.com/apache/superset/pull/40004#issuecomment-4416775639
<!-- Bito Reply -->
The flagged issue is correct: the restoration logic incorrectly uses only
the last column level for MultiIndex pivots, creating tuples with wrong depth
for multi-column pivots. To resolve, modify the code to collect all unique
combinations of non-metric levels and build full tuples. No other comments
found in the PR.
**superset/utils/pandas_postprocessing/pivot.py**
```
if isinstance(df.columns, pd.MultiIndex):
existing_metrics = set(df.columns.get_level_values(0))
missing = [m for m in expected_metrics if m not in existing_metrics]
if missing:
if df.columns.nlevels > 1:
unique_combos = df.columns.droplevel(0).unique()
for metric in missing:
for combo in unique_combos:
df[(metric,) + combo] = float("nan")
else:
# Fallback for single level, though unlikely
pass
```
--
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]