queryverse / Query.jl

Query almost anything in julia
Other
395 stars 50 forks source link

Defining multiple variables with `@let` errors #301

Open Datseris opened 4 years ago

Datseris commented 4 years ago

I am doing a simple query like so:

res = @from row in beatdata begin
    @let ms = deduce_bpm(row)
    @let σ, d, D_S = music_distances(row.beats, row.pianobeats, ms)
    @select {σ=σ, d=d, D_S=D_S, row.band, row.piece, row.task}
    @collect DataFrame
end

but I get

ERROR: LoadError: QueryException: identifier expected at (σ, d, D_S)Stacktrace:
 [1] find_names_to_put_in_scope(::Expr) at C:\Users\m300808\.julia\packages\Query\AwBtd\src\query_translation.jl:420
 [2] find_and_translate_transparent_identifier(::Expr) at C:\Users\m300808\.julia\packages\Query\AwBtd\src\query_translation.jl:429
 [3] find_and_translate_transparent_identifier(::Expr) at C:\Users\m300808\.julia\packages\Query\AwBtd\src\query_translation.jl:448 (repeats 2 times)
 [4] query_expression_translation_phase_7 at C:\Users\m300808\.julia\packages\Query\AwBtd\src\query_translation.jl:455 [inlined]
 [5] translate_query(::Expr) at C:\Users\m300808\.julia\packages\Query\AwBtd\src\query_translation.jl:511

Seems to me that this should be allowed.

davidanthoff commented 4 years ago

Yes, that is a nice syntax idea!