Skip to content

Commit

Permalink
Cleanup allocate for CategoricalValues in DataStreams implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Sep 19, 2017
1 parent 5488484 commit d06929b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/abstractdataframe/io.jl
Expand Up @@ -230,8 +230,10 @@ Data.streamtypes(::Type{DataFrame}) = [Data.Column, Data.Field]
Data.weakrefstrings(::Type{DataFrame}) = true

allocate(::Type{T}, rows, ref) where {T} = Vector{T}(rows)
allocate(::Type{T}, rows, ref) where {T <: Union{CategoricalValue, Null}} =
CategoricalArray{CategoricalArrays.unwrap_catvalue_type(T)}(rows)
allocate(::Type{CategoricalValue{T, R}}, rows, ref) where {T, R} =
CategoricalArray{T, 1, R}(rows)
allocate(::Type{Union{Null, CategoricalValue{T, R}}}, rows, ref) where {T, R} =
CategoricalArray{Union{Null, T}, 1, R}(rows)
allocate(::Type{T}, rows, ref) where {T <: Union{WeakRefString, Null}} =
WeakRefStringArray(ref, T, rows)

Expand Down Expand Up @@ -295,8 +297,13 @@ DataFrame(sink, sch::Data.Schema, ::Type{S}, append::Bool;
@inline Data.streamto!(sink::DataFrameStream, ::Type{Data.Field}, val,
row, col::Int, ::Type{Val{true}}) =
sink.columns[col][row] = val
@inline Data.streamto!(sink::DataFrameStream, ::Type{Data.Column}, column,
row, col::Int, knownrows) =
@inline function Data.streamto!(sink::DataFrameStream, ::Type{Data.Column}, column,
row, col::Int, knownrows)
# @show sink.columns[col]

This comment has been minimized.

Copy link
@nalimilan

nalimilan Sep 19, 2017

Member

@quinnj Once again, please don't push directly to master. These lines should never have been committed.

# @show column
append!(sink.columns[col], column)
# @show sink.columns[col]
end


Data.close!(df::DataFrameStream) = DataFrame(collect(Any, df.columns), Symbol.(df.header))

0 comments on commit d06929b

Please sign in to comment.