parses an intermediate language → CL (work in progress)
creates DSH's representation of the query
returns the resulting SQL queries
Quill and CL comparison:
Simple query
Quill
case class Person(id: Int, name: String)
val q = quote {
for {
p <- query[Person]
} yield p.name
}
CL
-- Definition of table:
let t = table(person, [id::Int, name::String], [[id]])::[(Int,String)]
-- ^^^^^^
in -- Keys
-- Query:
[ (p.name)::String | p <- t ]
Query with nested result
Quill
case class Person(name: String, age: Int)
val q = quote {
for {
p1 <- query[Person]
} yield {
( for {
p2 <- query[Person]
} yield (p1.age + p2.age)
, p1.name )
}
}
CL
-- name and age form a key:
let t = table(person, [name::String, age::Int], [[name,age]])::[(String,Int)]
in
[ ( [ (p1.age)::Int + (p2.age)::Int | p2 <- t ], (p1.name)::String ) | p1 <- t ]
-- Result will be of type [([Int],String)]
Conclusion
As far as I understand Quill, these things are missing in order to create this kind of CL expressions:
@freddie-freeloader Thanks for the examples, it makes more sense to me now. These changes are relatively simple to implement, I'll comment on the issues.
I'm currently assessing whether I can use quill as an interface for DSH.
DSH exposes a Module that
Quill and CL comparison:
Simple query Quill
CL
Query with nested result Quill
CL
Conclusion
As far as I understand Quill, these things are missing in order to create this kind of CL expressions: