-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Temporary Table support in unsharded keyspace #7411
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f5d6a79
add parse test for create temp tables
harshit-gangal 90dbcda
add temporary table parsing support for create table
harshit-gangal c7d3f3e
added drop temporary table parse test
harshit-gangal 98d71a7
add temporary table parsing support for drop table
harshit-gangal 7651de3
added IsTemporary method on DDLStatement interface
harshit-gangal ba15099
added temporary table plan and changed send primitive to reserve conn…
harshit-gangal b58a0d8
added e2e test
harshit-gangal 895f1bb
added executor unit test
harshit-gangal 4c0a763
fix destination on temp table plan
harshit-gangal 4c7f08f
Stop caching after creating temp tables
systay ebc20c6
handle skipping of the cache on the tablet
systay b326925
handle skipping of the cache on the vtgate
systay 2e3d9a7
Merge remote-tracking branch 'upstream/master' into temp-tables
systay 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
|
|
@@ -58,6 +58,7 @@ type ( | |
| DDLStatement interface { | ||
| iDDLStatement() | ||
| IsFullyParsed() bool | ||
| IsTemporary() bool | ||
| GetTable() TableName | ||
| GetAction() DDLAction | ||
| GetOptLike() *OptLike | ||
|
|
@@ -421,6 +422,7 @@ type ( | |
|
|
||
| // DropTable represents a DROP TABLE statement. | ||
| DropTable struct { | ||
| Temp bool | ||
| FromTables TableNames | ||
| // The following fields are set if a DDL was fully analyzed. | ||
| IfExists bool | ||
|
|
@@ -434,6 +436,7 @@ type ( | |
|
|
||
| // CreateTable represents a CREATE TABLE statement. | ||
| CreateTable struct { | ||
| Temp bool | ||
| Table TableName | ||
| IfNotExists bool | ||
| TableSpec *TableSpec | ||
|
|
@@ -677,6 +680,46 @@ func (node *AlterView) IsFullyParsed() bool { | |
| return true | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (*TruncateTable) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (*RenameTable) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *CreateTable) IsTemporary() bool { | ||
| return node.Temp | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *AlterTable) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *CreateView) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *DropView) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *DropTable) IsTemporary() bool { | ||
| return node.Temp | ||
| } | ||
|
|
||
| // IsTemporary implements the DDLStatement interface | ||
| func (node *AlterView) IsTemporary() bool { | ||
| return false | ||
| } | ||
|
|
||
| // GetTable implements the DDLStatement interface | ||
| func (node *TruncateTable) GetTable() TableName { | ||
| return node.Table | ||
|
|
@@ -3170,11 +3213,17 @@ func (node *AlterDatabase) Format(buf *TrackedBuffer) { | |
|
|
||
| // Format formats the node. | ||
| func (node *CreateTable) Format(buf *TrackedBuffer) { | ||
| buf.WriteString("create ") | ||
| if node.Temp { | ||
| buf.WriteString("temporary ") | ||
| } | ||
| buf.WriteString("table ") | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| if node.IfNotExists { | ||
| buf.astPrintf(node, "create table if not exists %v", node.Table) | ||
| } else { | ||
| buf.astPrintf(node, "create table %v", node.Table) | ||
| buf.WriteString("if not exists ") | ||
| } | ||
| buf.astPrintf(node, "%v", node.Table) | ||
|
|
||
| if node.OptLike != nil { | ||
| buf.astPrintf(node, " %v", node.OptLike) | ||
| } | ||
|
|
@@ -3239,11 +3288,15 @@ func (node *AlterView) Format(buf *TrackedBuffer) { | |
|
|
||
| // Format formats the node. | ||
| func (node *DropTable) Format(buf *TrackedBuffer) { | ||
| temp := "" | ||
| if node.Temp { | ||
| temp = " temporary" | ||
| } | ||
| exists := "" | ||
| if node.IfExists { | ||
| exists = " if exists" | ||
| } | ||
| buf.astPrintf(node, "drop table%s %v", exists, node.FromTables) | ||
| buf.astPrintf(node, "drop%s table%s %v", temp, exists, node.FromTables) | ||
| } | ||
|
|
||
| // Format formats the node. | ||
|
|
||
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.
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.
👍