1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Dlee mtr restructure (#2494)

* Restructured test suites and added autopilot and extended suites

* Updated autopilot with correct branch - develop

* Moved setup test case to a 'setup' directory, for consistency

* Fixed a path issue

* Updated some tests cases to keep up with development

Co-authored-by: root <root@rocky8.localdomain>
This commit is contained in:
Daniel Lee
2022-08-09 13:20:56 -05:00
committed by GitHub
parent 8b15e2f6a4
commit 4c9d6e39ac
6839 changed files with 10542409 additions and 77 deletions

View File

@ -0,0 +1,20 @@
1. General
The devregression test suite contains test cases migrated from development's regression tests.
2. Environment setup
Before execting this test suite, please execute regression_env_setup.test in the csinternal
directory. This test will setup the required databases and tables for the test suite.
3. About the tests
These test cases are regression tests for fixed bugs in development's regression tests.
There are about 350 .sql files matching "bug*.sql" or "MCOL*.sql" patterns were identified.
Some of them failed to run in MTR due to required data was not setup, or syntax is not MTR
compatible. There are also some cases that ran in MTR, but did not survive repeat MTR runs.
These failed test cases need more TLC before they can be migrated to MTR correctly.

View File

@ -0,0 +1,113 @@
USE tpch1;
select n1.n_nationkey, n1.n_regionkey from nation n1, nation n2 where
n1.n_nationkey = n2.n_regionkey order by 1, 2;
n_nationkey n_regionkey
0 0
0 0
0 0
0 0
0 0
1 1
1 1
1 1
1 1
1 1
2 1
2 1
2 1
2 1
2 1
3 1
3 1
3 1
3 1
3 1
4 4
4 4
4 4
4 4
4 4
select o1.o_orderkey o1order, o2.o_custkey o2order, o1.o_custkey
from orders o1,
orders o2
where o1.o_custkey = o2.o_orderkey and
o1.o_orderdate <= '1992-01-01' and
o1.o_orderstatus = 'F' and
o2.o_orderstatus = 'O'
order by 1, 2, 3;
o1order o2order o_custkey
23010 52549 91141
234946 25291 34885
302497 109117 133474
434722 83353 9376
613377 107278 143623
646854 135305 134503
717701 98785 127393
855717 50962 88390
857472 91084 97922
874625 39688 102112
902276 130828 21508
1049856 33811 8194
1091458 129698 99907
1185794 110383 63079
1190181 46441 67618
1203046 35158 53731
1255365 71594 107173
1399905 114295 143111
1517600 100157 58531
1552449 23057 19397
1639335 112588 132481
1643075 18527 104261
1656837 104576 63331
1737829 67267 72994
1787520 82414 8737
1837095 50077 43300
1876097 60265 48646
1885254 69845 65795
1939168 21583 12454
1984517 48106 121093
2005603 55738 69730
2160263 25165 52165
2171652 64412 138470
2323621 106978 63367
2330151 66539 54469
2388551 34093 19363
2569185 30046 41092
2700708 88000 12358
2785572 38476 108134
2908514 142355 10084
3172390 91493 31013
3214433 98675 6439
3363171 89218 50245
3395076 76700 96577
3492899 104378 126112
3643973 133907 7367
3891367 18578 142885
3903875 27058 67906
3973414 134476 13060
4100452 148916 98851
4109575 85798 85601
4376420 46057 9799
4390050 15496 46304
4396228 123454 98177
4443042 127456 89728
4513792 102635 144545
4859008 139166 9316
4905731 50830 47077
4969154 140204 142660
5114023 70547 70405
5154438 1627 136930
5188999 31504 60707
5261152 39481 48871
5287876 96251 61312
5383875 15119 48292
5431079 12463 81157
5485507 98152 83875
5520544 15380 45382
5559427 5035 52960
5572069 80473 61795
5615043 17401 65350
5653190 18241 17830
5660774 35158 53731
5765569 1606 16228
5863808 127553 93251

View File

@ -0,0 +1,17 @@
USE tpch1;
select count(n_nationkey)
from nation, customer, orders, lineitem
where n_nationkey = c_nationkey and
c_custkey = o_custkey and
o_orderkey = l_orderkey and
l_orderkey <= 10000;
count(n_nationkey)
9965
select count(n_nationkey)
from nation, customer, orders, lineitem
where c_custkey = o_custkey and
o_orderkey = l_orderkey and
n_nationkey = c_nationkey and
l_orderkey <= 10000;
count(n_nationkey)
9965

View File

@ -0,0 +1,12 @@
USE tpch1;
select n_regionkey, r_regionkey
from nation, region
where n_regionkey = r_regionkey and
r_regionkey = 3
order by 1, 2;
n_regionkey r_regionkey
3 3
3 3
3 3
3 3
3 3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
USE tpch1;
select sum((case when r_regionkey>3 or r_regionkey<1 then 1 else 0 end)*r_regionkey) alias from region;
alias
4
select (case when (n_regionkey>3 and n_nationkey<5 or n_regionkey <2 and n_nationkey >7) then 1 else 0 end) alias from nation where n_nationkey < 10 order by 1;
alias
0
0
0
0
0
0
0
0
0
1

View File

@ -0,0 +1,607 @@
USE tpch1;
select cidx, cbigint, round(cbigint) from datatypetestm;
cidx cbigint round(cbigint)
1 -72036854775806 -72036854775806
2 -72036854775805 -72036854775805
3 -72036854775804 -72036854775804
4 -72036854775803 -72036854775803
5 -72036854775802 -72036854775802
6 72036854775803 72036854775803
7 72036854775804 72036854775804
8 72036854775805 72036854775805
9 72036854775806 72036854775806
10 72036854775807 72036854775807
11 0 0
select cidx, cbigint, round(cbigint,0) from datatypetestm;
cidx cbigint round(cbigint,0)
1 -72036854775806 -72036854775806
2 -72036854775805 -72036854775805
3 -72036854775804 -72036854775804
4 -72036854775803 -72036854775803
5 -72036854775802 -72036854775802
6 72036854775803 72036854775803
7 72036854775804 72036854775804
8 72036854775805 72036854775805
9 72036854775806 72036854775806
10 72036854775807 72036854775807
11 0 0
select cidx, cbigint, round(cbigint,1) from datatypetestm;
cidx cbigint round(cbigint,1)
1 -72036854775806 -72036854775806
2 -72036854775805 -72036854775805
3 -72036854775804 -72036854775804
4 -72036854775803 -72036854775803
5 -72036854775802 -72036854775802
6 72036854775803 72036854775803
7 72036854775804 72036854775804
8 72036854775805 72036854775805
9 72036854775806 72036854775806
10 72036854775807 72036854775807
11 0 0
select cidx, cbigint, round(cbigint,-1) from datatypetestm;
cidx cbigint round(cbigint,-1)
1 -72036854775806 -72036854775810
2 -72036854775805 -72036854775810
3 -72036854775804 -72036854775800
4 -72036854775803 -72036854775800
5 -72036854775802 -72036854775800
6 72036854775803 72036854775800
7 72036854775804 72036854775800
8 72036854775805 72036854775810
9 72036854775806 72036854775810
10 72036854775807 72036854775810
11 0 0
select cidx, cdecimal4_2, round(cdecimal4_2) from datatypetestm;
cidx cdecimal4_2 round(cdecimal4_2)
1 -9.99 -10
2 -9.98 -10
3 -9.97 -10
4 -9.96 -10
5 -9.95 -10
6 9.95 10
7 9.96 10
8 9.97 10
9 9.98 10
10 9.99 10
11 0.00 0
select cidx, cdecimal4_2, round(cdecimal4_2,2) from datatypetestm;
cidx cdecimal4_2 round(cdecimal4_2,2)
1 -9.99 -9.99
2 -9.98 -9.98
3 -9.97 -9.97
4 -9.96 -9.96
5 -9.95 -9.95
6 9.95 9.95
7 9.96 9.96
8 9.97 9.97
9 9.98 9.98
10 9.99 9.99
11 0.00 0.00
select cidx, cdecimal4_2, round(cdecimal4_2,0) from datatypetestm;
cidx cdecimal4_2 round(cdecimal4_2,0)
1 -9.99 -10
2 -9.98 -10
3 -9.97 -10
4 -9.96 -10
5 -9.95 -10
6 9.95 10
7 9.96 10
8 9.97 10
9 9.98 10
10 9.99 10
11 0.00 0
select cidx, cdecimal4_2, round(cdecimal4_2,-2) from datatypetestm;
cidx cdecimal4_2 round(cdecimal4_2,-2)
1 -9.99 0
2 -9.98 0
3 -9.97 0
4 -9.96 0
5 -9.95 0
6 9.95 0
7 9.96 0
8 9.97 0
9 9.98 0
10 9.99 0
11 0.00 0
select cidx, cdecimal18_2, round(cdecimal18_2,1) from datatypetestm;
cidx cdecimal18_2 round(cdecimal18_2,1)
1 -99999999999.99 -100000000000.0
2 -99999999999.98 -100000000000.0
3 -99999999999.97 -100000000000.0
4 -99999999999.96 -100000000000.0
5 -99999999999.95 -100000000000.0
6 99999999999.95 100000000000.0
7 99999999999.96 100000000000.0
8 99999999999.97 100000000000.0
9 99999999999.98 100000000000.0
10 99999999999.99 100000000000.0
11 0.00 0.0
select cidx, cdecimal18_2, round(cdecimal18_2,-1) from datatypetestm;
cidx cdecimal18_2 round(cdecimal18_2,-1)
1 -99999999999.99 -100000000000
2 -99999999999.98 -100000000000
3 -99999999999.97 -100000000000
4 -99999999999.96 -100000000000
5 -99999999999.95 -100000000000
6 99999999999.95 100000000000
7 99999999999.96 100000000000
8 99999999999.97 100000000000
9 99999999999.98 100000000000
10 99999999999.99 100000000000
11 0.00 0
select cidx, cbigint from datatypetestm where round(cbigint) <> cbigint;
cidx cbigint
select cidx, cbigint from datatypetestm where round(cbigint,1) <> cbigint;
cidx cbigint
select cidx, cbigint from datatypetestm where round(cbigint,2) <> cbigint;
cidx cbigint
select cidx, cbigint from datatypetestm where round(cbigint,0) <> cbigint;
cidx cbigint
select cidx, cbigint from datatypetestm where round(cbigint,-2) <> cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
select cidx, cbigint from datatypetestm where round(cbigint,-1) <> cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
select cidx, cbigint from datatypetestm where round(cbigint) = cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
11 0
select cidx, cbigint from datatypetestm where round(cbigint,1) = cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
11 0
select cidx, cbigint from datatypetestm where round(cbigint,2) = cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
11 0
select cidx, cbigint from datatypetestm where round(cbigint,0) = cbigint;
cidx cbigint
1 -72036854775806
2 -72036854775805
3 -72036854775804
4 -72036854775803
5 -72036854775802
6 72036854775803
7 72036854775804
8 72036854775805
9 72036854775806
10 72036854775807
11 0
select cidx, cbigint from datatypetestm where round(cbigint,-2) = cbigint;
cidx cbigint
11 0
select cidx, cbigint from datatypetestm where round(cbigint,-1) = cbigint;
cidx cbigint
11 0
select cidx, cdecimal4_2 from datatypetestm where round(cdecimal4_2,2) > cdecimal4_2;
cidx cdecimal4_2
select cidx, cdecimal4_2 from datatypetestm where round(cdecimal4_2,0) > cdecimal4_2;
cidx cdecimal4_2
6 9.95
7 9.96
8 9.97
9 9.98
10 9.99
select cidx, cdecimal4_2 from datatypetestm where round(cdecimal4_2,-1) > cdecimal4_2;
cidx cdecimal4_2
6 9.95
7 9.96
8 9.97
9 9.98
10 9.99
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2) < cdecimal18_2;
cidx cdecimal18_2
1 -99999999999.99
2 -99999999999.98
3 -99999999999.97
4 -99999999999.96
5 -99999999999.95
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2,1) < cdecimal18_2;
cidx cdecimal18_2
1 -99999999999.99
2 -99999999999.98
3 -99999999999.97
4 -99999999999.96
5 -99999999999.95
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2,2) < cdecimal18_2;
cidx cdecimal18_2
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2,0) < cdecimal18_2;
cidx cdecimal18_2
1 -99999999999.99
2 -99999999999.98
3 -99999999999.97
4 -99999999999.96
5 -99999999999.95
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2,-2) < cdecimal18_2;
cidx cdecimal18_2
1 -99999999999.99
2 -99999999999.98
3 -99999999999.97
4 -99999999999.96
5 -99999999999.95
select cidx, cdecimal18_2 from datatypetestm where round(cdecimal18_2,-1) < cdecimal18_2;
cidx cdecimal18_2
1 -99999999999.99
2 -99999999999.98
3 -99999999999.97
4 -99999999999.96
5 -99999999999.95
select round(r_regionkey, 0) from region;
round(r_regionkey, 0)
0
1
2
3
4
select round(r_regionkey, -1) from region;
round(r_regionkey, -1)
0
0
0
0
0
select round(r_regionkey, 1) from region;
round(r_regionkey, 1)
0
1
2
3
4
select round(r_name, 2) from region;
round(r_name, 2)
0.00
0.00
0.00
0.00
0.00
select concat(n_name, round(n_nationkey, 0)) from nation;
concat(n_name, round(n_nationkey, 0))
ALGERIA0
ARGENTINA1
BRAZIL2
CANADA3
EGYPT4
ETHIOPIA5
FRANCE6
GERMANY7
INDIA8
INDONESIA9
IRAN10
IRAQ11
JAPAN12
JORDAN13
KENYA14
MOROCCO15
MOZAMBIQUE16
PERU17
CHINA18
ROMANIA19
SAUDI ARABIA20
VIETNAM21
RUSSIA22
UNITED KINGDOM23
UNITED STATES24
select concat(n_name, round(n_nationkey, 1)) from nation;
concat(n_name, round(n_nationkey, 1))
ALGERIA0
ARGENTINA1
BRAZIL2
CANADA3
EGYPT4
ETHIOPIA5
FRANCE6
GERMANY7
INDIA8
INDONESIA9
IRAN10
IRAQ11
JAPAN12
JORDAN13
KENYA14
MOROCCO15
MOZAMBIQUE16
PERU17
CHINA18
ROMANIA19
SAUDI ARABIA20
VIETNAM21
RUSSIA22
UNITED KINGDOM23
UNITED STATES24
select concat(n_name, round(n_nationkey, 2)) from nation;
concat(n_name, round(n_nationkey, 2))
ALGERIA0
ARGENTINA1
BRAZIL2
CANADA3
EGYPT4
ETHIOPIA5
FRANCE6
GERMANY7
INDIA8
INDONESIA9
IRAN10
IRAQ11
JAPAN12
JORDAN13
KENYA14
MOROCCO15
MOZAMBIQUE16
PERU17
CHINA18
ROMANIA19
SAUDI ARABIA20
VIETNAM21
RUSSIA22
UNITED KINGDOM23
UNITED STATES24
select concat(n_name, round(n_nationkey, -1)) from nation;
concat(n_name, round(n_nationkey, -1))
ALGERIA0
ARGENTINA0
BRAZIL0
CANADA0
EGYPT0
ETHIOPIA10
FRANCE10
GERMANY10
INDIA10
INDONESIA10
IRAN10
IRAQ10
JAPAN10
JORDAN10
KENYA10
MOROCCO20
MOZAMBIQUE20
PERU20
CHINA20
ROMANIA20
SAUDI ARABIA20
VIETNAM20
RUSSIA20
UNITED KINGDOM20
UNITED STATES20
select concat(n_name, round(n_nationkey, -2)) from nation;
concat(n_name, round(n_nationkey, -2))
ALGERIA0
ARGENTINA0
BRAZIL0
CANADA0
EGYPT0
ETHIOPIA0
FRANCE0
GERMANY0
INDIA0
INDONESIA0
IRAN0
IRAQ0
JAPAN0
JORDAN0
KENYA0
MOROCCO0
MOZAMBIQUE0
PERU0
CHINA0
ROMANIA0
SAUDI ARABIA0
VIETNAM0
RUSSIA0
UNITED KINGDOM0
UNITED STATES0
select concat(n_name, round(n_nationkey/10, -1)) from nation;
concat(n_name, round(n_nationkey/10, -1))
ALGERIA0
ARGENTINA0
BRAZIL0
CANADA0
EGYPT0
ETHIOPIA0
FRANCE0
GERMANY0
INDIA0
INDONESIA0
IRAN0
IRAQ0
JAPAN0
JORDAN0
KENYA0
MOROCCO0
MOZAMBIQUE0
PERU0
CHINA0
ROMANIA0
SAUDI ARABIA0
VIETNAM0
RUSSIA0
UNITED KINGDOM0
UNITED STATES0
select concat(n_name, round(n_nationkey/10, -2)) from nation;
concat(n_name, round(n_nationkey/10, -2))
ALGERIA0
ARGENTINA0
BRAZIL0
CANADA0
EGYPT0
ETHIOPIA0
FRANCE0
GERMANY0
INDIA0
INDONESIA0
IRAN0
IRAQ0
JAPAN0
JORDAN0
KENYA0
MOROCCO0
MOZAMBIQUE0
PERU0
CHINA0
ROMANIA0
SAUDI ARABIA0
VIETNAM0
RUSSIA0
UNITED KINGDOM0
UNITED STATES0
select concat(n_name, round(n_nationkey/10, 1)) from nation;
concat(n_name, round(n_nationkey/10, 1))
ALGERIA0.0
ARGENTINA0.1
BRAZIL0.2
CANADA0.3
EGYPT0.4
ETHIOPIA0.5
FRANCE0.6
GERMANY0.7
INDIA0.8
INDONESIA0.9
IRAN1.0
IRAQ1.1
JAPAN1.2
JORDAN1.3
KENYA1.4
MOROCCO1.5
MOZAMBIQUE1.6
PERU1.7
CHINA1.8
ROMANIA1.9
SAUDI ARABIA2.0
VIETNAM2.1
RUSSIA2.2
UNITED KINGDOM2.3
UNITED STATES2.4
select concat(n_name, round(n_nationkey/10, 2)) from nation;
concat(n_name, round(n_nationkey/10, 2))
ALGERIA0.00
ARGENTINA0.10
BRAZIL0.20
CANADA0.30
EGYPT0.40
ETHIOPIA0.50
FRANCE0.60
GERMANY0.70
INDIA0.80
INDONESIA0.90
IRAN1.00
IRAQ1.10
JAPAN1.20
JORDAN1.30
KENYA1.40
MOROCCO1.50
MOZAMBIQUE1.60
PERU1.70
CHINA1.80
ROMANIA1.90
SAUDI ARABIA2.00
VIETNAM2.10
RUSSIA2.20
UNITED KINGDOM2.30
UNITED STATES2.40
select round(n_nationkey / n_regionkey - (n_nationkey * n_nationkey), 2) as rnd from nation, region where n_regionkey = r_regionkey order by 1;
rnd
NULL
NULL
NULL
NULL
NULL
-552.00
-521.33
-476.67
-430.50
-395.00
-354.67
-315.00
-272.00
-165.75
-138.00
-118.25
-97.50
-76.50
-60.00
-46.67
-34.00
-15.00
-6.00
-2.00
0.00
select length(substr(n_name, round(n_nationkey / 10))) from nation;
length(substr(n_name, round(n_nationkey / 10)))
0
0
0
0
0
8
6
7
5
9
4
4
5
6
5
6
9
3
4
6
11
6
5
13
12
select substr(cchar255, round(cdecimal1, 0),3) from datatypetestm where length(cchar255) > 5;
substr(cchar255, round(cdecimal1, 0),3)
aaa
qqq
qqq
qqq
qqq
zz

View File

@ -0,0 +1,30 @@
USE tpch1;
select c2 from sub1 order by 1;
c2
NULL
1
1
2
3
99
select c2 from sub2 order by 1;
c2
NULL
1
2
2
3
4
5
select sub1.c2 as x, sub1.c2 as y from sub1, sub2 where sub1.c2 = sub2.c2 order by 1, 2;
x y
1 1
1 1
2 2
2 2
3 3
select sub1.c2 as x, sub2.c2 as y, count(sub2.c2) as z from sub1, sub2 where sub1.c2 = sub2.c2 group by 1, 2 order by 1, 2;
x y z
1 1 2
2 2 2
3 3 1

View File

@ -0,0 +1,126 @@
USE tpch1;
SELECT n_nationkey, n_name as c1 FROM nation group by n_nationkey,
n_name order by substr(n_nationkey,1,2);
n_nationkey c1
0 ALGERIA
1 ARGENTINA
10 IRAN
11 IRAQ
12 JAPAN
13 JORDAN
14 KENYA
15 MOROCCO
16 MOZAMBIQUE
17 PERU
18 CHINA
19 ROMANIA
2 BRAZIL
20 SAUDI ARABIA
21 VIETNAM
22 RUSSIA
23 UNITED KINGDOM
24 UNITED STATES
3 CANADA
4 EGYPT
5 ETHIOPIA
6 FRANCE
7 GERMANY
8 INDIA
9 INDONESIA
SELECT n_nationkey as c0, n_name as c1 FROM nation group by
n_nationkey, n_name order by isnull(n_nationkey), n_nationkey;
c0 c1
0 ALGERIA
1 ARGENTINA
2 BRAZIL
3 CANADA
4 EGYPT
5 ETHIOPIA
6 FRANCE
7 GERMANY
8 INDIA
9 INDONESIA
10 IRAN
11 IRAQ
12 JAPAN
13 JORDAN
14 KENYA
15 MOROCCO
16 MOZAMBIQUE
17 PERU
18 CHINA
19 ROMANIA
20 SAUDI ARABIA
21 VIETNAM
22 RUSSIA
23 UNITED KINGDOM
24 UNITED STATES
SELECT n_nationkey as c0, n_name as c1 FROM nation group by
n_nationkey, n_name order by isnull(n_name), n_name;
c0 c1
0 ALGERIA
1 ARGENTINA
2 BRAZIL
3 CANADA
18 CHINA
4 EGYPT
5 ETHIOPIA
6 FRANCE
7 GERMANY
8 INDIA
9 INDONESIA
10 IRAN
11 IRAQ
12 JAPAN
13 JORDAN
14 KENYA
15 MOROCCO
16 MOZAMBIQUE
17 PERU
19 ROMANIA
22 RUSSIA
20 SAUDI ARABIA
23 UNITED KINGDOM
24 UNITED STATES
21 VIETNAM
SELECT n_nationkey as c0, n_name as c1 FROM nation group by n_nationkey,
n_name order by substr(n_nationkey,1,2);
c0 c1
0 ALGERIA
1 ARGENTINA
10 IRAN
11 IRAQ
12 JAPAN
13 JORDAN
14 KENYA
15 MOROCCO
16 MOZAMBIQUE
17 PERU
18 CHINA
19 ROMANIA
2 BRAZIL
20 SAUDI ARABIA
21 VIETNAM
22 RUSSIA
23 UNITED KINGDOM
24 UNITED STATES
3 CANADA
4 EGYPT
5 ETHIOPIA
6 FRANCE
7 GERMANY
8 INDIA
9 INDONESIA
select cchar8, cvchar6 from datatypetestm order by isnull(cchar8), cchar8;
cchar8 cvchar6
aaaaaaaa aaaaaa
h f
hh ff
hhh fff
hhhh ffff
sssssss uuuuuu
ssssssss uuuuuu
ssssssss uuuuuu
ssssssss uuuuuu
zzzzzzzz zzzzzz
NULL NULL

View File

@ -0,0 +1,89 @@
USE tpch1;
select abs(n_regionkey+n_nationkey), count(*) from nation group by 1 order by 1;
abs(n_regionkey+n_nationkey) count(*)
0 1
2 1
3 1
4 1
5 1
8 1
9 1
10 2
11 1
14 3
15 2
16 1
17 1
18 1
20 1
22 1
23 1
24 1
25 2
26 1
select abs(n_regionkey+n_nationkey) a, count(*) from nation group by a order by 1;
a count(*)
0 1
2 1
3 1
4 1
5 1
8 1
9 1
10 2
11 1
14 3
15 2
16 1
17 1
18 1
20 1
22 1
23 1
24 1
25 2
26 1
select abs(n_regionkey+n_nationkey) a, count(*) from nation group by abs(n_regionkey+n_nationkey) order by 1;
a count(*)
0 1
2 1
3 1
4 1
5 1
8 1
9 1
10 2
11 1
14 3
15 2
16 1
17 1
18 1
20 1
22 1
23 1
24 1
25 2
26 1
select abs(n_regionkey+n_nationkey) a, count(*) from nation group by 1, abs(n_nationkey+n_regionkey) order by 1;
a count(*)
0 1
2 1
3 1
4 1
5 1
8 1
9 1
10 2
11 1
14 3
15 2
16 1
17 1
18 1
20 1
22 1
23 1
24 1
25 2
26 1

View File

@ -0,0 +1,43 @@
USE tpch1;
select n_name from nation where locate('A', n_name, 4) > 0 order by 1;
n_name
ALGERIA
ARGENTINA
CANADA
CHINA
ETHIOPIA
GERMANY
INDIA
INDONESIA
JAPAN
JORDAN
KENYA
MOZAMBIQUE
ROMANIA
RUSSIA
SAUDI ARABIA
UNITED STATES
VIETNAM
select n_name from nation where locate('A', n_name) > 0 order by 1;
n_name
ALGERIA
ARGENTINA
BRAZIL
CANADA
CHINA
ETHIOPIA
FRANCE
GERMANY
INDIA
INDONESIA
IRAN
IRAQ
JAPAN
JORDAN
KENYA
MOZAMBIQUE
ROMANIA
RUSSIA
SAUDI ARABIA
UNITED STATES
VIETNAM

View File

