Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9ad17ddd
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9ad17ddd
编写于
4月 12, 2023
作者:
D
dapan1121
提交者:
GitHub
4月 12, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20890 from taosdata/fix/TS-3137-M
fix: the precision of delete statement
上级
50057316
0145cbe1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
171 addition
and
0 deletion
+171
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+8
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/script/tsim/insert/delete0.sim
tests/script/tsim/insert/delete0.sim
+161
-0
tests/script/tsim/testsuit.sim
tests/script/tsim/testsuit.sim
+1
-0
未找到文件。
source/libs/parser/src/parTranslater.c
浏览文件 @
9ad17ddd
...
...
@@ -645,6 +645,10 @@ static bool isSelectStmt(SNode* pCurrStmt) {
return
NULL
!=
pCurrStmt
&&
QUERY_NODE_SELECT_STMT
==
nodeType
(
pCurrStmt
);
}
static
bool
isDeleteStmt
(
SNode
*
pCurrStmt
)
{
return
NULL
!=
pCurrStmt
&&
QUERY_NODE_DELETE_STMT
==
nodeType
(
pCurrStmt
);
}
static
bool
isSetOperator
(
SNode
*
pCurrStmt
)
{
return
NULL
!=
pCurrStmt
&&
QUERY_NODE_SET_OPERATOR
==
nodeType
(
pCurrStmt
);
}
...
...
@@ -669,6 +673,9 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
if
(
NULL
!=
pCurrStmt
&&
QUERY_NODE_CREATE_STREAM_STMT
==
nodeType
(
pCurrStmt
))
{
return
getPrecisionFromCurrStmt
(((
SCreateStreamStmt
*
)
pCurrStmt
)
->
pQuery
,
defaultVal
);
}
if
(
isDeleteStmt
(
pCurrStmt
))
{
return
((
SDeleteStmt
*
)
pCurrStmt
)
->
precision
;
}
return
defaultVal
;
}
...
...
@@ -3747,6 +3754,7 @@ static int32_t translateDelete(STranslateContext* pCxt, SDeleteStmt* pDelete) {
pCxt
->
pCurrStmt
=
(
SNode
*
)
pDelete
;
int32_t
code
=
translateFrom
(
pCxt
,
pDelete
->
pFromTable
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pDelete
->
precision
=
((
STableNode
*
)
pDelete
->
pFromTable
)
->
precision
;
code
=
translateDeleteWhere
(
pCxt
,
pDelete
);
}
pCxt
->
currClause
=
SQL_CLAUSE_SELECT
;
...
...
tests/parallel_test/cases.task
浏览文件 @
9ad17ddd
...
...
@@ -783,6 +783,7 @@
,,y,script,./test.sh -f tsim/insert/query_multi_file.sim
,,y,script,./test.sh -f tsim/insert/tcp.sim
,,y,script,./test.sh -f tsim/insert/update0.sim
,,y,script,./test.sh -f tsim/insert/delete0.sim
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
,,y,script,./test.sh -f tsim/insert/update2.sim
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
...
...
tests/script/tsim/insert/delete0.sim
0 → 100644
浏览文件 @
9ad17ddd
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print =============== create database with different precision
sql create database d0 keep 365
sql create database d1 keep 365 precision 'ms'
sql create database d2 keep 365 precision 'us'
sql create database d3 keep 365 precision 'ns'
sql select * from information_schema.ins_databases
if $rows != 6 then
return -1
endi
print $data00 $data01 $data02
sql create table if not exists d0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
sql create table if not exists d1.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
sql create table if not exists d2.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
sql create table if not exists d3.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
sql create table if not exists d0.ntb (ts timestamp, c1 int, c2 float, c3 double)
sql create table if not exists d1.ntb (ts timestamp, c1 int, c2 float, c3 double)
sql create table if not exists d2.ntb (ts timestamp, c1 int, c2 float, c3 double)
sql create table if not exists d3.ntb (ts timestamp, c1 int, c2 float, c3 double)
sql create table d0.ct1 using d0.stb tags(1000)
sql create table d1.ct1 using d1.stb tags(1000)
sql create table d2.ct1 using d2.stb tags(1000)
sql create table d3.ct1 using d3.stb tags(1000)
sql create table d0.ct2 using d0.stb tags(1000)
sql create table d1.ct2 using d1.stb tags(1000)
sql create table d2.ct2 using d2.stb tags(1000)
sql create table d3.ct2 using d3.stb tags(1000)
sql insert into d0.ct1 values(now+0s, 10, 2.0, 3.0)
sql insert into d1.ct1 values(now+0s, 10, 2.0, 3.0)
sql insert into d2.ct1 values(now+0s, 10, 2.0, 3.0)
sql insert into d3.ct1 values(now+0s, 10, 2.0, 3.0)
sql insert into d0.ct2 values(now+0s, 10, 2.0, 3.0)
sql insert into d1.ct2 values(now+0s, 10, 2.0, 3.0)
sql insert into d2.ct2 values(now+0s, 10, 2.0, 3.0)
sql insert into d3.ct2 values(now+0s, 10, 2.0, 3.0)
sql insert into d0.ntb values(now+0s, 10, 2.0, 3.0)
sql insert into d1.ntb values(now+0s, 10, 2.0, 3.0)
sql insert into d2.ntb values(now+0s, 10, 2.0, 3.0)
sql insert into d3.ntb values(now+0s, 10, 2.0, 3.0)
print =============== query data from super table
sql select count(*) from d0.stb
if $data00 != 2 then
return -1
endi
sql select count(*) from d1.stb
if $data00 != 2 then
return -1
endi
sql select count(*) from d2.stb
if $data00 != 2 then
return -1
endi
sql select count(*) from d3.stb
if $data00 != 2 then
return -1
endi
print =============== delete from child table
sql delete from d0.ct1 where ts < now()
sql delete from d1.ct1 where ts < now()
sql delete from d2.ct1 where ts < now()
sql delete from d3.ct1 where ts < now()
print =============== query data from super table
sql select count(*) from d0.stb
if $data00 != 1 then
return -1
endi
sql select count(*) from d1.stb
if $data00 != 1 then
return -1
endi
sql select count(*) from d2.stb
if $data00 != 1 then
return -1
endi
sql select count(*) from d3.stb
if $data00 != 1 then
return -1
endi
print =============== query data from normal table
sql select count(*) from d0.ntb
if $data00 != 1 then
return -1
endi
sql select count(*) from d1.ntb
if $data00 != 1 then
return -1
endi
sql select count(*) from d2.ntb
if $data00 != 1 then
return -1
endi
sql select count(*) from d3.ntb
if $data00 != 1 then
return -1
endi
print =============== delete from super table
sql delete from d0.stb where ts < now()
sql delete from d1.stb where ts < now()
sql delete from d2.stb where ts < now()
sql delete from d3.stb where ts < now()
print =============== query data from super table
sql select count(*) from d0.stb
if $data00 != 0 then
return -1
endi
sql select count(*) from d1.stb
if $data00 != 0 then
return -1
endi
sql select count(*) from d2.stb
if $data00 != 0 then
return -1
endi
sql select count(*) from d3.stb
if $data00 != 0 then
return -1
endi
print =============== delete from normal table
sql delete from d0.ntb where ts < now()
sql delete from d1.ntb where ts < now()
sql delete from d2.ntb where ts < now()
sql delete from d3.ntb where ts < now()
print =============== query data from normal table
sql select count(*) from d0.ntb
if $data00 != 0 then
return -1
endi
sql select count(*) from d1.ntb
if $data00 != 0 then
return -1
endi
sql select count(*) from d2.ntb
if $data00 != 0 then
return -1
endi
sql select count(*) from d3.ntb
if $data00 != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/testsuit.sim
浏览文件 @
9ad17ddd
...
...
@@ -114,6 +114,7 @@ run tsim/insert/basic1.sim
run tsim/insert/commit-merge0.sim
run tsim/insert/basic0.sim
run tsim/insert/update0.sim
run tsim/insert/delete0.sim
run tsim/insert/backquote.sim
run tsim/insert/null.sim
run tsim/catalog/alterInCurrent.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录