-
Notifications
You must be signed in to change notification settings - Fork 9
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
Develop the conversion of Datalog rules into operation-based SQL queries #72
base: master
Are you sure you want to change the base?
Conversation
…de_rules_into_groups'
…a predicates in rule bodies
Printf.sprintf "CREATE TEMPORARY TABLE temp2 AS %s;" query3; | ||
"INSERT INTO temp0 SELECT * FROM temp0 AS inst;"; | ||
"DELETE FROM temp1 WHERE EXISTS ( SELECT * FROM temp1 AS inst );"; | ||
"INSERT INTO temp2 SELECT * FROM temp2 AS inst;"; |
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 is
AS inst
? Is it necessary? rule1
means add toed
, so the correspondingquery1
must beINSERT INTO ed
, same fortemp2
andDELETE
statement.- The
DELETE
statement didn't work in the original spec, if it existed, it would all disappear, what I want to do is something likeeed - temp1
, can SQL do something with theDELETE WHERE
clause (instead ofEXISTS
)?
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.
Thank you all for pointing out!
Firstly c1f9657 remedies the second problem.
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.
205e15a remedies the first issue (i.e. removes unnecessary AS inst
s).
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.
06c3b1a fixes the third issue, i.e., makes the program output DELETE
queries appropriate in operational terms (which do not seem so performant though).
This PR adds the following function to
Ast2sql
:This function takes the following arguments:
expr : Expr.expr
: Datalog rules and sources for conversionand then converts
expr.rules
to the corresponding operation-based SQL queries. Rules that containNumberedVar
orAggVar
are currently not supported, though.The present PR also adds unit tests for the function above as
src/test/ast2sql_operation_based_conversion_test.ml
. One can run these tests by invoking:$ make test
In order to confirm that
convert_expr_to_operation_based_sql
works as intended, please see:I would appreciate it if you could give any comments or suggestion.