Is there a way to have a bitstype with missing values in Julia?

Viewed 69

For Mmap static arrays, we need the data to be a "bitstype" (have a fixed storage size in memory, afaik). If a dataset has missing values, the typical way they are stored is that the column type is Union{Missing,T} where T is the type when it is not missing. However, isbitstype(Union{Missing,T})=false even if isbitstype(T)=true (it also happens that isbitstype(Missing)=true).

Is there a a bitstype parametric type for allowing missing values in Julia? or generally for defining bitstype unions of bitstypes. I would imagine the size only needs to be 1 more bit (or, for practical reasons, 1 more byte) than the max of the two underlying types.

Otherwise, what is the "right way" to handle this case?

0 Answers
Related