@ -0,0 +1,84 @@
USE tpch1;
set autocommit=0;
select count(*) from nation where n_nationkey * (n_regionkey > 0) = 0;
count(*)
5
select count(*) from nation where n_nationkey * (n_regionkey > 0) = 0;
count(*)
5
select count(*) from nation where n_nationkey * (n_regionkey > 0) = 0;
count(*)
5
select count(*) from nation where n_nationkey * (n_regionkey > 2) = 0;
count(*)
15
select count(*) from nation where n_nationkey * (n_regionkey > 2) = 0;
count(*)
15
select count(*) from nation where n_nationkey * (n_regionkey > 2) = 0;
count(*)
15
update nation set n_regionkey = n_nationkey where n_nationkey * (n_regionkey > 0) = 0;
select count(*) from nation where n_nationkey * (n_regionkey > 0) = 0;
count(*)
1
select * from nation;
n_nationkey n_name n_regionkey n_comment
0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
5 ETHIOPIA 5 ven packages wake quickly. regu
6 FRANCE 3 refully final requests. regular, ironi
7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
10 IRAN 4 efully alongside of the slyly final dependencies.
11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
12 JAPAN 2 ously. final, express gifts cajole a
13 JORDAN 4 ic deposits are blithely about the carefully regular pa
14 KENYA 14 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
15 MOROCCO 15 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
16 MOZAMBIQUE 16 s. ironic, unusual asymptotes wake blithely r
17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
21 VIETNAM 2 hely enticingly express accounts. even, final
22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
rollback;
update nation set n_regionkey = n_nationkey where n_nationkey * (n_regionkey > 2) = 0;
select count(*) from nation where n_nationkey * (n_regionkey > 2) = 0;
count(*)
3
select * from nation;
n_nationkey n_name n_regionkey n_comment
0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
2 BRAZIL 2 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
3 CANADA 3 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
5 ETHIOPIA 5 ven packages wake quickly. regu
6 FRANCE 3 refully final requests. regular, ironi
7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
8 INDIA 8 ss excuses cajole slyly across the packages. deposits print aroun
9 INDONESIA 9 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
10 IRAN 4 efully alongside of the slyly final dependencies.
11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
12 JAPAN 12 ously. final, express gifts cajole a
13 JORDAN 4 ic deposits are blithely about the carefully regular pa
14 KENYA 14 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
15 MOROCCO 15 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
16 MOZAMBIQUE 16 s. ironic, unusual asymptotes wake blithely r
17 PERU 17 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
18 CHINA 18 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
21 VIETNAM 21 hely enticingly express accounts. even, final
22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
24 UNITED STATES 24 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
rollback;

View File

@ -0,0 +1,28 @@
USE tpch1;
select count(*) from orders where o_orderstatus = 'F';
count(*)
729413
select count(*) from orders where o_orderstatus like 'F%';
count(*)
729413
select count(*) from orders where o_orderstatus <> 'F';
count(*)
770587
select count(*) from orders where o_orderstatus not like 'F%';
count(*)
770587
select count(*) from orders where o_orderstatus = 'F' or o_orderstatus = 'O';
count(*)
1461457
select count(*) from orders where o_orderstatus like 'F%' or o_orderstatus like 'O%';
count(*)
1461457
select count(*) from orders where o_orderpriority like '4-NOT SPECIFIED';
count(*)
300254
select count(*) from orders where o_orderpriority = '4-NOT SPECIFIED';
count(*)
300254
select count(*) from orders where o_orderpriority like '4-%';
count(*)
300254

View File

@ -0,0 +1,6 @@
USE tpch1;
drop table if exists foo;
Warnings:
Note 1051 Unknown table 'tpch1.foo'
create table foo (col1 int(11) null default null) engine=columnstore;
drop table foo;

View File

@ -0,0 +1,18 @@
USE tpch1;
select 'q1', sub1.* from sub1 where c1 not in (select c1 from sub2 where sub1.c3 =
sub2.c3) order by 1, 2, 3;
q1 c1 c2 c3 s1 s2 s3
q1 2 2 2 2 2 2
q1 3 3 3 3 3 3
q1 4 1 1 1 1 1
q1 5 99 99 99 99 99
q1 6 NULL NULL NULL NULL NULL
select 'q2', c1,c3,c2 from sub1 where (c1,c3) not in (select c1,c3 from sub2 where sub1.c2 = sub2.c2) order by 1, 2, 3;
q2 c1 c3 c2
q2 2 2 2
q2 3 3 3
q2 4 1 1
q2 5 99 99
q2 6 NULL NULL
select 'q4', c1 from sub1 where c1 not in (select c2 from sub2) order by 1, 2;
q4 c1

View File

@ -0,0 +1,21 @@
USE ssb1;
select distinct(d_sellingseason) from dateinfo where d_sellingseason like 'F%' order by 1;
d_sellingseason
Fall
select distinct(d_sellingseason) from dateinfo where d_sellingseason like 'F%' or d_sellingseason like 'W%' order by 1;
d_sellingseason
Fall
Winter
select distinct(d_sellingseason) from dateinfo where d_sellingseason like '%r' order by 1;
d_sellingseason
Summer
Winter
select distinct(d_sellingseason) from dateinfo where d_sellingseason like '%r' or d_sellingseason like '%r' order by 1;
d_sellingseason
Summer
Winter
select distinct(d_sellingseason) from dateinfo where d_sellingseason like '%r' or d_sellingseason like '%g' order by 1;
d_sellingseason
Spring
Summer
Winter

View File

@ -0,0 +1,12 @@
USE tpch1;
drop table if exists bug2835;
Warnings:
Note 1051 Unknown table 'tpch1.bug2835'
create table bug2835 (c1 int, c2 varchar(6), c3 varchar(20), c4 datetime)engine=columnstore;
insert into bug2835 values (1, 'one', 'one', '2010-01-01'), (2, 'two', 'two', '2010-02-02'), (null, null, null, null);
select c1, c2, c3, ifnull(c1,"z"), ifnull(c2,''), ifnull(c3,''), ifnull(c4,'') from bug2835;
c1 c2 c3 ifnull(c1,"z") ifnull(c2,'') ifnull(c3,'') ifnull(c4,'')
1 one one 1 one one 2010-01-01 00:00:00
2 two two 2 two two 2010-02-02 00:00:00
NULL NULL NULL z
drop table bug2835;

View File

@ -0,0 +1,33 @@
USE ssb1;
select count(*), d1.d_date
from dateinfo as d1
inner join lineorder l1 on l1.lo_orderdate = d1.d_datekey
inner join lineorder l2 on l2.lo_orderkey = l1.lo_orderkey
where l1.lo_orderkey < 10 and l2.lo_orderkey < 10 and
l1.lo_linenumber <= l2.lo_linenumber
group by d1.d_date
order by d1.d_date;
count(*) d_date
1 December 1, 1996
1 February 21, 1992
28 January 10, 1996
21 January 2, 1996
6 July 30, 1994
1 Octorber 11, 1995
21 Octorber 14, 1993
select count(*), d1.d_date
from dateinfo as d1
inner join lineorder l1 on l1.lo_orderdate = d1.d_datekey
inner join lineorder l2 on l2.lo_orderkey = l1.lo_orderkey and
l1.lo_linenumber <= l2.lo_linenumber
where l1.lo_orderkey < 10 and l2.lo_orderkey < 10
group by d1.d_date
order by d1.d_date;
count(*) d_date
1 December 1, 1996
1 February 21, 1992
28 January 10, 1996
21 January 2, 1996
6 July 30, 1994
1 Octorber 11, 1995
21 Octorber 14, 1993

View File

@ -0,0 +1,18 @@
USE tpch1;
drop table if exists bug2845;
Warnings:
Note 1051 Unknown table 'tpch1.bug2845'
create table bug2845(c1 int, c2 varchar(7), c3 varchar(30))engine=columnstore;
insert into bug2845 values (1, 'A\'s', 'Joe\'s');
select * from bug2845;
c1 c2 c3
1 A's Joe's
update bug2845 set c2='Bubba\'s', c3='Uncle Julio\'s';
select * from bug2845;
c1 c2 c3
1 Bubba's Uncle Julio's
delete from bug2845;
select count(*) from bug2845;
count(*)
0
drop table bug2845;

View File

@ -0,0 +1,42 @@
USE tpch1;
drop table if exists bug2873;
Warnings:
Note 1051 Unknown table 'tpch1.bug2873'
create table bug2873(id int, logtime int, filename varchar(20))engine=columnstore;
insert into bug2873 values
(1, unix_timestamp('2010-05-23 10:00:10'), 'Cam1.jpg'),
(1, unix_timestamp('2010-05-23 10:00:12'), 'Cam1.jpg23'),
(1, unix_timestamp('2010-05-23 10:00:15'), 'LLCam1.jpg'),
(1, unix_timestamp('2010-05-23 10:00:18'), 'EECam1.jpg'),
(1, unix_timestamp('2010-05-23 10:00:19'), 'Hey.jpg'),
(1, unix_timestamp('2010-05-23 10:20:30'), 'Cam11.jpg'),
(1, unix_timestamp('2010-05-23 10:22:10'), 'Cam12.jpg'),
(1, unix_timestamp('2010-05-23 10:25:40'), 'ICam1.jpg'),
(1, unix_timestamp('2010-05-23 10:49:12'), 'Cam1.jpg2'),
(1, unix_timestamp('2010-05-23 10:50:10'), 'Cam15.jpg'),
(1, unix_timestamp('2010-05-23 10:51:10'), 'Cam1.jpg');
set @maxi=(select max(logtime) from bug2873);
select if(filename like 'Cam1.jpg',filename ,'no') datei , count(*)
cnt from bug2873 where logtime > @maxi-3600 group by 1 having datei != 'no';
datei cnt
Cam1.jpg 2
select if(filename rlike '^Cam1.jpg$',filename ,'no') datei from bug2873 limit 1;
datei
Cam1.jpg
select if(filename rlike '^Cam1.jpg$',filename ,'no') datei from bug2873;
datei
Cam1.jpg
no
no
no
no
no
no
no
no
no
Cam1.jpg
select if(filename rlike '^Cam1.jpg$',filename ,'no') datei from bug2873 where if(filename rlike '^Cam1.jpg$',filename ,'no')='no' limit 1;
datei
no
drop table bug2873;

View File

@ -0,0 +1,63 @@
USE tpch1;
drop table if exists bug2876;
Warnings:
Note 1051 Unknown table 'tpch1.bug2876'
create table bug2876(c1 int, c2 varchar(117))engine=columnstore;
insert into bug2876 values (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3);
insert into bug2876 values (1, null), (2, null), (3, null), (null, 1), (null, 2), (null, 3), (null, null);
select * from bug2876 where c1 = c2 order by 1, 2;
c1 c2
1 1
2 2
3 3
select * from bug2876 where c1 != c2 order by 1, 2;
c1 c2
1 2
1 3
2 1
2 3
3 1
3 2
select * from bug2876 where c1 < c2 order by 1, 2;
c1 c2
1 2
1 3
2 3
select * from bug2876 where c1 > c2 order by 1, 2;
c1 c2
2 1
3 1
3 2
select * from bug2876 where c1 <= c2 order by 1, 2;
c1 c2
1 1
1 2
1 3
2 2
2 3
3 3
select * from bug2876 where c1 >= c2 order by 1, 2;
c1 c2
1 1
2 1
2 2
3 1
3 2
3 3
delete from bug2876 where c1 = c2;
select * from bug2876 order by 1, 2;
c1 c2
NULL NULL
NULL 1
NULL 2
NULL 3
1 NULL
1 2
1 3
2 NULL
2 1
2 3
3 NULL
3 1
3 2
drop table bug2876;

View File

@ -0,0 +1,13 @@
USE ssb1;
select count(*) from dateinfo where d_datekey in (select d_datekey from dateinfo);
count(*)
2556
select count(*) from dateinfo where d_datekey not in (select d_datekey from dateinfo);
count(*)
0
select count(*) from dateinfo where d_month in (select d_month from dateinfo);
count(*)
2556
select count(*) from dateinfo where d_sellingseason in (select d_sellingseason from dateinfo);
count(*)
2556

View File

@ -0,0 +1,34 @@
USE tpch1;
select cdatetime, year(cdatetime), week(cdatetime) from datatypetestm group by 1, 2, 3 order by 1;
cdatetime year(cdatetime) week(cdatetime)
1997-01-01 00:00:00 1997 0
1997-01-01 00:00:01 1997 0
1997-01-02 00:00:01 1997 0
1997-01-03 00:00:02 1997 0
1997-01-04 00:00:03 1997 0
2009-12-31 23:59:56 2009 52
2009-12-31 23:59:57 2009 52
2009-12-31 23:59:58 2009 52
2009-12-31 23:59:59 2009 52
select cdatetime, week(cdatetime) from datatypetestm group by 1, 2 order by 1;
cdatetime week(cdatetime)
1997-01-01 00:00:00 0
1997-01-01 00:00:01 0
1997-01-02 00:00:01 0
1997-01-03 00:00:02 0
1997-01-04 00:00:03 0
2009-12-31 23:59:56 52
2009-12-31 23:59:57 52
2009-12-31 23:59:58 52
2009-12-31 23:59:59 52
select cdatetime, year(cdatetime) from datatypetestm group by 1, 2 order by 1;
cdatetime year(cdatetime)
1997-01-01 00:00:00 1997
1997-01-01 00:00:01 1997
1997-01-02 00:00:01 1997
1997-01-03 00:00:02 1997
1997-01-04 00:00:03 1997
2009-12-31 23:59:56 2009
2009-12-31 23:59:57 2009
2009-12-31 23:59:58 2009
2009-12-31 23:59:59 2009

View File

@ -0,0 +1,38 @@
USE ssb1;
select lo_shipmode, c_region, sum(lo_extendedprice), count(*) from lineorder join customer on lo_custkey = c_custkey where lo_orderdate between (select d_start from ( select d_yearmonthnum * 100 + 1 d_start , count(*) from dateinfo where d_weekdayfl = 1 and d_year = 1998 group by 1 order by 2 desc limit 1) alias1) and (select d_end from ( select d_yearmonthnum * 100 + 31 d_end , count(*) from dateinfo where d_weekdayfl = 1 and d_year = 1998 group by 1 order by 2 desc limit 1) alias2) group by 1,2 order by 1,2;
lo_shipmode c_region sum(lo_extendedprice) count(*)
AIR AFRICA 8291782410.00 2170
AIR AMERICA 8436416712.00 2214
AIR ASIA 8586449147.00 2237
AIR EUROPE 8453917173.00 2198
AIR MIDDLE EAST 8374048202.00 2175
FOB AFRICA 8222451296.00 2151
FOB AMERICA 8795070316.00 2262
FOB ASIA 8721414039.00 2259
FOB EUROPE 8581506525.00 2249
FOB MIDDLE EAST 8975397130.00 2318
MAIL AFRICA 8318241157.00 2199
MAIL AMERICA 8230593182.00 2103
MAIL ASIA 8754808681.00 2267
MAIL EUROPE 8051255917.00 2116
MAIL MIDDLE EAST 8604590488.00 2242
RAIL AFRICA 8959535402.00 2319
RAIL AMERICA 8654124417.00 2264
RAIL ASIA 8792793574.00 2282
RAIL EUROPE 8186982361.00 2189
RAIL MIDDLE EAST 8149675405.00 2145
REG AIR AFRICA 8199132520.00 2141
REG AIR AMERICA 8351964483.00 2176
REG AIR ASIA 8541147824.00 2291
REG AIR EUROPE 8603274423.00 2302
REG AIR MIDDLE EAST 8016893567.00 2122
SHIP AFRICA 8412953175.00 2253
SHIP AMERICA 8208649535.00 2160
SHIP ASIA 8746116053.00 2253
SHIP EUROPE 8483100040.00 2242
SHIP MIDDLE EAST 8687217441.00 2256
TRUCK AFRICA 8613962857.00 2253
TRUCK AMERICA 8635423089.00 2203
TRUCK ASIA 8204740240.00 2127
TRUCK EUROPE 8281322322.00 2198
TRUCK MIDDLE EAST 8502459194.00 2252

View File

@ -0,0 +1,87 @@
USE ssb1;
select customer.* from lineorder join customer on lo_custkey = c_custkey where lo_orderdate between
19970101 and 19971230 and lo_custkey = ( select lo_custkey from (select lo_custkey,
sum(lo_extendedprice) from lineorder where lo_orderdate between 19971201 and 19971230 group by 1 order by 2 desc
limit 1 ) a );
c_custkey c_name c_address c_city c_nation c_region c_phone c_mktsegment
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE
7603 Customer#000007603 ElvVqwXJWQ9BjAphY7YjBCHP UNITED ST1 UNITED STATES AMERICA 34-923-452-1398 FURNITURE

View File

@ -0,0 +1,4 @@
USE tpch1;
select count(*)%25 from nation;
count(*)%25
0

View File

@ -0,0 +1,7 @@
USE tpch1;
select if(count(r_regionkey)/15000=round(count(r_regionkey)*15000),"good","bad") alias from region;
alias
bad
select if(count(o_orderkey)/15000=round(count(o_orderkey)*15000/15000/15000),"good","bad") alias2 from orders;
alias2
good

View File

@ -0,0 +1,49 @@
USE tpch1;
drop table if exists tbl1;
Warnings:
Note 1051 Unknown table 'tpch1.tbl1'
drop table if exists tbl2;
Warnings:
Note 1051 Unknown table 'tpch1.tbl2'
create table tbl1 (c1 char(1), c2 char(255))engine=columnstore;
create table tbl2 (c1 char(1), c2 char(255))engine=columnstore;
insert into tbl1 values (1, 1), (2, 2), (3, 3), (4, 4), (null, null);
insert into tbl2 values (1, 1), (2, 2), (3, 3), (null, null);
select count(*) from tbl1 join tbl2 on tbl1.c1 = tbl2.c1;
count(*)
3
select count(*) from tbl1 join tbl2 on tbl1.c1 = tbl2.c2;
count(*)
3
select count(*) from tbl1 join tbl2 on tbl1.c2 = tbl2.c1;
count(*)
3
select count(*) from tbl1 join tbl2 on tbl1.c2 = tbl2.c2;
count(*)
3
select count(*) from tbl1 left join tbl2 on tbl1.c1 = tbl2.c1;
count(*)
5
select count(*) from tbl1 left join tbl2 on tbl1.c1 = tbl2.c2;
count(*)
5
select count(*) from tbl1 left join tbl2 on tbl1.c2 = tbl2.c1;
count(*)
5
select count(*) from tbl1 left join tbl2 on tbl1.c2 = tbl2.c2;
count(*)
5
select count(*) from tbl1 right join tbl2 on tbl1.c1 = tbl2.c1;
count(*)
4
select count(*) from tbl1 right join tbl2 on tbl1.c1 = tbl2.c2;
count(*)
4
select count(*) from tbl1 right join tbl2 on tbl1.c2 = tbl2.c1;
count(*)
4
select count(*) from tbl1 right join tbl2 on tbl1.c2 = tbl2.c2;
count(*)
4
drop table tbl1;
drop table tbl2;

View File

@ -0,0 +1,4 @@
USE tpch1;
select col1%75000 from (select count(r_regionkey) col1 from region) xxx;
col1%75000
5

View File

@ -0,0 +1,99 @@
USE ssb1;
select c_name, d_month, sum(lo_extendedprice), min(lo_orderdate), max(lo_orderdate) from lineorder join customer on lo_custkey = c_custkey join dateinfo on lo_orderdate = d_datekey where lo_orderdate between 19970101 and 19971230 and lo_custkey in ( select lo_custkey from (select lo_custkey, sum(lo_extendedprice) from lineorder where lo_orderdate between 19971201 and 19971230 group by 1 order by 2 desc limit 10 ) a ) group by 1,2 order by 1,2;
c_name d_month sum(lo_extendedprice) min(lo_orderdate) max(lo_orderdate)
Customer#000004069 April 21125678.00 19970419 19970419
Customer#000004069 Augest 20575825.00 19970827 19970827
Customer#000004069 December 113152144.00 19971204 19971218
Customer#000004069 February 8978034.00 19970221 19970221
Customer#000004069 January 11268406.00 19970111 19970125
Customer#000004069 July 7124434.00 19970716 19970716
Customer#000004069 June 19457631.00 19970612 19970612
Customer#000004069 March 9009729.00 19970303 19970303
Customer#000004069 May 70678616.00 19970509 19970519
Customer#000004069 November 38789361.00 19971105 19971113
Customer#000004069 Octorber 29258802.00 19971016 19971027
Customer#000004069 September 14125002.00 19970904 19970916
Customer#000005044 April 11564240.00 19970414 19970422
Customer#000005044 Augest 45510875.00 19970811 19970820
Customer#000005044 December 125177116.00 19971213 19971224
Customer#000005044 February 6175292.00 19970226 19970226
Customer#000005044 January 3621912.00 19970119 19970119
Customer#000005044 July 38067273.00 19970702 19970728
Customer#000005044 June 23521471.00 19970602 19970620
Customer#000005044 May 64822910.00 19970513 19970530
Customer#000005044 November 26601914.00 19971123 19971124
Customer#000005044 Octorber 22654964.00 19971014 19971031
Customer#000005044 September 40649108.00 19970923 19970923
Customer#000007603 April 44936847.00 19970410 19970422
Customer#000007603 December 140826821.00 19971203 19971229
Customer#000007603 February 6756338.00 19970224 19970224
Customer#000007603 January 13228025.00 19970102 19970102
Customer#000007603 July 26643005.00 19970705 19970721
Customer#000007603 June 24788678.00 19970619 19970624
Customer#000007603 March 14743022.00 19970330 19970330
Customer#000007603 May 7965026.00 19970529 19970529
Customer#000007603 Octorber 18343528.00 19971024 19971024
Customer#000007603 September 4957153.00 19970905 19970923
Customer#000010774 Augest 24107364.00 19970805 19970816
Customer#000010774 December 122948511.00 19971204 19971211
Customer#000010774 February 30707702.00 19970215 19970222
Customer#000010774 January 5452488.00 19970113 19970113
Customer#000010774 July 5722713.00 19970716 19970716
Customer#000010774 June 55198666.00 19970606 19970614
Customer#000010774 March 71491559.00 19970311 19970328
Customer#000010774 November 69058986.00 19971109 19971126
Customer#000010774 Octorber 41452044.00 19971020 19971026
Customer#000010774 September 25036440.00 19970930 19970930
Customer#000011731 April 21010770.00 19970405 19970405
Customer#000011731 Augest 45281533.00 19970809 19970830
Customer#000011731 December 139417016.00 19971205 19971220
Customer#000011731 February 22985450.00 19970207 19970211
Customer#000011731 January 50528512.00 19970117 19970131
Customer#000011731 July 10747859.00 19970709 19970709
Customer#000011731 June 6292314.00 19970616 19970616
Customer#000011731 March 20465224.00 19970305 19970305
Customer#000011731 September 8316196.00 19970902 19970908
Customer#000013396 April 18029353.00 19970412 19970425
Customer#000013396 December 116662602.00 19971205 19971228
Customer#000013396 February 25785304.00 19970225 19970225
Customer#000013396 January 17883861.00 19970121 19970127
Customer#000013396 July 20154854.00 19970704 19970704
Customer#000013396 May 30013896.00 19970501 19970521
Customer#000013396 Octorber 62557053.00 19971009 19971031
Customer#000013396 September 24508449.00 19970906 19970906
Customer#000015715 April 16488864.00 19970414 19970414
Customer#000015715 December 130063207.00 19971201 19971225
Customer#000015715 July 3843624.00 19970720 19970720
Customer#000015715 June 32091988.00 19970618 19970624
Customer#000015715 March 19359787.00 19970308 19970308
Customer#000015715 May 52332370.00 19970512 19970526
Customer#000015715 November 45275020.00 19971115 19971130
Customer#000015715 September 44116849.00 19970906 19970929
Customer#000018211 April 35495129.00 19970425 19970425
Customer#000018211 December 114244135.00 19971210 19971228
Customer#000018211 February 15447237.00 19970220 19970220
Customer#000018211 July 23683773.00 19970727 19970727
Customer#000018211 June 978426.00 19970606 19970606
Customer#000018211 March 1171624.00 19970319 19970319
Customer#000018211 May 32311651.00 19970506 19970518
Customer#000018211 September 264848.00 19970927 19970927
Customer#000019123 April 9166502.00 19970420 19970420
Customer#000019123 December 119723270.00 19971201 19971230
Customer#000019123 February 32932048.00 19970212 19970214
Customer#000019123 January 34771024.00 19970121 19970126
Customer#000019123 July 35836420.00 19970705 19970720
Customer#000019123 March 55962971.00 19970311 19970314
Customer#000019123 May 19076319.00 19970518 19970524
Customer#000019123 November 30034974.00 19971112 19971112
Customer#000019123 Octorber 33170059.00 19971013 19971013
Customer#000019123 September 18950129.00 19970910 19970919
Customer#000028558 April 20820127.00 19970405 19970411
Customer#000028558 Augest 4305224.00 19970815 19970815
Customer#000028558 December 113138659.00 19971208 19971228
Customer#000028558 March 33782060.00 19970330 19970330
Customer#000028558 November 3686042.00 19971126 19971126
Customer#000028558 Octorber 34536253.00 19971011 19971011
Customer#000028558 September 26372157.00 19970907 19970909
select count(*) from lineorder where lo_orderdate between 19970101 and 19970105 and lo_custkey not in ( select lo_custkey from (select lo_custkey from lineorder where lo_orderdate between 19971201 and 19971201 ) a );
count(*)
11926

View File

@ -0,0 +1,4 @@
USE ssb1;
select count(*) from lineorder alias1 join customer on lo_custkey = c_custkey where lo_orderdate between 19970101 and 19971230 and exists ( select 'x' from (select lo_custkey, sum(lo_extendedprice) from lineorder where lo_orderdate between 19971201 and 19971230 group by 1 order by 2 desc limit 100 ) a where a.lo_custkey = alias1.lo_orderkey );
count(*)
8

View File

@ -0,0 +1,4 @@
USE tpch1;
select count(1+1) from nation;
count(1+1)
25

View File

