Skip to content

Commit a8a9096

Browse files
committed
bug fix - writing columns with type Missing
1 parent 1d1faab commit a8a9096

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/writer.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ _string_size(x, f, threads, ::Type{T}) where T <: Characters{N} where N = N
1616
_STRING_L(x::AbstractString) = ncodeunits(x)
1717
_STRING_L(x) = ncodeunits(string(x))
1818
_STRING_L(::Missing) = 0
19-
function _string_size(x, f, threads, ::Type{T}) where T <: Any
19+
function _string_size(x, f, threads, ::Type{T}) where {T}
2020
# in the case of Any we need to manually calculate the maximim length
21-
mapreduce(_STRING_Lf, max, skipmissing(x), init=0)
21+
mapreduce(_STRING_L f, max, skipmissing(x), init=0)
2222
end
23+
# fix a bug that cause "ambiguous error" when a column is of type Missing alone
24+
function _string_size(x, f, threads, ::Type{Union{}})
25+
# in the case of Any we need to manually calculate the maximim length
26+
mapreduce(_STRING_L f, max, skipmissing(x), init=0)
27+
end
28+
2329

2430

2531

0 commit comments

Comments
 (0)