Skip to content

Commit

Permalink
Fix indexing (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDunnNZ authored and quinnj committed Oct 1, 2018
1 parent 87c74d2 commit 763c900
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/namedtuples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Base.iterate(rows::NamedTupleIterator{Schema{names, T}}, st=()) where {
x = iterate(rows.x, st...)
x === nothing && return nothing
row, st = x
return NamedTuple{names, unweakreftypes(T)}(Tuple(unweakref(getproperty(row, fieldtype(T, i), i, nm)) for i = 1:fieldcount(T))), (st,)
return NamedTuple{names, unweakreftypes(T)}(Tuple(unweakref(getproperty(row, fieldtype(T, i), i, names[i])) for i = 1:fieldcount(T))), (st,)
end
end

Expand Down Expand Up @@ -89,7 +89,7 @@ function columntable(sch::Schema{names, types}, cols) where {names, types}
vals = Tuple(:(getarray(getproperty(cols, $(fieldtype(types, i)), $i, $(Meta.QuoteNode(names[i]))))) for i = 1:fieldcount(types))
return :(NamedTuple{names}(($(vals...),)))
else
return NamedTuple{names}(Tuple(getarray(getproperty(cols, fieldtype(types, i), i, nm)) for i = 1:fieldcount(types)))
return NamedTuple{names}(Tuple(getarray(getproperty(cols, fieldtype(types, i), i, names[i])) for i = 1:fieldcount(types)))
end
end
# unknown schema case
Expand All @@ -116,4 +116,4 @@ function ctappend(ct1::NamedTuple{N1, T1}, ct2::NamedTuple{N2, T2}) where {N1, T
end
end

columntable(ct::ColumnTable, itr) = ctappend(ct, columntable(itr))
columntable(ct::ColumnTable, itr) = ctappend(ct, columntable(itr))

0 comments on commit 763c900

Please sign in to comment.