Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33e199f2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
33e199f2
编写于
6月 28, 2021
作者:
H
Haojun Liao
提交者:
GitHub
6月 28, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6647 from taosdata/feature/query
[td-4905]<fix>:fix import caused crash.
上级
c8e279d0
839ad25f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
5 deletion
+45
-5
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+0
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-0
tests/script/general/parser/gendata.sh
tests/script/general/parser/gendata.sh
+2
-0
tests/script/general/parser/import_file.sim
tests/script/general/parser/import_file.sim
+41
-4
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
33e199f2
...
@@ -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
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
33e199f2
...
@@ -3281,6 +3281,8 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
...
@@ -3281,6 +3281,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
;
...
...
tests/script/general/parser/gendata.sh
浏览文件 @
33e199f2
...
@@ -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
tests/script/general/parser/import_file.sim
浏览文件 @
33e199f2
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录