Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5df32cbc
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看板
提交
5df32cbc
编写于
3月 11, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: correct slimit&limit clause
上级
8b2dc48c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
125 addition
and
8 deletion
+125
-8
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+5
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-2
source/util/src/terror.c
source/util/src/terror.c
+1
-1
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/script/tsim/parser/slimit_limit.sim
tests/script/tsim/parser/slimit_limit.sim
+113
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
5df32cbc
...
...
@@ -641,7 +641,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INCORRECT_NUM_OF_COL TAOS_DEF_ERROR_CODE(0, 0x2634)
#define TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL TAOS_DEF_ERROR_CODE(0, 0x2635)
#define TSDB_CODE_PAR_OFFSET_LESS_ZERO TAOS_DEF_ERROR_CODE(0, 0x2637)
#define TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY TAOS_DEF_ERROR_CODE(0, 0x2638)
#define TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_
GROUP_
BY TAOS_DEF_ERROR_CODE(0, 0x2638)
#define TSDB_CODE_PAR_INVALID_TOPIC_QUERY TAOS_DEF_ERROR_CODE(0, 0x2639)
#define TSDB_CODE_PAR_INVALID_DROP_STABLE TAOS_DEF_ERROR_CODE(0, 0x263A)
#define TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE TAOS_DEF_ERROR_CODE(0, 0x263B)
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
5df32cbc
...
...
@@ -277,6 +277,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
terrno
=
TSDB_CODE_SUCCESS
;
int32_t
num
=
0
;
uint64_t
groupId
=
0
;
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
// Compare with the previous row of this column, and do not set the output buffer again if they are identical.
if
(
!
pInfo
->
isInit
)
{
...
...
@@ -306,8 +307,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
}
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
groupId
=
calcGroupId
(
pInfo
->
keyBuf
,
len
);
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
len
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
len
,
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
// null data, too many state code
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_APP_ERROR
);
}
...
...
@@ -324,8 +326,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
if
(
num
>
0
)
{
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
groupId
=
calcGroupId
(
pInfo
->
keyBuf
,
len
);
int32_t
ret
=
setGroupResultOutputBuf
(
pOperator
,
&
(
pInfo
->
binfo
),
pOperator
->
exprSupp
.
numOfExprs
,
pInfo
->
keyBuf
,
len
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
len
,
groupId
,
pInfo
->
aggSup
.
pResultBuf
,
&
pInfo
->
aggSup
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_APP_ERROR
);
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
5df32cbc
...
...
@@ -3373,8 +3373,8 @@ static int32_t checkLimit(STranslateContext* pCxt, SSelectStmt* pSelect) {
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_OFFSET_LESS_ZERO
);
}
if
(
NULL
!=
pSelect
->
pSlimit
&&
NULL
==
pSelect
->
pPartitionByList
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY
);
if
(
NULL
!=
pSelect
->
pSlimit
&&
(
NULL
==
pSelect
->
pPartitionByList
&&
NULL
==
pSelect
->
pGroupByList
)
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_
GROUP_
BY
);
}
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
5df32cbc
...
...
@@ -103,8 +103,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Incorrect TIMESTAMP value: %s"
;
case
TSDB_CODE_PAR_OFFSET_LESS_ZERO
:
return
"soffset/offset can not be less than 0"
;
case
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY
:
return
"slimit/soffset only available for PARTITION BY query"
;
case
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_
GROUP_
BY
:
return
"slimit/soffset only available for PARTITION
/GROUP
BY query"
;
case
TSDB_CODE_PAR_INVALID_TOPIC_QUERY
:
return
"Invalid topic query"
;
case
TSDB_CODE_PAR_INVALID_DROP_STABLE
:
...
...
source/util/src/terror.c
浏览文件 @
5df32cbc
...
...
@@ -514,7 +514,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_ONE_JSON_TAG, "Only one tag if ther
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INCORRECT_NUM_OF_COL
,
"Query block has incorrect number of result columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL
,
"Incorrect TIMESTAMP value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_OFFSET_LESS_ZERO
,
"soffset/offset can not be less than 0"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_
BY
,
"slimit/soffset only available for PARTITION
BY query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_
GROUP_BY
,
"slimit/soffset only available for PARTITION/GROUP
BY query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TOPIC_QUERY
,
"Invalid topic query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DROP_STABLE
,
"Cannot drop super table in batch"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE
,
"Start(end) time of query range required or time range too large"
)
...
...
tests/parallel_test/cases.task
浏览文件 @
5df32cbc
...
...
@@ -168,6 +168,7 @@
,,y,script,./test.sh -f tsim/parser/union.sim
,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim
,,y,script,./test.sh -f tsim/parser/where.sim
,,y,script,./test.sh -f tsim/parser/slimit_limit.sim
,,y,script,./test.sh -f tsim/query/tagLikeFilter.sim
,,y,script,./test.sh -f tsim/query/charScalarFunction.sim
,,y,script,./test.sh -f tsim/query/explain.sim
...
...
tests/script/tsim/parser/slimit_limit.sim
0 → 100644
浏览文件 @
5df32cbc
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql drop database if exists db1;
sql create database db1 vgroups 1;
sql use db1;
sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
sql create table tba1 using sta tags(1, 1, 1);
sql create table tba2 using sta tags(2, 2, 2);
sql create table tba3 using sta tags(3, 3, 3);
sql create table tba4 using sta tags(4, 4, 4);
sql create table tba5 using sta tags(5, 5, 5);
sql create table tba6 using sta tags(6, 6, 6);
sql create table tba7 using sta tags(7, 7, 7);
sql create table tba8 using sta tags(8, 8, 8);
sql create index index1 on sta (t2);
sql insert into tba1 values ('2022-04-26 15:15:01', 1, "a");
sql insert into tba1 values ('2022-04-26 15:15:02', 11, "a");
sql insert into tba2 values ('2022-04-26 15:15:01', 2, "a");
sql insert into tba2 values ('2022-04-26 15:15:02', 22, "a");
sql insert into tba3 values ('2022-04-26 15:15:01', 3, "a");
sql insert into tba4 values ('2022-04-26 15:15:01', 4, "a");
sql insert into tba5 values ('2022-04-26 15:15:01', 5, "a");
sql insert into tba6 values ('2022-04-26 15:15:01', 6, "a");
sql insert into tba7 values ('2022-04-26 15:15:01', 7, "a");
sql insert into tba8 values ('2022-04-26 15:15:01', 8, "a");
sql select t1,count(*) from sta group by t1 limit 1;
if $rows != 8 then
return -1
endi
sql select t1,count(*) from sta group by t1 slimit 1;
if $rows != 1 then
return -1
endi
sql select f1,count(*) from sta group by f1 limit 1;
if $rows != 10 then
return -1
endi
sql select f1,count(*) from sta group by f1 slimit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by t1, f1 limit 1;
if $rows != 10 then
return -1
endi
sql select t1,f1,count(*) from sta group by t1, f1 slimit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by f1, t1 limit 1;
if $rows != 10 then
return -1
endi
sql select t1,f1,count(*) from sta group by f1, t1 slimit 1;
if $rows != 1 then
return -1
endi
sql select t1,count(*) from sta group by t1 order by t1 limit 1;
if $rows != 1 then
return -1
endi
sql select t1,count(*) from sta group by t1 order by t1 slimit 1;
if $rows != 8 then
return -1
endi
sql select f1,count(*) from sta group by f1 order by f1 limit 1;
if $rows != 1 then
return -1
endi
sql select f1,count(*) from sta group by f1 order by f1 slimit 1;
if $rows != 10 then
return -1
endi
sql select t1,f1,count(*) from sta group by t1, f1 order by t1,f1 limit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by t1, f1 order by t1,f1 slimit 1;
if $rows != 10 then
return -1
endi
sql select t1,f1,count(*) from sta group by f1, t1 order by f1,t1 limit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by f1, t1 order by f1,t1 slimit 1;
if $rows != 10 then
return -1
endi
sql select t1,count(*) from sta group by t1 slimit 1 limit 1;
if $rows != 1 then
return -1
endi
sql select f1,count(*) from sta group by f1 slimit 1 limit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by t1, f1 slimit 1 limit 1;
if $rows != 1 then
return -1
endi
sql select t1,f1,count(*) from sta group by f1, t1 slimit 1 limit 1;
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录