You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff84872
Browse filesBrowse the repository at this point in the historyBrowse files
fix(spark): use one_of signature and decide pmod's null result types explicitly
Replaces the hand-written `coerce_types` with the `one_of` signature suggested
in review:
Coercible([Decimal, Decimal])
Numeric(2)
`Coercible` matches a null argument and passes it through uncoerced (#19458),
so a decimal pair still reaches `return_type` with its declared precision and
scale, while everything else falls to `Numeric(2)`. That drops
`pmod_numeric_coercion`, which existed only to reproduce `Numeric`'s fold.
The null cases the coercion API cannot express are handled in `return_type`
instead: two untyped nulls answer `Float64`, and one untyped null keeps the
other side's type. Both match what `mod` returns, verified directly:
SELECT arrow_typeof(mod(NULL, NULL)); -- Float64
SELECT arrow_typeof(mod(2.5::decimal(3,1), NULL)); -- Decimal128(3, 1)
Because the null is no longer coerced away, `spark_pmod` can now receive
`DataType::Null` arrays, so it short-circuits to a null array of the result
type rather than failing to build a zero scalar.
`pmod(NULL, 3::int)` does not plan under `Numeric(2)`. That matches both `mod`
today and `pmod` before this PR, which used `Signature::numeric(2)`, so it is
covered by a `statement error` test rather than treated as a regression.
0 commit comments