-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sorted dict #14
base: main
Are you sure you want to change the base?
Sorted dict #14
Conversation
Details that came up during implementation:
|
Have ported query FJ Codegen and runtime should work everywhere, just need to generate all the other queries in SDQL. |
case DictNode(seq, hint) => | ||
case DictNode(Nil, _) => raise("Type inference needs backtracking to infer empty type { }") | ||
// @vec { <...> -> 1 } treats the relational form <...> -> 1 it as a mapping i -> <...> | ||
case DictNode(Seq((r: RecNode, Const(1))), hint @ Vec(_)) => DictType(IntType, run(r), hint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear why you need to return this type? Is it because later on you are looking up over it based on the index? Otherwise, this makes the type system very complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's used by the "pure" sorting FJ queries in progs/job/sorting/fj
.
For example, in query 3a
the last line interm0(i).col0
is a lookup by index:
let interm0_unsort = sum(<mk_off, _> <- range(mk.size))
let x0 = mk.movie_id(mk_off) in
if (x0 ∈ t_trie0) then
let t_trie1 = t_trie0(x0) in
sum(<t_i, _> <- t_trie1)
let t_off = t_offsets(t_i)
@vec { <col0=mk.movie_id(mk_off), col1=mk.keyword_id(mk_off), col2=t.title(t_off)> -> 1 }
let interm0 = ext(`SortedVec`, 0, interm0_unsort)
let interm0_trie0 = sum(<i, _> <- range(ext(`Size`, interm0)))
@st(ext(`Size`, interm0)) { interm0(i).col0 -> @range { i -> 1 } }
@@ -222,3 +224,6 @@ sealed trait LLQL | |||
case class Initialise(tpe: Type, e: Exp) extends Exp with LLQL | |||
case class Update(e: Exp, agg: Aggregation, dest: Sym) extends Exp with LLQL | |||
case class Modify(e: Exp, dest: Sym) extends Exp with LLQL | |||
|
|||
/** Marks which section of the program to time in benchmarks */ | |||
case class Timer(exp: Exp) extends Exp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does exp
contain here? The entire program that will be timed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exp
contains the entire program after where the timer
expression appears, which is what we want to time since we must exclude the initial load
and sorting expressions.
This is simplest for now. In future, we could add more fine-grained control of the timer, e.g. timer_start
/ timer_elapsed
/ timer_stop
to time different subsections of the program.
@amirsh this PR is now ready to merge, subject to your approval:
|
Support for sorting and hybrid queries (i.e. using
SortedDict
andRange
). Includes all queries ported over to SDQL.