Refactors Query Language for Thicket#72
Merged
slabasan merged 11 commits intollnl:developfrom Feb 27, 2023
Merged
Conversation
8d58521 to
1f8379b
Compare
Collaborator
Author
|
This PR is now ready for review. However, it should not be merged until after #73 so that we can make sure it passes CI. |
eb05fdd to
1b2585e
Compare
slabasan
requested changes
Feb 10, 2023
Collaborator
slabasan
left a comment
There was a problem hiding this comment.
Code looks good, but please resolve branch conflicts and update copyright year in the header to 2023.
…onstruction tests) working
1b2585e to
0fa6bc5
Compare
1227dd7 to
831a4df
Compare
Collaborator
Author
slabasan
approved these changes
Feb 24, 2023
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.
Summary
This PR refactors the Query Language (QL) to prepare it for use in Thicket, improve its overall extensibility, and make its terminology more in line with that of the QL paper.
First and foremost, the QL is no longer contained within a single file. Now, all code for the QL is contained in the new
querydirectory. This directory contains the following files:__init__.py: contains re-exports for everything in the QL so it can all be imported withfrom hatchet.query import ...(same as before)engine.py: contains a class containing the algorithm for applying queries toGraphFrameserrors.py: contains any errors the QL may raisequery.py: contains the class representing the base QL syntax and compound queries (i.e., classes for operations like "and," "or," "xor," and "not"object_dialect.py: contains the class representing the Object-based dialectstring_dialect.py: contains the class representing the String-based dialectcompat.py: contains various classes that ensure (deprecated) backwards compatibility with earlier versions of HatchetIn this PR, queries are represented by one of 3 classes:
Query: represents the base syntax for the QLStringQuery: represents the String-based dialect. This class extendsQueryand implements the conversion from String-based dialect to base syntaxObjectQuery: represents the Object-based dialect. This class extendsQueryand implements the conversion from Object-based dialect to base syntaxAdditionally, as before, there are classes to allow queries to combined via set operations. All of these classes extend the
CompoundQueryclass. These classes are:ConjunctionQuery: combines the results of a set of queries through set conjunction (equivalent to logical AND)DisjunctionQuery: combines the results of a set of queries through set disjunction (equivalent to logical OR)ExclusiveDisjunctionQuery: combines the results of a set of queries through exclusive set disjunction (equivalent to logical XOR)NegationQuery: inverts the results of a query (equivalent to logical NOT)As before, these "compound queries" can easily be created from the 3 main query classes using the
&,|,^, and~operators.New in this PR, the algorithm for applying queries to
GraphFrameshas been separated from query composition. The algorithm is now contained within the newQueryEngineclass.Finally, all the old QL classes and functions have been reimplemented to be thin wrappers around the classes mentioned above. As a result, this PR should ensure full backwards compatibility with old QL code. However, if this PR is merged, all "old-style" query code should be considered deprecated.
What's left to do
All the implementation has been completed for this PR. Additionally, all existing unit tests that do not involve query composition are passing, which validates my claims about backwards compatibility. All that's left to do before this PR can be merged is:
query_compat.py)