Repository navigation
fix(dataframe): normalize trusted nonfinite scalars - #44219
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #44219 +/- ##
=======================================
Coverage 81.21% 81.22%
=======================================
Files 2968 2968
Lines 179363 179417 +54
Branches 41597 41606 +9
=======================================
+ Hits 145675 145733 +58
+ Misses 30977 30975 -2
+ Partials 2711 2709 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review Agent Run #c713d3
Actionable Suggestions - 1
-
superset/dataframe.py - 1
- longdouble overflow nulls data · Line 58-60
Additional Suggestions - 2
-
tests/unit_tests/sql_lab_test.py - 1
-
Tautological test assertion · Line 94-96This assertion always passes: in the non-msgpack branch `_deserialize_results_payload` (views/utils.py:668) just calls `json.loads(payload)` from the same `superset.utils.json` module as `superset_json.loads`, so both sides are identical. It verifies nothing about the view consumer's projection. Assert the actual deserialized `data` values (None for non-finite, `float(finite)` for the finite Decimal) instead.
-
-
tests/unit_tests/dataframe_test.py - 1
-
Misleading JSON assertion · Line 96-96`superset_json.dumps` serializes the finite `Decimal` through `float()` in `base_json_conv`, so the emitted JSON number is `0.1`, not `0.10000000000000000001`. This assertion only passes because Python collapses `0.10000000000000000001 == 0.1`, masking that Decimal precision is lost on serialization. Assert `0.1` to reflect real behavior.
-
Review Details
-
Files reviewed - 6 · Commit Range:
6d141c1..6d141c1- superset/common/query_context_processor.py
- superset/dataframe.py
- tests/unit_tests/common/test_query_context_processor.py
- tests/unit_tests/dataframe_test.py
- tests/unit_tests/sql/execution/test_celery_task.py
- tests/unit_tests/sql_lab_test.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #fce4dcActionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #8cae59Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Nice, this is a clean extraction. The trusted-scalar/hostile-object handling is careful (love the tests that assert hooks never fire on subclassed values), and the Decimal/longdouble/NaN edge cases all look covered. Codeant and Bito's threads look addressed too. LGTM, approving.
SUMMARY
Extracts self-contained DataFrame/JSON scalar normalization from #43771 so that the Sunburst feature PR has a smaller, more reviewable scope.
The projection boundary now normalizes exact trusted pandas, Python float, NumPy float, and Decimal missing/non-finite scalars to
Nonewithout invoking equality or numeric hooks on arbitrary object-column values. Query-context output, synchronous SQL Lab output, and asynchronous SQL result serialization therefore emit strict JSON nulls rather than NaN/Infinity tokens while preserving finite Decimal precision. JavaScript-unsafe integers are stringified at the query-context producer boundary, and finitenp.longdoublevalues are classified without narrowing through Python float.This change is independent of Sunburst and can land before #43771. The other independent extraction is #44218. Once merged, #43771 can absorb master normally and its corresponding diff disappears without rewriting either branch.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; backend serialization behavior only.
TESTING INSTRUCTIONS
Regression coverage includes finite/non-finite Decimal and
np.longdoublevalues, browser-safe integer wire serialization, NumPy/pandas missing values, hostile object equality/numeric hooks, synchronous SQL Lab serialization, and asynchronous SQL result serialization.Exact-head CI:
ee59e685f8adfc53485d07c6d3c62b66739bbdcdis mergeable. Focused tests and pre-commit pass; integration checks are blocked by the two migration heads present on the currentmastermerge result (c7f53d184ea2and88a01c781622).ADDITIONAL INFORMATION