diff --git a/src/namedtuples.jl b/src/namedtuples.jl index e6d0024..0061f8f 100644 --- a/src/namedtuples.jl +++ b/src/namedtuples.jl @@ -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 @@ -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 @@ -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)) \ No newline at end of file +columntable(ct::ColumnTable, itr) = ctappend(ct, columntable(itr))