import_file.sim 1.7 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3

system sh/deploy.sh -n dnode1 -i 1
4
system sh/cfg.sh -n dnode1 -c walLevel -v 1
S
slguan 已提交
5
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
6
sleep 500
S
slguan 已提交
7
sql connect
H
Haojun Liao 已提交
8
sleep 500
S
slguan 已提交
9 10 11 12 13 14 15

sql drop database if exists indb
sql create database if not exists indb
sql use indb

$inFileName = '~/data.csv'
$numOfRows = 10000
H
Haojun Liao 已提交
16
system general/parser/gendata.sh
S
slguan 已提交
17

H
Haojun Liao 已提交
18 19
sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16),  imei BINARY(16),  mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) tags(a int, b binary(12));

S
slguan 已提交
20 21 22
sql create table tbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16),  imei BINARY(16),  mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2))
print ====== create tables success, starting import data

23
sql import into tbx file '~/data.sql'
H
Haojun Liao 已提交
24
sql import into tbx file '~/data.sql'
S
slguan 已提交
25 26 27

sql select count(*) from tbx
if $rows != 1 then
H
Haojun Liao 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  print expect 1, actual: $rows
  return -1
endi

if $data00 != 3 then
  return -1
endi

sql drop table tbx;

sql insert into tbx using stbx tags(1,'abc') file '~/data.sql';
sql insert into tbx using stbx tags(1,'abc') file '~/data.sql';

sql select count(*) from tbx
if $rows != 1 then
  return -1
endi

if $data00 != 3 then
S
slguan 已提交
47 48 49
  return -1
endi

H
Haojun Liao 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
sql drop table tbx;
sql insert into tbx using stbx(b) tags('abcf') file '~/data.sql';

sql select ts,a,b from tbx;
if $rows != 3 then
  return -1
endi

if $data00 != @20-01-01 01:01:01.000@ then
  print expect 20-01-01 01:01:01.000 , actual: $data00
  return -1
endi

if $data01 != NULL then
  return -1
endi

if $data02 != @abcf@ then
  return -1
endi
S
slguan 已提交
70

H
Haojun Liao 已提交
71
system rm -f ~/data.sql
S
scripts  
Shengliang Guan 已提交
72 73

system sh/exec.sh -n dnode1 -s stop -x SIGINT