diff --git a/src/fallbacks.jl b/src/fallbacks.jl index d2ce02b..c560889 100644 --- a/src/fallbacks.jl +++ b/src/fallbacks.jl @@ -103,8 +103,13 @@ end Custom column types can override with an appropriate "scalar" element type that should dispatch to their column allocator. Alternatively, and more generally, custom scalars can overload `DataAPI.defaultarray` to signal the default array type. +In this case the signaled array type must support a constructor accepting `undef` for initialization. """ -allocatecolumn(T, len) = DataAPI.defaultarray(T, 1)(Base.nonmissingtype(T) === T ? undef : missing, len) +function allocatecolumn(T, len) + a = DataAPI.defaultarray(T, 1)(undef, len) + Missing <: T && fill!(a, missing) + return a +end @inline function _allocatecolumns(::Schema{names, types}, len) where {names, types} if @generated