Skip to content

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

@tkf

Description

@tkf
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 queryverse/TableTraits.jl#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions