mikebridge commented on code in PR #45527:
URL: https://github.com/apache/superset/pull/45527#discussion_r4330944110
##########
superset/charts/client_processing.py:
##########
@@ -1417,18 +1417,27 @@ def _is_default_index_column(series: pd.Series) -> bool:
def _read_excel_for_client_processing(
data: bytes,
form_data: dict[str, Any],
+ verbose_map: Optional[dict[str, str]] = None,
) -> pd.DataFrame:
df = pd.read_excel(BytesIO(data))
if len(df.columns) == 0:
return df
first_column = df.columns[0]
- expected_columns = {
+ expected_columns: set[str] = {
*get_column_names(form_data.get("columns")),
+ *get_column_names(form_data.get("all_columns")),
+ *get_column_names(form_data.get("groupby")),
*get_column_names(form_data.get("groupbyRows")),
*get_column_names(form_data.get("groupbyColumns")),
*get_metric_names(form_data.get("metrics")),
+ *(f"%{name}" for name in
get_metric_names(form_data.get("percent_metrics"))),
}
+ # Query exports can already carry display labels rather than selection
names.
+ if verbose_map:
+ expected_columns |= {
+ verbose_map.get(column, column) for column in expected_columns
+ }
if first_column in expected_columns:
Review Comment:
Good catch—fixed both in b29dab724c. The tabular flattening path preserves
the index name, and the allowlist compares the first header as a string. The
numeric-header issue was pre-existing; with values 0, 1 it could drop the
column entirely. Added red-first round-trip cases for both; all 241
client-processing tests 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]