queryverse / queryverse/Query.jl

Confusing error with mixed-type inputs

Open
#270 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I found a strange behaviour with mixed-type inputs. 2D arrays work correctly:

[(a=1,) (a='a',)] |> @filter(isa(_.a, Char)) |> collect

1-element Array{NamedTuple{(:a,),T} where T<:Tuple,1}:
 (a = 'a',)

However, 1D do not:

[(a=1,) (a='a',)][:] |> @filter(isa(_.a, Char)) |> collect

Schemaless sources cannot be passed to datavaluerows.

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] datavaluerows(::Array{NamedTuple{(:a,),T} where T<:Tuple,1}) at /users/aplavin/.julia/packages/Tables/NEFJq/src/tofromdatavalues.jl:72
 [3] getiterator(::Array{NamedTuple{(:a,),T} where T<:Tuple,1}) at /users/aplavin/.julia/packages/Tables/NEFJq/src/Tables.jl:189
 [4] query(::Array{NamedTuple{(:a,),T} where T<:Tuple,1}) at /users/aplavin/.julia/packages/QueryOperators/PfROc/src/source_iterable.jl:7
 [5] (::getfield(Main, Symbol("##134#136")))(::Array{NamedTuple{(:a,),T} where T<:Tuple,1}) at /users/aplavin/.julia/packages/Query/UeHfO/src/standalone_query_macros.jl:221
 [6] |>(::Array{NamedTuple{(:a,),T} where T<:Tuple,1}, ::getfield(Main, Symbol("##134#136"))) at ./operators.jl:813
 [7] top-level scope at In[37]:1

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

Reproduce the two examples in the issue, then trace the 1D case through query, getiterator, and datavaluerows using the stacktrace. Compare it with the working 2D input and verify that filtering and collecting the mixed-type 1D NamedTuple array no longer raises the schemaless-source error.

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.