Skip to content

Commit

Permalink
wip: Adhere to code-review #3
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed May 31, 2022
1 parent 3da94c5 commit 5229476
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 39 deletions.
35 changes: 10 additions & 25 deletions query/graphql/planner/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,14 @@ var (
_ explainablePlanNode = (*selectNode)(nil)
_ explainablePlanNode = (*selectTopNode)(nil)
_ explainablePlanNode = (*typeIndexJoin)(nil)

// Nodes to implement in the next explain request PRs.
// _ explainablePlanNode = (*averageNode)(nil)
// _ explainablePlanNode = (*commitSelectNode)(nil)
// _ explainablePlanNode = (*countNode)(nil)
// _ explainablePlanNode = (*dagScanNode)(nil)
// _ explainablePlanNode = (*renderNode)(nil)
// _ explainablePlanNode = (*sortNode)(nil)
// _ explainablePlanNode = (*sumNode)(nil)
// _ explainablePlanNode = (*updateNode)(nil)

// Internal Nodes that we don't want to expose / explain.
// - commitSelectTopNode
// - renderLimitNode
// - groupNode
// - hardLimitNode
// - headsetScanNode
// - parallelNode
// - pipeNode
// - typeJoinMany
// - typeJoinOne
_ explainablePlanNode = (*averageNode)(nil)
_ explainablePlanNode = (*commitSelectNode)(nil)
_ explainablePlanNode = (*countNode)(nil)
_ explainablePlanNode = (*dagScanNode)(nil)
_ explainablePlanNode = (*renderNode)(nil)
_ explainablePlanNode = (*sortNode)(nil)
_ explainablePlanNode = (*sumNode)(nil)
_ explainablePlanNode = (*updateNode)(nil)
)

// buildExplainGraph builds the explainGraph from the given top level plan.
Expand All @@ -68,11 +55,9 @@ var (
// "explain": {
// "selectTopNode": {
// "selectNode": {
// "filter": null,
// ...
// "scanNode": {
// "collectionID": "1",
// "collectionName": "user",
// "filter": null
// ...
// }
// }
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ func TestExplainRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T
},
},

Updates: map[int][]string{
0: {
(`{
"name": "Rust in Action.",
"publisher_id": "bae-5c599633-d6d2-56ae-b3f0-1b65b4cee9fe"
}`)},
},

Results: []map[string]interface{}{
{
"explain": map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@ func TestExplainMutationCreateSimple(t *testing.T) {
}
}`,

Docs: map[int][]string{},

Results: []map[string]interface{}{
{
"explain": map[string]interface{}{
"selectTopNode": map[string]interface{}{
"selectNode": map[string]interface{}{
"createNode": map[string]interface{}{
"data": map[string]interface{}{
// Potential explain bug, need to investigate why this is a float.
"age": float64(27),
"name": "John",
"points": float64(42.1),
Expand Down Expand Up @@ -85,7 +82,6 @@ func TestExplainMutationCreateSimpleDoesNotCreateDocGivenDuplicate(t *testing.T)
"selectNode": map[string]interface{}{
"createNode": map[string]interface{}{
"data": map[string]interface{}{
// Potential explain bug, need to investigate why this is a float.
"age": float64(27),
"name": "John",
},
Expand Down
1 change: 0 additions & 1 deletion tests/integration/mutation/simple/create/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestMutationCreateSimple(t *testing.T) {
age
}
}`,
Docs: map[int][]string{},
Results: []map[string]interface{}{
{
"_key": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d",
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/query/simple/explain_with_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ func TestExplainQuerySimpleWithKeyFilterBlock(t *testing.T) {
(`{
"Name": "John",
"Age": 21
}`),
(`{
"Name": "Bob",
"Age": 32
}`)},
},
Results: []map[string]interface{}{
Expand Down Expand Up @@ -335,6 +339,10 @@ func TestExplainQuerySimpleWithStringFilterBlock(t *testing.T) {
(`{
"Name": "John",
"Age": 21
}`),
(`{
"Name": "Bob",
"Age": 32
}`)},
},

Expand Down Expand Up @@ -494,6 +502,10 @@ func TestExplainQuerySimpleWithNumberEqualsFilterBlock(t *testing.T) {
(`{
"Name": "John",
"Age": 21
}`),
(`{
"Name": "Bob",
"Age": 32
}`)},
},
Results: []map[string]interface{}{
Expand Down Expand Up @@ -536,6 +548,10 @@ func TestExplainQuerySimpleWithNumberGreaterThanFilterBlock(t *testing.T) {
(`{
"Name": "John",
"Age": 21
}`),
(`{
"Name": "Bob",
"Age": 19
}`)},
},
Results: []map[string]interface{}{
Expand Down
1 change: 0 additions & 1 deletion tools/configs/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ linters:
# - nlreturn
# - nolintlint
# - tagliatelle
# - unparam
# - whitespace
# - wrapcheck
# - wsl
Expand Down

0 comments on commit 5229476

Please sign in to comment.