-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
promote_typejoin with abstract types #35504
Comments
I think you mean
|
Woops, that was a typo. I was indeed talking about ( |
The solution seems to be altering this block here to add a method like
|
The |
But we aren't joining to |
Would it be possible to get something that fixes this into 1.6? |
I've filed #36939 to get the ball rolling. |
It is useful to have `promote_typejoin(Union{Missing, Int}, Float64}` return `Union{Missing, Real}` instead of `Any`, in particular because `zero` is defined on the former but not on the latter. This allows `sum(skipmissing(::NamedTuple))` to work even when it contains only missing values. Fixes #35504, Closes #36939 Co-authored-by: Milan Bouchet-Valat <[email protected]>
It is useful to have `promote_typejoin(Union{Missing, Int}, Float64}` return `Union{Missing, Real}` instead of `Any`, in particular because `zero` is defined on the former but not on the latter. This allows `sum(skipmissing(::NamedTuple))` to work even when it contains only missing values. Fixes #35504, Closes #36939 Co-authored-by: Milan Bouchet-Valat <[email protected]>
It is useful to have `promote_typejoin(Union{Missing, Int}, Float64}` return `Union{Missing, Real}` instead of `Any`, in particular because `zero` is defined on the former but not on the latter. This allows `sum(skipmissing(::NamedTuple))` to work even when it contains only missing values. Fixes #35504, Closes #36939 Co-authored-by: Milan Bouchet-Valat <[email protected]>
This just got merged into Julia master, so it should be in 1.6. |
Wonderful! Now basically all |
Currently,
promote_typejoin(Missing, T)
returnsAny
whenT
isn't concrete. This can be annoying in cases where the type information is necessary to perform some operation (and not just for performance), like computingzero(T)
:This would work if
promote_typejoin
returnedUnion{Missing, Real}
sincezero
is defined for that type.This situation happens in practice, for example when a row or group of rows happens to contain only missing values (see JuliaData/DataFrames.jl#2196).
Would it make sense to change
promote_typejoin
to stop special-casing concrete types?Cc: @JeffBezanson @vtjnash
The text was updated successfully, but these errors were encountered: