提交 839ad25f 编写于 作者: H Haojun Liao

[td-4905]<fix>:fix import caused crash.

上级 14d9473b
...@@ -1580,7 +1580,6 @@ void tscImportDataFromFile(SSqlObj *pSql) { ...@@ -1580,7 +1580,6 @@ void tscImportDataFromFile(SSqlObj *pSql) {
SImportFileSupport *pSupporter = calloc(1, sizeof(SImportFileSupport)); SImportFileSupport *pSupporter = calloc(1, sizeof(SImportFileSupport));
SSqlObj *pNew = createSubqueryObj(pSql, 0, parseFileSendDataBlock, pSupporter, TSDB_SQL_INSERT, NULL); SSqlObj *pNew = createSubqueryObj(pSql, 0, parseFileSendDataBlock, pSupporter, TSDB_SQL_INSERT, NULL);
pCmd->count = 1;
FILE *fp = fopen(pCmd->payload, "rb"); FILE *fp = fopen(pCmd->payload, "rb");
if (fp == NULL) { if (fp == NULL) {
......
...@@ -3278,6 +3278,8 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t ...@@ -3278,6 +3278,8 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pnCmd->insertParam.pTableNameList = NULL; pnCmd->insertParam.pTableNameList = NULL;
pnCmd->insertParam.pTableBlockHashList = NULL; pnCmd->insertParam.pTableBlockHashList = NULL;
memset(&pnCmd->insertParam.tagData, 0, sizeof(STagData));
if (tscAddQueryInfo(pnCmd) != TSDB_CODE_SUCCESS) { if (tscAddQueryInfo(pnCmd) != TSDB_CODE_SUCCESS) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto _error; goto _error;
......
...@@ -4,3 +4,5 @@ Cur_Dir=$(pwd) ...@@ -4,3 +4,5 @@ Cur_Dir=$(pwd)
echo $Cur_Dir echo $Cur_Dir
echo "'2020-1-1 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al'" >> ~/data.sql echo "'2020-1-1 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al'" >> ~/data.sql
echo "'2020-1-2 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al'" >> ~/data.sql
echo "'2020-1-3 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al'" >> ~/data.sql
...@@ -15,6 +15,8 @@ $inFileName = '~/data.csv' ...@@ -15,6 +15,8 @@ $inFileName = '~/data.csv'
$numOfRows = 10000 $numOfRows = 10000
system general/parser/gendata.sh system general/parser/gendata.sh
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));
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)) 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 print ====== create tables success, starting import data
...@@ -23,13 +25,48 @@ sql import into tbx file '~/data.sql' ...@@ -23,13 +25,48 @@ sql import into tbx file '~/data.sql'
sql select count(*) from tbx sql select count(*) from tbx
if $rows != 1 then if $rows != 1 then
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
return -1 return -1
endi endi
#if $data00 != $numOfRows then sql drop table tbx;
# print "expect: $numOfRows, act: $data00" sql insert into tbx using stbx(b) tags('abcf') file '~/data.sql';
# return -1
#endi 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
system rm -f ~/data.sql system rm -f ~/data.sql
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册