Skip to content

Commit a547b5c

Browse files
authored
Merge pull request #27 from queryverse/fix-gather
Fix a corner case in gather
2 parents 7318351 + fd3e88a commit a547b5c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/enumerable/enumerable_gather.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ end
1414
function gather(source::Enumerable, args...; key::Symbol = :key, value::Symbol = :value)
1515
fields = fieldnames(eltype(source))
1616
if length(args) > 0
17-
indexFields = ()
17+
indexFields_vector = Vector{Symbol}(undef, 0)
1818
firstArg = true
1919
for arg in args
2020
if typeof(arg) == Symbol
21-
indexFields = (indexFields..., arg)
21+
push!(indexFields_vector, arg)
2222
else typeof(arg) == Not{Symbol}
2323
if firstArg
24-
indexFields = (a for a in fields if a != arg.val)
24+
indexFields_vector = [a for a in fields if a != arg.val]
2525
else
26-
indexFields = (a for a in indexFields if a != arg.val)
26+
indexFields_vector = [a for a in indexFields_vector if a != arg.val]
2727
end
2828
end
2929
firstArg = false
3030
end
31+
indexFields = tuple(indexFields_vector...)
3132
else
3233
indexFields = fields
3334
end

0 commit comments

Comments
 (0)