-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: Add ability to explain-debug all nodes #1563
Merged
shahzadlone
merged 14 commits into
sourcenetwork:develop
from
shahzadlone:feat/debug-explain
Jun 13, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c3cd77e
PR(UNRELATED): Add ExpectedPatterns check in test
shahzadlone 1b848f8
PR(MAIN): Implement debug explain
shahzadlone 105b596
PR(TEST): Add basic test + fixture
shahzadlone 6080924
PR(TEST): Add type join tests
shahzadlone 4a4ece1
PR(TEST): Add mutation tests
shahzadlone 2a3761b
PR(TEST): Add dagscan tests
shahzadlone 6a7b5ed
PR(TEST): Add filter tests
shahzadlone b995280
PR(TEST): Add order tests
shahzadlone dba5559
PR(TEST): Add limit tests
shahzadlone 5a1baf0
PR(TEST): Add count tests
shahzadlone 2d11954
PR(TEST): Add sum tests
shahzadlone 6b4111b
PR(TEST): Add average tests
shahzadlone 8cb30b5
PR(TEST): Add top level tests
shahzadlone 1e186cc
PR(TEST): Add group tests
shahzadlone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package test_explain_debug | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
explainUtils "github.com/sourcenetwork/defradb/tests/integration/explain" | ||
) | ||
|
||
func TestDebugExplainRequest(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Description: "Explain (debug) a basic request, assert full graph.", | ||
|
||
Actions: []any{ | ||
explainUtils.SchemaForExplainTests, | ||
|
||
testUtils.ExplainRequest{ | ||
Request: `query @explain(type: debug) { | ||
Author { | ||
name | ||
age | ||
} | ||
}`, | ||
|
||
ExpectedFullGraph: []dataMap{basicPattern}, | ||
}, | ||
}, | ||
} | ||
|
||
explainUtils.ExecuteTestCase(t, test) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright 2023 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package test_explain_debug | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
explainUtils "github.com/sourcenetwork/defradb/tests/integration/explain" | ||
) | ||
|
||
var createPattern = dataMap{ | ||
"explain": dataMap{ | ||
"createNode": dataMap{ | ||
"selectTopNode": dataMap{ | ||
"selectNode": dataMap{ | ||
"scanNode": dataMap{}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
func TestDebugExplainMutationRequestWithCreate(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Description: "Explain (debug) mutation request with create.", | ||
|
||
Actions: []any{ | ||
explainUtils.SchemaForExplainTests, | ||
|
||
testUtils.ExplainRequest{ | ||
|
||
Request: `mutation @explain(type: debug) { | ||
create_Author(data: "{\"name\": \"Shahzad Lone\",\"age\": 27,\"verified\": true}") { | ||
name | ||
age | ||
} | ||
}`, | ||
|
||
ExpectedPatterns: []dataMap{createPattern}, | ||
}, | ||
}, | ||
} | ||
|
||
explainUtils.ExecuteTestCase(t, test) | ||
} | ||
|
||
func TestDebugExplainMutationRequestDoesNotCreateDocGivenDuplicate(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Description: "Explain (debug) mutation request with create, document exists.", | ||
|
||
Actions: []any{ | ||
explainUtils.SchemaForExplainTests, | ||
|
||
testUtils.ExplainRequest{ | ||
|
||
Request: `mutation @explain(type: debug) { | ||
create_Author(data: "{\"name\": \"Shahzad Lone\",\"age\": 27}") { | ||
name | ||
age | ||
} | ||
}`, | ||
|
||
ExpectedPatterns: []dataMap{createPattern}, | ||
}, | ||
}, | ||
} | ||
|
||
explainUtils.ExecuteTestCase(t, test) | ||
} |
Oops, something went wrong.
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.
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 (out of scope): These are all public, and I think they should live in
client/request/explain.go
- might be worth adding a ticket if you agree.Same also goes for the attribute tags and node names (if they are in planner atm)
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 appreciate this suggestion! Would be much nicer. Will open a ticket.
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.
ticket: #1571