@ -0,0 +1,10 @@
USE tpch1;
select count(*) from region a inner join nation b on (a.r_regionkey=b.n_regionkey) right outer join customer c on (b.n_name and b.n_nationkey = c.c_nationkey);
count(*)
150000
select * from region where r_regionkey;
r_regionkey r_name r_comment
1 AMERICA hs use ironic, even requests. s
2 ASIA ges. thinly even pinto beans ca
3 EUROPE ly final courts cajole furiously final excuse
4 MIDDLE EAST uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl

View File

@ -0,0 +1,185 @@
USE tpch1;
select t.CCHAR1 from datatypetestm t, (select CCHAR1 from datatypetestm1) t1 where t.CCHAR1 = t1.CCHAR1 order by 1;
CCHAR1
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
select t.CCHAR9 from datatypetestm t, (select CCHAR9 from datatypetestm1) t1 where t.CCHAR9 = t1.CCHAR9 order by 1;
CCHAR9
aaaaaaaaa
aaaaaaaaa
i
i
ii
ii
iii
iii
iiii
iiii
rrrrrrr
rrrrrrr
rrrrrrrr
rrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
rrrrrrrrr
zzzzzzzzz
zzzzzzzzz
select t.CCHAR1 from datatypetestm t, (select CCHAR9 from datatypetestm1) t1 where t.CCHAR1 = t1.CCHAR9 order by 1;
CCHAR1
select t1.CCHAR1 from datatypetestm t1, (select t2.CCHAR1 from datatypetestm t2) t3 where t1.CCHAR1 = t3.CCHAR1 order by 1;
CCHAR1
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
select t1.CCHAR1 from datatypetestm t1, (select t2.CCHAR9 from datatypetestm t2) t3 where t1.CCHAR1 = t3.CCHAR9 order by 1;
CCHAR1

View File

@ -0,0 +1,14 @@
USE tpch1;
select cidx, abs(ROUND(COT(cidx),2)) from datatypetestm order by 1;
cidx abs(ROUND(COT(cidx),2))
1 0.64
2 0.46
3 7.02
4 0.86
5 0.30
6 3.44
7 1.15
8 0.15
9 2.21
10 1.54
11 0.00

View File

@ -0,0 +1,97 @@
USE tpch1;
/* From bug 2961 description. */
select top_part.n_nationkey top, minus_part.n_nationkey minus from (select n_nationkey from nation)
top_part left outer join (select n_nationkey from nation) minus_part on ( top_part.n_nationkey = minus_part.n_nationkey ) order by 1, 2;
top minus
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
select top_part.n_nationkey top, minus_part.n_nationkey minus from (select n_nationkey from nation) top_part left outer join
(select n_nationkey from nation where n_nationkey < 5) minus_part on (top_part.n_nationkey = minus_part.n_nationkey ) order by 1, 2;
top minus
0 0
1 1
2 2
3 3
4 4
5 NULL
6 NULL
7 NULL
8 NULL
9 NULL
10 NULL
11 NULL
12 NULL
13 NULL
14 NULL
15 NULL
16 NULL
17 NULL
18 NULL
19 NULL
20 NULL
21 NULL
22 NULL
23 NULL
24 NULL
/* Comment 1 */
select sub1.c1 x, sub2.c1 y from sub1 left join sub2 on sub1.c1 = sub2.c1 order by 1, 2;
x y
1 1
1 1
1 1
2 2
2 2
2 2
3 NULL
4 NULL
5 NULL
6 6
select sub1.c1, x.c1 from sub1 left join (select c1 from sub2) x on sub1.c1 = x.c1 order by 1, 2;
c1 c1
1 1
1 1
1 1
2 2
2 2
2 2
3 NULL
4 NULL
5 NULL
6 6
/* Comment 3 */
select sub1.c1, x.c1 from sub1 join (select sub1.c1 as sub1_c1, sub2.c1 from sub1 left join sub2 on
sub1.c1 = sub2.c1) x on sub1.c1 = x.sub1_c1 order by 1, 2;
c1 c1
1 1
1 1
1 1
2 2
2 2
2 2
3 NULL
4 NULL
5 NULL
6 6

View File

@ -0,0 +1,197 @@
USE tpch1;
/*
* Bug 2976. Lost connection with from clause subselect against MyISAM tables in an InfiniDB instance.
*/
drop table if exists a;
Warnings:
Note 1051 Unknown table 'tpch1.a'
drop table if exists b;
Warnings:
Note 1051 Unknown table 'tpch1.b'
create table a (c1 int)engine=myisam;
create table b (c2 int)engine=myisam;
insert into a values (1), (2);
insert into b values (1), (2);
select * from a, (select * from b) x;
c1 c2
1 1
2 1
1 2
2 2
drop table a;
drop table b;
/*
* Skinit example.
*/
drop table if exists shipamounts;
Warnings:
Note 1051 Unknown table 'tpch1.shipamounts'
drop table if exists ship1;
Warnings:
Note 1051 Unknown table 'tpch1.ship1'
drop table if exists ship2;
Warnings:
Note 1051 Unknown table 'tpch1.ship2'
CREATE TABLE `shipamounts` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) ENGINE=myisam DEFAULT CHARSET=latin1;
CREATE TABLE `ship1` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) ENGINE=myisam DEFAULT CHARSET=latin1;
CREATE TABLE `ship2` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) ENGINE=myisam DEFAULT CHARSET=latin1;
insert into shipamounts values (2357203684, 352338, 0, 0, 0, 0);
insert into ship1 values (2357203684, 352338, 0, 0, 0, 0);
insert into ship2 values (2357203684, 352338, 0, 0, 0, 0);
SELECT s.OrderNum, s.OrderLine, s.ShippingAmount, s.ShippingOrderAmount,
total.ShippingTotalAmount, s.ShippingDiscountAmount,
s.ShippingDiscountOrderAmount,
total.ShippingDiscountTotalAmount,
IF( s.OrderLine = t.MinOrderLine, 1, 0 )
FROM shipAmounts AS s
LEFT OUTER JOIN (
SELECT OrderNum, MIN(OrderLine) AS MinOrderLine
FROM ship1
GROUP BY OrderNum
) AS t ON s.OrderNum = t.OrderNum
LEFT OUTER JOIN (
SELECT OrderNum, SUM(ShippingAmount) AS ShippingTotalAmount,
SUM(ShippingDiscountAmount) AS ShippingDiscountTotalAmount
FROM ship2 GROUP BY OrderNum
) AS total ON s.OrderNum = total.OrderNum;
OrderNum OrderLine ShippingAmount ShippingOrderAmount ShippingTotalAmount ShippingDiscountAmount ShippingDiscountOrderAmount ShippingDiscountTotalAmount IF( s.OrderLine = t.MinOrderLine, 1, 0 )
2357203684 352338 0.00 0.00 0.00 0.00 0.00 0.00 1
SELECT s.OrderNum, s.OrderLine, s.ShippingAmount, s.ShippingOrderAmount,
total.ShippingTotalAmount, s.ShippingDiscountAmount,
s.ShippingDiscountOrderAmount,
total.ShippingDiscountTotalAmount,
IF( s.OrderLine = t.MinOrderLine, 1, 0 )
FROM shipAmounts AS s
JOIN (
SELECT sa.OrderNum, MIN(ship1.OrderLine) AS MinOrderLine
FROM shipAmounts sa left join ship1
on (sa.OrderNum = ship1.OrderNum)
GROUP BY OrderNum
) AS t ON s.OrderNum = t.OrderNum
LEFT OUTER JOIN (
SELECT OrderNum, SUM(ShippingAmount) AS ShippingTotalAmount,
SUM(ShippingDiscountAmount) AS ShippingDiscountTotalAmount
FROM ship2 GROUP BY OrderNum
) AS total ON s.OrderNum = total.OrderNum;
OrderNum OrderLine ShippingAmount ShippingOrderAmount ShippingTotalAmount ShippingDiscountAmount ShippingDiscountOrderAmount ShippingDiscountTotalAmount IF( s.OrderLine = t.MinOrderLine, 1, 0 )
2357203684 352338 0.00 0.00 0.00 0.00 0.00 0.00 1
drop table if exists shipamounts;
drop table if exists ship1;
drop table if exists ship2;
/*
* Lurn India example.
*/
drop table if exists users;
Warnings:
Note 1051 Unknown table 'tpch1.users'
drop table if exists user_login_log;
Warnings:
Note 1051 Unknown table 'tpch1.user_login_log'
drop table if exists user_groups;
Warnings:
Note 1051 Unknown table 'tpch1.user_groups'
drop table if exists user_types;
Warnings:
Note 1051 Unknown table 'tpch1.user_types'
drop table if exists system;
Warnings:
Note 1051 Unknown table 'tpch1.system'
drop table if exists user_system;
Warnings:
Note 1051 Unknown table 'tpch1.user_system'
create table users(
id int,
users_id int,
fullname varchar(40),
email varchar(40),
countries_name varchar(40),
state_name varchar(7),
tel_no varchar(12),
affiliate_id varchar(30),
created datetime,
milestone varchar(20),
tel_no2 varchar(12),
class int,
status varchar(20)
)engine=myisam;
create table user_login_log
(
user_id int,
dw_system_id int,
login_time datetime
)engine=myisam;
create table user_groups
(
user_id int,
status varchar(7),
start_date date,
end_date date,
user_type_id int
)engine=myisam;
create table user_types
(
id int,
user_type_id int,
name varchar(20)
)engine=myisam;
create table user_system
(
user_id int,
system_id int
)engine=myisam;
create table system
(
id int,
dw_system_id int
)engine=myisam;
SELECT u.users_id as user_id, u.fullname as fullname, u.email as email, u.countries_name as country, u.state_name as state, COALESCE(tel_no, tel_no2, 'No Number') as contact,
IFNULL((SELECT users.fullname FROM users WHERE users.id = affiliate_id), 'No Affiliate') as affiliate_name,
IFNULL((SELECT users.email FROM users WHERE users.id = affiliate_id), 'No Affiliate') as affiliate_email,
DATE_FORMAT( ug.start_date, '%W %D, %M %Y' ) as start_date, DATE_FORMAT( ug.end_date, '%W %D, %M %Y' ) as end_date, ug.status AS status , ug.name AS product, DATE_FORMAT( u.created, '%W %D, %M %Y' ) as created,
(SELECT DATE_FORMAT( max(ull.login_time), '%W %D, %M %Y' ) FROM user_login_log as ull WHERE ull.user_id = ug.user_id AND ull.dw_system_id = (SELECT dw_system_id from system where id = 6) AND ull.login_time BETWEEN '2010-06-01' AND '2010-06-30') as 'Last Log In',
(SELECT count(id) FROM user_login_log as ull WHERE ull.user_id = ug.user_id AND ull.dw_system_id = (SELECT dw_system_id from system where id = 6) AND ull.login_time BETWEEN '2010-06-01' AND '2010-06-30') as login_count,
u.milestone as milestone_level,
u.class as class_level
FROM users u, (
SELECT user_id, user_groups.user_type_id, start_date, end_date, user_groups.status, user_types.name
FROM user_groups, user_types
WHERE user_types.user_type_id IN (54)
AND user_groups.user_type_id = user_types.id
AND user_groups.status IN ('active')
GROUP BY user_id
ORDER BY user_type_id DESC ) ug, user_system as us
WHERE ug.user_id = u.id
AND u.id = us.user_id
AND us.system_id IN (6)
AND u.status IN ('active')
AND ug.start_date BETWEEN '2010-06-01' AND '2010-06-30'
ORDER BY DATE(ug.start_date) DESC, u.users_id DESC;
user_id fullname email country state contact affiliate_name affiliate_email start_date end_date status product created Last Log In login_count milestone_level class_level
NULL NULL NULL NULL NULL No Number No Affiliate No Affiliate NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table if exists users;
drop table if exists user_login_log;
drop table if exists user_groups;
drop table if exists user_types;
drop table if exists system;
drop table if exists user_system;

View File

@ -0,0 +1,17 @@
USE tpch1;
select cidx, cbigint, avg(cbigint) from datatypetestm group by cidx, cbigint order by 1;
cidx cbigint avg(cbigint)
1 -72036854775806 -72036854775806.0000
2 -72036854775805 -72036854775805.0000
3 -72036854775804 -72036854775804.0000
4 -72036854775803 -72036854775803.0000
5 -72036854775802 -72036854775802.0000
6 72036854775803 72036854775803.0000
7 72036854775804 72036854775804.0000
8 72036854775805 72036854775805.0000
9 72036854775806 72036854775806.0000
10 72036854775807 72036854775807.0000
11 0 0.0000
select avg(cbigint) from datatypetestm where cidx=1;
avg(cbigint)
-72036854775806.0000

View File

@ -0,0 +1,35 @@
USE tpch1;
select * from (select l_orderkey from lineitem where l_orderkey <= 10) x order by 1;
l_orderkey
1
1
1
1
1
1
2
3
3
3
3
3
3
4
5
5
5
6
7
7
7
7
7
7
7
select * from region;
r_regionkey r_name r_comment
0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
1 AMERICA hs use ironic, even requests. s
2 ASIA ges. thinly even pinto beans ca
3 EUROPE ly final courts cajole furiously final excuse
4 MIDDLE EAST uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl

View File

@ -0,0 +1,35 @@
USE tpch1;
SELECT
`LOGICAL_TABLE_1`.`p_name` AS `COL0`,
`LOGICAL_TABLE_1`.`p_size` AS `COL1`
FROM
(select * from part where p_partkey < 20 limit 10) `LOGICAL_TABLE_1`
ORDER BY `COL0`, `COL1`;
COL0 COL1
bisque cornflower lawn forest magenta 4
blush thistle blue yellow saddle 1
cornflower chocolate smoke green pink 14
forest brown coral puff cream 15
goldenrod lavender spring chocolate lace 7
linen pink saddle puff powder 44
misty lace thistle snow royal 41
moccasin green thistle khaki floral 45
spring green yellow purple cornsilk 21
thistle dim navajo dark gainsboro 12
SELECT
`LOGICAL_TABLE_1`.`p_name` AS `COL0`,
`LOGICAL_TABLE_1`.`p_size` AS `COL1`
FROM
(select * from part where p_partkey < 20 limit 10) `LOGICAL_TABLE_1`
ORDER BY COL0, COL1;
COL0 COL1
bisque cornflower lawn forest magenta 4
blush thistle blue yellow saddle 1
cornflower chocolate smoke green pink 14
forest brown coral puff cream 15
goldenrod lavender spring chocolate lace 7
linen pink saddle puff powder 44
misty lace thistle snow royal 41
moccasin green thistle khaki floral 45
spring green yellow purple cornsilk 21
thistle dim navajo dark gainsboro 12

View File

@ -0,0 +1,15 @@
USE tpch1;
create database if not exists bug3007;
drop table if exists bug3007.bug;
Warnings:
Note 1051 Unknown table 'bug3007.bug'
create table bug3007.bug(c1 int)engine=columnstore;
insert into bug3007.bug values (1), (2);
select * from bug3007.bug;
c1
1
2
update bug3007.bug set c1=99;
delete from bug3007.bug;
drop table if exists bug3007.bug;
drop database if exists bug3007;

View File

@ -0,0 +1,27 @@
USE tpch1;
drop table if exists bug3012;
Warnings:
Note 1051 Unknown table 'tpch1.bug3012'
create table bug3012 (anz int, mx varchar(20)) engine=columnstore;
insert into bug3012 values (1,'hotmail.com'), (2,'hotmail.com'), (3,'foo.com'),
(4,'www.1and1.net'), (5,'1and1.com');
select * from bug3012;
anz mx
1 hotmail.com
2 hotmail.com
3 foo.com
4 www.1and1.net
5 1and1.com
SELECT * FROM bug3012 WHERE (mx RLIKE 'hotmail' OR mx RLIKE '1and1');
anz mx
1 hotmail.com
2 hotmail.com
4 www.1and1.net
5 1and1.com
SELECT * FROM bug3012 WHERE (mx RLIKE '1and1' OR mx RLIKE 'hotmail');
anz mx
1 hotmail.com
2 hotmail.com
4 www.1and1.net
5 1and1.com
drop table if exists bug3012;

View File

@ -0,0 +1,66 @@
USE ssb1;
select lo_supplycost
from lineorder
where lo_partkey < 3400 and lo_suppkey < 90 and lo_discount/lo_tax < 1.4 and
lo_supplycost in
(select col1
from ( select lo_supplycost col1, count(*) cnt
from lineorder
where lo_partkey < 3400 and lo_suppkey < 90 and lo_discount/lo_tax < 1.4
group by 1
having cnt > 2
order by cnt desc limit 100) a)
order by 1;
lo_supplycost
60786.00
60786.00
60786.00
63489.00
63489.00
63489.00
63969.00
63969.00
63969.00
64750.00
64750.00
64750.00
75741.00
75741.00
75741.00
81627.00
81627.00
81627.00
86011.00
86011.00
86011.00
88113.00
88113.00
88113.00
91116.00
91116.00
91116.00
94780.00
94780.00
94780.00
101086.00
101086.00
101086.00
102948.00
102948.00
102948.00
103489.00
103489.00
103489.00
106131.00
106131.00
106131.00
107032.00
107032.00
107032.00
113338.00
113338.00
113338.00
select count(*) from dateinfo where d_datekey in ( select d_datekey from
(select d_datekey from dateinfo group by 1 order by count(*) desc limit 10) a);
count(*)
10

View File

@ -0,0 +1,19 @@
USE tpch1;
select date('2010-02-01') into @xxx;
select @xxx;
@xxx
2010-02-01
drop table if exists bug3021;
Warnings:
Note 1051 Unknown table 'tpch1.bug3021'
create table bug3021(c1 date)engine=columnstore;
insert into bug3021 values ('2001-01-01');
update bug3021 set c1=@xxx;
select * from bug3021;
c1
2010-02-01
update bug3021 set c1=date('2010-11-14');
select * from bug3021;
c1
2010-11-14
drop table bug3021;

View File

@ -0,0 +1,17 @@
USE tpch1;
select * from nation where n_nationkey=@value;
n_nationkey n_name n_regionkey n_comment
set @value=5;
select * from nation where n_nationkey=@value;
n_nationkey n_name n_regionkey n_comment
5 ETHIOPIA 0 ven packages wake quickly. regu
create table if not exists bug3024 (c1 int) engine=columnstore;
insert into bug3024 values (1), (2);
update bug3024 set c1=3 where c1=@value;
set @value=2;
update bug3024 set c1=3 where c1=@value;
select * from bug3024;
c1
1
3
drop table if exists bug3024;

View File

@ -0,0 +1,66 @@
USE tpch1;
drop table if exists bug3025;
Warnings:
Note 1051 Unknown table 'tpch1.bug3025'
create table bug3025(value integer(5)) engine=Columnstore;
insert into bug3025 values (1), (1001), (24), (2123), (null), (123), (888), (8421), (231), (-100), (null);
select value, IF(value<=1000,'<=1000', '>1000')
from bug3025
group by value, IF(value<=1000,'<=1000', '>1000')
order by ISNULL(IF(value<=1000,'<=1000', '>1000')), value;
value IF(value<=1000,'<=1000', '>1000')
NULL >1000
-100 <=1000
1 <=1000
24 <=1000
123 <=1000
231 <=1000
888 <=1000
1001 >1000
2123 >1000
8421 >1000
select IF(value<=1000,'<=1000', '>1000')
from bug3025
group by IF(value<=1000,'<=1000', '>1000'), value
order by ISNULL(IF(value<=1000,'<=1000', '>1000')), value;
IF(value<=1000,'<=1000', '>1000')
>1000
<=1000
<=1000
<=1000
<=1000
<=1000
<=1000
>1000
>1000
>1000
select IF(value<=1000,'<=1000', '>1000') from bug3025 group by
IF(value<=1000,'<=1000', '>1000') order by IF(value<=1000,'<=1000', '>1000');
IF(value<=1000,'<=1000', '>1000')
<=1000
>1000
select IF(value<=1000,'<=1000', '>1000') a, isnull(IF(value<=1000,'<=1000',
'>1000')) b from bug3025 group by 1,2 order by 2,1;
a b
<=1000 0
>1000 0
select * from (select count(*) cnt , if((if(not isnull(value),"notNull","null")
like 'null'),null,if(value<1000,"<1000",">=1000")) a from bug3025 group by a, value
order by not isnull(a),2 asc) b
order by 1, 2;
cnt a
1 <1000
1 <1000
1 <1000
1 <1000
1 <1000
1 <1000
1 >=1000
1 >=1000
1 >=1000
2 NULL
select IF(value<=1000,'<=1000', '>1000') a, isnull(IF(value<=1000,'<=1000', '>1000')) b from bug3025 group by 1,2 order by 2,1;
a b
<=1000 0
>1000 0
drop table if exists bug3025;

View File

@ -0,0 +1,28 @@
USE tpch1;
drop table if exists bug3051;
Warnings:
Note 1051 Unknown table 'tpch1.bug3051'
CREATE TABLE `bug3051` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(17) DEFAULT NULL,
`c3` tinyint(3) DEFAULT NULL,
`c4` varchar(20) DEFAULT NULL,
`c5` varchar(20) DEFAULT NULL,
`c6` varchar(15) DEFAULT NULL,
`c7` datetime DEFAULT NULL,
`c8` int(11) DEFAULT NULL,
`c9` varchar(50) DEFAULT NULL,
`c10` varchar(20) DEFAULT NULL,
`c11` varchar(255) DEFAULT NULL,
`c12` varchar(4096) DEFAULT NULL,
`c14` int(11) DEFAULT NULL
) engine=columnstore DEFAULT CHARSET=latin1;
insert into bug3051 values (1,1,1,1,1,1,now(),1,1,1,1,1,1);
insert into bug3051 values (2,2,2,2,2,2,now(),2,2,2,2,2,2);
alter table bug3051 drop column c7;
alter table bug3051 add column c7 datetime;
select count(*) from bug3051;
count(*)
2
update bug3051 set c7=now();
drop table bug3051;

View File

@ -0,0 +1,51 @@
USE tpch1;
select count(*) from nation where n_nationkey in (select n_nationkey from (select n_nationkey from nation group by n_nationkey ) a);
count(*)
25
select count(*) from nation where n_nationkey in (select n_nationkey from (select count(*) c3, n_nationkey from nation group by n_nationkey ) a);
count(*)
25
select count(*) from nation where n_nationkey in (select n_nationkey from (select n_nationkey, count(*) from nation group by n_nationkey ) a);
count(*)
25
select n_nationkey from (select count(*) c3, n_nationkey from nation group by 2) a order by 1;
n_nationkey
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
select n_nationkey, n_name from nation where n_nationkey in (select r_regionkey from (select count(*), r_regionkey from region group by 2) a) order by 1;
n_nationkey n_name
0 ALGERIA
1 ARGENTINA
2 BRAZIL
3 CANADA
4 EGYPT
select n_nationkey, n_name from nation where n_nationkey in (select r_regionkey from (select r_regionkey, count(*) from region group by 1) a) order by 1;
n_nationkey n_name
0 ALGERIA
1 ARGENTINA
2 BRAZIL
3 CANADA
4 EGYPT

View File

@ -0,0 +1,48 @@
USE ssb1;
select * from (
select F, count(*) from (select count(*) F from lineorder where
lo_orderdate between 19940101 and 19940110 and lo_quantity <= 20
group
by lo_quantity ) a group by F union all
select F, count(*) from (select count(*) F from lineorder where
lo_orderdate between 19940101 and 19940110 and lo_quantity between 21 and 40
group
by lo_quantity ) a group by F) a
order by 1, 2;
F count(*)
464 1
475 1
475 1
477 1
481 1
483 1
484 1
485 1
488 1
495 1
499 1
500 1
502 1
504 1
507 1
508 2
510 1
512 1
512 1
513 1
514 1
515 2
518 1
519 2
521 1
524 1
527 1
529 1
532 1
534 1
537 1
538 1
541 2
542 1
552 1
566 1

View File

@ -0,0 +1,36 @@
USE tpch1;
select count(*), o_orderstatus from orders group by o_orderstatus order by count(*) desc, 2;
count(*) o_orderstatus
732044 O
729413 F
38543 P
select count(*), o_orderstatus from orders group by o_orderstatus order by 1 desc, 2;
count(*) o_orderstatus
732044 O
729413 F
38543 P
select count(*) cnt, o_orderstatus from orders group by o_orderstatus order by cnt desc, 2;
cnt o_orderstatus
732044 O
729413 F
38543 P
select count(o_orderstatus), o_orderstatus from orders group by o_orderstatus order by count(o_orderstatus) desc, 2;
count(o_orderstatus) o_orderstatus
732044 O
729413 F
38543 P
select count(o_orderstatus), o_orderstatus from orders group by o_orderstatus order by 1, 2 desc;
count(o_orderstatus) o_orderstatus
38543 P
729413 F
732044 O
select count(distinct o_orderstatus), o_orderstatus from orders group by o_orderstatus order by 1, 2 desc;
count(distinct o_orderstatus) o_orderstatus
1 P
1 O
1 F
select count(distinct o_orderstatus), o_orderstatus from orders group by o_orderstatus order by count(distinct o_orderstatus), 2 desc;
count(distinct o_orderstatus) o_orderstatus
1 P
1 O
1 F

View File

@ -0,0 +1,21 @@
USE tpch1;
set autocommit=0;
select * from region where r_regionkey=1;
r_regionkey r_name r_comment
1 AMERICA hs use ironic, even requests. s
update region set r_comment='xxx' where r_regionkey=1;
select * from region where r_regionkey=1;
r_regionkey r_name r_comment
1 AMERICA xxx
rollback;
select * from region where r_regionkey=1;
r_regionkey r_name r_comment
1 AMERICA hs use ironic, even requests. s
update region set r_comment='xxx' where r_regionkey=1;
select * from region where r_regionkey=1;
r_regionkey r_name r_comment
1 AMERICA xxx
rollback;
select * from region where r_regionkey=1;
r_regionkey r_name r_comment
1 AMERICA hs use ironic, even requests. s

