Dask masked scalar arithmetic: hand off graph dtype and computed dtype together
Reconcile actual masked-array scalar promotion with graph inference.
Do not promise from meta alone
Reconcile actual masked-array scalar promotion with graph inference. An astype label alone cannot promise final precision. Supplying only meta to Truthound would miss the computed array; first identify the consumer’s dtype contract rather than labeling every float64 result numerically wrong. [1, 2, 3]
Promotion of two array kinds
Dask #12154 reports declared float32 but computed float64 after masked-array arithmetic with a Python float. A follow-up explains ndarray-based inference differing from MaskedArray promotion and links a PR. A proposed correction is separate from whether the installed version contains it. [1]
Record the final array
Record meta and actual computed dtype under the same operation ID and compare them with the approved consumer dtype. Hand off a different dtype only after explicit final conversion and value/mask verification. Extract observations from the computed array and fix the consumer policy beforehand. [1, 3]
A wider type still needs its own contract
The illustrative consumer requires a final float32 array with its mask preserved. Computed float32 meets that type condition. float64 requires consumer approval before handoff and fails this unchanged contract; it is not a claim that float64 values are mathematically incorrect. [1, 3]
Compare the consumer dtype
Truthound Core Python SDK 3.3.2 can compare prepared approved_consumer_dtype and computed_dtype through ColumnPairValidator with relationship="==". The operator supplies final signatures and mask evidence. The SDK does not repair Dask inference or choose a universally correct MaskedArray promotion policy. [1, 2, 3]
A cast or a contract change
Apply a verified final cast after compute or obtain explicit consumer approval for a float64 contract. Reconcile mask and value semantics under either choice. If the same actual operation is already verified, do not add a redundant meta-only check. [1, 3]
Application conditions
Extract dtype and mask from the actual computed array and approve consumer dtype beforehand.
Alternatives
Use a verified post-compute cast or obtain explicit approval of a float64 contract.
Limitations
Core compares dtype signatures, does not repair inference and does not label float64 promotion mathematically incorrect.
Evidence
- Event checked
- Subject checked
- Modified
