codeant-ai-for-open-source[bot] commented on code in PR #45527:
URL: https://github.com/apache/superset/pull/45527#discussion_r4328128873
##########
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
+ }
Review Comment:
**Suggestion:** A display label that matches another key in `verbose_map` is
retained as a column, then renamed again, producing an incorrect XLSX header.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Logic error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6ac044ba226e4accb9b1285a42c49965&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6ac044ba226e4accb9b1285a42c49965&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/charts/client_processing.py
**Line:** 1438:1440
**Comment:**
*Logic Error: A display label that matches another key in `verbose_map`
is retained as a column, then renamed again, producing an incorrect XLSX header.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45527&comment_hash=41c50e87724ee77401d68481b350e228af6b05b6f62025b18fbdc6f99c052a2e&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45527&comment_hash=41c50e87724ee77401d68481b350e228af6b05b6f62025b18fbdc6f99c052a2e&reaction=dislike'>๐</a>
--
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]