bito-code-review[bot] commented on code in PR #44897:
URL: https://github.com/apache/superset/pull/44897#discussion_r4167653271


##########
superset/models/helpers.py:
##########
@@ -2635,7 +2635,9 @@ def normalize_df(
         if getattr(self, "enforce_numerical_metrics", True):
             dataframe_utils.df_metrics_to_num(df, query_object)
 
-        df.replace([np.inf, -np.inf], np.nan, inplace=True)
+        # ``mask`` + ``infer_objects`` rather than ``replace``, which emits a

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Silent dtype change on object columns</b></div>
   <div id="fix">
   
   This changes object-column dtypes even when no ±inf is present: verified by 
execution, `mask().infer_objects()` converts object-float columns to float64 
and object-string columns to `str` (pandas 3), while the old `replace` left 
dtypes untouched. Downstream `exec_post_processing` and chart serialization now 
see different dtypes. Prefer `df.where(~df.isin([np.inf, -np.inf]))`, which 
masks without re-typing.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #1f63e3</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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]

Reply via email to