View File

@ -0,0 +1,30 @@
USE tpch1;
drop table if exists bug3137;
Warnings:
Note 1051 Unknown table 'tpch1.bug3137'
CREATE TABLE `bug3137` (
`id` INTEGER DEFAULT NULL,
`value` INTEGER DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8;
INSERT INTO `bug3137` (id, value) VALUES (0, 1);
INSERT INTO `bug3137` (id, value) VALUES (1, 1);
INSERT INTO `bug3137` (id, value) VALUES (2, 2);
INSERT INTO `bug3137` (id, value) VALUES (3, 2);
INSERT INTO `bug3137` (id, value) VALUES (4, 3);
INSERT INTO `bug3137` (id, value) VALUES (5, 3);
select * from bug3137 where (value = 1 OR 1 = 1);
id value
0 1
1 1
2 2
3 2
4 3
5 3
select * from bug3137 where id >= 0 and (value = 1 or 1 = -1);
id value
0 1
1 1
select n_nationkey from nation where n_nationkey <=5 and (n_nationkey=2 or 1=-1);
n_nationkey
2
drop table if exists bug3137;

View File

@ -0,0 +1,299 @@
USE tpch1;
select n_name from ((select n_name, n_regionkey from nation) union all
(select n_name, n_regionkey from nation)) as a order by 1;
n_name
ALGERIA
ALGERIA
ARGENTINA
ARGENTINA
BRAZIL
BRAZIL
CANADA
CANADA
CHINA
CHINA
EGYPT
EGYPT
ETHIOPIA
ETHIOPIA
FRANCE
FRANCE
GERMANY
GERMANY
INDIA
INDIA
INDONESIA
INDONESIA
IRAN
IRAN
IRAQ
IRAQ
JAPAN
JAPAN
JORDAN
JORDAN
KENYA
KENYA
MOROCCO
MOROCCO
MOZAMBIQUE
MOZAMBIQUE
PERU
PERU
ROMANIA
ROMANIA
RUSSIA
RUSSIA
SAUDI ARABIA
SAUDI ARABIA
UNITED KINGDOM
UNITED KINGDOM
UNITED STATES
UNITED STATES
VIETNAM
VIETNAM
select n_name from ((select n_name, n_regionkey from nation) union
(select n_name, n_regionkey from nation)) as a order by 1;
n_name
ALGERIA
ARGENTINA
BRAZIL
CANADA
CHINA
EGYPT
ETHIOPIA
FRANCE
GERMANY
INDIA
INDONESIA
IRAN
IRAQ
JAPAN
JORDAN
KENYA
MOROCCO
MOZAMBIQUE
PERU
ROMANIA
RUSSIA
SAUDI ARABIA
UNITED KINGDOM
UNITED STATES
VIETNAM
select a_name from ((select n_name as a_name from nation) union (select
n_name as a_name from nation)) as a order by 1;
a_name
ALGERIA
ARGENTINA
BRAZIL
CANADA
CHINA
EGYPT
ETHIOPIA
FRANCE
GERMANY
INDIA
INDONESIA
IRAN
IRAQ
JAPAN
JORDAN
KENYA
MOROCCO
MOZAMBIQUE
PERU
ROMANIA
RUSSIA
SAUDI ARABIA
UNITED KINGDOM
UNITED STATES
VIETNAM
select name1 from ((select n_name as name1, n_regionkey from nation)
union all (select n_name as name1, n_regionkey from nation)) as a order by 1;
name1
ALGERIA
ALGERIA
ARGENTINA
ARGENTINA
BRAZIL
BRAZIL
CANADA
CANADA
CHINA
CHINA
EGYPT
EGYPT
ETHIOPIA
ETHIOPIA
FRANCE
FRANCE
GERMANY
GERMANY
INDIA
INDIA
INDONESIA
INDONESIA
IRAN
IRAN
IRAQ
IRAQ
JAPAN
JAPAN
JORDAN
JORDAN
KENYA
KENYA
MOROCCO
MOROCCO
MOZAMBIQUE
MOZAMBIQUE
PERU
PERU
ROMANIA
ROMANIA
RUSSIA
RUSSIA
SAUDI ARABIA
SAUDI ARABIA
UNITED KINGDOM
UNITED KINGDOM
UNITED STATES
UNITED STATES
VIETNAM
VIETNAM
select a.a_name, a.regionkey from ((select n_name as a_name, n_regionkey
as regionkey from nation) union (select n_name as a_name, n_regionkey as
regionkey from nation)) as a order by 1, 2;
a_name regionkey
ALGERIA 0
ARGENTINA 1
BRAZIL 1
CANADA 1
CHINA 2
EGYPT 4
ETHIOPIA 0
FRANCE 3
GERMANY 3
INDIA 2
INDONESIA 2
IRAN 4
IRAQ 4
JAPAN 2
JORDAN 4
KENYA 0
MOROCCO 0
MOZAMBIQUE 0
PERU 1
ROMANIA 3
RUSSIA 3
SAUDI ARABIA 4
UNITED KINGDOM 3
UNITED STATES 1
VIETNAM 2
select a_name from ((select n_name as a_name from nation) union all (select
n_name as a_name from nation)) as a order by 1;
a_name
ALGERIA
ALGERIA
ARGENTINA
ARGENTINA
BRAZIL
BRAZIL
CANADA
CANADA
CHINA
CHINA
EGYPT
EGYPT
ETHIOPIA
ETHIOPIA
FRANCE
FRANCE
GERMANY
GERMANY
INDIA
INDIA
INDONESIA
INDONESIA
IRAN
IRAN
IRAQ
IRAQ
JAPAN
JAPAN
JORDAN
JORDAN
KENYA
KENYA
MOROCCO
MOROCCO
MOZAMBIQUE
MOZAMBIQUE
PERU
PERU
ROMANIA
ROMANIA
RUSSIA
RUSSIA
SAUDI ARABIA
SAUDI ARABIA
UNITED KINGDOM
UNITED KINGDOM
UNITED STATES
UNITED STATES
VIETNAM
VIETNAM
select a.a_name, a.regionkey from ((select n_name as a_name, n_regionkey
as regionkey from nation) union all (select n_name as a_name, n_regionkey as
regionkey from nation)) as a order by 1, 2;
a_name regionkey
ALGERIA 0
ALGERIA 0
ARGENTINA 1
ARGENTINA 1
BRAZIL 1
BRAZIL 1
CANADA 1
CANADA 1
CHINA 2
CHINA 2
EGYPT 4
EGYPT 4
ETHIOPIA 0
ETHIOPIA 0
FRANCE 3
FRANCE 3
GERMANY 3
GERMANY 3
INDIA 2
INDIA 2
INDONESIA 2
INDONESIA 2
IRAN 4
IRAN 4
IRAQ 4
IRAQ 4
JAPAN 2
JAPAN 2
JORDAN 4
JORDAN 4
KENYA 0
KENYA 0
MOROCCO 0
MOROCCO 0
MOZAMBIQUE 0
MOZAMBIQUE 0
PERU 1
PERU 1
ROMANIA 3
ROMANIA 3
RUSSIA 3
RUSSIA 3
SAUDI ARABIA 4
SAUDI ARABIA 4
UNITED KINGDOM 3
UNITED KINGDOM 3
UNITED STATES 1
UNITED STATES 1
VIETNAM 2
VIETNAM 2

View File

@ -0,0 +1,33 @@
USE tpch1;
select r_regionkey, r_name,
sum(ordercnt2) ordercnt3,
round(sum(sumcusttotal2)/100,2) custtotal3,
min(minorderdate2) minorderdate3,
max(maxorderdate2) maxorderdate3
from region,
(select n_nationkey,
n_regionkey,
sum(ordercnt1) ordercnt2,
sum(totalprice1) sumcusttotal2,
min(minorderdate1) minorderdate2,
max(maxorderdate1) maxorderdate2
from customer, nation,
(select o_custkey,
count(*) ordercnt1,
sum(o_totalprice)*100 totalprice1,
min(o_orderdate) minorderdate1,
max(o_orderdate) maxorderdate1
from orders group by o_custkey) order1
where c_custkey = o_custkey
and c_nationkey = n_nationkey
group by n_nationkey, n_regionkey
) nation1
where r_regionkey = n_regionkey
group by r_regionkey, r_name
order by r_regionkey, r_name;
r_regionkey r_name ordercnt3 custtotal3 minorderdate3 maxorderdate3
0 AFRICA 298994 45230223902.22 1992-01-01 1998-08-02
1 AMERICA 299103 45306943255.21 1992-01-01 1998-08-02
2 ASIA 301740 45613415042.56 1992-01-01 1998-08-02
3 EUROPE 303286 45793265459.71 1992-01-01 1998-08-02
4 MIDDLE EAST 296877 44885458787.76 1992-01-01 1998-08-02

View File

@ -0,0 +1,9 @@
USE tpch1;
select * from sub1 LEFT OUTER JOIN (select * from sub2) Meal on(sub1.c1=Meal.c1 and sub1.c2=Meal.c2) order by 1;
c1 c2 c3 s1 s2 s3 c1 c2 c3 s1 s2 s3
1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 NULL NULL NULL NULL NULL NULL
3 3 3 3 3 3 NULL NULL NULL NULL NULL NULL
4 1 1 1 1 1 NULL NULL NULL NULL NULL NULL
5 99 99 99 99 99 NULL NULL NULL NULL NULL NULL
6 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL

View File

@ -0,0 +1,35 @@
USE tpch1;
select * from sub1 left outer join (select * from sub2)a on (sub1.c1=a.c1 and sub1.c2=a.c2) order by 1,2, 3, 4, 5, 6, 7, 8, 9, 10;
c1 c2 c3 s1 s2 s3 c1 c2 c3 s1 s2 s3
1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 NULL NULL NULL NULL NULL NULL
3 3 3 3 3 3 NULL NULL NULL NULL NULL NULL
4 1 1 1 1 1 NULL NULL NULL NULL NULL NULL
5 99 99 99 99 99 NULL NULL NULL NULL NULL NULL
6 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
select * from sub1 right outer join (select * from sub2)a on (sub1.c1=a.c1 and sub1.c2=a.c2) order by 1,2, 3, 4, 5, 6, 7, 8, 9, 10;
c1 c2 c3 s1 s2 s3 c1 c2 c3 s1 s2 s3
NULL NULL NULL NULL NULL NULL 1 2 2 2 2 2
NULL NULL NULL NULL NULL NULL 1 3 3 3 3 3
NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL 2 4 4 4 4 4
NULL NULL NULL NULL NULL NULL 2 5 5 5 5 5
NULL NULL NULL NULL NULL NULL 6 2 2 2 2 2
1 1 1 1 1 1 1 1 1 1 1 1
select * from sub1 left outer join (select * from sub2)a using(c1,c2) order by 1,2, 3, 4, 5, 6, 7, 8, 9, 10;
c1 c2 c3 s1 s2 s3 c3 s1 s2 s3
1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 NULL NULL NULL NULL
3 3 3 3 3 3 NULL NULL NULL NULL
4 1 1 1 1 1 NULL NULL NULL NULL
5 99 99 99 99 99 NULL NULL NULL NULL
6 NULL NULL NULL NULL NULL NULL NULL NULL NULL
select * from sub1 right outer join (select * from sub2)a using(c1,c2) order by 1,2, 3, 4, 5, 6, 7, 8, 9, 10;
c1 c2 c3 s1 s2 s3 c3 s1 s2 s3
1 1 1 1 1 1 1 1 1 1
1 2 2 2 2 2 NULL NULL NULL NULL
1 3 3 3 3 3 NULL NULL NULL NULL
2 NULL NULL NULL NULL NULL NULL NULL NULL NULL
2 4 4 4 4 4 NULL NULL NULL NULL
2 5 5 5 5 5 NULL NULL NULL NULL
6 2 2 2 2 2 NULL NULL NULL NULL

View File

@ -0,0 +1,8 @@
USE tpch1;
drop table if exists bug3203;
Warnings:
Note 1051 Unknown table 'tpch1.bug3203'
create table bug3203 (c1 varchar(20))engine=columnstore;
select * from bug3203 where c1 = 'x';
c1
drop table if exists bug3203;

View File

@ -0,0 +1,47 @@
USE tpch1;
drop table if exists testnulldate;
Warnings:
Note 1051 Unknown table 'tpch1.testnulldate'
create table testnulldate (id int, time_stamp datetime) engine=columnstore;
insert into testnulldate values (1, '2010-11-08 17:46:44');
insert into testnulldate values (2, null);
insert into testnulldate values (3, SUBDATE('2010-11-08 17:46:44', 1));
select
id,
`time_stamp`,
DATE(`time_stamp`) as `Date`,
case when `time_stamp` is null then 'N/A' else DATE(`time_stamp`) end as
`Test1`,
ifnull((DATE(`time_stamp`)),'N/A') as `Test2`,
if(`time_stamp` is null, 'N/A', DATE(`time_stamp`)) as `Test3`,
if(`time_stamp`<='2010-11-08 17:46:44',DATE(`time_stamp`),'N/A') as `Test4`,
if(`time_stamp`<='2010-11-08 17:46:44',DATE(`time_stamp`),DATE('2010-11-08 17:46:44')) as `Test5`
from testnulldate;
id time_stamp Date Test1 Test2 Test3 Test4 Test5
1 2010-11-08 17:46:44 2010-11-08 2010-11-08 2010-11-08 2010-11-08 2010-11-08 2010-11-08
2 NULL NULL N/A N/A N/A N/A 2010-11-08
3 2010-11-07 17:46:44 2010-11-07 2010-11-07 2010-11-07 2010-11-07 2010-11-07 2010-11-07
select
id,
`time_stamp`,
YEAR(`time_stamp`) as `Date`,
case when `time_stamp` is null then 'N/A' else YEAR(`time_stamp`) end as
`Test1`,
ifnull((YEAR(`time_stamp`)),'N/A') as `Test2`,
if(`time_stamp` is null, 'N/A', YEAR(`time_stamp`)) as `Test3`,
if(`time_stamp`<='2010-11-08 17:46:44',YEAR(`time_stamp`),'N/A') as `Test4`,
if(`time_stamp`<='2010-11-08 17:46:44',YEAR(`time_stamp`),DATE('2010-11-08 17:46:44')) as `Test5`
from testnulldate;
id time_stamp Date Test1 Test2 Test3 Test4 Test5
1 2010-11-08 17:46:44 2010 2010 2010 2010 2010 2010
2 NULL NULL N/A N/A N/A N/A 2010-11-08
3 2010-11-07 17:46:44 2010 2010 2010 2010 2010 2010
select
id,
case when `time_stamp` is null then 'N/A' end as `Test1`
from testnulldate;
id Test1
1 NULL
2 N/A
3 NULL
drop table if exists testnulldate;

View File

@ -0,0 +1,38 @@
USE tpch1;
drop table if exists var_between;
Warnings:
Note 1051 Unknown table 'tpch1.var_between'
create table var_between (c1 varchar(10), c2 char(7)) engine=columnstore;
insert into var_between values ('099', '099');
insert into var_between values ('9', '9');
insert into var_between values ('1', '1');
select 'q1', var_between.* from var_between where substr(c1,1,1) between '0' and '9';
q1 c1 c2
q1 099 099
q1 9 9
q1 1 1
select 'q2', var_between.* from var_between where substr(c1,1,1) not between '0' and '9';
q2 c1 c2
select 'q3', var_between.* from var_between where substr(c2,1,1) between '0' and '9';
q3 c1 c2
q3 099 099
q3 9 9
q3 1 1
select 'q4', var_between.* from var_between where substr(c2,1,1) not between '0' and '9';
q4 c1 c2
drop table var_between;
select 'q5', count(*) from orders where substr(o_comment, 1, 1) between 'a' and 'f';
q5 count(*)
q5 388241
select 'q6', count(*) from orders where substr(o_orderpriority, 1, 1) between '2' and '3';
q6 count(*)
q6 598814
select 'q7', count(*) from orders where substr(o_orderpriority, 1, 1) not between '2' and '3';
q7 count(*)
q7 901186
select 'q8', count(*) from orders where substr(o_totalprice, 2, 3) between '200' and '300';
q8 count(*)
q8 165747
select 'q9', count(*) from orders where substr(o_totalprice, 2, 3) not between '200' and '300';
q9 count(*)
q9 1334253

View File

@ -0,0 +1,11 @@
USE tpch1;
select count(*) from nation into outfile '/tmp/natcount.tbl';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
select count(*) into outfile '/tmp/natcount.tbl' from nation;
select count(*) from nation;
count(*)
25
select count(*) from nation into outfile 'nation.out';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead

View File

@ -0,0 +1,23 @@
USE tpch1;
drop table if exists bug3267;
Warnings:
Note 1051 Unknown table 'tpch1.bug3267'
create table bug3267 (c1 decimal(12, 6), c2 float) engine=columnstore;
insert into bug3267 values (5.240620, 5.24062e+06), (7.240620, 7.24062e+06), (9.940620, 9.94062e+06), (5.240620, 5.24062), (-4.44, -4.44), (-8.87, -8.87);
select floor(c1), ceil(c1), c1 from bug3267;
floor(c1) ceil(c1) c1
5 6 5.240620
7 8 7.240620
9 10 9.940620
5 6 5.240620
-5 -4 -4.440000
-9 -8 -8.870000
select floor(c2), ceil(c2), c2 from bug3267;
floor(c2) ceil(c2) c2
5240620 5240620 5240620
7240620 7240620 7240620
9940620 9940620 9940620
5 6 5.24062
-5 -4 -4.44
-9 -8 -8.87
drop table if exists bug3267;

View File

@ -0,0 +1,106 @@
USE tpch1;
drop table if exists bug3270;
Warnings:
Note 1051 Unknown table 'tpch1.bug3270'
create table bug3270 (c1 decimal(12, 6), c2 float) engine=columnstore;
insert into bug3270
values (5.240620, 5.24062e+06), (7.240620, 7.24062e+06), (9.940620, 9.94062e+06), (5.240620, 5.24062), (5.240720, 5.240720),
(5.240720, 5.240720), (5.240720, 5.240720), (-4.23, -4.23), (-8.89, -8.89);
insert into bug3270 values (-5.240620, -5.24062e+06), (-7.240620, -7.24062e+06), (-9.940620, -9.94062e+06),
(-5.240620, -5.24062), (-5.240720, -5.240720), (-5.240720, -5.240720), (-5.240720, -5.240720);
insert into bug3270 values (-18.9479, -18.9479), (45.1557, 45.1557);
select floor(c1), ceil(c1), c1 from bug3270 order by 1,2,3;
floor(c1) ceil(c1) c1
-19 -18 -18.947900
-10 -9 -9.940620
-9 -8 -8.890000
-8 -7 -7.240620
-6 -5 -5.240720
-6 -5 -5.240720
-6 -5 -5.240720
-6 -5 -5.240620
-6 -5 -5.240620
-5 -4 -4.230000
5 6 5.240620
5 6 5.240620
5 6 5.240720
5 6 5.240720
5 6 5.240720
7 8 7.240620
9 10 9.940620
45 46 45.155700
select floor(c2), ceil(c2), c2 from bug3270 order by 1,2,3;
floor(c2) ceil(c2) c2
-9940620 -9940620 -9940620
-7240620 -7240620 -7240620
-5240620 -5240620 -5240620
-19 -18 -18.9479
-9 -8 -8.89
-6 -5 -5.24072
-6 -5 -5.24072
-6 -5 -5.24072
-6 -5 -5.24062
-5 -4 -4.23
5 6 5.24062
5 6 5.24072
5 6 5.24072
5 6 5.24072
45 46 45.1557
5240620 5240620 5240620
7240620 7240620 7240620
9940620 9940620 9940620
select truncate(c1, 0), truncate(c1, 1), truncate(c1, 2) from bug3270 order by 1,2,3;
truncate(c1, 0) truncate(c1, 1) truncate(c1, 2)
-18 -18.9 -18.94
-9 -9.9 -9.94
-8 -8.8 -8.89
-7 -7.2 -7.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-4 -4.2 -4.23
5 5.2 5.24
5 5.2 5.24
5 5.2 5.24
5 5.2 5.24
5 5.2 5.24
7 7.2 7.24
9 9.9 9.94
45 45.1 45.15
select truncate(c2, 0), truncate(c2, 1), truncate(c2, 2) from bug3270 order by 1,2,3;
truncate(c2, 0) truncate(c2, 1) truncate(c2, 2)
-9940620 -9940620.0 -9940620.00
-7240620 -7240620.0 -7240620.00
-5240620 -5240620.0 -5240620.00
-18 -18.9 -18.94
-8 -8.8 -8.89
-5 -5.2 -5.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-5 -5.2 -5.24
-4 -4.2 -4.23
5 5.2 5.24
5 5.2 5.24
5 5.2 5.24
5 5.2 5.24
45 45.1 45.15
5240620 5240620.0 5240620.00
7240620 7240620.0 7240620.00
9940620 9940620.0 9940620.00
select truncate(c2 ,2), count(*) from bug3270 group by 1 order by 1, 2;
truncate(c2 ,2) count(*)
-9940620.00 1
-7240620.00 1
-5240620.00 1
-18.94 1
-8.89 1
-5.24 4
-4.23 1
5.24 4
45.15 1
5240620.00 1
7240620.00 1
9940620.00 1
drop table if exists bug3270;

View File

@ -0,0 +1,66 @@
USE tpch1;
drop table if exists bug3272;
Warnings:
Note 1051 Unknown table 'tpch1.bug3272'
create table bug3272 (c1 float, c2 char(12)) engine=columnstore;
insert into bug3272 values (5.24062, '5.24062'), (7.24062, '7.24062'), (9.94062, '9.94062');
insert into bug3272 values (-5.24062, '-5.24062'), (-7.24062, '-7.24062'), (-9.94062, '-9.94062');
insert into bug3272 values (5.24562, '5.24562'), (7.24562, '7.24562'), (9.94562, '9.94562');
insert into bug3272 values (-5.24562, '-5.24562'), (-7.24562, '-7.24562'), (-9.94562, '-9.94562');
select cast(c1 as decimal(4,2)) floattype, cast(c2 as decimal(4,2)) chartype from bug3272 order by 1, 2;
floattype chartype
-9.95 -9.95
-9.94 -9.94
-7.25 -7.25
-7.24 -7.24
-5.25 -5.25
-5.24 -5.24
5.24 5.24
5.25 5.25
7.24 7.24
7.25 7.25
9.94 9.94
9.95 9.95
select cast(c1 as decimal(0,0)) floattype, cast(c2 as decimal(0,0)) chartype from bug3272 order by 1, 2;
floattype chartype
-10 -10
-10 -10
-7 -7
-7 -7
-5 -5
-5 -5
5 5
5 5
7 7
7 7
10 10
10 10
select cast(c1 as signed) floattype, cast(c2 as signed) chartype from bug3272 order by 1, 2;
floattype chartype
-10 -9
-10 -9
-7 -7
-7 -7
-5 -5
-5 -5
5 5
5 5
7 7
7 7
10 9
10 9
select cast(cast(c1 as decimal(4,2)) as signed) decimaltype, cast(c2 as signed) chartype from bug3272 order by 1, 2;
decimaltype chartype
-10 -9
-10 -9
-7 -7
-7 -7
-5 -5
-5 -5
5 5
5 5
7 7
7 7
10 9
10 9
drop table if exists bug3272;

View File

@ -0,0 +1,23 @@
USE tpch1;
drop table if exists bug3274;
Warnings:
Note 1051 Unknown table 'tpch1.bug3274'
create table bug3274(d2 decimal(4,2), f float);
insert into bug3274 values (43.34, 43.345), (13.54, 13.545);
select d2, count(*) from bug3274 group by 1 order by 1;
d2 count(*)
13.54 1
43.34 1
select f, count(*) from bug3274 group by 1 order by 1;
f count(*)
13.545 1
43.345 1
select * from (select d2, count(*) from bug3274 group by 1 order by 1) a;
d2 count(*)
13.54 1
43.34 1
select * from (select f, count(*) from bug3274 group by 1 order by 1) a;
f count(*)
13.545 1
43.345 1
drop table if exists bug3274;

View File

@ -0,0 +1,178 @@
USE tpch1;
set autocommit=0;
select 'q1', nation.* from nation;
q1 n_nationkey n_name n_regionkey n_comment
q1 0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
q1 1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
q1 2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
q1 3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
q1 4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
q1 5 ETHIOPIA 0 ven packages wake quickly. regu
q1 6 FRANCE 3 refully final requests. regular, ironi
q1 7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
q1 8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
q1 9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
q1 10 IRAN 4 efully alongside of the slyly final dependencies.
q1 11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
q1 12 JAPAN 2 ously. final, express gifts cajole a
q1 13 JORDAN 4 ic deposits are blithely about the carefully regular pa
q1 14 KENYA 0 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
q1 15 MOROCCO 0 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
q1 16 MOZAMBIQUE 0 s. ironic, unusual asymptotes wake blithely r
q1 17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
q1 18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
q1 19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
q1 20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
q1 21 VIETNAM 2 hely enticingly express accounts. even, final
q1 22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
q1 23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
q1 24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
update nation set n_comment='x' where n_nationkey <= n_regionkey;
select 'q2', nation.* from nation;
q2 n_nationkey n_name n_regionkey n_comment
q2 0 ALGERIA 0 x
q2 1 ARGENTINA 1 x
q2 2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
q2 3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
q2 4 EGYPT 4 x
q2 5 ETHIOPIA 0 ven packages wake quickly. regu
q2 6 FRANCE 3 refully final requests. regular, ironi
q2 7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
q2 8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
q2 9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
q2 10 IRAN 4 efully alongside of the slyly final dependencies.
q2 11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
q2 12 JAPAN 2 ously. final, express gifts cajole a
q2 13 JORDAN 4 ic deposits are blithely about the carefully regular pa
q2 14 KENYA 0 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
q2 15 MOROCCO 0 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
q2 16 MOZAMBIQUE 0 s. ironic, unusual asymptotes wake blithely r
q2 17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
q2 18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
q2 19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
q2 20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
q2 21 VIETNAM 2 hely enticingly express accounts. even, final
q2 22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
q2 23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
q2 24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
rollback;
select 'q3', nation.* from nation;
q3 n_nationkey n_name n_regionkey n_comment
q3 0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
q3 1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
q3 2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
q3 3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
q3 4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
q3 5 ETHIOPIA 0 ven packages wake quickly. regu
q3 6 FRANCE 3 refully final requests. regular, ironi
q3 7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
q3 8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
q3 9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
q3 10 IRAN 4 efully alongside of the slyly final dependencies.
q3 11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
q3 12 JAPAN 2 ously. final, express gifts cajole a
q3 13 JORDAN 4 ic deposits are blithely about the carefully regular pa
q3 14 KENYA 0 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
q3 15 MOROCCO 0 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
q3 16 MOZAMBIQUE 0 s. ironic, unusual asymptotes wake blithely r
q3 17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
q3 18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
q3 19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
q3 20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
q3 21 VIETNAM 2 hely enticingly express accounts. even, final
q3 22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
q3 23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
q3 24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
update nation set n_comment='x' where n_nationkey = n_regionkey;
select 'q4', nation.* from nation;
q4 n_nationkey n_name n_regionkey n_comment
q4 0 ALGERIA 0 x
q4 1 ARGENTINA 1 x
q4 2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
q4 3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
q4 4 EGYPT 4 x
q4 5 ETHIOPIA 0 ven packages wake quickly. regu
q4 6 FRANCE 3 refully final requests. regular, ironi
q4 7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
q4 8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
q4 9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
q4 10 IRAN 4 efully alongside of the slyly final dependencies.
q4 11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
q4 12 JAPAN 2 ously. final, express gifts cajole a
q4 13 JORDAN 4 ic deposits are blithely about the carefully regular pa
q4 14 KENYA 0 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
q4 15 MOROCCO 0 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
q4 16 MOZAMBIQUE 0 s. ironic, unusual asymptotes wake blithely r
q4 17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
q4 18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
q4 19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
q4 20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
q4 21 VIETNAM 2 hely enticingly express accounts. even, final
q4 22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
q4 23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
q4 24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
rollback;
select 'q5', nation.* from nation;
q5 n_nationkey n_name n_regionkey n_comment
q5 0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
q5 1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
q5 2 BRAZIL 1 y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
q5 3 CANADA 1 eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
q5 4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
q5 5 ETHIOPIA 0 ven packages wake quickly. regu
q5 6 FRANCE 3 refully final requests. regular, ironi
q5 7 GERMANY 3 l platelets. regular accounts x-ray: unusual, regular acco
q5 8 INDIA 2 ss excuses cajole slyly across the packages. deposits print aroun
q5 9 INDONESIA 2 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
q5 10 IRAN 4 efully alongside of the slyly final dependencies.
q5 11 IRAQ 4 nic deposits boost atop the quickly final requests? quickly regula
q5 12 JAPAN 2 ously. final, express gifts cajole a
q5 13 JORDAN 4 ic deposits are blithely about the carefully regular pa
q5 14 KENYA 0 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
q5 15 MOROCCO 0 rns. blithely bold courts among the closely regular packages use furiously bold platelets?
q5 16 MOZAMBIQUE 0 s. ironic, unusual asymptotes wake blithely r
q5 17 PERU 1 platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
q5 18 CHINA 2 c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
q5 19 ROMANIA 3 ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
q5 20 SAUDI ARABIA 4 ts. silent requests haggle. closely express packages sleep across the blithely
q5 21 VIETNAM 2 hely enticingly express accounts. even, final
q5 22 RUSSIA 3 requests against the platelets use never according to the quickly regular pint
q5 23 UNITED KINGDOM 3 eans boost carefully special requests. accounts are. carefull
q5 24 UNITED STATES 1 y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
update nation set n_comment='x' where n_nationkey > n_regionkey;
select 'q6', nation.* from nation;
q6 n_nationkey n_name n_regionkey n_comment
q6 0 ALGERIA 0 haggle. carefully final deposits detect slyly agai
q6 1 ARGENTINA 1 al foxes promise slyly according to the regular accounts. bold requests alon
q6 2 BRAZIL 1 x
q6 3 CANADA 1 x
q6 4 EGYPT 4 y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
q6 5 ETHIOPIA 0 x
q6 6 FRANCE 3 x
q6 7 GERMANY 3 x
q6 8 INDIA 2 x
q6 9 INDONESIA 2 x
q6 10 IRAN 4 x
q6 11 IRAQ 4 x
q6 12 JAPAN 2 x
q6 13 JORDAN 4 x
q6 14 KENYA 0 x
q6 15 MOROCCO 0 x
q6 16 MOZAMBIQUE 0 x
q6 17 PERU 1 x
q6 18 CHINA 2 x
q6 19 ROMANIA 3 x
q6 20 SAUDI ARABIA 4 x
q6 21 VIETNAM 2 x
q6 22 RUSSIA 3 x
q6 23 UNITED KINGDOM 3 x
q6 24 UNITED STATES 1 x
rollback;
select 'q7', count(*) from orders where o_orderkey<o_custkey and o_shippriority < o_custkey;
q7 count(*)
q7 18613
update orders set o_orderkey=o_custkey where o_orderkey<o_custkey and o_shippriority < o_custkey;
select 'q8', count(*) from orders where o_orderkey=o_custkey and o_shippriority < o_custkey;
q8 count(*)
q8 18613
rollback;

View File

@ -0,0 +1,11 @@
USE tpch1;
select caldroppartitions('lineitem', '4.1.1');
caldroppartitions('lineitem', '4.1.1')
No partitions are dropped
Warnings:
Warning 9999 MCS-4003: Partition "4.1.1" does not exist.
select caldisablepartitions('lineitem', '4.1.1');
caldisablepartitions('lineitem', '4.1.1')
No partitions are disabled
Warnings:
Warning 9999 MCS-4003: Partition "4.1.1" does not exist.

View File

@ -0,0 +1,194 @@
USE tpch1;
drop table if exists bug3292;
Warnings:
Note 1051 Unknown table 'tpch1.bug3292'
create table bug3292 (c1 double, c2 float, c3 char(12)) engine=columnstore;
insert into bug3292 values
(5.24062, 5.24062, '5.24062'),
(5.24062, 5.24062, '5.24062'),
(3.24062, 3.24062, '3.24062'),
(9.24062, 9.24062, '9.24062'),
(-5.24062, -5.24062, '-5.24062'),
(-3.24062, -3.24062, '-3.24062'),
(-9.24062, -9.24062, '-9.24062'),
(5.24562, 5.24562, '5.24562'),
(3.24562, 3.24562, '3.24562'),
(9.94562, 9.94562, '9.94562'),
(-5.24562, -5.24562, '-5.24562'),
(-3.24562, -3.24562, '-3.24562'),
(-9.94562, -9.94562, '-9.94562'),
(-3.2e-10, -3.2e-10, '-3.2e-10'),
(3.2e-10, 3.2e-10, '3.2e-10'),
(-3.2e10, -3.2e10, '-3.2e10'),
(3.2e10, 3.2e10, '3.2e10'),
(-3.2e30, -3.2e30, '-3.2e30'),
(3.2e30, 3.2e30, '3.2e30');
select c1, format(c1, 0), format(c2,0), format(c3,0) from bug3292;
c1 format(c1, 0) format(c2,0) format(c3,0)
5.24062 5 5 5
5.24062 5 5 5
3.24062 3 3 3
9.24062 9 9 9
-5.24062 -5 -5 -5
-3.24062 -3 -3 -3
-9.24062 -9 -9 -9
5.24562 5 5 5
3.24562 3 3 3
9.94562 10 10 10
-5.24562 -5 -5 -5
-3.24562 -3 -3 -3
-9.94562 -10 -10 -10
-0.00000000032 -0 -0 -0
0.00000000032 0 0 0
-32000000000 -32,000,000,000 -32,000,000,000 -32,000,000,000
32000000000 32,000,000,000 32,000,000,000 32,000,000,000
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912 -3,200,000,048,151,891,903,605,404,336,128 -3,199,999,999,999,999,725,860,827,430,912
3.2e30 3,199,999,999,999,999,725,860,827,430,912 3,200,000,048,151,891,903,605,404,336,128 3,199,999,999,999,999,725,860,827,430,912
select c1, format(c1, 1), format(c2,1), format(c3,1) from bug3292;
c1 format(c1, 1) format(c2,1) format(c3,1)
5.24062 5.2 5.2 5.2
5.24062 5.2 5.2 5.2
3.24062 3.2 3.2 3.2
9.24062 9.2 9.2 9.2
-5.24062 -5.2 -5.2 -5.2
-3.24062 -3.2 -3.2 -3.2
-9.24062 -9.2 -9.2 -9.2
5.24562 5.2 5.2 5.2
3.24562 3.2 3.2 3.2
9.94562 9.9 9.9 9.9
-5.24562 -5.2 -5.2 -5.2
-3.24562 -3.2 -3.2 -3.2
-9.94562 -9.9 -9.9 -9.9
-0.00000000032 -0.0 -0.0 -0.0
0.00000000032 0.0 0.0 0.0
-32000000000 -32,000,000,000.0 -32,000,000,000.0 -32,000,000,000.0
32000000000 32,000,000,000.0 32,000,000,000.0 32,000,000,000.0
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.0 -3,200,000,048,151,891,903,605,404,336,128.0 -3,199,999,999,999,999,725,860,827,430,912.0
3.2e30 3,199,999,999,999,999,725,860,827,430,912.0 3,200,000,048,151,891,903,605,404,336,128.0 3,199,999,999,999,999,725,860,827,430,912.0
select c1, format(c1, 2), format(c2,2), format(c3,2) from bug3292;
c1 format(c1, 2) format(c2,2) format(c3,2)
5.24062 5.24 5.24 5.24
5.24062 5.24 5.24 5.24
3.24062 3.24 3.24 3.24
9.24062 9.24 9.24 9.24
-5.24062 -5.24 -5.24 -5.24
-3.24062 -3.24 -3.24 -3.24
-9.24062 -9.24 -9.24 -9.24
5.24562 5.25 5.25 5.25
3.24562 3.25 3.25 3.25
9.94562 9.95 9.95 9.95
-5.24562 -5.25 -5.25 -5.25
-3.24562 -3.25 -3.25 -3.25
-9.94562 -9.95 -9.95 -9.95
-0.00000000032 -0.00 -0.00 -0.00
0.00000000032 0.00 0.00 0.00
-32000000000 -32,000,000,000.00 -32,000,000,000.00 -32,000,000,000.00
32000000000 32,000,000,000.00 32,000,000,000.00 32,000,000,000.00
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.00 -3,200,000,048,151,891,903,605,404,336,128.00 -3,199,999,999,999,999,725,860,827,430,912.00
3.2e30 3,199,999,999,999,999,725,860,827,430,912.00 3,200,000,048,151,891,903,605,404,336,128.00 3,199,999,999,999,999,725,860,827,430,912.00
select c1, format(c1, 3), format(c2,2), format(c3,2) from bug3292;
c1 format(c1, 3) format(c2,2) format(c3,2)
5.24062 5.241 5.24 5.24
5.24062 5.241 5.24 5.24
3.24062 3.241 3.24 3.24
9.24062 9.241 9.24 9.24
-5.24062 -5.241 -5.24 -5.24
-3.24062 -3.241 -3.24 -3.24
-9.24062 -9.241 -9.24 -9.24
5.24562 5.246 5.25 5.25
3.24562 3.246 3.25 3.25
9.94562 9.946 9.95 9.95
-5.24562 -5.246 -5.25 -5.25
-3.24562 -3.246 -3.25 -3.25
-9.94562 -9.946 -9.95 -9.95
-0.00000000032 -0.000 -0.00 -0.00
0.00000000032 0.000 0.00 0.00
-32000000000 -32,000,000,000.000 -32,000,000,000.00 -32,000,000,000.00
32000000000 32,000,000,000.000 32,000,000,000.00 32,000,000,000.00
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.000 -3,200,000,048,151,891,903,605,404,336,128.00 -3,199,999,999,999,999,725,860,827,430,912.00
3.2e30 3,199,999,999,999,999,725,860,827,430,912.000 3,200,000,048,151,891,903,605,404,336,128.00 3,199,999,999,999,999,725,860,827,430,912.00
select c1, format(c1, 4), format(c2,2), format(c3,2) from bug3292;
c1 format(c1, 4) format(c2,2) format(c3,2)
5.24062 5.2406 5.24 5.24
5.24062 5.2406 5.24 5.24
3.24062 3.2406 3.24 3.24
9.24062 9.2406 9.24 9.24
-5.24062 -5.2406 -5.24 -5.24
-3.24062 -3.2406 -3.24 -3.24
-9.24062 -9.2406 -9.24 -9.24
5.24562 5.2456 5.25 5.25
3.24562 3.2456 3.25 3.25
9.94562 9.9456 9.95 9.95
-5.24562 -5.2456 -5.25 -5.25
-3.24562 -3.2456 -3.25 -3.25
-9.94562 -9.9456 -9.95 -9.95
-0.00000000032 -0.0000 -0.00 -0.00
0.00000000032 0.0000 0.00 0.00
-32000000000 -32,000,000,000.0000 -32,000,000,000.00 -32,000,000,000.00
32000000000 32,000,000,000.0000 32,000,000,000.00 32,000,000,000.00
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.0000 -3,200,000,048,151,891,903,605,404,336,128.00 -3,199,999,999,999,999,725,860,827,430,912.00
3.2e30 3,199,999,999,999,999,725,860,827,430,912.0000 3,200,000,048,151,891,903,605,404,336,128.00 3,199,999,999,999,999,725,860,827,430,912.00
select c1, format(c1, 5), format(c2,2), format(c3,2) from bug3292;
c1 format(c1, 5) format(c2,2) format(c3,2)
5.24062 5.24062 5.24 5.24
5.24062 5.24062 5.24 5.24
3.24062 3.24062 3.24 3.24
9.24062 9.24062 9.24 9.24
-5.24062 -5.24062 -5.24 -5.24
-3.24062 -3.24062 -3.24 -3.24
-9.24062 -9.24062 -9.24 -9.24
5.24562 5.24562 5.25 5.25
3.24562 3.24562 3.25 3.25
9.94562 9.94562 9.95 9.95
-5.24562 -5.24562 -5.25 -5.25
-3.24562 -3.24562 -3.25 -3.25
-9.94562 -9.94562 -9.95 -9.95
-0.00000000032 -0.00000 -0.00 -0.00
0.00000000032 0.00000 0.00 0.00
-32000000000 -32,000,000,000.00000 -32,000,000,000.00 -32,000,000,000.00
32000000000 32,000,000,000.00000 32,000,000,000.00 32,000,000,000.00
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.00000 -3,200,000,048,151,891,903,605,404,336,128.00 -3,199,999,999,999,999,725,860,827,430,912.00
3.2e30 3,199,999,999,999,999,725,860,827,430,912.00000 3,200,000,048,151,891,903,605,404,336,128.00 3,199,999,999,999,999,725,860,827,430,912.00
select c1, format(c1, 6), format(c2,6), format(c3,6) from bug3292;
c1 format(c1, 6) format(c2,6) format(c3,6)
5.24062 5.240620 5.240620 5.240620
5.24062 5.240620 5.240620 5.240620
3.24062 3.240620 3.240620 3.240620
9.24062 9.240620 9.240620 9.240620
-5.24062 -5.240620 -5.240620 -5.240620
-3.24062 -3.240620 -3.240620 -3.240620
-9.24062 -9.240620 -9.240620 -9.240620
5.24562 5.245620 5.245620 5.245620
3.24562 3.245620 3.245620 3.245620
9.94562 9.945620 9.945620 9.945620
-5.24562 -5.245620 -5.245620 -5.245620
-3.24562 -3.245620 -3.245620 -3.245620
-9.94562 -9.945620 -9.945620 -9.945620
-0.00000000032 -0.000000 -0.000000 -0.000000
0.00000000032 0.000000 0.000000 0.000000
-32000000000 -32,000,000,000.000000 -32,000,000,000.000000 -32,000,000,000.000000
32000000000 32,000,000,000.000000 32,000,000,000.000000 32,000,000,000.000000
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912.000000 -3,200,000,048,151,891,903,605,404,336,128.000000 -3,199,999,999,999,999,725,860,827,430,912.000000
3.2e30 3,199,999,999,999,999,725,860,827,430,912.000000 3,200,000,048,151,891,903,605,404,336,128.000000 3,199,999,999,999,999,725,860,827,430,912.000000
select c1, format(c1, -1), format(c2,-1), format(c3,-1) from bug3292;
c1 format(c1, -1) format(c2,-1) format(c3,-1)
5.24062 5 5 5
5.24062 5 5 5
3.24062 3 3 3
9.24062 9 9 9
-5.24062 -5 -5 -5
-3.24062 -3 -3 -3
-9.24062 -9 -9 -9
5.24562 5 5 5
3.24562 3 3 3
9.94562 10 10 10
-5.24562 -5 -5 -5
-3.24562 -3 -3 -3
-9.94562 -10 -10 -10
-0.00000000032 -0 -0 -0
0.00000000032 0 0 0
-32000000000 -32,000,000,000 -32,000,000,000 -32,000,000,000
32000000000 32,000,000,000 32,000,000,000 32,000,000,000
-3.2e30 -3,199,999,999,999,999,725,860,827,430,912 -3,200,000,048,151,891,903,605,404,336,128 -3,199,999,999,999,999,725,860,827,430,912
3.2e30 3,199,999,999,999,999,725,860,827,430,912 3,200,000,048,151,891,903,605,404,336,128 3,199,999,999,999,999,725,860,827,430,912
drop table if exists bug3292;

View File

@ -0,0 +1,80 @@
USE tpch1;
drop table if exists visit;
Warnings:
Note 1051 Unknown table 'tpch1.visit'
drop table if exists client;
Warnings:
Note 1051 Unknown table 'tpch1.client'
create table visit (id_client integer,nb_event integer,update_date datetime, visit_date datetime) engine=columnstore;
create table client (id_client integer,id_event integer,event_date datetime) engine=columnstore;
insert into visit values (1,0,NULL,"2010-09-08");
insert into visit values (2,0,NULL,"2010-09-08");
insert into visit values (2,0,NULL,"2010-09-10");
insert into visit values (3,0,NULL,"2010-09-08");
insert into visit values (3,0,NULL,"2010-09-10");
insert into client values (1,20,"2010-09-07");
insert into client values (1,21,"2010-09-07");
insert into client values (1,22,"2010-09-07");
insert into client values (2,23,"2010-09-07");
insert into client values (2,24,"2010-09-07");
insert into client values (2,25,"2010-09-10");
insert into client values (3,29,"2010-09-10");
select * from
visit V,
(
SELECT
CL.id_client,
COUNT(CL.id_event) as nb_event
FROM
client CL
WHERE
CL.event_date < "2010-09-10"
GROUP BY
CL.id_client
) Res
WHERE
V.visit_date ="2010-09-08"
AND V.id_client = Res.id_client order by 1, 2, 3;
id_client nb_event update_date visit_date id_client nb_event
1 0 NULL 2010-09-08 00:00:00 1 3
2 0 NULL 2010-09-08 00:00:00 2 2
UPDATE
visit V,
(
SELECT
CL.id_client,
COUNT(CL.id_event) as nb_event
FROM
client CL
WHERE
CL.event_date < "2010-09-10"
GROUP BY
CL.id_client
) Res
SET
V.nb_event = Res.nb_event,
V.update_date = '2010-12-11'
WHERE
V.visit_date ="2010-09-08"
AND V.id_client = Res.id_client;
select * from
visit V,
(
SELECT
CL.id_client,
COUNT(CL.id_event) as nb_event
FROM
client CL
WHERE
CL.event_date < "2010-09-10"
GROUP BY
CL.id_client
) Res
WHERE
V.visit_date ="2010-09-08"
AND V.id_client = Res.id_client order by 1, 2, 3;
id_client nb_event update_date visit_date id_client nb_event
1 3 2010-12-11 00:00:00 2010-09-08 00:00:00 1 3
2 2 2010-12-11 00:00:00 2010-09-08 00:00:00 2 2
drop table if exists visit;
drop table if exists client;

View File

@ -0,0 +1,24 @@
USE tpch1;
drop table if exists user_prop_by_game;
Warnings:
Note 1051 Unknown table 'tpch1.user_prop_by_game'
drop table if exists visit;
Warnings:
Note 1051 Unknown table 'tpch1.visit'
create table user_prop_by_game(cl_id int, last_visit_date date)engine=columnstore;
create table visit(cl_id int, visit_date date)engine=columnstore;
insert into user_prop_by_game values (1, now()), (2, now());
Warnings:
Note 1265 Data truncated for column 'last_visit_date' at row 1
Note 1265 Data truncated for column 'last_visit_date' at row 2
insert into visit values (1, '2010-10-01'), (2, '2010-11-01'), (2,
'2010-10-01');
UPDATE user_prop_by_game UPBG, (SELECT cl_id, max(visit_date) AS max_date FROM
visit GROUP BY cl_id) sub SET UPBG.last_visit_date = sub.max_date WHERE
UPBG.cl_id = sub.cl_id;
select * from user_prop_by_game;
cl_id last_visit_date
1 2010-10-01
2 2010-11-01
drop table if exists user_prop_by_game;
drop table if exists visit;

View File

@ -0,0 +1,58 @@
USE tpch1;
drop table if exists paa;
Warnings:
Note 1051 Unknown table 'tpch1.paa'
drop table if exists dates;
Warnings:
Note 1051 Unknown table 'tpch1.dates'
drop table if exists t;
Warnings:
Note 1051 Unknown table 'tpch1.t'
create table paa (
p_id int,
a_id int,
date_id int
) ENGINE=Columnstore DEFAULT CHARSET=latin1;
insert into paa values
(1, 10, 100),
(2, 20, 100);
create table dates (
date_id int,
dates date
) ENGINE=Columnstore DEFAULT CHARSET=latin1;
insert into dates values
(100, '2010-09-01');
create table t (
p_id int,
a_id int,
date_id int,
amount int
) ENGINE=Columnstore DEFAULT CHARSET=latin1;
insert into t values
(2, 20, 100, 99999);
select p.p_id,
p.a_id,
ifnull(`new_sales_amount`,0),
ifnull(`new_sales_amount_ok`,0),
p.dates as 'Date'
from (select aaa.p_id, aaa.a_id, dof.date_id, dof.dates
from (select paa.p_id, paa.a_id, 1 as xxx
from paa
) aaa
join (select date_id, 1 as xxx, dates from dates) dof on (dof.xxx=aaa.xxx)
) p
left outer join (select t.date_id, t.p_id, a_id,
IF(t.amount = 99999, amount, 0) / 10000 as 'new_sales_amount',
IF(t.amount = 99999, amount, 0) as 'new_sales_amount_ok'
from t
) tx
on (p.p_id = tx.p_id
and p.a_id = tx.a_id
and p.date_id = tx.date_id)
order by 1, 2, 3;
p_id a_id ifnull(`new_sales_amount`,0) ifnull(`new_sales_amount_ok`,0) Date
1 10 0.0000 0 2010-09-01
2 20 9.9999 99999 2010-09-01
drop table if exists paa;
drop table if exists dates;
drop table if exists t;

View File

@ -0,0 +1,8 @@
USE tpch1;
select if(sum(r_regionkey)>1, r_name, r_regionkey) from region group by r_name, r_regionkey order by 1;
if(sum(r_regionkey)>1, r_name, r_regionkey)
0
1
ASIA
EUROPE
MIDDLE EAST

View File

@ -0,0 +1,256 @@
USE ssb1;
drop table if exists datetest;
Warnings:
Note 1051 Unknown table 'ssb1.datetest'
create table if not exists datetest (rowid int, c1 varchar(20), c2 bigint) engine=columnstore;
insert into datetest values (1, "1990-10-20", 19901121), (2, "1997-01-01 10:00:05", 19970201000000), (3, "0705", 0805), (4, "20120230", 20120230),(5, "20110229", 20110229),(6, "9905", 9905),(7, "20011010888888", 20031010888888),(8, "20011011124455", 20011010122233);
select 'q1', rowid, c1, c2, cast(c1 as date), cast(c2 as date) from datetest where c2 <> 0805 order by rowid;
q1 rowid c1 c2 cast(c1 as date) cast(c2 as date)
q1 1 1990-10-20 19901121 1990-10-20 1990-11-21
q1 2 1997-01-01 10:00:05 19970201000000 1997-01-01 1997-02-01
q1 4 20120230 20120230 NULL NULL
q1 5 20110229 20110229 NULL NULL
q1 6 9905 9905 NULL NULL
q1 7 20011010888888 20031010888888 NULL NULL
q1 8 20011011124455 20011010122233 2001-10-11 2001-10-10
select 'q1b', rowid, c1, c2, cast(c1 as date), substr(cast(c2 as date), 6, 5) from datetest where c2 = 0805 order by rowid;
q1b rowid c1 c2 cast(c1 as date) substr(cast(c2 as date), 6, 5)
q1b 3 0705 805 NULL 08-05
select 'q2', rowid, c1, c2, cast(c1 as date), cast(c2 as datetime) from datetest where c2 <> 0805 order by rowid;
q2 rowid c1 c2 cast(c1 as date) cast(c2 as datetime)
q2 1 1990-10-20 19901121 1990-10-20 1990-11-21 00:00:00
q2 2 1997-01-01 10:00:05 19970201000000 1997-01-01 1997-02-01 00:00:00
q2 4 20120230 20120230 NULL NULL
q2 5 20110229 20110229 NULL NULL
q2 6 9905 9905 NULL NULL
q2 7 20011010888888 20031010888888 NULL NULL
q2 8 20011011124455 20011010122233 2001-10-11 2001-10-10 12:22:33
select 'q2b', rowid, c1, c2, cast(c1 as date), substr(cast(c2 as datetime), 6, 14) from datetest where c2 = 0805 order by rowid;
q2b rowid c1 c2 cast(c1 as date) substr(cast(c2 as datetime), 6, 14)
q2b 3 0705 805 NULL 08-05 00:00:00
select 'q3', rowid, c1, c2, quarter(c1), quarter(c2) from datetest order by rowid;
q3 rowid c1 c2 quarter(c1) quarter(c2)
q3 1 1990-10-20 19901121 4 4
q3 2 1997-01-01 10:00:05 19970201000000 1 1
q3 3 0705 805 NULL 3
q3 4 20120230 20120230 NULL NULL
q3 5 20110229 20110229 NULL NULL
q3 6 9905 9905 NULL NULL
q3 7 20011010888888 20031010888888 NULL NULL
q3 8 20011011124455 20011010122233 4 4
select 'q4', rowid, c1, c2 from datetest where quarter(c1) = quarter(c2) order by rowid;
q4 rowid c1 c2
q4 1 1990-10-20 19901121
q4 2 1997-01-01 10:00:05 19970201000000
q4 8 20011011124455 20011010122233
select 'q5', rowid, c1, c2, timediff(c1,c2) from datetest order by rowid;
q5 rowid c1 c2 timediff(c1,c2)
q5 1 1990-10-20 19901121 NULL
q5 2 1997-01-01 10:00:05 19970201000000 -733:59:55.000000
q5 3 0705 805 -00:01:00.000000
q5 4 20120230 20120230 NULL
q5 5 20110229 20110229 NULL
q5 6 9905 9905 NULL
q5 7 20011010888888 20031010888888 NULL
q5 8 20011011124455 20011010122233 24:22:22.000000
select 'q6', rowid, c1, c2, date_format(c1, '%W %M %Y'), date_format(c2, '%H:%i:%s') from datetest order by rowid;
q6 rowid c1 c2 date_format(c1, '%W %M %Y') date_format(c2, '%H:%i:%s')
q6 1 1990-10-20 19901121 Saturday October 1990 00:00:00
q6 2 1997-01-01 10:00:05 19970201000000 Wednesday January 1997 00:00:00
q6 3 0705 805 NULL 00:00:00
q6 4 20120230 20120230 NULL NULL
q6 5 20110229 20110229 NULL NULL
q6 6 9905 9905 NULL NULL
q6 7 20011010888888 20031010888888 NULL NULL
q6 8 20011011124455 20011010122233 Thursday October 2001 12:22:33
select 'q7', rowid, c1, c2, c1 + interval 2 day, c2 + interval 12 hour from datetest where c2 <> 0805 order by rowid;
q7 rowid c1 c2 c1 + interval 2 day c2 + interval 12 hour
q7 1 1990-10-20 19901121 1990-10-22 00:00:00.0000 1990-11-21 12:00:00
q7 2 1997-01-01 10:00:05 19970201000000 1997-01-03 10:00:05.0000 1997-02-01 12:00:00
q7 4 20120230 20120230 NULL NULL
q7 5 20110229 20110229 NULL NULL
q7 6 9905 9905 NULL NULL
q7 7 20011010888888 20031010888888 NULL NULL
q7 8 20011011124455 20011010122233 2001-10-13 12:44:55.0000 2001-10-11 00:22:33
select 'q7b', rowid, c1, c2, c1 + interval 2 day, substr(c2 + interval 12 hour, 6, 14) from datetest where c2 = 0805 order by rowid;
q7b rowid c1 c2 c1 + interval 2 day substr(c2 + interval 12 hour, 6, 14)
q7b 3 0705 805 NULL 08-05 12:00:00
select 'q8', rowid, c1, c2, minute(c1), minute(c2) from datetest order by rowid;
q8 rowid c1 c2 minute(c1) minute(c2)
q8 1 1990-10-20 19901121 0 0
q8 2 1997-01-01 10:00:05 19970201000000 0 0
q8 3 0705 805 NULL 0
q8 4 20120230 20120230 NULL NULL
q8 5 20110229 20110229 NULL NULL
q8 6 9905 9905 NULL NULL
q8 7 20011010888888 20031010888888 NULL NULL
q8 8 20011011124455 20011010122233 44 22
select 'q9', rowid, c1, c2, day(c1), day(c2) from datetest order by 1,2;
q9 rowid c1 c2 day(c1) day(c2)
q9 1 1990-10-20 19901121 20 21
q9 2 1997-01-01 10:00:05 19970201000000 1 1
q9 3 0705 805 NULL 5
q9 4 20120230 20120230 NULL NULL
q9 5 20110229 20110229 NULL NULL
q9 6 9905 9905 NULL NULL
q9 7 20011010888888 20031010888888 NULL NULL
q9 8 20011011124455 20011010122233 11 10
select 'q10', rowid, c1, c2, hour(c1), hour(c2) from datetest order by 1,2;
q10 rowid c1 c2 hour(c1) hour(c2)
q10 1 1990-10-20 19901121 0 0
q10 2 1997-01-01 10:00:05 19970201000000 10 0
q10 3 0705 805 NULL 0
q10 4 20120230 20120230 NULL NULL
q10 5 20110229 20110229 NULL NULL
q10 6 9905 9905 NULL NULL
q10 7 20011010888888 20031010888888 NULL NULL
q10 8 20011011124455 20011010122233 12 12
select 'q11', rowid, c1, c2, dayofweek(c1), dayofweek(c2) from datetest where c2 <> 0805 order by 1,2;
q11 rowid c1 c2 dayofweek(c1) dayofweek(c2)
q11 1 1990-10-20 19901121 7 4
q11 2 1997-01-01 10:00:05 19970201000000 4 7
q11 4 20120230 20120230 NULL NULL
q11 5 20110229 20110229 NULL NULL
q11 6 9905 9905 NULL NULL
q11 7 20011010888888 20031010888888 NULL NULL
q11 8 20011011124455 20011010122233 5 4
select 'q12', rowid, c1, c2, dayofyear(c1), dayofyear(c2) from datetest where c2 <> 0805 order by 1,2;
q12 rowid c1 c2 dayofyear(c1) dayofyear(c2)
q12 1 1990-10-20 19901121 293 325
q12 2 1997-01-01 10:00:05 19970201000000 1 32
q12 4 20120230 20120230 NULL NULL
q12 5 20110229 20110229 NULL NULL
q12 6 9905 9905 NULL NULL
q12 7 20011010888888 20031010888888 NULL NULL
q12 8 20011011124455 20011010122233 284 283
select 'q13', rowid, c1, c2, week(c1), week(c2) from datetest where c2 <> 0805 order by 1,2;
q13 rowid c1 c2 week(c1) week(c2)
q13 1 1990-10-20 19901121 41 46
q13 2 1997-01-01 10:00:05 19970201000000 0 4
q13 4 20120230 20120230 NULL NULL
q13 5 20110229 20110229 NULL NULL
q13 6 9905 9905 NULL NULL
q13 7 20011010888888 20031010888888 NULL NULL
q13 8 20011011124455 20011010122233 40 40
select 'q14', rowid, second(c1), second(c2) from datetest order by 1,2;
q14 rowid second(c1) second(c2)
q14 1 0 0
q14 2 5 0
q14 3 NULL 0
q14 4 NULL NULL
q14 5 NULL NULL
q14 6 NULL NULL
q14 7 NULL NULL
q14 8 55 33
select 'q15', rowid, c1, c2, year(c1), year(c2) from datetest where c2 <> 0805 order by 1,2;
q15 rowid c1 c2 year(c1) year(c2)
q15 1 1990-10-20 19901121 1990 1990
q15 2 1997-01-01 10:00:05 19970201000000 1997 1997
q15 4 20120230 20120230 NULL NULL
q15 5 20110229 20110229 NULL NULL
q15 6 9905 9905 NULL NULL
q15 7 20011010888888 20031010888888 NULL NULL
q15 8 20011011124455 20011010122233 2001 2001
select 'q16', rowid, c1, c2, month(c1), month(c2) from datetest order by 1,2;
q16 rowid c1 c2 month(c1) month(c2)
q16 1 1990-10-20 19901121 10 11
q16 2 1997-01-01 10:00:05 19970201000000 1 2
q16 3 0705 805 NULL 8
q16 4 20120230 20120230 NULL NULL
q16 5 20110229 20110229 NULL NULL
q16 6 9905 9905 NULL NULL
q16 7 20011010888888 20031010888888 NULL NULL
q16 8 20011011124455 20011010122233 10 10
select 'q17', rowid, c1, c2, time(c1), time(c2) from datetest order by 1,2;
q17 rowid c1 c2 time(c1) time(c2)
q17 1 1990-10-20 19901121 NULL 00:00:00
q17 2 1997-01-01 10:00:05 19970201000000 10:00:05.000000 00:00:00
q17 3 0705 805 00:07:05.000000 00:08:05
q17 4 20120230 20120230 838:59:59.999999 00:00:00
q17 5 20110229 20110229 838:59:59.999999 00:00:00
q17 6 9905 9905 NULL NULL
q17 7 20011010888888 20031010888888 NULL NULL
q17 8 20011011124455 20011010122233 12:44:55.000000 12:22:33
drop table if exists datetest;
select 'q18', year(lo_orderdate), month(lo_orderdate), count(*) from ssb1.lineorder group by 1, 2, 3 order by 1, 2, 3;
q18 year(lo_orderdate) month(lo_orderdate) count(*)
q18 1992 1 77440
q18 1992 2 71974
q18 1992 3 77322
q18 1992 4 74258
q18 1992 5 76361
q18 1992 6 74587
q18 1992 7 77167
q18 1992 8 76217
q18 1992 9 74315
q18 1992 10 76928
q18 1992 11 73794
q18 1992 12 77631
q18 1993 1 77007
q18 1993 2 69730
q18 1993 3 77089
q18 1993 4 74824
q18 1993 5 76108
q18 1993 6 75017
q18 1993 7 77724
q18 1993 8 76628
q18 1993 9 75339
q18 1993 10 76988
q18 1993 11 75023
q18 1993 12 76761
q18 1994 1 78537
q18 1994 2 69066
q18 1994 3 78095
q18 1994 4 74494
q18 1994 5 77182
q18 1994 6 75261
q18 1994 7 76596
q18 1994 8 77690
q18 1994 9 74736
q18 1994 10 75569
q18 1994 11 75507
q18 1994 12 77786
q18 1995 1 77914
q18 1995 2 71096
q18 1995 3 77112
q18 1995 4 75695
q18 1995 5 76770
q18 1995 6 75530
q18 1995 7 77978
q18 1995 8 77977
q18 1995 9 74836
q18 1995 10 77848
q18 1995 11 74701
q18 1995 12 76470
q18 1996 1 76859
q18 1996 2 73197
q18 1996 3 76283
q18 1996 4 74941
q18 1996 5 76445
q18 1996 6 75728
q18 1996 7 76868
q18 1996 8 79102
q18 1996 9 75401
q18 1996 10 77467
q18 1996 11 75472
q18 1996 12 77728
q18 1997 1 76351
q18 1997 2 70499
q18 1997 3 76106
q18 1997 4 75915
q18 1997 5 78040
q18 1997 6 75284
q18 1997 7 77549
q18 1997 8 77286
q18 1997 9 74530
q18 1997 10 77324
q18 1997 11 73744
q18 1997 12 77391
q18 1998 1 77437
q18 1998 2 70453
q18 1998 3 77588
q18 1998 4 74713
q18 1998 5 77725
q18 1998 6 74584
q18 1998 7 77744
q18 1998 8 4783

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
USE tpch1;
select *,
wide2.c19 a,
wide2.c19 b,
wide2.c19 c,
wide2.c19 d,
wide2.c19 e,
wide2.c19 f,
wide2.c19 g,
wide2.c19 h
into outfile '/tmp/tmp.tbl'
from wide2
where id <= 3000000;
0 /tmp/tmp.tbl

View File

@ -0,0 +1,25 @@
USE tpch1;
select case substr(dtm,12,2) when '06' then 'L' when '08' then 'M' end daypart, count(*)
from dtypes group by 1 order by 1;
daypart count(*)
NULL 60
L 20
M 20
select case substr(dtm,12,2) when '06' then 'L' when '08' then 'M' else 'Z' end daypart, count(*)
from dtypes group by 1 order by 1;
daypart count(*)
L 20
M 20
Z 60
select substr(dtm,12,2), case substr(dtm,12,2) when '06' then 'L' when '08' then 'M' end daypart, count(*)
from dtypes group by 1,2 order by 1;
substr(dtm,12,2) daypart count(*)
06 L 20
07 NULL 60
08 M 20
select substr(dtm,12,2), case substr(dtm,12,2) when '06' then 'L' when '08' then 'M' else 'Z' end daypart, count(*)
from dtypes group by 1,2 order by 1;
substr(dtm,12,2) daypart count(*)
06 L 20
07 Z 60
08 M 20

View File

@ -0,0 +1,4 @@
USE tpch1;
select count(*) from nation where n_name is not null and n_name != 'A';
count(*)
25

View File

@ -0,0 +1,16 @@
USE tpch1;
select avg(if(n_regionkey>0, n_nationkey, NULL)) from nation;
avg(if(n_regionkey>0, n_nationkey, NULL))
12.5000
select r_regionkey as r, NULL as n from region union select r_regionkey, r_name from region order by 1, 2;
r n
0 NULL
0 AFRICA
1 NULL
1 AMERICA
2 NULL
2 ASIA
3 NULL
3 EUROPE
4 NULL
4 MIDDLE EAST

View File

@ -0,0 +1,23 @@
USE tpch1;
DROP TABLE IF EXISTS bug3398_1;
Warnings:
Note 1051 Unknown table 'tpch1.bug3398_1'
DROP TABLE IF EXISTS bug3398_2;
Warnings:
Note 1051 Unknown table 'tpch1.bug3398_2'
CREATE TABLE bug3398_1 (lid int, name char(10)) engine=columnstore;
INSERT INTO bug3398_1 (lid, name) VALUES (1, 'YES'), (2, 'NO');
CREATE TABLE bug3398_2 ( id int, gid int, lid int, dt date) engine=columnstore;
INSERT INTO bug3398_2 (id, gid, lid, dt) VALUES
(1, 1, 1, '2007-01-01'),(2, 1, 2, '2007-01-02'),
(3, 2, 2, '2007-02-01'),(4, 2, 1, '2007-02-02');
SELECT DISTINCT tt.gid AS lgid, (SELECT bug3398_1.name FROM bug3398_1, bug3398_2 WHERE bug3398_1.lid = bug3398_2.lid AND bug3398_2.gid = lgid and bug3398_1.name > 'NO' ORDER BY bug3398_2.dt) as clid FROM bug3398_2 tt ORDER BY 1;
lgid clid
1 YES
2 YES
SELECT DISTINCT bug3398_2.gid AS lgid, (SELECT bug3398_1.name FROM bug3398_1, bug3398_2 WHERE bug3398_1.lid = bug3398_2.lid AND bug3398_2.gid = lgid and bug3398_1.name > 'NO' ORDER BY bug3398_2.dt) as clid FROM bug3398_2 ORDER BY 1;
lgid clid
1 YES
2 YES
DROP TABLE bug3398_1;
DROP TABLE bug3398_2;

View File

@ -0,0 +1,16 @@
USE tpch1;
drop table if exists qa_cast;
Warnings:
Note 1051 Unknown table 'tpch1.qa_cast'
create table qa_cast ( s1 varchar(20), qaint1 int, qadouble double) engine=columnstore;
insert into qa_cast values ('123456789',123456789, 1234);
insert into qa_cast values ('123.45',123456789, 123.45);
insert into qa_cast values ('abc',123456789, 1.5);
insert into qa_cast values ('0.001',123456789, 0.001);
select s1, qaint1, mod(s1, 10), mod(qaint1, 10), mod(qadouble, 10) from qa_cast;
s1 qaint1 mod(s1, 10) mod(qaint1, 10) mod(qadouble, 10)
123456789 123456789 9 9 4
123.45 123456789 3.450000000000003 9 3.450000000000003
abc 123456789 0 9 1.5
0.001 123456789 0.001 9 0.001
drop table qa_cast;

View File

@ -0,0 +1,61 @@
USE tpch1;
drop table if exists bug3436a;
Warnings:
Note 1051 Unknown table 'tpch1.bug3436a'
drop table if exists bug3436b;
Warnings:
Note 1051 Unknown table 'tpch1.bug3436b'
create table bug3436a (i int, j int, c1 tinyint, c2 decimal(2,1), c3 decimal(4,0), c4 decimal(4,2), c5 float, c6 double) engine=columnstore;
insert into bug3436a values (1, 1, 1, 1.1, 9991, 99.1, 1.1, 1.1), (1, 1, 2, 2.2, 9992, 99.2, 2.2, 2.2), (2, 2, 1, 1.1, 9993, 99.3, 1.1, 1.1), (2, 2, 2, 2.2, 9994, 99.4, 2.2, 2.2), (1, 1, 127, 9.1, 9995, 99.5, 127.1, 127.1), (1, 2, 100, 9.2, 9996, 99.6, 100.2, 100.2);
create table bug3436b (k int) engine=columnstore;
insert into bug3436b values (1), (2), (3);
select s/d from (select k, sum(c1) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
3.0000
115.0000
select s/d from (select k, sum(c2) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
3.30000
10.80000
select s/d from (select k, sum(c3) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
19987.0000
19987.0000
select s/d from (select k, sum(c4) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
198.700000
198.700000
select s/d from (select k, sum(c5) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
3.3000000715255737
115.29999774694443
select s/d from (select k, sum(c6) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
3.3000000000000003
115.3
select s/d from (select k, stddev(c1) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.50000000
28.40444507
select s/d from (select k, stddev(c2) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.550000000
1.885139252
select s/d from (select k, stddev(c3) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.50000000
1.03077641
select s/d from (select k, stddev(c4) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.0500000000
0.1030776406
select s/d from (select k, stddev(c5) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.550000011920929
28.401594938011623
select s/d from (select k, stddev(c6) s, count(distinct j) d from bug3436a join bug3436b on i=k group by 1) a order by 1;
s/d
0.55
28.401595465748045
drop table bug3436a;
drop table bug3436b;

View File

@ -0,0 +1,215 @@
USE tpch1;
drop table if exists optest;
Warnings:
Note 1051 Unknown table 'tpch1.optest'
create table optest (id int, c1 date, c2 decimal(4,2), c3 date) engine=columnstore;
insert into optest values (0, '2011-01-27', null, '1999-08-25'), (1, null, null, null), (2, '2001-01-05', 2.34, null), (3, null, null, '2001-05-03');
select * from optest where (year(c1) = 2011 or c2 = 2.34) or month(c3) = 1;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
2 2001-01-05 2.34 NULL
select * from optest where (year(c1) = 2011 or c2 = 2.34) and month(c1) = 1;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
2 2001-01-05 2.34 NULL
select * from optest where year(c1) = 2011 or (c2 = 2.4) or month(c3) = 8;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
select * from optest where year(c1) = 2011 or (c2 is null) or month(c1) = 2;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
1 NULL NULL NULL
3 NULL NULL 2001-05-03
select * from optest where c1 is null or (c2 is null) or year(c1) = 99;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
1 NULL NULL NULL
3 NULL NULL 2001-05-03
select * from optest where year(ifnull(c1, c3)) > 2000 and c2 is not null;
id c1 c2 c3
2 2001-01-05 2.34 NULL
select * from optest where year(ifnull(c1, c3)) < 2000 or c2 is null and c3 is not null;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
3 NULL NULL 2001-05-03
select * from optest where ifnull(year(c1), 2011) > 2010 or c2 is null and c3 is not null;
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
1 NULL NULL NULL
3 NULL NULL 2001-05-03
select * from optest where ifnull(year(c1), 2011) > 2010 or (c2 is null and c3 is not null or c2 > 2);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
1 NULL NULL NULL
2 2001-01-05 2.34 NULL
3 NULL NULL 2001-05-03
select * from optest where (null or year(ifnull(c1, c3)) > 2000) and ( c3 is not null or null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
3 NULL NULL 2001-05-03
select * from optest where (null or year(ifnull(c1, c3)) > 2000) or ( (c3 is not null or null) and c3 is null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
2 2001-01-05 2.34 NULL
3 NULL NULL 2001-05-03
select * from optest where (null or year(ifnull(c1, c3)) > 2000) or ( (c3 is not null or null) and null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
2 2001-01-05 2.34 NULL
3 NULL NULL 2001-05-03
select * from optest where (null or year(ifnull(c1, c3)) > 2000 and isnull(c2)) or ( (c3 is not null or null) and null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
3 NULL NULL 2001-05-03
select * from optest where ((null or year(ifnull(c1, c3)) > 2000) and isnull(c2)) or ( (c3 is not null or null) and null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
3 NULL NULL 2001-05-03
select * from optest where (null or c2+1 between 0 and 4 or isnull(c2)) and ( c3 is not null or null);
id c1 c2 c3
0 2011-01-27 NULL 1999-08-25
3 NULL NULL 2001-05-03
drop table if exists bug3442b;
Warnings:
Note 1051 Unknown table 'tpch1.bug3442b'
create table bug3442b (
idx int,
i1 int,
i2 int,
bi1 bigint,
bi2 bigint,
d1 double,
d2 double,
f1 float,
f2 float,
c1 char(8),
c2 char(8),
vc1 varchar(20),
vc2 varchar(20),
dt1 date,
dt2 date,
dtm1 datetime,
dtm2 datetime
)engine=columnstore;
insert into bug3442b values
(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2008-01-25', '2008-01-25', '2008-01-25 10:00', '2011-01-08 11:00'),
(2, null, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, null, '2009-01-25', '2009-01-25', '2009-01-25 10:00', '2019-01-25 11:00'),
(3, 3, null, 3, 3, 3, 3, 3, 3, 3, 3, null, 3, '2010-01-25', '2010-01-25', '2010-01-25 10:00', '2018-01-25 11:00'),
(4, 4, 4, null, 4, 4, 4, 4, 4, 4, null, 4, 4, null, '2011-01-25', '2011-01-25 10:00', '2017-01-25 11:00'),
(5, 5, 5, 5, null, 5, 5, 5, 5, null, 5, 5, 5, '2012-01-25', null, '2012-01-25 10:00', '2016-01-25 11:00'),
(6, 6, 6, 6, 6, null, 6, 6, 6, 6, 6, 6, 6, '2013-01-25', '2014-01-25', null, '2015-01-25 11:00'),
(7, 7, 7, 7, 7, 7, null, 7, 7, 7, 7, 7, 7, '2014-01-25', '2013-01-25', '2014-01-25 10:00', null),
(8, 8, 8, 8, 8, 8, 8, null, 8, 8, 8, 8, 8, '2015-01-25', '2012-01-25', '2013-01-25 10:00', '2015-01-25 11:00'),
(9, 9, 9, 9, 9, 9, 9, 9, null, 9, 9, 9, 9, '2016-01-25', '2011-01-25', '2012-01-25 10:00', '2016-01-25 11:00'),
(10, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
select 'q1', idx from bug3442b where (idx <=5 or idx is null) or (if(idx > 7, null, idx) = idx);
q1 idx
q1 1
q1 2
q1 3
q1 4
q1 5
q1 6
q1 7
select 'q2', idx, bi1, dt1, dt2 from bug3442b
where (bi1 is null) or (year(dt1)<2013 or year(dt2)=2012 or dt1 is null) and (idx <= 9) and (year(dt2)<2020 or
year(dt2) is null);
q2 idx bi1 dt1 dt2
q2 1 1 2008-01-25 2008-01-25
q2 2 2 2009-01-25 2009-01-25
q2 3 3 2010-01-25 2010-01-25
q2 4 NULL NULL 2011-01-25
q2 5 5 2012-01-25 NULL
q2 8 8 2015-01-25 2012-01-25
q2 10 NULL NULL NULL
select 'q3', idx, bi1, dt1, dt2 from bug3442b
where (bi1 is null) or (year(dt1)=2017 or year(dt2)=2012 or dt1 is null) and (idx <= 9) and (year(dt2)<2020 or
year(dt2) is null);
q3 idx bi1 dt1 dt2
q3 4 NULL NULL 2011-01-25
q3 8 8 2015-01-25 2012-01-25
q3 10 NULL NULL NULL
select 'q4', idx, f1, f2 from bug3442b where (f1 > 3) or (f2 < 7);
q4 idx f1 f2
q4 1 1 1
q4 2 2 2
q4 3 3 3
q4 4 4 4
q4 5 5 5
q4 6 6 6
q4 7 7 7
q4 9 9 NULL
select 'q5', idx, vc1, vc2 from bug3442b where (vc1 > 1) or (vc2 > 1);
q5 idx vc1 vc2
q5 2 2 NULL
q5 3 NULL 3
q5 4 4 4
q5 5 5 5
q5 6 6 6
q5 7 7 7
q5 8 8 8
q5 9 9 9
select 'q6', idx, dtm1, dtm2 from bug3442b where (year(dtm1)=2014 and month(dtm1)=1) or (year(dtm2)=2015 and
month(dtm2) <= 7);
q6 idx dtm1 dtm2
q6 6 NULL 2015-01-25 11:00:00
q6 7 2014-01-25 10:00:00 NULL
q6 8 2013-01-25 10:00:00 2015-01-25 11:00:00
select 'q7', idx, d1, d2, f1, f2 from bug3442b where (d1 <= d2 or f1 > f2 or f2 is null) and (idx >= 1 and (f1 < 8 or
f2 > 7));
q7 idx d1 d2 f1 f2
q7 1 1 1 1 1
q7 2 2 2 2 2
q7 3 3 3 3 3
q7 4 4 4 4 4
q7 5 5 5 5 5
q7 8 8 8 NULL 8
select 'q8', idx, dtm1, dtm2 from bug3442b where hour(dtm1)=10 or hour(dtm2)=11;
q8 idx dtm1 dtm2
q8 1 2008-01-25 10:00:00 2011-01-08 11:00:00
q8 2 2009-01-25 10:00:00 2019-01-25 11:00:00
q8 3 2010-01-25 10:00:00 2018-01-25 11:00:00
q8 4 2011-01-25 10:00:00 2017-01-25 11:00:00
q8 5 2012-01-25 10:00:00 2016-01-25 11:00:00
q8 6 NULL 2015-01-25 11:00:00
q8 7 2014-01-25 10:00:00 NULL
q8 8 2013-01-25 10:00:00 2015-01-25 11:00:00
q8 9 2012-01-25 10:00:00 2016-01-25 11:00:00
select 'q9', idx from bug3442b where hour(dtm1)=10 or i1 > 2 or i2 < 5 or f1 > 6 or year(dtm2) < 2018 or vc1 < 9 or
bi2 < 4;
q9 idx
q9 1
q9 2
q9 3
q9 4
q9 5
q9 6
q9 7
q9 8
q9 9
select 'q10', idx from bug3442b where hour(dtm1)=9 or i1 = 2 or i2 = 5 or f2 is null or f1 > 6 or year(dtm2)= 2012 or
vc1 = 9 or bi2 = 4;
q10 idx
q10 4
q10 5
q10 7
q10 9
q10 10
drop table bug3442b;
drop table optest;
select count(*) from nation where n_nationkey < 3 OR NULL;
count(*)
3
select count(*) from nation where n_nationkey > 0 and (n_nationkey < 3 OR NULL);
count(*)
2
select count(*) from nation where n_nationkey > 0 and (n_nationkey < 3 OR n_nationkey is null);
count(*)
2
select count(*) from nation where n_comment like '%ep%' and (n_comment not like '%lee%' OR null);
count(*)
9
select count(*) from nation where n_nationkey > 0 union select count(*) from nation where n_nationkey < 3 OR NULL order by 1;
count(*)
3
24

View File

@ -0,0 +1,21 @@
USE tpch1;
select (sum(case r_regionkey when 1 then r_regionkey else null end) / count(distinct (case r_regionkey when 3 then r_regionkey else null end))) s from region;
s
1.0000
select (sum(case r_regionkey when 1 then r_regionkey else null end) / count(distinct (case r_regionkey when 3 then r_regionkey else null end))) s from region, nation where r_regionkey=n_regionkey;
s
5.0000
select n_regionkey, (sum(case n_nationkey when 1 then n_nationkey else null end) / count(distinct (case n_nationkey when 3 then n_nationkey else null end))) s from nation group by n_regionkey order by n_regionkey;
n_regionkey s
0 NULL
1 1.0000
2 NULL
3 NULL
4 NULL
select n_regionkey, (sum(case r_regionkey when 1 then r_regionkey else null end) / count(distinct (case r_regionkey when 3 then r_regionkey else null end))) s from region, nation where r_regionkey=n_regionkey group by n_regionkey order by n_regionkey;
n_regionkey s
0 NULL
1 NULL
2 NULL
3 NULL
4 NULL

View File

@ -0,0 +1,27 @@
USE tpch1;
select cidx, CAST(132.499*cidx AS DECIMAL(9,2)) from datatypetestm order by cidx;
cidx CAST(132.499*cidx AS DECIMAL(9,2))
1 132.50
2 265.00
3 397.50
4 530.00
5 662.50
6 794.99
7 927.49
8 1059.99
9 1192.49
10 1324.99
11 1457.49
select cidx, convert(132.499*cidx, decimal(9,2)) from datatypetestm order by cidx;
cidx convert(132.499*cidx, decimal(9,2))
1 132.50
2 265.00
3 397.50
4 530.00
5 662.50
6 794.99
7 927.49
8 1059.99
9 1192.49
10 1324.99
11 1457.49

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
USE tpch1;
select p_size from part group by p_size order by count(*) desc limit 1;
p_size
10
select p_size, count(*) from part group by p_size order by count(*) desc limit 1;
p_size count(*)
10 4177
select p_size, count(*) from part group by p_size order by 2 desc limit 1;
p_size count(*)
10 4177
select p_size, count(*) from part group by 1 order by 2 desc limit 1;
p_size count(*)
10 4177
select p_size, count(*) from part group by 1 order by sum(p_size) desc limit 1;
p_size count(*)
48 4056

View File

@ -0,0 +1,31 @@
USE tpch1;
select cidx, cdate from datatypetestm where ADDDATE(CDATE, INTERVAL 3 MICROSECOND) > 0;
cidx cdate
1 1997-01-01
2 1997-01-01
3 1997-01-02
4 1997-01-03
5 1997-01-04
6 2009-12-28
7 2009-12-29
8 2009-12-30
9 2009-12-31
10 2009-12-31
11 2009-12-31
select cidx, cdate from datatypetestm where SUBDATE(CDATE, INTERVAL 3 MICROSECOND) > 0;
cidx cdate
1 1997-01-01
2 1997-01-01
3 1997-01-02
4 1997-01-03
5 1997-01-04
6 2009-12-28
7 2009-12-29
8 2009-12-30
9 2009-12-31
10 2009-12-31
11 2009-12-31
select cidx, cdate from datatypetestm where TIMEDIFF(CDATE,'2007-02-28 22:23:0') > 0;
cidx cdate
select cidx, cchar1 from datatypetestm where CONCAT(CCHAR1,CCHAR3,CCHAR7,'ALOHA') > 0 ;
cidx cchar1

View File

@ -0,0 +1,89 @@
USE tpch1;
drop table if exists bug3483;
Warnings:
Note 1051 Unknown table 'tpch1.bug3483'
create table bug3483 (c1 bigint, c2 decimal(18,2), c3 float, c4 double, c5 char(120), c6 varchar(120)) engine=columnstore;
insert into bug3483 values
(1, 1.1, 1.1, 1.1, '1.1', '1.1'),
(1234567890, 1234567890.1, 1234567890.1, 1234567890.1, '1234567890.1', '1234567890.1'),
(1234567890, 1234567890.8, 1234567890.8, 1234567890.8, '1234567890.8', '1234567890.8'),
(1.234567890e10, 1.2345678901e10, 1.2345678901e10, 1.2345678901e10, '1.2345678901e10', '1.2345678901e10'),
(1234567890, 1234567890123456.78, 1.2345678901e20, 1.2345678901e208, '12345678901234567890', '12345678901234567890'),
(1234567890, 1234567890987654.32, 1.2345678901e38, 1.2345678901e308, '12345678901234567890123456789012345678901234567890', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'),
(-1, -1.1, -1.1, -1.1, '-1.1', '-1.1'),
(-1234567890, -1234567890.1, -1234567890.1, -1234567890.1, '-1234567890.1', '-1234567890.1'),
(-1234567890, -1234567890.8, -1234567890.8, -1234567890.8, '-1234567890.8', '-1234567890.8'),
(-1.234567890e10, -1.2345678901e10, -1.2345678901e10, -1.2345678901e10, '-1.2345678901e10', '-1.2345678901e10'),
(-1234567890, -1234567890123456.78, -1.2345678901e20, -1.2345678901e208, '-12345678901234567890', '-12345678901234567890'),
(-1234567890, -1234567890987654.32, -1.2345678901e38, -1.2345678901e308, '-12345678901234567890123456789012345678901234567890', '-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
select c1, ceil(c1), ceiling(c1), floor(c1), truncate(c1, 2) from bug3483;
c1 ceil(c1) ceiling(c1) floor(c1) truncate(c1, 2)
1 1 1 1 1
1234567890 1234567890 1234567890 1234567890 1234567890
1234567890 1234567890 1234567890 1234567890 1234567890
12345678900 12345678900 12345678900 12345678900 12345678900
1234567890 1234567890 1234567890 1234567890 1234567890
1234567890 1234567890 1234567890 1234567890 1234567890
-1 -1 -1 -1 -1
-1234567890 -1234567890 -1234567890 -1234567890 -1234567890
-1234567890 -1234567890 -1234567890 -1234567890 -1234567890
-12345678900 -12345678900 -12345678900 -12345678900 -12345678900
-1234567890 -1234567890 -1234567890 -1234567890 -1234567890
-1234567890 -1234567890 -1234567890 -1234567890 -1234567890
select c2, ceil(c2), ceiling(c2), floor(c2), truncate(c2, 2) from bug3483;
c2 ceil(c2) ceiling(c2) floor(c2) truncate(c2, 2)
1.10 2 2 1 1.10
1234567890.10 1234567891 1234567891 1234567890 1234567890.10
1234567890.80 1234567891 1234567891 1234567890 1234567890.80
12345678901.00 12345678901 12345678901 12345678901 12345678901.00
1234567890123456.78 1234567890123457 1234567890123457 1234567890123456 1234567890123456.78
1234567890987654.32 1234567890987655 1234567890987655 1234567890987654 1234567890987654.32
-1.10 -1 -1 -2 -1.10
-1234567890.10 -1234567890 -1234567890 -1234567891 -1234567890.10
-1234567890.80 -1234567890 -1234567890 -1234567891 -1234567890.80
-12345678901.00 -12345678901 -12345678901 -12345678902 -12345678901.00
-1234567890123456.78 -1234567890123456 -1234567890123456 -1234567890123457 -1234567890123456.78
-1234567890987654.32 -1234567890987654 -1234567890987654 -1234567890987655 -1234567890987654.32
select c4, ceil(c4), ceiling(c4), floor(c4) from bug3483;
c4 ceil(c4) ceiling(c4) floor(c4)
1.1 2 2 1
1234567890.1 1234567891 1234567891 1234567890
1234567890.8 1234567891 1234567891 1234567890
12345678901 12345678901 12345678901 12345678901
1.2345678901e208 12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1.2345678901e308 123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-1.1 -1 -1 -2
-1234567890.1 -1234567890 -1234567890 -1234567891
-1234567890.8 -1234567890 -1234567890 -1234567891
-12345678901 -12345678901 -12345678901 -12345678901
-1.2345678901e208 -12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -12345678901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-1.2345678901e308 -123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -123456789010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
select c5, ceil(c5), ceiling(c5), floor(c5), truncate(c5, 2) from bug3483;
c5 ceil(c5) ceiling(c5) floor(c5) truncate(c5, 2)
1.1 2 2 1 1.10
1234567890.1 1234567891 1234567891 1234567890 1234567890.09
1234567890.8 1234567891 1234567891 1234567890 1234567890.80
1.2345678901e10 12345678901 12345678901 12345678901 12345678901.00
12345678901234567890 12345678901234567000 12345678901234567000 12345678901234567000 -92233720368547760.00
12345678901234567890123456789012345678901234567890 12345678901234567000000000000000000000000000000000 12345678901234567000000000000000000000000000000000 12345678901234567000000000000000000000000000000000 -92233720368547760.00
-1.1 -1 -1 -2 -1.10
-1234567890.1 -1234567890 -1234567890 -1234567891 -1234567890.09
-1234567890.8 -1234567890 -1234567890 -1234567891 -1234567890.80
-1.2345678901e10 -12345678901 -12345678901 -12345678901 -12345678901.00
-12345678901234567890 -12345678901234567000 -12345678901234567000 -12345678901234567000 -92233720368547760.00
-12345678901234567890123456789012345678901234567890 -12345678901234567000000000000000000000000000000000 -12345678901234567000000000000000000000000000000000 -12345678901234567000000000000000000000000000000000 -92233720368547760.00
select c6, ceil(c6), ceiling(c6), floor(c6), truncate(c6, 2) from bug3483;
c6 ceil(c6) ceiling(c6) floor(c6) truncate(c6, 2)
1.1 2 2 1 1.10
1234567890.1 1234567891 1234567891 1234567890 1234567890.09
1234567890.8 1234567891 1234567891 1234567890 1234567890.80
1.2345678901e10 12345678901 12345678901 12345678901 12345678901.00
12345678901234567890 12345678901234567000 12345678901234567000 12345678901234567000 -92233720368547760.00
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 -92233720368547760.00
-1.1 -1 -1 -2 -1.10
-1234567890.1 -1234567890 -1234567890 -1234567891 -1234567890.09
-1234567890.8 -1234567890 -1234567890 -1234567891 -1234567890.80
-1.2345678901e10 -12345678901 -12345678901 -12345678901 -12345678901.00
-12345678901234567890 -12345678901234567000 -12345678901234567000 -12345678901234567000 -92233720368547760.00
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 -1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 -1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000 -92233720368547760.00
drop table bug3483;

View File

@ -0,0 +1,32 @@
USE tpch1;
set autocommit=0;
update datatypetestm set cchar255=convert(cdate,date),cvchar255=convert(cdatetime,date);
select cchar255, cvchar255 from datatypetestm;
cchar255 cvchar255
1997-01-01 1997-01-01
1997-01-01 1997-01-01
1997-01-02 1997-01-02
1997-01-03 1997-01-03
1997-01-04 1997-01-04
2009-12-28 2009-12-31
2009-12-29 2009-12-31
2009-12-30 2009-12-31
2009-12-31 2009-12-31
2009-12-31 2009-12-31
2009-12-31 2009-12-31
rollback;
update datatypetestm set cidx=cidx*10, CCHAR255=DATE(CDATE) where DATE(CDATE) >0;
select cidx, cchar255 from datatypetestm;
cidx cchar255
10 1997-01-01
20 1997-01-01
30 1997-01-02
40 1997-01-03
50 1997-01-04
60 2009-12-28
70 2009-12-29
80 2009-12-30
90 2009-12-31
100 2009-12-31
110 2009-12-31
rollback;

View File

@ -0,0 +1,159 @@
USE tpch1;
drop table if exists bug3488;
Warnings:
Note 1051 Unknown table 'tpch1.bug3488'
create table bug3488 (c1 bigint, c2 decimal(18,2), c3 float, c4 double, c5 char(120), c6 varchar(120)) engine=columnstore;
insert into bug3488 values
(1, 1.1, 1.1, 1.1, '1.1', '1.1'),
(1234567890, 1234567890.1, 1234567890.1, 1234567890.1, '1234567890.1', '1234567890.1'),
(1234567890, 1234567890.8, 1234567890.8, 1234567890.8, '1234567890.8', '1234567890.8'),
(1.234567890e10, 1.2345678901e10, 1.2345678901e10, 1.2345678901e10, '1.2345678901e10', '1.2345678901e10'),
(1234567890, 1234567890123456.78, 1.2345678901e20, 1.2345678901e208, '12345678901234567890', '12345678901234567890'),
(1234567890, 1234567890987654.32, 1.2345678901e38, 1.2345678901e308, '12345678901234567890123456789012345678901234567890', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'),
(-1, -1.1, -1.1, -1.1, '-1.1', '-1.1'),
(-1234567890, -1234567890.1, -1234567890.1, -1234567890.1, '-1234567890.1', '-1234567890.1'),
(-1234567890, -1234567890.8, -1234567890.8, -1234567890.8, '-1234567890.8', '-1234567890.8'),
(-1.234567890e10, -1.2345678901e10, -1.2345678901e10, -1.2345678901e10, '-1.2345678901e10', '-1.2345678901e10'),
(-1234567890, -1234567890123456.78, -1.2345678901e20, -1.2345678901e208, '-12345678901234567890', '-12345678901234567890'),
(-1234567890, -1234567890987654.32, -1.2345678901e38, -1.2345678901e308, '-12345678901234567890123456789012345678901234567890', '-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
select c1, format(c1, -2), format(c1, 0), format(c1, 2) from bug3488;
c1 format(c1, -2) format(c1, 0) format(c1, 2)
1 1 1 1.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
12345678900 12,345,678,900 12,345,678,900 12,345,678,900.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
-1 -1 -1 -1.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-12345678900 -12,345,678,900 -12,345,678,900 -12,345,678,900.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
select c2, format(c2, -2), format(c2, 0), format(c2, 2) from bug3488;
c2 format(c2, -2) format(c2, 0) format(c2, 2)
1.10 1 1 1.10
1234567890.10 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.80 1,234,567,891 1,234,567,891 1,234,567,890.80
12345678901.00 12,345,678,901 12,345,678,901 12,345,678,901.00
1234567890123456.78 1,234,567,890,123,457 1,234,567,890,123,457 1,234,567,890,123,456.78
1234567890987654.32 1,234,567,890,987,654 1,234,567,890,987,654 1,234,567,890,987,654.32
-1.10 -1 -1 -1.10
-1234567890.10 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.80 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-12345678901.00 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-1234567890123456.78 -1,234,567,890,123,457 -1,234,567,890,123,457 -1,234,567,890,123,456.78
-1234567890987654.32 -1,234,567,890,987,654 -1,234,567,890,987,654 -1,234,567,890,987,654.32
select c4, format(c4, -2), format(c4, 0), format(c4, 2) from bug3488;
c4 format(c4, -2) format(c4, 0) format(c4, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
12345678901 12,345,678,901 12,345,678,901 12,345,678,901.00
1.2345678901e208 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096.00
1.2345678901e308 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-12345678901 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-1.2345678901e208 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096.00
-1.2345678901e308 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176.00
select c5, format(c5, -2), format(c5, 0), format(c5, 2) from bug3488;
c5 format(c5, -2) format(c5, 0) format(c5, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
1.2345678901e10 12,345,678,901 12,345,678,901 12,345,678,901.00
12345678901234567890 12,345,678,901,234,567,168 12,345,678,901,234,567,168 12,345,678,901,234,567,168.00
12345678901234567890123456789012345678901234567890 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-1.2345678901e10 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-12345678901234567890 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168.00
-12345678901234567890123456789012345678901234567890 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656.00
select c6, format(c6, -2), format(c6, 0), format(c6, 2) from bug3488;
c6 format(c6, -2) format(c6, 0) format(c6, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
1.2345678901e10 12,345,678,901 12,345,678,901 12,345,678,901.00
12345678901234567890 12,345,678,901,234,567,168 12,345,678,901,234,567,168 12,345,678,901,234,567,168.00
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-1.2345678901e10 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-12345678901234567890 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168.00
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400.00
select c1, format(c1, -2), format(c1, 0), format(c1, 2) from (select * from bug3488) sub;
c1 format(c1, -2) format(c1, 0) format(c1, 2)
1 1 1 1.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
12345678900 12,345,678,900 12,345,678,900 12,345,678,900.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
1234567890 1,234,567,890 1,234,567,890 1,234,567,890.00
-1 -1 -1 -1.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-12345678900 -12,345,678,900 -12,345,678,900 -12,345,678,900.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
-1234567890 -1,234,567,890 -1,234,567,890 -1,234,567,890.00
select c2, format(c2, -2), format(c2, 0), format(c2, 2) from (select * from bug3488) sub;
c2 format(c2, -2) format(c2, 0) format(c2, 2)
1.10 1 1 1.10
1234567890.10 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.80 1,234,567,891 1,234,567,891 1,234,567,890.80
12345678901.00 12,345,678,901 12,345,678,901 12,345,678,901.00
1234567890123456.78 1,234,567,890,123,457 1,234,567,890,123,457 1,234,567,890,123,456.78
1234567890987654.32 1,234,567,890,987,654 1,234,567,890,987,654 1,234,567,890,987,654.32
-1.10 -1 -1 -1.10
-1234567890.10 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.80 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-12345678901.00 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-1234567890123456.78 -1,234,567,890,123,457 -1,234,567,890,123,457 -1,234,567,890,123,456.78
-1234567890987654.32 -1,234,567,890,987,654 -1,234,567,890,987,654 -1,234,567,890,987,654.32
select c4, format(c4, -2), format(c4, 0), format(c4, 2) from (select * from bug3488) sub;
c4 format(c4, -2) format(c4, 0) format(c4, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
12345678901 12,345,678,901 12,345,678,901 12,345,678,901.00
1.2345678901e208 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096.00
1.2345678901e308 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-12345678901 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-1.2345678901e208 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096 -12,345,678,900,999,999,233,702,015,044,958,622,693,183,936,076,284,780,362,474,237,068,469,512,109,091,905,769,475,650,956,406,726,044,392,324,291,673,911,579,673,435,841,679,894,322,111,543,979,736,271,655,002,247,372,787,505,331,443,016,571,555,565,037,648,415,185,327,620,096.00
-1.2345678901e308 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176 -123,456,789,010,000,003,013,769,221,302,475,265,236,473,260,868,443,180,100,707,231,243,197,604,846,678,491,603,701,791,833,592,622,260,767,755,587,241,551,101,641,071,285,970,395,887,287,299,936,335,501,367,119,307,918,969,722,323,877,313,450,129,317,836,543,043,061,686,055,660,760,257,877,809,447,984,085,651,532,908,811,501,208,193,676,911,145,259,694,125,922,340,467,359,889,260,267,302,158,242,651,570,176.00
select c5, format(c5, -2), format(c5, 0), format(c5, 2) from (select * from bug3488) sub;
c5 format(c5, -2) format(c5, 0) format(c5, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
1.2345678901e10 12,345,678,901 12,345,678,901 12,345,678,901.00
12345678901234567890 12,345,678,901,234,567,168 12,345,678,901,234,567,168 12,345,678,901,234,567,168.00
12345678901234567890123456789012345678901234567890 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-1.2345678901e10 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-12345678901234567890 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168.00
-12345678901234567890123456789012345678901234567890 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656 -12,345,678,901,234,566,660,398,341,115,085,767,575,755,770,822,656.00
select c6, format(c6, -2), format(c6, 0), format(c6, 2) from (select * from bug3488) sub;
c6 format(c6, -2) format(c6, 0) format(c6, 2)
1.1 1 1 1.10
1234567890.1 1,234,567,890 1,234,567,890 1,234,567,890.10
1234567890.8 1,234,567,891 1,234,567,891 1,234,567,890.80
1.2345678901e10 12,345,678,901 12,345,678,901 12,345,678,901.00
12345678901234567890 12,345,678,901,234,567,168 12,345,678,901,234,567,168 12,345,678,901,234,567,168.00
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400.00
-1.1 -1 -1 -1.10
-1234567890.1 -1,234,567,890 -1,234,567,890 -1,234,567,890.10
-1234567890.8 -1,234,567,891 -1,234,567,891 -1,234,567,890.80
-1.2345678901e10 -12,345,678,901 -12,345,678,901 -12,345,678,901.00
-12345678901234567890 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168 -12,345,678,901,234,567,168.00
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400 -1,234,567,890,123,456,718,070,421,139,719,794,622,419,313,690,432,875,243,234,074,448,189,700,007,474,323,004,944,782,828,398,182,400.00
drop table bug3488;

View File

@ -0,0 +1,55 @@
USE ssb1;
select format(count(lo_orderdate), 0) num_days,
format(min(lo_orderdate), 0),
format(max(lo_orderdate), 0),
format(avg(daily_cnt), 0) avg_rows_per_day,
format(sum(daily_cnt), 0) total_rows,
format(sum(daily_cnt * d_lastdayinweekfl), 0) total_sales_last_day_in_week,
format(sum(daily_cnt * d_lastdayinmonthfl), 0) total_sales_last_day_in_month,
format(sum(daily_cnt * d_holidayfl), 0) total_sales_on_holidays,
format(sum(daily_cnt * d_weekdayfl), 0) total_weekday_sales,
format(sum(case when d_weekdayfl = 0 then daily_cnt else 0 end), 0) total_weekend_sales
from (select lo_orderdate, count(*) daily_cnt
from lineorder where lo_orderdate in (19920102,19920101,19930101) group by 1) a,
dateinfo where d_datekey = lo_orderdate;
num_days format(min(lo_orderdate), 0) format(max(lo_orderdate), 0) avg_rows_per_day total_rows total_sales_last_day_in_week total_sales_last_day_in_month total_sales_on_holidays total_weekday_sales total_weekend_sales
3 19,920,101 19,930,101 2,402 7,207 2,366 7,207 4,863 4,841 2,366
select count(lo_orderdate) num_days,
min(lo_orderdate),
max(lo_orderdate),
avg(daily_cnt) avg_rows_per_day,
sum(daily_cnt) total_rows,
sum(daily_cnt * d_lastdayinweekfl) total_sales_last_day_in_week,
sum(daily_cnt * d_lastdayinmonthfl) total_sales_last_day_in_month,
sum(daily_cnt * d_holidayfl) total_sales_on_holidays,
sum(daily_cnt * d_weekdayfl) total_weekday_sales,
sum(case when d_weekdayfl = 0 then daily_cnt else 0 end) total_weekend_sales,
format(count(lo_orderdate), 0) num_days,
format(min(lo_orderdate), 0),
format(max(lo_orderdate), 0),
format(avg(daily_cnt), 0) avg_rows_per_day,
format(sum(daily_cnt), 0) total_rows1,
format(sum(daily_cnt * d_lastdayinweekfl), 0) total_sales_last_day_in_week,
format(sum(daily_cnt * d_lastdayinmonthfl), 0) total_sales_last_day_in_month,
format(sum(daily_cnt * d_holidayfl), 0) total_sales_on_holidays,
format(sum(daily_cnt * d_weekdayfl), 0) total_weekday_sales,
format(sum(case when d_weekdayfl = 0 then daily_cnt else 0 end), 0) total_weekend_sales
from (select lo_orderdate, count(*) daily_cnt
from lineorder where lo_orderdate in (19920102,19920101,19930101) group by 1) a,
dateinfo where d_datekey = lo_orderdate;
num_days min(lo_orderdate) max(lo_orderdate) avg_rows_per_day total_rows total_sales_last_day_in_week total_sales_last_day_in_month total_sales_on_holidays total_weekday_sales total_weekend_sales num_days format(min(lo_orderdate), 0) format(max(lo_orderdate), 0) avg_rows_per_day total_rows1 total_sales_last_day_in_week total_sales_last_day_in_month total_sales_on_holidays total_weekday_sales total_weekend_sales
3 19920101 19930101 2402.3333 7207 2366 7207 4863 4841 2366 3 19,920,101 19,930,101 2,402 7,207 2,366 7,207 4,863 4,841 2,366
select count(lo_orderdate) num_days, sum(daily_cnt * d_lastdayinweekfl)
##-- ,format(cast(sum(daily_cnt * d_lastdayinweekfl) as char), 0) total_sales_last_day_in_week
from (select lo_orderdate, count(*) daily_cnt
from lineorder where lo_orderdate in (19920102,19920101,19930101) group by 1) a,
dateinfo where d_datekey = lo_orderdate;
num_days sum(daily_cnt * d_lastdayinweekfl)
3 2366
select count(lo_orderdate) num_days, sum(daily_cnt * d_lastdayinweekfl)
,format(cast(sum(daily_cnt * d_lastdayinweekfl) as char), 0) total_sales_last_day_in_week
from (select lo_orderdate, count(*) daily_cnt
from lineorder where lo_orderdate in (19920102,19920101,19930101) group by 1) a,
dateinfo where d_datekey = lo_orderdate;
num_days sum(daily_cnt * d_lastdayinweekfl) total_sales_last_day_in_week
3 2366 2,366

View File

@ -0,0 +1,395 @@
USE tpch1;
drop table if exists bug3496;
Warnings:
Note 1051 Unknown table 'tpch1.bug3496'
create table `bug3496` (`c1` int(11) default null,`c2` char(6) default null, `c3` char(11) default null) engine=columnstore;
insert into bug3496 values
(1, 'abc', 'abc'),
(2, 'abbc', 'abbc'),
(3, 'acbc', 'acbc'),
(4, 'a.c', 'a.c'),
(5, 'a[bc]d', 'a[bc]d'),
(6, 'a[]d', 'a[]d'),
(7, 'a[bcd', 'a[bcd'),
(8, 'abc]d', 'abc]d'),
(9, 'a{bc}d', 'a{bc}d'),
(10, 'a{}d', 'a{}d'),
(11, 'a{bcd', 'a{bcd'),
(12, 'abc}d', 'abc}d'),
(13, 'a(b)c', 'a(b)c'),
(14, 'a()c', 'a()c'),
(15, 'ab(bc', 'ab(bc'),
(16, 'abb)c', 'abb)c'),
(17, 'a\c', 'a\c'),
(18, 'a*bc', 'a*bc'),
(19, 'a.*c', 'a.*c'),
(20, 'a+c', 'a+c'),
(21, 'a?c', 'a?c'),
(22, 'a|c', 'a|c'),
(23, 'a^c', 'a^c'),
(24, 'a$c', 'a$c'),
(25, 'a&c', 'a&c'),
(26, 'a(b)', 'a(b)|(c)');
select c1, c2 from bug3496 where c2 like '%.%';
c1 c2
4 a.c
19 a.*c
select c1, c2 from bug3496 where c2 like 'a.%';
c1 c2
4 a.c
19 a.*c
select c1, c2 from bug3496 where c2 like '%[%';
c1 c2
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c2 from bug3496 where c2 like 'a[%';
c1 c2
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c2 from bug3496 where c2 like 'a[%';
c1 c2
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c2 from bug3496 where c2 like 'a[bc]%';
c1 c2
5 a[bc]d
select c1, c2 from bug3496 where c2 like 'a[%]%';
c1 c2
5 a[bc]d
6 a[]d
select c1, c2 from bug3496 where c2 like '%{%';
c1 c2
9 a{bc}d
10 a{}d
11 a{bcd
select c1, c2 from bug3496 where c2 like 'a{%';
c1 c2
9 a{bc}d
10 a{}d
11 a{bcd
select c1, c2 from bug3496 where c2 like '%}%';
c1 c2
9 a{bc}d
10 a{}d
12 abc}d
select c1, c2 from bug3496 where c2 like 'a}%';
c1 c2
select c1, c2 from bug3496 where c2 like '%{%}%';
c1 c2
9 a{bc}d
10 a{}d
select c1, c2 from bug3496 where c2 like '%(%';
c1 c2
13 a(b)c
14 a()c
15 ab(bc
26 a(b)
select c1, c2 from bug3496 where c2 like 'a(%';
c1 c2
13 a(b)c
14 a()c
26 a(b)
select c1, c2 from bug3496 where c2 like '%)%';
c1 c2
13 a(b)c
14 a()c
16 abb)c
26 a(b)
select c1, c2 from bug3496 where c2 like 'a)%';
c1 c2
select c1, c2 from bug3496 where c2 like '%(%)%';
c1 c2
13 a(b)c
14 a()c
26 a(b)
select c1, c2 from bug3496 where c2 like '%\%';
c1 c2
select c1, c2 from bug3496 where c2 like 'a\%';
c1 c2
select c1, c2 from bug3496 where c2 like '%*%';
c1 c2
18 a*bc
19 a.*c
select c1, c2 from bug3496 where c2 like 'a*%';
c1 c2
18 a*bc
select c1, c2 from bug3496 where c2 like '%+%';
c1 c2
20 a+c
select c1, c2 from bug3496 where c2 like 'a+%';
c1 c2
20 a+c
select c1, c2 from bug3496 where c2 like '%?%';
c1 c2
21 a?c
select c1, c2 from bug3496 where c2 like 'a?%';
c1 c2
21 a?c
select c1, c2 from bug3496 where c2 like '%|%';
c1 c2
22 a|c
select c1, c2 from bug3496 where c2 like 'a|%';
c1 c2
22 a|c
select c1, c2 from bug3496 where c2 like '%^%';
c1 c2
23 a^c
select c1, c2 from bug3496 where c2 like 'a^%';
c1 c2
23 a^c
select c1, c2 from bug3496 where c2 like '%$%';
c1 c2
24 a$c
select c1, c2 from bug3496 where c2 like 'a$%';
c1 c2
24 a$c
select c1, c2 from bug3496 where c2 like '%&%';
c1 c2
25 a&c
select c1, c2 from bug3496 where c2 like 'a&%';
c1 c2
25 a&c
select c1, c2 from bug3496 where c2 like '%_%';
c1 c2
1 abc
2 abbc
3 acbc
4 a.c
5 a[bc]d
6 a[]d
7 a[bcd
8 abc]d
9 a{bc}d
10 a{}d
11 a{bcd
12 abc}d
13 a(b)c
14 a()c
15 ab(bc
16 abb)c
17 ac
18 a*bc
19 a.*c
20 a+c
21 a?c
22 a|c
23 a^c
24 a$c
25 a&c
26 a(b)
select c1, c2 from bug3496 where c2 like 'a_%';
c1 c2
1 abc
2 abbc
3 acbc
4 a.c
5 a[bc]d
6 a[]d
7 a[bcd
8 abc]d
9 a{bc}d
10 a{}d
11 a{bcd
12 abc}d
13 a(b)c
14 a()c
15 ab(bc
16 abb)c
17 ac
18 a*bc
19 a.*c
20 a+c
21 a?c
22 a|c
23 a^c
24 a$c
25 a&c
26 a(b)
select c1, c2 from bug3496 where c2 like 'a(b)|(c)%';
c1 c2
select c1, c3 from bug3496 where c3 like '%.%';
c1 c3
4 a.c
19 a.*c
select c1, c3 from bug3496 where c3 like 'a.%';
c1 c3
4 a.c
19 a.*c
select c1, c3 from bug3496 where c3 like '%[%';
c1 c3
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c3 from bug3496 where c3 like 'a[%';
c1 c3
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c3 from bug3496 where c3 like 'a[%';
c1 c3
5 a[bc]d
6 a[]d
7 a[bcd
select c1, c3 from bug3496 where c3 like 'a[bc]%';
c1 c3
5 a[bc]d
select c1, c3 from bug3496 where c3 like 'a[%]%';
c1 c3
5 a[bc]d
6 a[]d
select c1, c3 from bug3496 where c3 like '%{%';
c1 c3
9 a{bc}d
10 a{}d
11 a{bcd
select c1, c3 from bug3496 where c3 like 'a{%';
c1 c3
9 a{bc}d
10 a{}d
11 a{bcd
select c1, c3 from bug3496 where c3 like '%}%';
c1 c3
9 a{bc}d
10 a{}d
12 abc}d
select c1, c3 from bug3496 where c3 like 'a}%';
c1 c3
select c1, c3 from bug3496 where c3 like '%{%}%';
c1 c3
9 a{bc}d
10 a{}d
select c1, c3 from bug3496 where c3 like '%(%';
c1 c3
13 a(b)c
14 a()c
15 ab(bc
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like 'a(%';
c1 c3
13 a(b)c
14 a()c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like '%)%';
c1 c3
13 a(b)c
14 a()c
16 abb)c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like 'a)%';
c1 c3
select c1, c3 from bug3496 where c3 like '%(%)%';
c1 c3
13 a(b)c
14 a()c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like '%\%';
c1 c3
select c1, c3 from bug3496 where c3 like 'a\%';
c1 c3
select c1, c3 from bug3496 where c3 like '%*%';
c1 c3
18 a*bc
19 a.*c
select c1, c3 from bug3496 where c3 like 'a*%';
c1 c3
18 a*bc
select c1, c3 from bug3496 where c3 like '%+%';
c1 c3
20 a+c
select c1, c3 from bug3496 where c3 like 'a+%';
c1 c3
20 a+c
select c1, c3 from bug3496 where c3 like '%?%';
c1 c3
21 a?c
select c1, c3 from bug3496 where c3 like 'a?%';
c1 c3
21 a?c
select c1, c3 from bug3496 where c3 like '%|%';
c1 c3
22 a|c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like 'a|%';
c1 c3
22 a|c
select c1, c3 from bug3496 where c3 like '%^%';
c1 c3
23 a^c
select c1, c3 from bug3496 where c3 like 'a^%';
c1 c3
23 a^c
select c1, c3 from bug3496 where c3 like '%$%';
c1 c3
24 a$c
select c1, c3 from bug3496 where c3 like 'a$%';
c1 c3
24 a$c
select c1, c3 from bug3496 where c3 like '%&%';
c1 c3
25 a&c
select c1, c3 from bug3496 where c3 like 'a&%';
c1 c3
25 a&c
select c1, c3 from bug3496 where c3 like '%_%';
c1 c3
1 abc
2 abbc
3 acbc
4 a.c
5 a[bc]d
6 a[]d
7 a[bcd
8 abc]d
9 a{bc}d
10 a{}d
11 a{bcd
12 abc}d
13 a(b)c
14 a()c
15 ab(bc
16 abb)c
17 ac
18 a*bc
19 a.*c
20 a+c
21 a?c
22 a|c
23 a^c
24 a$c
25 a&c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like 'a_%';
c1 c3
1 abc
2 abbc
3 acbc
4 a.c
5 a[bc]d
6 a[]d
7 a[bcd
8 abc]d
9 a{bc}d
10 a{}d
11 a{bcd
12 abc}d
13 a(b)c
14 a()c
15 ab(bc
16 abb)c
17 ac
18 a*bc
19 a.*c
20 a+c
21 a?c
22 a|c
23 a^c
24 a$c
25 a&c
26 a(b)|(c)
select c1, c3 from bug3496 where c3 like 'a(b)|(c)%';
c1 c3
26 a(b)|(c)
drop table bug3496;

View File

@ -0,0 +1,49 @@
USE tpch1;
drop table if exists bug3497a;
Warnings:
Note 1051 Unknown table 'tpch1.bug3497a'
drop table if exists bug3497b;
Warnings:
Note 1051 Unknown table 'tpch1.bug3497b'
CREATE TABLE bug3497a (col1 int, col2 varchar(10)) engine=columnstore;
INSERT INTO bug3497a VALUES(1,'trudy');
INSERT INTO bug3497a VALUES(2,'peter');
INSERT INTO bug3497a VALUES(3,'sanja');
INSERT INTO bug3497a VALUES(4,'monty');
INSERT INTO bug3497a VALUES(5,'david');
INSERT INTO bug3497a VALUES(6,'kent');
INSERT INTO bug3497a VALUES(7,'carsten');
INSERT INTO bug3497a VALUES(8,'ranger');
INSERT INTO bug3497a VALUES(10,'matt');
CREATE TABLE bug3497b (col1 int, col2 int, col3 char(1)) engine=columnstore;
INSERT INTO bug3497b VALUES (1,1,'y');
INSERT INTO bug3497b VALUES (1,2,'y');
INSERT INTO bug3497b VALUES (2,1,'n');
INSERT INTO bug3497b VALUES (3,1,'n');
INSERT INTO bug3497b VALUES (4,1,'y');
INSERT INTO bug3497b VALUES (4,2,'n');
INSERT INTO bug3497b VALUES (4,3,'n');
INSERT INTO bug3497b VALUES (6,1,'n');
INSERT INTO bug3497b VALUES (8,1,'y');
SELECT a.col1,a.col2,b.col2,b.col3 FROM bug3497b b RIGHT JOIN bug3497a a ON
a.col1=b.col1 WHERE a.col1 IN (1,5,9) AND b.col2=(SELECT MAX(col2) FROM bug3497b b2
WHERE b2.col1=b.col1) order by 1, 2;
col1 col2 col2 col3
1 trudy 2 y
SELECT distinct a.col1,a.col2,b.col2,b.col3 FROM bug3497b b RIGHT JOIN bug3497a a ON
a.col1=b.col1 WHERE b.col2=(SELECT MAX(col2) FROM bug3497b b2 WHERE b2.col1=b.col1)
order by 1, 2;
col1 col2 col2 col3
1 trudy 2 y
2 peter 1 n
3 sanja 1 n
4 monty 3 n
6 kent 1 n
8 ranger 1 y
SELECT a.col1,a.col2,b.col2,b.col3 FROM bug3497b b RIGHT JOIN bug3497a a ON
a.col1=b.col1 WHERE b.col1 IN (1,5,9) AND b.col2=(SELECT MAX(col2) FROM bug3497b b2
WHERE b2.col1=b.col1) order by 1, 2;
col1 col2 col2 col3
1 trudy 2 y
drop table if exists bug3497a;
drop table if exists bug3497b;

View File

@ -0,0 +1,42 @@
USE tpch1;
select rand(0) from region;
rand(0)
0.15522042769493574
0.620881741513388
0.6387474552157777
0.33109208227236947
0.7392180764481594
select rand(-2) from region order by 1;
rand(-2)
0.11941688239520125
0.12422665872073421
0.6325218050112219
0.6548542125661431
0.804358408604151
select rand(2) from region order by rand(1);
rand(2)
0.354211017819318
0.8578261098431667
0.64497318737672
0.6555866465490187
0.12234661925802624
select * from (select n_nationkey, rand(1) from nation limit 1) x;
n_nationkey rand(1)
0 0.40540353712197724
select * from (select n_nationkey from nation order by rand(1) limit 1 )a;
n_nationkey
22
select rand(r_regionkey) from region;
rand(r_regionkey)
0.15522042769493574
0.40540353712197724
0.6555866465490187
0.9057697559760601
0.15595286540310166
select rand(r_name) from region;
rand(r_name)
0.15522042769493574
0.15522042769493574
0.15522042769493574
0.15522042769493574
0.15522042769493574

View File

@ -0,0 +1,7 @@
USE ssb1;
select 'A' A,REVERSE(d_datekey), 'B' B from dateinfo where d_datekey = 19980404;
A REVERSE(d_datekey) B
A 40408991 B
select 'A' A,REVERSE(d_datekey), md5(d_datekey) from dateinfo where d_datekey = 19980404;
A REVERSE(d_datekey) md5(d_datekey)
A 40408991 35472a41f34f6cffd1b4157cdc42d360

View File

@ -0,0 +1,109 @@
USE tpch1;
drop table if exists qa_dict_join_1;
drop table if exists qa_dict_join_2;
Create table qa_dict_join_1 (
CIDX INTEGER,
CBIGINT BIGINT,
CDECIMAL1 DECIMAL(1),
CDECIMAL4 DECIMAL(4),
CDECIMAL4_2 DECIMAL(4,2),
CDECIMAL5 DECIMAL(5),
CDECIMAL9 DECIMAL(9),
CDECIMAL9_2 DECIMAL(9,2),
CDECIMAL10 DECIMAL(10),
CDECIMAL18 DECIMAL(18),
CDECIMAL18_2 DECIMAL(18,2),
CINTEGER INTEGER,
CSMALLINT SMALLINT,
CTINYINT TINYINT,
CDATE DATE,
CDATETIME DATETIME,
CCHAR1 CHAR(1),
CCHAR2 CHAR(2),
CCHAR3 CHAR(3),
CCHAR4 CHAR(4),
CCHAR5 CHAR(5),
CCHAR6 CHAR(6),
CCHAR7 CHAR(7),
CCHAR8 CHAR(8),
CCHAR9 CHAR(9),
CCHAR255 CHAR(255),
CVCHAR1 VARCHAR(1),
CVCHAR2 VARCHAR(2),
CVCHAR3 VARCHAR(3),
CVCHAR4 VARCHAR(4),
CVCHAR5 VARCHAR(5),
CVCHAR6 VARCHAR(6),
CVCHAR7 VARCHAR(7),
CVCHAR8 VARCHAR(8),
CVCHAR255 VARCHAR(255)
) engine=columnstore;
insert into qa_dict_join_1 values (1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
insert into qa_dict_join_1 values (2,0,0,0,0,0,0,0,0,0,0,0,0,0,'1000-01-01','1000-01-01 00:00:00',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
insert into qa_dict_join_1 values (3,0,-9,-9999,-99.99,-99999,-999999999,-9999999.99,-9999999999,-999999999999999999,-9999999999999999.99,-2147483646,-32766,-126,'1000-01-01','1000-01-01 00:00:00','a','aa','aaa','aaaa','aaaaa','aaaaaa','aaaaaaa','aaaaaaaa','aaaaaaaa','aaaaaaaaaa','a','aa','aaa','aaaa','aaaaa','aaaaaa','aaaaaaa','aaaaaaaa','aaaaaaaaaa');
Create table qa_dict_join_2 (
CIDX INTEGER,
CBIGINT BIGINT,
CDECIMAL1 DECIMAL(1),
CDECIMAL4 DECIMAL(4),
CDECIMAL4_2 DECIMAL(4,2),
CDECIMAL5 DECIMAL(5),
CDECIMAL9 DECIMAL(9),
CDECIMAL9_2 DECIMAL(9,2),
CDECIMAL10 DECIMAL(10),
CDECIMAL18 DECIMAL(18),
CDECIMAL18_2 DECIMAL(18,2),
CINTEGER INTEGER,
CSMALLINT SMALLINT,
CTINYINT TINYINT,
CDATE DATE,
CDATETIME DATETIME,
CCHAR1 CHAR(1),
CCHAR2 CHAR(2),
CCHAR3 CHAR(3),
CCHAR4 CHAR(4),
CCHAR5 CHAR(5),
CCHAR6 CHAR(6),
CCHAR7 CHAR(7),
CCHAR8 CHAR(8),
CCHAR9 CHAR(9),
CCHAR255 CHAR(255),
CVCHAR1 VARCHAR(1),
CVCHAR2 VARCHAR(2),
CVCHAR3 VARCHAR(3),
CVCHAR4 VARCHAR(4),
CVCHAR5 VARCHAR(5),
CVCHAR6 VARCHAR(6),
CVCHAR7 VARCHAR(7),
CVCHAR8 VARCHAR(8),
CVCHAR255 VARCHAR(255)
) engine=columnstore;
insert into qa_dict_join_2 values (1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
insert into qa_dict_join_2 values (2,0,0,0,0,0,0,0,0,0,0,0,0,0,'1000-01-01','1000-01-01 00:00:00',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
insert into qa_dict_join_2 values (3,0,-9,-9999,-99.99,-99999,-999999999,-9999999.99,-9999999999,-999999999999999999,-9999999999999999.99,-2147483646,-32766,-126,'1000-01-01','1000-01-01 00:00:00','a','aa','aaa','aaaa','aaaaa','aaaaaa','aaaaaaa','aaaaaaaa','aaaaaaaa','aaaaaaaaaa','a','aa','aaa','aaaa','aaaaa','aaaaaa','aaaaaaa','aaaaaaaa','aaaaaaaaaa');
select a.cidx, b.cidx from qa_dict_join_1 a, qa_dict_join_2 b where a.CBIGINT = b.CBIGINT order by a.cidx, b.cidx;
cidx cidx
2 2
2 3
3 2
3 3
select b.cidx from qa_dict_join_1 a, qa_dict_join_2 b where a.CBIGINT = b.CBIGINT order by a.cidx, b.cidx;
cidx
2
3
2
3
select a.cidx, b.cidx from qa_dict_join_1 a, qa_dict_join_2 b where a.CBIGINT = b.CBIGINT order by abs(a.cidx), abs(b.cidx);
cidx cidx
2 2
2 3
3 2
3 3
select abs(a.cidx), b.cidx from qa_dict_join_1 a, qa_dict_join_2 b where a.CBIGINT = b.CBIGINT order by a.cidx, b.cidx;
abs(a.cidx) cidx
2 2
2 3
3 2
3 3
drop table if exists qa_dict_join_1;
drop table if exists qa_dict_join_2;

View File

@ -0,0 +1,11 @@
USE ssb1;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;
select lo_orderkey into outfile '/tmp/bug3520.txt' from (select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1 union all select lo_orderkey from lineorder group by 1) x;

View File

@ -0,0 +1,56 @@
USE tpch1;
select
count(distinct c1) c1,
count(distinct c2) c2,
count(distinct c3) c3,
count(distinct c4) c4,
count(distinct c5) c5,
count(distinct c6) c6,
count(distinct c7) c7,
count(distinct c8) c8,
count(distinct c9) c9,
count(distinct c10) c10,
count(distinct c11) c11,
count(distinct c12) c12,
count(distinct c13) c13,
count(distinct c14) c14,
count(distinct c15) c15,
count(distinct c16) c16,
count(distinct c17) c17,
count(distinct c18) c18,
count(distinct c19) c19,
count(distinct c20) c20,
count(distinct c21) c21,
count(distinct c22) c22,
count(distinct c23) c23,
count(distinct c24) c24,
count(distinct c25) c25,
count(distinct c26) c26,
count(distinct c27) c27,
count(distinct c28) c28,
count(distinct c29) c29,
count(distinct c30) c30,
count(distinct c31) c31,
count(distinct c32) c32,
count(distinct c33) c33,
count(distinct c34) c34,
count(distinct c35) c35,
count(distinct c36) c36,
count(distinct c37) c37,
count(distinct c38) c38,
count(distinct c39) c39,
count(distinct c40) c40,
count(distinct c41) c41,
count(distinct c42) c42,
count(distinct c43) c43,
count(distinct c44) c44,
count(distinct c45) c45,
count(distinct c46) c46,
count(distinct c47) c47,
count(distinct c48) c48,
count(distinct c49) c49,
count(distinct c50) c50
from wide
where idx = 99;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 c41 c42 c43 c44 c45 c46 c47 c48 c49 c50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

View File

@ -0,0 +1,19 @@
USE tpch1;
select count(*) from (select n_regionkey, n_nationkey, count(*) c from nation group by 1, 2) n;
count(*)
25
select sum(c+0) from (select n_regionkey, n_nationkey, count(*) c from nation group by 1, 2) n;
sum(c+0)
25
select count(*),sum(c) from (select n_regionkey,n_nationkey, count(*) c from nation group by 1,2) n;
count(*) sum(c)
25 25
select count(*), sum(c+0) from (select n_regionkey, n_nationkey, count(*) c from nation group by 1, 2) n;
count(*) sum(c+0)
25 25
select sum(1) T, sum(if(F=1,1,0)) "1", sum(if(F>=2,1,0)) "2+" from (select n_nationkey, n_regionkey, least(3, count(*)) F from nation group by 1, 2) a;
T 1 2+
25 25 0
select sum(1) T, sum(if(F=1,1,0)) "1", sum(if(F=2,1,0)) "2", sum(if(F>=3,1,0)) "3+" from (select n_nationkey, n_regionkey, least(3, count(*)+n_regionkey) F from nation group by 1, 2) a;
T 1 2 3+
25 5 5 15

View File

@ -0,0 +1,54 @@
USE tpch1;
drop table if exists a1;
Warnings:
Note 1051 Unknown table 'tpch1.a1'
drop table if exists a2;
Warnings:
Note 1051 Unknown table 'tpch1.a2'
create table a1 (c1 int, c2 int)engine=columnstore;
create table a2 (c1 int, c2 int)engine=columnstore;
insert into a1 values (1, 1),(2,2),(3,null),(null,3),(null,null);
insert into a2 values (1, 1),(2, null),(null, 2),(3, 3),(null, null);
select * from a1 where c1 not in (select c2 from a2);
c1 c2
select * from a1 where c1 not in (select c2 from a2 where a1.c2=a2.c2);
c1 c2
3 NULL
NULL NULL
select * from a1 where not exists (select c2 from a2 where a1.c2=a2.c2 and a1.c1=a2.c1);
c1 c2
2 2
3 NULL
NULL 3
NULL NULL
select * from a1 where not exists (select c2 from a2 where a1.c2=a2.c2);
c1 c2
3 NULL
NULL NULL
select * from a1 where (c1,c2) not in (select c1,c2 from a2 where a2.c1 > a1.c2);
c1 c2
1 1
2 2
3 NULL
NULL 3
NULL NULL
select * from a1 where c1 not in (select c2 from a2 where a1.c2>a2.c2);
c1 c2
1 1
2 2
3 NULL
NULL NULL
select * from a1 where c1 not in (select 1 from a2 where a1.c1=a2.c1);
c1 c2
2 2
3 NULL
NULL 3
NULL NULL
select count(*) from a1 where c1 not in (select c2 from a2 where a1.c2=a2.c2);
count(*)
2
select count(*) from a1 where not exists (select c2 from a2 where a1.c2=a2.c2 and a1.c1=a2.c1);
count(*)
4
drop table a1;
drop table a2;

View File

@ -0,0 +1,12 @@
USE tpch1;
drop table if exists bug3532;
Warnings:
Note 1051 Unknown table 'tpch1.bug3532'
create table `bug3532` (`c1` char(1) default null, `c2` int(11) default null) engine=columnstore;
insert into bug3532 values (1,1), (0,0), (1,12), (1,-1), (null, null);
select round(c1,c1) from bug3532 where c1 = 1;
round(c1,c1)
1
1
1
drop table bug3532;

Some files were not shown because too many files have changed in this diff Show More