Skip to content

Commit

Permalink
Merge pull request #110 from davidanthoff/weakrefstrings-update
Browse files Browse the repository at this point in the history
Update to latest WeakRefStrings
  • Loading branch information
davidanthoff authored Jan 22, 2019
2 parents 55ba0c5 + ebca23c commit b0a9454
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ julia 0.7
PooledArrays 0.2.0
Nullables
DataStructures
WeakRefStrings 0.4.4
WeakRefStrings 0.5.4
CodecZlib
DoubleFloats
15 changes: 3 additions & 12 deletions src/csv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,10 @@ function promote_field(failed_str, field, col, err, nastrings, stringtype, strin
swapinner(field, newtoken), newcol
end

function _construct_stringvector(::Type{T}, ::Type{S}, len) where {T<:Array,S}
return Vector{S}(undef, len)
end

function _construct_stringvector(::Type{T}, ::Type{S}, len) where {T<:StringArray,S}
return StringVector{S}(len)
end


function promote_column(col, rowno, T, stringtype, stringarraytype, inner=false)
if typeof(col) <: Array{Missing}
if T <: StringLike
arr = _construct_stringvector(stringarraytype, stringtype, length(col))
arr = stringarraytype{stringtype,1}(undef, length(col))
for i = 1:rowno
arr[i] = ""
end
Expand Down Expand Up @@ -594,9 +585,9 @@ function makeoutputvec(eltyp, N, stringtype, stringarraytype)
# all cells were blank
Array{Missing}(undef, N)
elseif fieldtype(eltyp) == StrRange
_construct_stringvector(stringarraytype, stringtype, N)
stringarraytype{stringtype,1}(undef, N)
elseif ismissingtype(fieldtype(eltyp)) && fieldtype(eltyp) <: StrRange
_construct_stringvector(stringarraytype, Union{Missing, String}, N)
stringarraytype{Union{Missing, String},1}(undef, N)
else
Array{fieldtype(eltyp)}(undef, N)
end
Expand Down

0 comments on commit b0a9454

Please sign in to comment.