Develop the conversion of Datalog rules into operation-based SQL queries#72
Open
gfngfn wants to merge 57 commits intodangtv:masterfrom
Open
Develop the conversion of Datalog rules into operation-based SQL queries#72gfngfn wants to merge 57 commits intodangtv:masterfrom
gfngfn wants to merge 57 commits intodangtv:masterfrom
Conversation
…de_rules_into_groups'
…a predicates in rule bodies
yoshihiro503
reviewed
Mar 9, 2023
| 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;"; |
Contributor
There was a problem hiding this comment.
- What is
AS inst? Is it necessary? rule1means add toed, so the correspondingquery1must beINSERT INTO ed, same fortemp2andDELETEstatement.- The
DELETEstatement 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 WHEREclause (instead ofEXISTS)?
Contributor
Author
There was a problem hiding this comment.
Thank you all for pointing out!
Firstly c1f9657 remedies the second problem.
Contributor
Author
There was a problem hiding this comment.
205e15a remedies the first issue (i.e. removes unnecessary AS insts).
Contributor
Author
There was a problem hiding this comment.
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rulesto the corresponding operation-based SQL queries. Rules that containNumberedVarorAggVarare 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 testIn order to confirm that
convert_expr_to_operation_based_sqlworks as intended, please see:I would appreciate it if you could give any comments or suggestion.