columnValue_unsign.sim 5.0 KB
Newer Older
H
Haojun Liao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
sleep 100
sql connect
sql create database if not exists db
sql use db

sql drop table if exists mt_unsigned;

sql create table mt_unsigned (ts timestamp, a tinyint unsigned, b smallint unsigned, c int unsigned, d bigint unsigned, e tinyint, f smallint, g int, h bigint, j bool) tags (t1 tinyint unsigned, t2 smallint unsigned, t3 int unsigned, t4 bigint unsigned, t5 tinyint, t6 smallint, t7 int, t8 bigint);
sql create table mt_unsigned_1 using mt_unsigned tags(0, 0, 0, 0, 0, 0, 0, 0);

sql alter table mt_unsigned_1 set tag t1=138;
sql alter table mt_unsigned_1 set tag t2=32769;
sql alter table mt_unsigned_1 set tag t3=294967295;
sql alter table mt_unsigned_1 set tag t4=446744073709551615;
sql select t1,t2,t3,t4 from mt_unsigned_1
if $rows != 1 then
 return -1
endi

print $data00, $data01, $data02, $data03

if $data00 != 138 then
 print expect 138, actual: $data00
 return -1
endi

if $data01 != 32769 then
return -1
endi

if $data02 != 294967295 then
return -1
endi

if $data03 != 446744073709551615 then
return -1
endi

sql_error sql alter table mt_unsigned_1 set tag t1 = 999;
sql_error sql alter table mt_unsigned_1 set tag t2 = 95535;
sql_error sql alter table mt_unsigned_1 set tag t3 = 8294967295l;
sql_error sql alter table mt_unsigned_1 set tag t4 = 19446744073709551615;

sql_error create table mt_unsigned_2 using mt_unsigned tags(-1, 0, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, -1, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, -1, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, -1, 0, 0, 0, 0);

sql_error create table mt_unsigned_2 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0);

sql_error create table mt_unsigned_2 using mt_unsigned tags(999, 0, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 95535, 0, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, 5294967295l, 0, 0, 0, 0, 0);
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, 28446744073709551615u, 0, 0, 0, 0);

sql alter table mt_unsigned_1 set tag t1=NULL;
sql alter table mt_unsigned_1 set tag t2=NULL;
sql alter table mt_unsigned_1 set tag t3=NULL;
sql alter table mt_unsigned_1 set tag t4=NULL;
sql select t1,t2,t3,t4 from mt_unsigned_1
if $rows != 1 then
  return -1;
endi

if $data00 != NULL then
  print expect NULL, actual: $data00
  return -1
endi

if $data01 != NULL then
  return -1
endi

if $data02 != NULL then
  return -1
endi

if $data03 != NULL then
  return -1
endi

sql insert into mt_unsigned_1 values(now, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
D
dapan1121 已提交
86
sql insert into mt_unsigned_1 values(now+1s, 1, 2, 3, 4, 5, 6, 7, 8, 9);
H
Haojun Liao 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

sql_error insert into mt_unsigned_1 values(now, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL);
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL);
sql select count(a),count(b),count(c),count(d), count(e) from mt_unsigned_1
if $rows != 1 then
  return -1
endi

if $data00 != 1 then
  return -1
endi

if $data01 != 1 then
  return -1
endi

H
Haojun Liao 已提交
109 110 111 112 113
sql select a+b+c from mt_unsigned_1 where a is null;
if $rows != 1 then
  return -1
endi

H
Haojun Liao 已提交
114 115
if $data00 != NULL then
  print expect NULL, actual:$data00
H
Haojun Liao 已提交
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
  return -1
endi

sql select count(*), a from mt_unsigned_1 group by a;
if $rows != 1 then
  return -1
endi

if $data00 != 1 then
  return -1
endi

if $data01 != 1 then
  return -1
endi

sql select count(*), b from mt_unsigned_1 group by b;
if $rows != 1 then
  return -1
endi

if $data00 != 1 then
  return -1
endi

if $data01 != 2 then
  return -1
endi

sql select count(*), c from mt_unsigned_1 group by c;
if $rows != 1 then
  return -1
endi

if $data00 != 1 then
  return -1
endi

if $data01 != 3 then
  return -1
endi

sql select count(*), d from mt_unsigned_1 group by d;
if $rows != 1 then
  return -1
endi

if $data00 != 1 then
  return -1
endi

if $data01 != 4 then
  return -1
endi

H
Haojun Liao 已提交
171
## todo insert more rows and chec it
H
Haojun Liao 已提交
172 173 174 175 176
sql select first(a),count(b),last(c),sum(b),spread(d),avg(c),min(b),max(a),stddev(a) from mt_unsigned_1;
if $rows != 1 then
  return -1
endi