Skip to content

Commit

Permalink
test: add integration test for query plan (#1228)
Browse files Browse the repository at this point in the history
## Rationale


## Detailed Changes
- Bump sqlness to 0.5.0, which contains interceptor to replace random
values before compare
  - https://github.com/CeresDB/sqlness/releases/tag/v0.5.0
- add query-plan test case
- add pre_cmd interceptor, which is used to flush memtable.

## Test Plan
CI
  • Loading branch information
jiacai2050 authored Sep 26, 2023
1 parent 8a3a22e commit 0e79f9c
Show file tree
Hide file tree
Showing 24 changed files with 243 additions and 168 deletions.
122 changes: 15 additions & 107 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ceresdb-client = "1.0.2"
local-ip-address = "0.5"
reqwest = { workspace = true }
serde = { workspace = true }
sqlness = "0.4.3"
sqlness = "0.5.0"
tokio = { workspace = true }
uuid = { version = "1.3", features = ["v4"] }
12 changes: 6 additions & 6 deletions integration_tests/cases/common/dml/case_sensitive.result
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SELECT
FROM
CASE_SENSITIVE_TABLE1;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: SELECT \n * \n FROM \n CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Failed to generate datafusion plan, err:Execution error: Table is not found, \"table:CASE_SENSITIVE_TABLE1\"" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:SELECT\n *\nFROM\n CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Failed to generate datafusion plan, err:Execution error: Table is not found, \"table:CASE_SENSITIVE_TABLE1\"" })

SELECT
*
Expand All @@ -51,7 +51,7 @@ SELECT
FROM
`CASE_SENSITIVE_TABLE1`;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: SELECT \n * \n FROM \n `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Failed to generate datafusion plan, err:Execution error: Table is not found, \"table:CASE_SENSITIVE_TABLE1\"" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:SELECT\n *\nFROM\n `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Failed to generate datafusion plan, err:Execution error: Table is not found, \"table:CASE_SENSITIVE_TABLE1\"" })

SHOW CREATE TABLE case_SENSITIVE_table1;

Expand All @@ -61,7 +61,7 @@ String("case_SENSITIVE_table1"),String("CREATE TABLE `case_SENSITIVE_table1` (`t

SHOW CREATE TABLE CASE_SENSITIVE_TABLE1;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: SHOW CREATE TABLE CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:SHOW CREATE TABLE CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })

SHOW CREATE TABLE `case_SENSITIVE_table1`;

Expand All @@ -71,7 +71,7 @@ String("case_SENSITIVE_table1"),String("CREATE TABLE `case_SENSITIVE_table1` (`t

SHOW CREATE TABLE `CASE_SENSITIVE_TABLE1`;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: SHOW CREATE TABLE `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:SHOW CREATE TABLE `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })

DESC case_SENSITIVE_table1;

Expand All @@ -83,7 +83,7 @@ String("VALUE1"),String("double"),Boolean(false),Boolean(true),Boolean(false),Bo

DESC CASE_SENSITIVE_TABLE1;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: DESC CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:DESC CASE_SENSITIVE_TABLE1;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })

DESC `case_SENSITIVE_table1`;

Expand All @@ -95,7 +95,7 @@ String("VALUE1"),String("double"),Boolean(false),Boolean(true),Boolean(false),Bo

DESC `CASE_SENSITIVE_TABLE1`;

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: DESC `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })
Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query:DESC `CASE_SENSITIVE_TABLE1`;. Caused by: Failed to create plan, err:Table not found, table:CASE_SENSITIVE_TABLE1" })

DROP TABLE IF EXISTS case_SENSITIVE_table1;

Expand Down
6 changes: 6 additions & 0 deletions integration_tests/cases/common/dml/insert_mode.result
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- overwrite
DROP TABLE IF EXISTS `03_dml_insert_mode_table1`;

affected_rows: 0
Expand Down Expand Up @@ -54,6 +55,7 @@ DROP TABLE `03_dml_insert_mode_table1`;

affected_rows: 0

-- append
DROP TABLE IF EXISTS `03_dml_insert_mode_table2`;

affected_rows: 0
Expand Down Expand Up @@ -113,6 +115,7 @@ DROP TABLE `03_dml_insert_mode_table2`;

affected_rows: 0

-- default(overwrite)
DROP TABLE IF EXISTS `03_dml_insert_mode_table3`;

affected_rows: 0
Expand All @@ -133,6 +136,8 @@ INSERT INTO `03_dml_insert_mode_table3` (`timestamp`, `value`, `dic`)

affected_rows: 3

-- TODO support insert Null
-- INSERT INTO `03_dml_insert_mode_table3` (`timestamp`, `value`, `dic`) VALUES (1, 100, "d2"), (2, 200, "d1"), (3, 300, Null);
SELECT
*
FROM
Expand Down Expand Up @@ -168,6 +173,7 @@ DROP TABLE `03_dml_insert_mode_table3`;

affected_rows: 0

-- insert with missing columns
DROP TABLE IF EXISTS `03_dml_insert_mode_table4`;

affected_rows: 0
Expand Down
1 change: 1 addition & 0 deletions integration_tests/cases/common/dml/issue-1087.result
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CREATE TABLE `issue_1087` (

affected_rows: 0

-- Check which optimizer rules we are using now
explain verbose select * from issue_1087;

plan_type,plan,
Expand Down
Loading

0 comments on commit 0e79f9c

Please sign in to comment.