-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@> macro doesn't work with DataFramesMeta in 1.0 #98
Comments
This is probably due to the change to macro parsing, which now inserts a line number:
Probably a simple fix to this line. |
I spent some time exploring this in the REPL. I wrote this dummy macro for threading arguments into macro calls to see what's going on:
This is taken straight from the line you referenced above. Using this macro to thread a dataframe
Now, calling the P.S. Do you happen to have a link to the change to macro parsing you mentioned? |
Interesting, thanks a lot. Am I right to assume that this would fix the
|
You probably want to grab the line with |
yeah, I just realised that as well... on a different note, this fix should also work for the edit: come to think of it, |
I just tried to see if the As far as I can tell, the only real change that is needed to make Furthermore, I think that it would be helpful to have a test that runs |
You can probably do @static if VERSION < v"0.7"
ex = Expr(...
else
...
end or something similar. A test would be a good idea for sure. |
I made a PR for the changes that I made to the code based on this discussion. |
Not sure if this is related, but the julia> using Lazy
julia> f(x, y) = 10x+y
f (generic function with 1 method)
julia> @> 1 begin
f(2)
end
21
julia> @macroexpand @> 1 begin
f(2)
end
:(f(2, 1)) |
In the past, I used the Lazy threading macro quite heavily with DataFramesMeta and JuliaDBMeta to string data selection and transformation together. For example, to select a subset of rows and then a subset of columns from a dataframe
df
using the DataFramesMeta macros, I would do something like this:@> df @where(:from.=="WDON") @select(:to)
This works like a charm in 0.6.4. However, when I tried this out in 1.0, I got the following error message:
ERROR: MethodError: no method matching where(::Nothing, ::getfield(Main, Symbol("##56#57")))
I'm not sure what the root cause of this error is, but it'd be very interesting if someone could elucidate the reason for the threading macro not working in 1.0, at least for this particular application.
The text was updated successfully, but these errors were encountered: