eschutho opened a new pull request, #44897:
URL: https://github.com/apache/superset/pull/44897

   ## Decisions made that were not in the instructions
   
   None.
   
   ## Summary
   
   Production logs emit this on every query that reaches 
`ExploreMixin.normalize_df` with an object column:
   
   ```
   helpers.py: FutureWarning: Downcasting behavior in `replace` is deprecated 
and will be removed in a future version. ... df.replace([np.inf, -np.inf], 
np.nan, inplace=True)
   ```
   
   `normalize_df` replaced ±inf with NaN via `df.replace(..., inplace=True)`, 
which triggers pandas' deprecated silent downcasting on object-dtype columns. 
This replaces it with `df.mask(df.isin([np.inf, -np.inf])).infer_objects()`, 
which emits no warning and does not touch any global pandas option.
   
   `normalize_df` is the only emitter (the only ±inf replace in `superset/`), 
is defined only on `ExploreMixin` with no overrides, and both of its callers 
use the returned frame.
   
   No behavior change: the resulting dtypes and values are identical to the 
previous code (object columns of floats/ints still become float64/int64; 
strings stay object). The one nuance is that the input frame is no longer 
mutated in place; both callers already use the return value.
   
   ## Test plan
   
   - Added `test_normalize_df_replaces_infinity_without_downcasting_warning` 
(fails on base with the `FutureWarning` promoted to an error, passes with the 
fix).
   - `pytest tests/unit_tests/models/helpers_test.py` — all `normalize_df` 
tests pass. `test_build_like_predicate_is_case_insensitive_and_escaped` fails 
identically on the base commit (pre-existing, unrelated).
   - `ruff check` / `ruff format --check` clean.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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