codeant-ai-for-open-source[bot] commented on code in PR #45311:
URL: https://github.com/apache/superset/pull/45311#discussion_r4320980685
##########
superset/charts/client_processing.py:
##########
@@ -654,17 +667,24 @@ def collapse(block: pd.DataFrame) -> tuple[pd.DataFrame,
str]:
# to a number. The row totals below already coerce; do the
# same here so a total means the same thing on both axes.
block = block.apply(pd.to_numeric, errors="coerce")
- if percent_mode:
- source, reducer = collapse(block)
+ source, reducer = collapse(block)
+ mixed_metrics = (
+ source is None and aggfunc != CURRENCY_CONTEXT_AGGREGATION
+ )
+ if mixed_metrics:
+ subtotal = pd.Series(np.nan, index=block.index)
Review Comment:
**Suggestion:** Until the paired browser change lands, the chart still
displays the last metric in shared total slots while exports blank them, so
their results disagree.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3589c801c7da4b049805a762da659110&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=3589c801c7da4b049805a762da659110&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:** 675:675
**Comment:**
*Api Mismatch: Until the paired browser change lands, the chart still
displays the last metric in shared total slots while exports blank them, so
their results disagree.
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%2F45311&comment_hash=d7456f818d7150e8616675ef38e00f7abadc0a2f4e46295ba82546e061b5ee1a&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45311&comment_hash=d7456f818d7150e8616675ef38e00f7abadc0a2f4e46295ba82546e061b5ee1a&reaction=dislike'>๐</a>
##########
superset/charts/client_processing.py:
##########
@@ -752,13 +776,13 @@ def collapse(block: pd.DataFrame) -> tuple[pd.DataFrame,
str]:
else None,
)
- # if we want to apply the metrics on the rows we need to pivot the
- # dataframe back
+ # Replace placeholders before transposing, while column dtypes are intact.
+ df.replace("SUPERSET_PANDAS_NAN", np.nan, inplace=True)
if apply_metrics_on_rows:
- df = df.T
+ # Mixed blank columns must not coerce integer cells through float64
+ # during transposition (which would round integers above 2**53).
+ df = df.astype(object).T if mixed_metric_totals else df.T
Review Comment:
**Suggestion:** For metrics-on-rows mixed totals, XLSX processing re-infers
these object columns as numeric; blank cells make `pd.to_numeric` round
integers above 2**53.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Type error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=69c7f2710fdc4572bcdc0d447ec8fb2a&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=69c7f2710fdc4572bcdc0d447ec8fb2a&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:** 784:784
**Comment:**
*Type Error: For metrics-on-rows mixed totals, XLSX processing
re-infers these object columns as numeric; blank cells make `pd.to_numeric`
round integers above 2**53.
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%2F45311&comment_hash=4f02b735d33d92c8d5bce2d75bdcf23414208a3b51b13f7994f56ecdce8e560f&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45311&comment_hash=4f02b735d33d92c8d5bce2d75bdcf23414208a3b51b13f7994f56ecdce8e560f&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]