queryverse / queryverse/Query.jl
Mixing types does not work
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 403
- Forks
- 48
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 6
Description
Hi! There is a very confusing error thrown in some cases with mixed types.
A minimal example:
df = DataFrame(a=1:1)
df |>
@mapmany([(c=Inf,), (c=1,)], (; _..., b=__)) |>
@groupby({_.b}) |>
@map((; key(_)..., a=_.a))
throws type NamedTuple has no field a on the last line with @map. This is due to c having type Float in one row, and Int in another. When all values have the same type, the same code works:
df = DataFrame(a=1:1)
df |>
@mapmany([(c=0,), (c=1,)], (; _..., b=__)) |> # changed Inf to 0
@groupby({_.b}) |>
@map((; key(_)..., a=_.a))
Julia 1.2.0, Query v0.12.1.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the minimal example with Julia 1.2.0 and Query v0.12.1, then compare it with the version where Inf is replaced by 0. Trace the interaction among @mapmany, @groupby, and the final @map when mixed types are present. Done means the mixed-type example no longer throws the NamedTuple field error and retains access to a.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100