-
Notifications
You must be signed in to change notification settings - Fork 44
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
refactor: Change terminology from query to request #1054
refactor: Change terminology from query to request #1054
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1054 +/- ##
===========================================
+ Coverage 68.03% 68.10% +0.07%
===========================================
Files 171 172 +1
Lines 16250 16250
===========================================
+ Hits 11055 11067 +12
+ Misses 4261 4251 -10
+ Partials 934 932 -2
|
- Rename the folder. - Update all import modules that need updating due to the rename. - Update a comment that needed updating. - Update the `request/` package name.
- Rename `planner/query.go` file to `planner/request.go`. - Rename the type `planner.Query` to `planner.Request`. - Update a comment about `ExecQuery` (which will soon be changed).
NOTE: Some instances are left as `query` as this is more user facing.
Change to `PostSubscriptionRequests` & `TransactionalRequests`
87a8a2c
to
e5c70aa
Compare
This comment was marked as spam.
This comment was marked as spam.
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.
LGTM - thanks a bunch for sorting this out Shahzad, would suggest merging this really aggressively to mimimize any conflicts (including for those working on other branches that will be affected by this merge)
trivia: etymologically, request and query come from the same quaerō (latin) which essentially means to want |
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.
LGTM but there are a lot of repetitive lines that I went through quickly
I saw a non-gofmt
-ed notice, that would be good to fix it before it's merged.
I think you fixed it already in a later commit |
d91f4cd
to
e55a45b
Compare
@@ -19,5 +19,5 @@ import ( | |||
) | |||
|
|||
var ( | |||
log = logging.MustNewLogger("defra.query.schema") | |||
log = logging.MustNewLogger("defra.request.schema") |
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.
question: Should this be defra.request.graphql.schema
instead @jsimnz ?
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.
suggestion: This is a very large PR that could potentially disrupt other developers. Keeping these changes in isolation for the sake of very minor stuff like this is not going to help things and will increase the likelihood of it costing any of us time. The question you asked is not really specific to this PR (issue existed before), and can easily be sorted out after the many lines that this PR changes have been merged.
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.
Understand your concern and agree with not delaying this PR, John is reviewing it as we speak so thought will ask a question I had before I forget. This shouldn't really effect the speed of this PR merging.
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.
Just noting that this PR moves several files/directories that I am actively working with (including new files which definitely will not be auto-magically handled by git).
Additionally, IMO a rename PR on an item that has already been agreed upon (and reviewed in draft format) really doesnt need 3 approvals, and had I known that the majority of the dev team was going to review it prior to merge I would not have felt that adding my review to that list would have been worth the time that I spent on this.
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.
It isn't that it needs 3 approvals, but more that if someone is taking a look at it then why not wait for them to finish the review?
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.
Approving for now as my suggestions aren't necessarily for blocking. Some are just for seeding discussion as well as indexing of thoughts.
Two primary concerns (again non blocking) - There is some minor confusion regarding what a "request" is, as "request" is also used to refer to "query operation" as well as the top level GQL request.
Second, one thing we didn't reach too much consensus on regarding this change is the goals highlighted in #864 of seperating GQL from the Defra Query layer. This PR changes that conversation a bit to refer to all Defra Query layer as Requests, when in reality this change was caused by the GQL confusion specifically.
Non blocking, but wanted to see what ppl think
cc: @AndrewSisley since he started #864
// Query is an external hook into the planNode | ||
// RequestPlan is an external hook into the planNode | ||
// system. It allows outside packages to | ||
// execute and manage a query plan graph directly. | ||
// execute and manage a request plan graph directly. | ||
// Instead of using one of the available functions | ||
// like ExecQuery(...). | ||
// like ExecRequest(...). | ||
// Currently, this is used by the collection.Update | ||
// system. | ||
type Query planNode | ||
type RequestPlan planNode |
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.
suggestion: Can likely be just Request
, since the package name is planner
, so written it would be planner.Request
which more succinct then planner.RequestPlan
.
Likely why it was just Query
instead of QueryPlan
before.
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.
This file was previously called query.go
, by your suggestion this file would be called request.go
? Would like to avoid using request.go
file for plan stuff.
I would also suggest that the planNode
is more a plan than a request
at this stage (as the request will be converted into a plan by the time this type is used IRRC).
IMO planner.Request
is still ambiguous, can be easily confused as a request to the planner for example. As planner
is something that "creates a plan", and plan
is the actual graph of steps.
package query | ||
package request |
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 somewhat hesitant to rename this package since the terminology confusion/replacement imo is scoped to GQL. Fundementally this is still the "DefraDB Query Language" - of which we have GQL Requests, which contains a GQL Query Operation.
This somewhat goes along with a discussion previously regarding the seperation of GQL from the Query interface #864.
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 have linked this as a thing to discuss in #864, as this is non-blocking we can discuss and change it back if needed.
Thanks appreciate the planting of seeds that will grow into fruitful discussions.
This is a good question, let me see if I can clarify the definitions according to this PR: According to GQL:
DefraDB Terminology: With the above definition, we can use other descriptors to specify the type of request it is, for example: "Explain request" or "Subscription Request". But the only gotcha / confusing rule we need to worry about is that IMO in the code base (excluding 3rd party stuff, eg. ipfs), we should avoid the use of (2), (4), and (7) to avoid confusion. The only exception to (4) I can see is when we say "Defra Query Language", but to be fair even the One other benefit of using these definitions is that, while they work "nicely" (maybe not perfectly) with GQL it still gives us the control to keep the terminology consistent across other query languages as we add support for them.
This PR should comply the definition rules I defined above, if you notice any rules were broken we can change that easily in the later PR, and hope this will help keep things in harmony for #864 as well, the more reason to not depend on terms only dependent on a specific query language. |
- Resolves #455 - DESCRIPTION: This PR changes existing terminology to comply with the following terminology definitions: DefraDB Terminology: * (1) `Request` is the top-level term that encapsulates all the operations (`query` and `mutation` ops). * (2) `Query Request` or `Request Query` are same as (1) but only for situations where we need to use the word "Query" for some reason (say for external use for example in `cli` package), so the `Request` descriptor clarifies the type of "Query" this is. * (3) `Query Operation` implies that the request is a "read-only request", but note that if we loosely say `Query Request` that does not mean a read-only operation according to (2). * (4) `Query` loosely the same as (3), BUT STRONGLY AVOID USING ON IT'S OWN. * (5) `Mutation Operation` implies that the request is a "write request". * (6) `Mutation Request` implies that the request's operation is of type `mutation`. Note: `(6)` and `(5)` can be used interchangeably but `(2)` and `(3)` can not. * (7) `Mutation` is loosely the same as (5) and (6) but avoid using this term. With the above definition, we can use other descriptors to specify the type of request it is, for example: "Explain request" or "Subscription Request". But the only gotcha / confusing rule we need to worry about is that `Query Request` is not the same as `Query Operation`. The use of the word `Query` with another descriptor assumes (4), for example: `Query Plan` is a plan that is made from a read-only query. Throughout the codebase (excluding 3rd party stuff, eg. ipfs), we should avoid the use of (2), (4), and (7) to avoid confusion. The only exception to (4) I can see is when we say "Defra Query Language" (because this is not referring to the query operation).
- Resolves sourcenetwork#455 - DESCRIPTION: This PR changes existing terminology to comply with the following terminology definitions: DefraDB Terminology: * (1) `Request` is the top-level term that encapsulates all the operations (`query` and `mutation` ops). * (2) `Query Request` or `Request Query` are same as (1) but only for situations where we need to use the word "Query" for some reason (say for external use for example in `cli` package), so the `Request` descriptor clarifies the type of "Query" this is. * (3) `Query Operation` implies that the request is a "read-only request", but note that if we loosely say `Query Request` that does not mean a read-only operation according to (2). * (4) `Query` loosely the same as (3), BUT STRONGLY AVOID USING ON IT'S OWN. * (5) `Mutation Operation` implies that the request is a "write request". * (6) `Mutation Request` implies that the request's operation is of type `mutation`. Note: `(6)` and `(5)` can be used interchangeably but `(2)` and `(3)` can not. * (7) `Mutation` is loosely the same as (5) and (6) but avoid using this term. With the above definition, we can use other descriptors to specify the type of request it is, for example: "Explain request" or "Subscription Request". But the only gotcha / confusing rule we need to worry about is that `Query Request` is not the same as `Query Operation`. The use of the word `Query` with another descriptor assumes (4), for example: `Query Plan` is a plan that is made from a read-only query. Throughout the codebase (excluding 3rd party stuff, eg. ipfs), we should avoid the use of (2), (4), and (7) to avoid confusion. The only exception to (4) I can see is when we say "Defra Query Language" (because this is not referring to the query operation).
RELEVANT ISSUE(S)
Resolves #455
DESCRIPTION
This PR changes existing terminology to comply with the following terminology definitions:
DefraDB Terminology:
Request
is the top-level term that encapsulates all the operations (query
andmutation
ops).Query Request
orRequest Query
are same as (1) but only for situations where we need to use the word "Query" for some reason (say for external use for example incli
package), so theRequest
descriptor clarifies the type of "Query" this is.Query Operation
implies that the request is a "read-only request", but note that if we loosely sayQuery Request
that does not mean a read-only operation according to (2).Query
loosely the same as (3), BUT STRONGLY AVOID USING ON IT'S OWN.Mutation Operation
implies that the request is a "write request".Mutation Request
implies that the request's operation is of typemutation
. Note:(6)
and(5)
can be used interchangeably but(2)
and(3)
can not.Mutation
is loosely the same as (5) and (6) but avoid using this term.With the above definition, we can use other descriptors to specify the type of request it is, for example: "Explain request" or "Subscription Request". But the only gotcha / confusing rule we need to worry about is that
Query Request
is not the same asQuery Operation
. The use of the wordQuery
with another descriptor assumes (4), for example:Query Plan
is a plan that is made from a read-only query.Throughout the codebase (excluding 3rd party stuff, eg. ipfs), we should avoid the use of (2), (4), and (7) to avoid confusion. The only exception to (4) I can see is when we say "Defra Query Language" (because this is not referring to the query operation).