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
Simplify grounding by removing joins with var ID tables #110
Conversation
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.
Looks great other than the minor inline comments. Changes to the test examples made things a lot clearer how it'd reduce the # joins
val fakeCQ = stmt.q.copy(bodies = List(fakeBody)) | ||
|
||
// TODO XXX: Fix the `internal` hack below | ||
val qc = new QueryCompiler(fakeCQ, internalVarTables, internalVarJoinConds) | ||
val qc = new QueryCompiler(fakeCQ) |
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.
can you remove the TODO XXX comment since they're gone now?
@@ -116,8 +116,9 @@ class DeepDiveLogCompiler( program : DeepDiveLog.Program, config : DeepDiveLog.C | |||
// odd has happened. | |||
def resolveName( v : Variable ) : String = { | |||
v match { case Variable(v,relName,i) => | |||
if(attrNameForRelationAndPosition contains (relName,i)) { | |||
attrNameForRelationAndPosition(relName,i) | |||
val realRel = relName.replaceAll("^" + deepdivePrefixForVariablesWithIdsTable, "") |
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.
I'm not comfortable with stitching regex like this.. Looks like stripPrefix
will do a cleaner job?
@@ -685,7 +673,7 @@ object DeepDiveLogCompiler extends DeepDiveLogHandler { | |||
val deepdiveVariableIdColumn = "dd_id" | |||
val deepdiveVariableLabelColumn = "dd_label" | |||
val deepdiveVariableLabelTruthinessColumn = "dd_truthiness" | |||
val deepdivePrefixForVariablesIdsTable = "dd_variables_" | |||
val deepdivePrefixForVariablesWithIdsTable = "dd_predicate_" |
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.
Actually, could you elaborate a bit on the naming of this table? "predicate" isn't very intuitive IMO. I think it's still a materialized variable, so maybe something straightforward as dd_variable_copy_
or dd_variable_with_id_
?
dd_predicate_V
extends variable tableV
with two additional columns (copied from the var ID table):dd_id
(var ID) anddd_part
(partition ID).