queryverse / queryverse/Query.jl

eltype for @map result can be a "malformed" NamedTuple type

Open
#284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
403
Forks
48
Avg merge
3d 6h
Merged PRs (30d)
6

Description

julia> coll = (row for row in [(a=1, b=Dict{Any,Any}(:c=>1))]) |> @map({_.a, c=_.b[:c]})
1-element query result
 (a = 1, c = 1)

julia> typeof(coll)
QueryOperators.EnumerableMap{NamedTuple{(:a, :c),_A} where _A,QueryOperators.EnumerableIterable{NamedTuple{(:a, :b),Tuple{Int64,Dict{Any,Any}}},IterableTables.GeneratorWithElType{NamedTuple{(:a, :b),Tuple{Int64,Dict{Any,Any}}},Base.Generator{Array{NamedTuple{(:a, :b),Tuple{Int64,Dict{Any,Any}}},1},getfield(Main, Symbol("##51#54"))}}},getfield(Main, Symbol("##53#56"))}

julia> eltype(coll)
NamedTuple{(:a, :c),_A} where _A

julia> eltype(coll) <: NamedTuple
false

Note that this breaks isiterabletable without https://github.com/queryverse/TableTraits.jl/pull/11

(v1.2) pkg> st -m Query
    Status `~/.julia/environments/v1.2/Manifest.toml`
  [e7dc6d0d] DataValues v0.4.12
  [1c8ee90f] IterableTables v0.11.0
  [1914dd2f] MacroTools v0.5.1
  [1a8c2f83] Query v0.12.2
  [2aef5ad7] QueryOperators v0.9.1
  [10745b16] Statistics

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Julia example with @map and inspecting the resulting eltype; then trace how that type is produced and how it affects isiterabletable, including the referenced TableTraits change. Done means the @map result exposes a valid NamedTuple subtype and no longer breaks isiterabletable.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.