Query.jl icon indicating copy to clipboard operation
Query.jl copied to clipboard

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

Open ssfrr opened this issue 5 years ago • 0 comments

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.

ssfrr avatar Mar 28 '19 13:03 ssfrr