Skip to content
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

@turbo with passmissing? #470

Open
alfaromartino opened this issue Feb 20, 2023 · 1 comment
Open

@turbo with passmissing? #470

alfaromartino opened this issue Feb 20, 2023 · 1 comment

Comments

@alfaromartino
Copy link

I've been using FastBroadcast and @turbo to speed up broadcasting operations in DataFrames. However, missing values are quite common when you work with a DataFrame, and @turbo throws an error in that case.

Is it possible to have something similar to passmissing for @turbo? This would be consistent with Base broadcast and as FastBroadcast works, which passes missing values when you broadcast.

using LoopVectorization, FastBroadcast

df = DataFrame(a = [1,missing,3])

@.. df.a .* df.a 		# this works
@turbo df.a .* df.a	# this throws error

The error is:

ERROR: MethodError: no method matching vmaterialize!(::Vector{Union{Missing, Int64}}, 
::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), 
Tuple{Vector{Union{Missing, Int64}}, Vector{Union{Missing, Int64}}}}, 
::Val{:Main}, ::Val{(true, 0, 0, 0, true, 0, 32, 15, 64, 0x0000000000000001, 1, true)}, ::Val{((true,), (true,))})

The problem persists if you create a view dropping missings, since the vector is still Union{Missing,T} and is not allowed.

Many thanks!!! Great package!!!

@chriselrod
Copy link
Member

Yes, this is fixable.
If someone wants to make a PR, I could explain the approach and answer any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants