-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: supports if_not_exists when create database
- Loading branch information
1 parent
0c37df2
commit 5406731
Showing
14 changed files
with
195 additions
and
5 deletions.
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
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,50 @@ | ||
CREATE SCHEMA test; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
CREATE TABLE test.hello(i BIGINT TIME INDEX); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DROP TABLE test.hello; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DROP SCHEMA test; | ||
|
||
Failed to execute, error: Datanode { code: 1001, msg: "Failed to execute sql, source: Cannot parse SQL, source: SQL statement is not supported: DROP SCHEMA test;, keyword: SCHEMA" } | ||
|
||
CREATE SCHEMA test; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
CREATE TABLE test.hello(i BIGINT TIME INDEX); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
INSERT INTO test.hello VALUES (2), (3), (4); | ||
|
||
MutateResult { success: 3, failure: 0 } | ||
|
||
SELECT * FROM test.hello; | ||
|
||
+-----------------------+ | ||
| i, #Timestamp, #Int64 | | ||
+-----------------------+ | ||
| 2 | | ||
| 3 | | ||
| 4 | | ||
+-----------------------+ | ||
|
||
DROP TABLE test.hello; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DROP SCHEMA test; | ||
|
||
Failed to execute, error: Datanode { code: 1001, msg: "Failed to execute sql, source: Cannot parse SQL, source: SQL statement is not supported: DROP SCHEMA test;, keyword: SCHEMA" } | ||
|
||
SELECT * FROM test.hello; | ||
|
||
Failed to execute, error: Datanode { code: 3000, msg: "Failed to execute sql, source: Cannot plan SQL: SELECT * FROM test.hello, source: Error during planning: table 'greptime.test.hello' not found" } | ||
|
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,21 @@ | ||
CREATE SCHEMA test; | ||
|
||
CREATE TABLE test.hello(i BIGINT TIME INDEX); | ||
|
||
DROP TABLE test.hello; | ||
|
||
DROP SCHEMA test; | ||
|
||
CREATE SCHEMA test; | ||
|
||
CREATE TABLE test.hello(i BIGINT TIME INDEX); | ||
|
||
INSERT INTO test.hello VALUES (2), (3), (4); | ||
|
||
SELECT * FROM test.hello; | ||
|
||
DROP TABLE test.hello; | ||
|
||
DROP SCHEMA test; | ||
|
||
SELECT * FROM test.hello; |
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,58 @@ | ||
CREATE TABLE integers (i BIGINT TIME INDEX); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
CREATE TABLE IF NOT EXISTS integers (i BIGINT TIME INDEX); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
CREATE TABLE test1 (i INTEGER, j INTEGER); | ||
|
||
Failed to execute, error: Datanode { code: 1004, msg: "Missing timestamp column in request" } | ||
|
||
CREATE TABLE test1 (i INTEGER, j BIGINT TIME INDEX NOT NULL); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX NULL); | ||
|
||
Failed to execute, error: Datanode { code: 2000, msg: "Failed to execute sql, source: Cannot parse SQL, source: Unexpected token while parsing SQL statement: CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX NULL);, expected: 'NOT NULL', found: NULL, source: sql parser error: Expected NOT, found: NULL" } | ||
|
||
CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX); | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DESC TABLE INTEGERS; | ||
|
||
Failed to execute, error: Datanode { code: 1004, msg: "Failed to execute sql, source: Table not found: INTEGERS" } | ||
|
||
DESC TABLE test1; | ||
|
||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
| Field, #Field, #String | Type, #Field, #String | Null, #Field, #String | Default, #Field, #String | Semantic Type, #Field, #String | | ||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
| i | Int32 | YES | | VALUE | | ||
| j | Int64 | NO | | TIME INDEX | | ||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
|
||
DESC TABLE test2; | ||
|
||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
| Field, #Field, #String | Type, #Field, #String | Null, #Field, #String | Default, #Field, #String | Semantic Type, #Field, #String | | ||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
| i | Int32 | YES | | VALUE | | ||
| j | Int64 | NO | | TIME INDEX | | ||
+------------------------+-----------------------+-----------------------+--------------------------+--------------------------------+ | ||
|
||
DROP TABLE integers; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DROP TABLE test1; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
||
DROP TABLE test2; | ||
|
||
MutateResult { success: 1, failure: 0 } | ||
|
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,23 @@ | ||
CREATE TABLE integers (i BIGINT TIME INDEX); | ||
|
||
CREATE TABLE IF NOT EXISTS integers (i BIGINT TIME INDEX); | ||
|
||
CREATE TABLE test1 (i INTEGER, j INTEGER); | ||
|
||
CREATE TABLE test1 (i INTEGER, j BIGINT TIME INDEX NOT NULL); | ||
|
||
CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX NULL); | ||
|
||
CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX); | ||
|
||
DESC TABLE INTEGERS; | ||
|
||
DESC TABLE test1; | ||
|
||
DESC TABLE test2; | ||
|
||
DROP TABLE integers; | ||
|
||
DROP TABLE test1; | ||
|
||
DROP TABLE test2; |