queryverse / queryverse/Query.jl

`@join` should catch when result function is 1-arg

Open
#255 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I was figuring out how @join works and ended up trying this:

df1 = DataFrame(id=[1, 2, 3, 6, 8, 9], val1 = rand(6))
df2 = DataFrame(id=1:10)
@join(df1, df2, _.id, _.id, _) |> DataFrame

Which throws the error message:

MethodError: no method matching (::getfield(Main, Symbol("##121#124")))(::NamedTuple{(:id, :val1),Tuple{Int64,Float64}}, ::NamedTuple{(:id,),Tuple{Int64}})

After a little head-scratching I realized that Query was creating a 1-arg function with my final _, but then calling it with 2 arguments, throwing the error. Perhaps at macro expansion time it could catch this error and display a more descriptive error message.

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 issue with the Julia snippet using @join and the final _. Read the @join macro expansion and how it invokes the result function. Done means the one-argument result function case is detected and produces a more descriptive error instead of the shown MethodError.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.