Unverified 提交 22198a0d authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1112 from katzyn/tests

Improve test scripts
...@@ -86,6 +86,7 @@ public class TestScript extends TestBase { ...@@ -86,6 +86,7 @@ public class TestScript extends TestBase {
reconnectOften = !config.memory && config.big; reconnectOften = !config.memory && config.big;
testScript("testScript.sql"); testScript("testScript.sql");
testScript("comments.sql");
testScript("derived-column-names.sql"); testScript("derived-column-names.sql");
testScript("dual.sql"); testScript("dual.sql");
testScript("indexes.sql"); testScript("indexes.sql");
...@@ -206,7 +207,37 @@ public class TestScript extends TestBase { ...@@ -206,7 +207,37 @@ public class TestScript extends TestBase {
while (true) { while (true) {
String s = in.readLine(); String s = in.readLine();
if (s == null) { if (s == null) {
return s; return null;
}
if (s.startsWith("#")) {
int end = s.indexOf('#', 1);
if (end < 3) {
fail("Bad line \"" + s + '\"');
}
boolean val;
switch (s.charAt(1)) {
case '+':
val = true;
break;
case '-':
val = false;
break;
default:
fail("Bad line \"" + s + '\"');
return null;
}
String flag = s.substring(2, end);
s = s.substring(end + 1);
switch (flag) {
case "mvStore":
if (config.mvStore == val) {
break;
} else {
continue;
}
default:
fail("Unknown flag \"" + flag + '\"');
}
} }
s = s.trim(); s = s.trim();
if (s.length() > 0) { if (s.length() > 0) {
...@@ -493,10 +524,7 @@ public class TestScript extends TestBase { ...@@ -493,10 +524,7 @@ public class TestScript extends TestBase {
if (reconnectOften && sql.toUpperCase().startsWith("EXPLAIN")) { if (reconnectOften && sql.toUpperCase().startsWith("EXPLAIN")) {
return; return;
} }
errors.append(fileName).append('\n'); addWriteResultError(compare, s);
errors.append("line: ").append(in.getLineNumber()).append('\n');
errors.append("exp: ").append(compare).append('\n');
errors.append("got: ").append(s).append('\n');
if (ex != null) { if (ex != null) {
TestBase.logError("script", ex); TestBase.logError("script", ex);
} }
...@@ -507,11 +535,20 @@ public class TestScript extends TestBase { ...@@ -507,11 +535,20 @@ public class TestScript extends TestBase {
} }
} }
} else { } else {
addWriteResultError("<nothing>", s);
TestBase.logErrorMessage(errors.toString());
putBack = compare; putBack = compare;
} }
write(s); write(s);
} }
private void addWriteResultError(String expected, String got) {
errors.append(fileName).append('\n');
errors.append("line: ").append(in.getLineNumber()).append('\n');
errors.append("exp: ").append(expected).append('\n');
errors.append("got: ").append(got).append('\n');
}
private void write(String s) { private void write(String s) {
outputLineNo++; outputLineNo++;
out.println(s); out.println(s);
......
-- Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0,
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
CALL 1 /* comment */ ;;
> 1
> -
> 1
> rows: 1
CALL 1 /* comment */ ;
> 1
> -
> 1
> rows: 1
call /* remark * / * /* ** // end */ 1;
> 1
> -
> 1
> rows: 1
--- remarks/comments/syntax ----------------------------------------------------------------------------------------------
CREATE TABLE TEST(
ID INT PRIMARY KEY, -- this is the primary key, type {integer}
NAME VARCHAR(255) -- this is a string
);
> ok
INSERT INTO TEST VALUES(
1 /* ID */,
'Hello' // NAME
);
> update count: 1
SELECT * FROM TEST;
> ID NAME
> -- -----
> 1 Hello
> rows: 1
DROP_ TABLE_ TEST_T;
> exception SYNTAX_ERROR_2
DROP TABLE TEST /*;
> exception SYNTAX_ERROR_1
DROP TABLE TEST;
> ok
...@@ -24,6 +24,7 @@ select * from card; ...@@ -24,6 +24,7 @@ select * from card;
> 0 clubs > 0 clubs
> 3 hearts > 3 hearts
> 4 null > 4 null
> rows: 3
select * from card order by suit; select * from card order by suit;
> RANK SUIT > RANK SUIT
...@@ -31,6 +32,7 @@ select * from card order by suit; ...@@ -31,6 +32,7 @@ select * from card order by suit;
> 4 null > 4 null
> 3 hearts > 3 hearts
> 0 clubs > 0 clubs
> rows (ordered): 3
insert into card (rank, suit) values (8, 'diamonds'), (10, 'clubs'), (7, 'hearts'); insert into card (rank, suit) values (8, 'diamonds'), (10, 'clubs'), (7, 'hearts');
> update count: 3 > update count: 3
...@@ -42,17 +44,13 @@ select suit, count(rank) from card group by suit order by suit, count(rank); ...@@ -42,17 +44,13 @@ select suit, count(rank) from card group by suit order by suit, count(rank);
> hearts 2 > hearts 2
> clubs 2 > clubs 2
> diamonds 1 > diamonds 1
> rows (ordered): 4
select rank from card where suit = 'diamonds'; select rank from card where suit = 'diamonds';
> RANK >> 8
> ----
> 8
select column_type from information_schema.columns where COLUMN_NAME = 'SUIT'; select column_type from information_schema.columns where COLUMN_NAME = 'SUIT';
> COLUMN_TYPE >> ENUM('hearts','clubs','spades','diamonds')
> ------------------------------------------
> ENUM('hearts','clubs','spades','diamonds')
> rows: 1
--- ENUM integer-based operations --- ENUM integer-based operations
...@@ -61,6 +59,7 @@ select rank from card where suit = 1; ...@@ -61,6 +59,7 @@ select rank from card where suit = 1;
> ---- > ----
> 0 > 0
> 10 > 10
> rows: 2
insert into card (rank, suit) values(5, 2); insert into card (rank, suit) values(5, 2);
> update count: 1 > update count: 1
...@@ -69,6 +68,7 @@ select * from card where rank = 5; ...@@ -69,6 +68,7 @@ select * from card where rank = 5;
> RANK SUIT > RANK SUIT
> ---- ------ > ---- ------
> 5 spades > 5 spades
> rows: 1
--- ENUM edge cases --- ENUM edge cases
...@@ -100,6 +100,7 @@ select * from card; ...@@ -100,6 +100,7 @@ select * from card;
> ---- ------ > ---- ------
> 0 clubs > 0 clubs
> 3 hearts > 3 hearts
> rows: 2
drop table card; drop table card;
> ok > ok
...@@ -125,6 +126,7 @@ select rank from card where suit = 'clubs'; ...@@ -125,6 +126,7 @@ select rank from card where suit = 'clubs';
> ---- > ----
> 0 > 0
> 1 > 1
> rows: 2
drop table card; drop table card;
> ok > ok
...@@ -143,18 +145,21 @@ insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts'), (1, 'clubs'); ...@@ -143,18 +145,21 @@ insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts'), (1, 'clubs');
> update count: 3 > update count: 3
create index idx_card_suite on card(`suit`); create index idx_card_suite on card(`suit`);
> ok
select rank from card where suit = 'clubs'; select rank from card where suit = 'clubs';
> RANK > RANK
> ---- > ----
> 0 > 0
> 1 > 1
> rows: 2
select rank from card where suit in ('clubs'); select rank from card where suit in ('clubs');
> RANK > RANK
> ---- > ----
> 0 > 0
> 1 > 1
> rows: 2
drop table card; drop table card;
> ok > ok
......
...@@ -10,9 +10,7 @@ INSERT INTO tab_with_timezone(x) VALUES ('2017-01-01'); ...@@ -10,9 +10,7 @@ INSERT INTO tab_with_timezone(x) VALUES ('2017-01-01');
> update count: 1 > update count: 1
SELECT "Query".* FROM (select * from tab_with_timezone where x > '2016-01-01') AS "Query"; SELECT "Query".* FROM (select * from tab_with_timezone where x > '2016-01-01') AS "Query";
> X >> 2017-01-01 00:00:00+00
> ----------------------
> 2017-01-01 00:00:00+00
DELETE FROM tab_with_timezone; DELETE FROM tab_with_timezone;
> update count: 1 > update count: 1
......
...@@ -19,6 +19,7 @@ SELECT * FROM PARENT; ...@@ -19,6 +19,7 @@ SELECT * FROM PARENT;
> -- ----- > -- -----
> 1 Coco1 > 1 Coco1
> 2 Coco2 > 2 Coco2
> rows: 2
EXPLAIN PLAN EXPLAIN PLAN
MERGE INTO PARENT AS P MERGE INTO PARENT AS P
...@@ -28,9 +29,7 @@ EXPLAIN PLAN ...@@ -28,9 +29,7 @@ EXPLAIN PLAN
UPDATE SET P.NAME = S.NAME WHERE 2 = 2 WHEN NOT UPDATE SET P.NAME = S.NAME WHERE 2 = 2 WHEN NOT
MATCHED THEN MATCHED THEN
INSERT (ID, NAME) VALUES (S.ID, S.NAME); INSERT (ID, NAME) VALUES (S.ID, S.NAME);
> PLAN >> MERGE INTO PUBLIC.PARENT(ID, NAME) KEY(ID) SELECT X AS ID, ('Coco' || X) AS NAME FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX */
> ---------------------------------------------------------------------------------------------------------------------------------
> MERGE INTO PUBLIC.PARENT(ID, NAME) KEY(ID) SELECT X AS ID, ('Coco' || X) AS NAME FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX */
DROP TABLE PARENT; DROP TABLE PARENT;
> ok > ok
......
...@@ -20,6 +20,7 @@ select array_agg(v order by v asc), ...@@ -20,6 +20,7 @@ select array_agg(v order by v asc),
> rows (ordered): 1 > rows (ordered): 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select ARRAY_AGG(v order by v asc), select ARRAY_AGG(v order by v asc),
ARRAY_AGG(v order by v desc) filter (where v >= '4') ARRAY_AGG(v order by v desc) filter (where v >= '4')
......
...@@ -18,6 +18,7 @@ select avg(v), avg(v) filter (where v >= 40) from test where v <= 100; ...@@ -18,6 +18,7 @@ select avg(v), avg(v) filter (where v >= 40) from test where v <= 100;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select avg(v), avg(v) filter (where v >= 40) from test where v <= 100; select avg(v), avg(v) filter (where v >= 40) from test where v <= 100;
> AVG(V) AVG(V) FILTER (WHERE (V >= 40)) > AVG(V) AVG(V) FILTER (WHERE (V >= 40))
......
...@@ -21,6 +21,7 @@ select bit_and(v), bit_and(v) filter (where v <= 0xffffffff0fff) from test where ...@@ -21,6 +21,7 @@ select bit_and(v), bit_and(v) filter (where v <= 0xffffffff0fff) from test where
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select bit_and(v), bit_and(v) filter (where v <= 0xffffffff0fff) from test where v >= 0xff0fffffffff; select bit_and(v), bit_and(v) filter (where v <= 0xffffffff0fff) from test where v >= 0xff0fffffffff;
> BIT_AND(V) BIT_AND(V) FILTER (WHERE (V <= 281474976649215)) > BIT_AND(V) BIT_AND(V) FILTER (WHERE (V <= 281474976649215))
......
...@@ -20,6 +20,7 @@ select bit_or(v), bit_or(v) filter (where v >= 8) from test where v <= 512; ...@@ -20,6 +20,7 @@ select bit_or(v), bit_or(v) filter (where v >= 8) from test where v <= 512;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select bit_or(v), bit_or(v) filter (where v >= 8) from test where v <= 512; select bit_or(v), bit_or(v) filter (where v >= 8) from test where v <= 512;
> BIT_OR(V) BIT_OR(V) FILTER (WHERE (V >= 8)) > BIT_OR(V) BIT_OR(V) FILTER (WHERE (V >= 8))
......
...@@ -18,6 +18,7 @@ select count(v), count(v) filter (where v >= 4) from test where v <= 10; ...@@ -18,6 +18,7 @@ select count(v), count(v) filter (where v >= 4) from test where v <= 10;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select count(v), count(v) filter (where v >= 4) from test where v <= 10; select count(v), count(v) filter (where v >= 4) from test where v <= 10;
> COUNT(V) COUNT(V) FILTER (WHERE (V >= 4)) > COUNT(V) COUNT(V) FILTER (WHERE (V >= 4))
......
...@@ -20,6 +20,7 @@ select group_concat(v order by v asc separator '-'), ...@@ -20,6 +20,7 @@ select group_concat(v order by v asc separator '-'),
> rows (ordered): 1 > rows (ordered): 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select group_concat(v order by v asc separator '-'), select group_concat(v order by v asc separator '-'),
group_concat(v order by v desc separator '-') filter (where v >= '4') group_concat(v order by v desc separator '-') filter (where v >= '4')
......
...@@ -18,6 +18,7 @@ select max(v), max(v) filter (where v <= 8) from test where v <= 10; ...@@ -18,6 +18,7 @@ select max(v), max(v) filter (where v <= 8) from test where v <= 10;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select max(v), max(v) filter (where v <= 8) from test where v <= 10; select max(v), max(v) filter (where v <= 8) from test where v <= 10;
> MAX(V) MAX(V) FILTER (WHERE (V <= 8)) > MAX(V) MAX(V) FILTER (WHERE (V <= 8))
......
...@@ -598,6 +598,7 @@ select median(v), median(v) filter (where v >= 40) from test where v <= 100; ...@@ -598,6 +598,7 @@ select median(v), median(v) filter (where v >= 40) from test where v <= 100;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select median(v), median(v) filter (where v >= 40) from test where v <= 100; select median(v), median(v) filter (where v >= 40) from test where v <= 100;
> MEDIAN(V) MEDIAN(V) FILTER (WHERE (V >= 40)) > MEDIAN(V) MEDIAN(V) FILTER (WHERE (V >= 40))
...@@ -623,6 +624,7 @@ insert into test values ...@@ -623,6 +624,7 @@ insert into test values
('First', 10), ('First', 10), ('First', 20), ('First', 30), ('First', 30), ('First', 10), ('First', 10), ('First', 20), ('First', 30), ('First', 30),
('Second', 5), ('Second', 4), ('Second', 20), ('Second', 22), ('Second', 300), ('Second', 5), ('Second', 4), ('Second', 20), ('Second', 22), ('Second', 300),
('Third', 3), ('Third', 100), ('Third', 150), ('Third', 170), ('Third', 400); ('Third', 3), ('Third', 100), ('Third', 150), ('Third', 170), ('Third', 400);
> update count: 15
select dept, median(amount) from test group by dept order by dept; select dept, median(amount) from test group by dept order by dept;
> DEPT MEDIAN(AMOUNT) > DEPT MEDIAN(AMOUNT)
......
...@@ -18,6 +18,7 @@ select min(v), min(v) filter (where v >= 4) from test where v >= 2; ...@@ -18,6 +18,7 @@ select min(v), min(v) filter (where v >= 4) from test where v >= 2;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select min(v), min(v) filter (where v >= 4) from test where v >= 2; select min(v), min(v) filter (where v >= 4) from test where v >= 2;
> MIN(V) MIN(V) FILTER (WHERE (V >= 4)) > MIN(V) MIN(V) FILTER (WHERE (V >= 4))
......
...@@ -18,6 +18,7 @@ select sum(v), sum(v) filter (where v >= 4) from test where v <= 10; ...@@ -18,6 +18,7 @@ select sum(v), sum(v) filter (where v >= 4) from test where v <= 10;
> rows: 1 > rows: 1
create index test_idx on test(v); create index test_idx on test(v);
> ok
select sum(v), sum(v) filter (where v >= 4) from test where v <= 10; select sum(v), sum(v) filter (where v >= 4) from test where v <= 10;
> SUM(V) SUM(V) FILTER (WHERE (V >= 4)) > SUM(V) SUM(V) FILTER (WHERE (V >= 4))
......
...@@ -7,10 +7,10 @@ create memory table test(id int primary key, name varchar(255)); ...@@ -7,10 +7,10 @@ create memory table test(id int primary key, name varchar(255));
> ok > ok
insert into test values(1, 'Hello'); insert into test values(1, 'Hello');
> update count: 1
select char(null) en, char(65) ea from test; select char(null) en, char(65) ea from test;
> EN EA > EN EA
> ---- -- > ---- --
> null A > null A
> rows: 1 > rows: 1
...@@ -6,6 +6,7 @@ create memory table test(id int primary key, name varchar(255)); ...@@ -6,6 +6,7 @@ create memory table test(id int primary key, name varchar(255));
> ok > ok
insert into test values(1, 'Hello'); insert into test values(1, 'Hello');
> update count: 1
select concat(null, null) en, concat(null, 'a') ea, concat('b', null) eb, concat('ab', 'c') abc from test; select concat(null, null) en, concat(null, 'a') ea, concat('b', null) eb, concat('ab', 'c') abc from test;
> EN EA EB ABC > EN EA EB ABC
......
...@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255)); ...@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255));
> ok > ok
insert into test values(1, 'Hello'); insert into test values(1, 'Hello');
> update count: 1
select difference(null, null) en, difference('a', null) en1, difference(null, 'a') en2 from test; select difference(null, null) en, difference('a', null) en1, difference(null, 'a') en2 from test;
> EN EN1 EN2 > EN EN1 EN2
...@@ -19,5 +20,3 @@ select difference('abc', 'abc') e0, difference('Thomas', 'Tom') e1 from test; ...@@ -19,5 +20,3 @@ select difference('abc', 'abc') e0, difference('Thomas', 'Tom') e1 from test;
> -- -- > -- --
> 4 3 > 4 3
> rows: 1 > rows: 1
...@@ -13,6 +13,7 @@ select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni'); ...@@ -13,6 +13,7 @@ select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni');
>> TOTOvain >> TOTOvain
set mode oracle; set mode oracle;
> ok
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1'); select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> last first >> last first
...@@ -27,6 +28,7 @@ select regexp_replace('first last', '(\w+) (\w+)', '$2 $1'); ...@@ -27,6 +28,7 @@ select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> $2 $1 >> $2 $1
set mode regular; set mode regular;
> ok
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1'); select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> 2 1 >> 2 1
......
...@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255)); ...@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255));
> ok > ok
insert into test values(1, 'Hello'); insert into test values(1, 'Hello');
> update count: 1
select soundex(null) en, soundex('tom') et from test; select soundex(null) en, soundex('tom') et from test;
> EN ET > EN ET
...@@ -23,4 +24,3 @@ soundex('VanDeusen') V532, soundex('Ashcraft') A261 from test; ...@@ -23,4 +24,3 @@ soundex('VanDeusen') V532, soundex('Ashcraft') A261 from test;
> ---- ---- ---- ---- ---- ---- ---- ---- > ---- ---- ---- ---- ---- ---- ---- ----
> W252 L000 G362 P236 J250 T522 V532 A261 > W252 L000 G362 P236 J250 T522 V532 A261
> rows: 1 > rows: 1
...@@ -11,7 +11,7 @@ select row_number() over () as rnum, str from test where str = 'A'; ...@@ -11,7 +11,7 @@ select row_number() over () as rnum, str from test where str = 'A';
> RNUM STR > RNUM STR
> ---- --- > ---- ---
> 1 A > 1 A
> rows: 1
drop table test; drop table test;
> ok > ok
...@@ -24,6 +24,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID_VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _12345678 ...@@ -24,6 +24,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID_VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _12345678
> VERY_VERY_VERY_LONG_ID_VERY_VE _123456789012345 SUMX1 SUMX147 x noName6 noName7 > VERY_VERY_VERY_LONG_ID_VERY_VE _123456789012345 SUMX1 SUMX147 x noName6 noName7
> ------------------------------ ---------------- ----- ------- - ------- ------- > ------------------------------ ---------------- ----- ------- - ------- -------
> 1 4 4 51 x !!! !!!! > 1 4 4 51 x !!! !!!!
> rows: 1
SET COLUMN_NAME_RULES=EMULATE='Oracle'; SET COLUMN_NAME_RULES=EMULATE='Oracle';
> ok > ok
...@@ -33,6 +34,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM ...@@ -33,6 +34,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
> VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7 > VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7
> ---------------------- ---------------- ----- ------- - ---------- ---------- > ---------------------- ---------------- ----- ------- - ---------- ----------
> 1 4 4 51 x !!! !!!! > 1 4 4 51 x !!! !!!!
> rows: 1
SET COLUMN_NAME_RULES=EMULATE='Oracle'; SET COLUMN_NAME_RULES=EMULATE='Oracle';
> ok > ok
...@@ -42,6 +44,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM ...@@ -42,6 +44,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
> VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7 _23456789012345678901234567890XXX > VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7 _23456789012345678901234567890XXX
> ---------------------- ---------------- ----- ------- - ---------- ---------- --------------------------------- > ---------------------- ---------------- ----- ------- - ---------- ---------- ---------------------------------
> 1 4 4 51 x !!! !!!! Very Long > 1 4 4 51 x !!! !!!! Very Long
> rows: 1
SET COLUMN_NAME_RULES=EMULATE='PostgreSQL'; SET COLUMN_NAME_RULES=EMULATE='PostgreSQL';
> ok > ok
...@@ -51,6 +54,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM ...@@ -51,6 +54,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
> VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7 QuotedColumnId > VERY_VERY_VERY_LONG_ID _123456789012345 SUMX1 SUMX147 x _UNNAMED_6 _UNNAMED_7 QuotedColumnId
> ---------------------- ---------------- ----- ------- - ---------- ---------- -------------- > ---------------------- ---------------- ----- ------- - ---------- ---------- --------------
> 1 4 4 51 x !!! !!!! 999 > 1 4 4 51 x !!! !!!! 999
> rows: 1
SET COLUMN_NAME_RULES=DEFAULT; SET COLUMN_NAME_RULES=DEFAULT;
> ok > ok
......
...@@ -265,10 +265,8 @@ explain select * from test1 ...@@ -265,10 +265,8 @@ explain select * from test1
inner join test2 on test1.id=test2.id left inner join test2 on test1.id=test2.id left
outer join test3 on test2.id=test3.id outer join test3 on test2.id=test3.id
where test3.id is null; where test3.id is null;
> PLAN #+mvStore#>> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2.tableScan */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ ON 1=1 WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #-mvStore#>> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST1 /* PUBLIC.TEST1.tableScan */ INNER JOIN PUBLIC.TEST2 /* PUBLIC.PRIMARY_KEY_4C: ID = TEST1.ID AND ID = TEST1.ID */ ON 1=1 /* WHERE TEST1.ID = TEST2.ID */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2.tableScan */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ ON 1=1 WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> rows: 1
insert into test1 select x from system_range(2, 1000); insert into test1 select x from system_range(2, 1000);
> update count: 999 > update count: 999
...@@ -285,10 +283,7 @@ explain select * from test1 ...@@ -285,10 +283,7 @@ explain select * from test1
inner join test2 on test1.id=test2.id inner join test2 on test1.id=test2.id
left outer join test3 on test2.id=test3.id left outer join test3 on test2.id=test3.id
where test3.id is null; where test3.id is null;
> PLAN >> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2.tableScan */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ ON 1=1 WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2.tableScan */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ ON 1=1 WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> rows: 1
SELECT TEST1.ID, TEST2.ID, TEST3.ID SELECT TEST1.ID, TEST2.ID, TEST3.ID
FROM TEST2 FROM TEST2
...@@ -764,21 +759,36 @@ DROP TABLE C; ...@@ -764,21 +759,36 @@ DROP TABLE C;
> ok > ok
CREATE TABLE T1(X1 INT); CREATE TABLE T1(X1 INT);
> ok
CREATE TABLE T2(X2 INT); CREATE TABLE T2(X2 INT);
> ok
CREATE TABLE T3(X3 INT); CREATE TABLE T3(X3 INT);
> ok
CREATE TABLE T4(X4 INT); CREATE TABLE T4(X4 INT);
> ok
CREATE TABLE T5(X5 INT); CREATE TABLE T5(X5 INT);
> ok
INSERT INTO T1 VALUES (1); INSERT INTO T1 VALUES (1);
> update count: 1
INSERT INTO T1 VALUES (NULL); INSERT INTO T1 VALUES (NULL);
> update count: 1
INSERT INTO T2 VALUES (1); INSERT INTO T2 VALUES (1);
> update count: 1
INSERT INTO T2 VALUES (NULL); INSERT INTO T2 VALUES (NULL);
> update count: 1
INSERT INTO T3 VALUES (1); INSERT INTO T3 VALUES (1);
> update count: 1
INSERT INTO T3 VALUES (NULL); INSERT INTO T3 VALUES (NULL);
> update count: 1
INSERT INTO T4 VALUES (1); INSERT INTO T4 VALUES (1);
> update count: 1
INSERT INTO T4 VALUES (NULL); INSERT INTO T4 VALUES (NULL);
> update count: 1
INSERT INTO T5 VALUES (1); INSERT INTO T5 VALUES (1);
> update count: 1
INSERT INTO T5 VALUES (NULL); INSERT INTO T5 VALUES (NULL);
> update count: 1
SELECT T1.X1, T2.X2, T3.X3, T4.X4, T5.X5 FROM ( SELECT T1.X1, T2.X2, T3.X3, T4.X4, T5.X5 FROM (
T1 INNER JOIN ( T1 INNER JOIN (
......
...@@ -3384,24 +3384,6 @@ call select 1.0/3.0*3.0, 100.0/2.0, -25.0/100.0, 0.0/3.0, 6.9/2.0, 0.72179425150 ...@@ -3384,24 +3384,6 @@ call select 1.0/3.0*3.0, 100.0/2.0, -25.0/100.0, 0.0/3.0, 6.9/2.0, 0.72179425150
> (0.999999999999999999999999990, 50, -0.25, 0, 3.45, 1.35822361752313607260107721120531135706133161972E-10) > (0.999999999999999999999999990, 50, -0.25, 0, 3.45, 1.35822361752313607260107721120531135706133161972E-10)
> rows: 1 > rows: 1
CALL 1 /* comment */ ;;
> 1
> -
> 1
> rows: 1
CALL 1 /* comment */ ;
> 1
> -
> 1
> rows: 1
call /* remark * / * /* ** // end */ 1;
> 1
> -
> 1
> rows: 1
call (select x from dual where x is null); call (select x from dual where x is null);
> SELECT X FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX: X IS NULL */ /* scanCount: 1 */ WHERE X IS NULL > SELECT X FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX: X IS NULL */ /* scanCount: 1 */ WHERE X IS NULL
> ------------------------------------------------------------------------------------------------------- > -------------------------------------------------------------------------------------------------------
...@@ -6384,34 +6366,6 @@ SELECT ID, MAX(NAME) FROM TEST GROUP BY ID HAVING MAX(NAME) LIKE 'World%'; ...@@ -6384,34 +6366,6 @@ SELECT ID, MAX(NAME) FROM TEST GROUP BY ID HAVING MAX(NAME) LIKE 'World%';
DROP TABLE TEST; DROP TABLE TEST;
> ok > ok
--- remarks/comments/syntax ----------------------------------------------------------------------------------------------
CREATE TABLE TEST(
ID INT PRIMARY KEY, -- this is the primary key, type {integer}
NAME VARCHAR(255) -- this is a string
);
> ok
INSERT INTO TEST VALUES(
1 /* ID */,
'Hello' // NAME
);
> update count: 1
SELECT * FROM TEST;
> ID NAME
> -- -----
> 1 Hello
> rows: 1
DROP_ TABLE_ TEST_T;
> exception SYNTAX_ERROR_2
DROP TABLE TEST /*;
> exception SYNTAX_ERROR_1
DROP TABLE TEST;
> ok
--- exists ---------------------------------------------------------------------------------------------- --- exists ----------------------------------------------------------------------------------------------
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255)); CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
> ok > ok
...@@ -8498,6 +8452,7 @@ select * from test where year in (select distinct year from test order by year d ...@@ -8498,6 +8452,7 @@ select * from test where year in (select distinct year from test order by year d
> ---- --------- > ---- ---------
> 2016 order > 2016 order
> 2016 execution > 2016 execution
> rows (ordered): 2
drop table test; drop table test;
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论