mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
More tests
This commit is contained in:
parent
10611ef92a
commit
ded4556942
@ -1,6 +1,8 @@
|
||||
create database engine
|
||||
show database tables:
|
||||
table1
|
||||
table2
|
||||
table3
|
||||
describe table:
|
||||
col1 Nullable(String)
|
||||
col2 Nullable(Int64)
|
||||
@ -19,11 +21,28 @@ line3 3
|
||||
test insert:
|
||||
line4 4
|
||||
4 text4
|
||||
test NULLs:
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
after delete:
|
||||
after detach:
|
||||
detach
|
||||
line1 1
|
||||
line2 2
|
||||
line3 3
|
||||
1 text1
|
||||
2 text2
|
||||
3 text3
|
||||
create table engine with table1
|
||||
CREATE TABLE default.sqlite_table1\n(\n `col1` String,\n `col2` Int32\n)\nENGINE = SQLite
|
||||
line1 1
|
||||
line2 2
|
||||
line3 3
|
||||
test1 12
|
||||
create table engine with table2
|
||||
CREATE TABLE default.sqlite_table2\n(\n `col1` Int32,\n `col2` String\n)\nENGINE = SQLite
|
||||
1 text1
|
||||
2 text2
|
||||
3 text3
|
||||
12 test2
|
||||
|
@ -9,6 +9,7 @@ DATA_FILE=$CUR_DIR/data_sqlite/db1
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query='DROP DATABASE IF EXISTS sqlite_database'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'create database engine'";
|
||||
${CLICKHOUSE_CLIENT} --query="CREATE DATABASE sqlite_database ENGINE = SQLite('${DATA_FILE}')"
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'show database tables:'";
|
||||
@ -29,26 +30,47 @@ ${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 ORDER BY col1
|
||||
${CLICKHOUSE_CLIENT} --query="select 'test insert:'";
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_database.table1 VALUES ('line4', 4);"
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_database.table2 VALUES (4, 'text4');"
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table1 WHERE col2 > 3 ORDER BY col2;'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 WHERE col1 > 3 ORDER BY col1;'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table1 WHERE col2 > 3;'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 WHERE col1 > 3;'
|
||||
${CLICKHOUSE_CLIENT} --query="select 'test NULLs:'";
|
||||
sqlite3 data_sqlite/db1 'INSERT INTO table3 VALUES (NULL, 2)'
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_database.table3 VALUES (NULL, 3);"
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_database.table3 VALUES (NULL, 4);"
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table3 ORDER BY col2;'
|
||||
|
||||
sqlite3 data_sqlite/db1 'DELETE FROM table1 WHERE col2 > 3'
|
||||
sqlite3 data_sqlite/db1 'DELETE FROM table2 WHERE col1 > 3'
|
||||
sqlite3 data_sqlite/db1 'DELETE FROM table3 WHERE col2 > 1'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'after delete:'";
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table1 WHERE col2 > 3;'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 WHERE col1 > 3;'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table1 WHERE col2 > 3 ORDER BY col2;'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 WHERE col1 > 3 ORDER BY col1;'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'after detach:'";
|
||||
${CLICKHOUSE_CLIENT} --query="select 'detach'";
|
||||
${CLICKHOUSE_CLIENT} --query='DETACH DATABASE sqlite_database;'
|
||||
${CLICKHOUSE_CLIENT} --query='ATTACH DATABASE sqlite_database;'
|
||||
#${CLICKHOUSE_CLIENT} --query='DETACH TABLE sqlite_database.table1;'
|
||||
#${CLICKHOUSE_CLIENT} --query='DETACH TABLE sqlite_database.table2;'
|
||||
#${CLICKHOUSE_CLIENT} --query='ATTACH TABLE sqlite_database.table1;'
|
||||
#${CLICKHOUSE_CLIENT} --query='ATTACH TABLE sqlite_database.table2;'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table1 ORDER BY col2'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_database.table2 ORDER BY col1;'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query='DROP DATABASE IF EXISTS sqlite_database;'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'create table engine with table1'";
|
||||
${CLICKHOUSE_CLIENT} --query='DROP TABLE IF EXISTS sqlite_table1'
|
||||
${CLICKHOUSE_CLIENT} --query="CREATE TABLE sqlite_table1 (col1 String, col2 Int32) ENGINE = SQLite('${DATA_FILE}', 'table1')"
|
||||
${CLICKHOUSE_CLIENT} --query='SHOW CREATE TABLE sqlite_table1;' | sed -r 's/(.*SQLite)(.*)/\1/'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_table1 ORDER BY col2'
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_table1 VALUES ('test1', 12);"
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_table1 WHERE col2 = 12'
|
||||
sqlite3 data_sqlite/db1 'DELETE FROM table1 WHERE col2 = 12'
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query="select 'create table engine with table2'";
|
||||
${CLICKHOUSE_CLIENT} --query='DROP TABLE IF EXISTS sqlite_table2'
|
||||
${CLICKHOUSE_CLIENT} --query="CREATE TABLE sqlite_table2 (col1 Int32, col2 String) ENGINE = SQLite('${DATA_FILE}', 'table2')"
|
||||
${CLICKHOUSE_CLIENT} --query='SHOW CREATE TABLE sqlite_table2;' | sed -r 's/(.*SQLite)(.*)/\1/'
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_table2 ORDER BY col1'
|
||||
${CLICKHOUSE_CLIENT} --query="INSERT INTO sqlite_table2 VALUES (12, 'test2');"
|
||||
${CLICKHOUSE_CLIENT} --query='SELECT * FROM sqlite_table2 WHERE col1 = 12'
|
||||
sqlite3 data_sqlite/db1 'DELETE FROM table2 WHERE col1 = 12'
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user