Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Commit

Permalink
Make sure we allocate a separate empty parent for each column if ther…
Browse files Browse the repository at this point in the history
…e's no parent
  • Loading branch information
quinnj committed Jun 22, 2016
1 parent f75f579 commit f530cb4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/DataStreams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,14 @@ function DataFrame(sch::Data.Schema)
rows, cols = size(sch)
columns = Vector{Any}(cols)
types = Data.types(sch)
parent = haskey(sch.metadata, "parent") ? sch.metadata["parent"] : UInt8[]
for i = 1:cols
columns[i] = NullableArray{types[i],1}(Array{types[i]}(rows), Array{Bool}(rows), parent)
T = types[i]
A = Array{T}(rows);
columns[i] = NullableArray{T,1}(A, Array{Bool}(rows),
haskey(sch.metadata, "parent") ? sch.metadata["parent"] : UInt8[])
if T <: AbstractString && length(fieldnames(T)) == 2
ccall(:memset, Void, (Ptr{Void}, Cint, Csize_t), A, 0, rows * sizeof(T))
end
end
return DataFrame(columns, DataFrames.Index(map(Symbol, header(sch))))
end
Expand Down

0 comments on commit f530cb4

Please sign in to comment.