queryverse / QuerySQLite.jl

SQLite backend for Query.jl
Other
4 stars 2 forks source link

Problem when using @map #28

Closed pstaabp closed 4 years ago

pstaabp commented 4 years ago

Another problem that I found was using the @map command. In this example:

database.Track |> 
    @groupby(_.AlbumId) |> 
    @map({AlbumId = key(_), time_min = minimum(_.Milliseconds)})

returns the error:

MethodError: no method matching iterate(::QuerySQLite.SourceCode{SQLite.DB})

This seems to be because Julia's minimum function uses iterate under the hood. It seems that it would be nice for this to translate into something like:

SELECT AlbumID, MIN(Milliseconds) FROM Track GROUP BY AlbumID;

and run the MIN function from SQLITE instead.

bramtayl commented 4 years ago

Yes, thanks for testing out the package. Can you open up a separate issue for minimum?

bramtayl commented 4 years ago

Oh, nevermind, for some reason I thought this was the same issue. Carry on!