-
Notifications
You must be signed in to change notification settings - Fork 69
【OSCP Dev】SCDB 支持 explain statement Feat:support Explain statement for SCDB(#478) #675
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
Open
zhuyanhuazhuyanhua
wants to merge
21
commits into
secretflow:main
Choose a base branch
from
zhuyanhuazhuyanhua:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fa12954
feat:support expaln statement for SCDB(#478)
zhuyanhuazhuyanhua 84ea160
Merge branch 'secretflow:main' into main
zhuyanhuazhuyanhua 14410ef
feat:handle explain in runSQL
zhuyanhuazhuyanhua 71b7164
Feat:imply with runSQL
zhuyanhuazhuyanhua 6e00a83
Merge branch 'main' into main
Candicepan 478cab1
Feat:fix and imply in submitAndGet
zhuyanhuazhuyanhua 6183c85
Merge branch 'main' of https://github.com/zhuyanhuazhuyanhua/scql
zhuyanhuazhuyanhua b92dbc6
Merge branch 'main' into main
Candicepan eb23b93
Feat:add isexplain test and fix submitandget
zhuyanhuazhuyanhua a08f5f6
Merge branch 'main' of https://github.com/zhuyanhuazhuyanhua/scql
zhuyanhuazhuyanhua 19c9397
Feat:support select and union state in buildexplain
zhuyanhuazhuyanhua 2a9615b
Feat:imply explain in 3 steps
zhuyanhuazhuyanhua 8f5ee99
bug:fix bug in scdb_api.swagger.yaml
zhuyanhuazhuyanhua b742b93
Feat:store expalin in OutColumns instead of Status
zhuyanhuazhuyanhua 034c377
Feat:fix SubmitAndGet in api\scdb_api.proto
zhuyanhuazhuyanhua c7030f3
Feat:imply explain in runSQL
zhuyanhuazhuyanhua 1b24bbf
Feat:imply in runSQL
zhuyanhuazhuyanhua 258d1f3
undo:imply explain in runDQL
zhuyanhuazhuyanhua 8c6f668
Feat:imply in runSQL
zhuyanhuazhuyanhua 9fde404
feat: add test
zhuyanhuazhuyanhua 757e034
feat:add explain test func
zhuyanhuazhuyanhua 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 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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| package server | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestIsExplain(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| query string | ||
| expected bool | ||
| hasError bool | ||
| }{ | ||
| { | ||
| name: "Valid EXPLAIN query", | ||
zhuyanhuazhuyanhua marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| query: "EXPLAIN SELECT * FROM users", | ||
| expected: true, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "Valid EXPLAIN query in lowercase", | ||
| query: "explain select * from users", | ||
| expected: true, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "Valid EXPLAIN query with whitespace", | ||
| query: " EXPLAIN SELECT * FROM users ", | ||
| expected: true, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "Non-EXPLAIN query", | ||
| query: "SELECT * FROM users", | ||
| expected: false, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "INSERT query", | ||
| query: "INSERT INTO users (name) VALUES ('alice')", | ||
| expected: false, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "Empty query", | ||
| query: "", | ||
| expected: true, | ||
| hasError: true, | ||
| }, | ||
| { | ||
| name: "EXPLAIN with complex query", | ||
| query: "EXPLAIN SELECT u.name, p.title FROM users u JOIN posts p ON u.id = p.user_id WHERE u.age > 18", | ||
| expected: true, | ||
| hasError: false, | ||
| }, | ||
| { | ||
| name: "EXPLAIN ANALYZE query", | ||
| query: "EXPLAIN ANALYZE SELECT * FROM users", | ||
| expected: true, | ||
| hasError: false, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| result, err := isExplainQuery(tt.query) | ||
|
|
||
| if tt.hasError { | ||
| assert.Error(t, err) | ||
| } else { | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, tt.expected, result) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.