Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5c06bd53
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看板
提交
5c06bd53
编写于
11月 20, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]
上级
c0ea91ef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
80 addition
and
67 deletion
+80
-67
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+8
-11
src/query/src/qUtil.c
src/query/src/qUtil.c
+11
-3
tests/script/general/parser/projection_limit_offset.sim
tests/script/general/parser/projection_limit_offset.sim
+10
-2
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+50
-50
未找到文件。
src/query/inc/qUtil.h
浏览文件 @
5c06bd53
...
...
@@ -34,7 +34,7 @@ int32_t initWindowResInfo(SWindowResInfo* pWindowResInfo, int32_t size, int32_t
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
void
clearFirstN
TimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
num
);
void
clearFirstN
WindowRes
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
num
);
void
clearClosedTimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int32_t
numOfClosedTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
...
...
src/query/src/qExecutor.c
浏览文件 @
5c06bd53
...
...
@@ -3342,12 +3342,9 @@ int32_t initResultRow(SResultRow *pResultRow) {
void
resetCtxOutputBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
SResultRow
*
pRow
=
NULL
;
// if (pRuntimeEnv->windowResInfo.size == 0) {
int32_t
groupIndex
=
0
;
int32_t
uid
=
0
;
pRow
=
doPrepareResultRowFromKey
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
,
(
char
*
)
&
groupIndex
,
sizeof
(
groupIndex
),
true
,
uid
);
int32_t
groupIndex
=
0
;
int32_t
uid
=
0
;
SResultRow
*
pRow
=
doPrepareResultRowFromKey
(
pRuntimeEnv
,
&
pRuntimeEnv
->
windowResInfo
,
(
char
*
)
&
groupIndex
,
sizeof
(
groupIndex
),
true
,
uid
);
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
SQLFunctionCtx
*
pCtx
=
&
pRuntimeEnv
->
pCtx
[
i
];
...
...
@@ -5528,7 +5525,7 @@ static void tableIntervalProcessImpl(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start)
int32_t
numOfClosed
=
numOfClosedTimeWindow
(
&
pRuntimeEnv
->
windowResInfo
);
int32_t
c
=
(
int32_t
)(
MIN
(
numOfClosed
,
pQuery
->
limit
.
offset
));
clearFirstN
TimeWindow
(
pRuntimeEnv
,
c
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
c
);
pQuery
->
limit
.
offset
-=
c
;
}
...
...
@@ -5565,7 +5562,7 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
pQuery
->
rec
.
rows
=
0
;
copyFromWindowResToSData
(
pQInfo
,
&
pRuntimeEnv
->
windowResInfo
);
clearFirstN
TimeWindow
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
}
// no result generated, abort
...
...
@@ -5602,12 +5599,12 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
if
((
pQuery
->
limit
.
offset
>
0
&&
pQuery
->
limit
.
offset
<
numOfClosed
)
||
pQuery
->
limit
.
offset
==
0
)
{
// skip offset result rows
clearFirstN
TimeWindow
(
pRuntimeEnv
,
(
int32_t
)
pQuery
->
limit
.
offset
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
(
int32_t
)
pQuery
->
limit
.
offset
);
pQuery
->
rec
.
rows
=
0
;
pQInfo
->
groupIndex
=
0
;
copyFromWindowResToSData
(
pQInfo
,
&
pRuntimeEnv
->
windowResInfo
);
clearFirstN
TimeWindow
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
doSecondaryArithmeticProcess
(
pQuery
);
limitResults
(
pRuntimeEnv
);
...
...
@@ -5641,7 +5638,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
if
(
pRuntimeEnv
->
windowResInfo
.
size
>
0
)
{
copyFromWindowResToSData
(
pQInfo
,
&
pRuntimeEnv
->
windowResInfo
);
clearFirstN
TimeWindow
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
if
(
pQuery
->
rec
.
rows
>
0
)
{
qDebug
(
"QInfo:%p %"
PRId64
" rows returned from group results, total:%"
PRId64
""
,
pQInfo
,
pQuery
->
rec
.
rows
,
pQuery
->
rec
.
total
);
...
...
src/query/src/qUtil.c
浏览文件 @
5c06bd53
...
...
@@ -64,10 +64,18 @@ void resetTimeWindowInfo(SQueryRuntimeEnv *pRuntimeEnv, SWindowResInfo *pWindowR
if
(
pWindowResInfo
==
NULL
||
pWindowResInfo
->
capacity
==
0
)
{
return
;
}
// assert(pWindowResInfo->size == 1);
for
(
int32_t
i
=
0
;
i
<
pWindowResInfo
->
size
;
++
i
)
{
SResultRow
*
pWindowRes
=
pWindowResInfo
->
pResult
[
i
];
clearResultRow
(
pRuntimeEnv
,
pWindowRes
);
int32_t
groupIndex
=
0
;
int64_t
uid
=
0
;
SET_RES_WINDOW_KEY
(
pRuntimeEnv
->
keyBuf
,
&
groupIndex
,
sizeof
(
groupIndex
),
uid
);
taosHashRemove
(
pRuntimeEnv
->
pResultRowHashTable
,
(
const
char
*
)
pRuntimeEnv
->
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
sizeof
(
groupIndex
)));
}
pWindowResInfo
->
curIndex
=
-
1
;
...
...
@@ -77,7 +85,7 @@ void resetTimeWindowInfo(SQueryRuntimeEnv *pRuntimeEnv, SWindowResInfo *pWindowR
pWindowResInfo
->
prevSKey
=
TSKEY_INITIAL_VAL
;
}
void
clearFirstN
TimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
num
)
{
void
clearFirstN
WindowRes
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
num
)
{
SWindowResInfo
*
pWindowResInfo
=
&
pRuntimeEnv
->
windowResInfo
;
if
(
pWindowResInfo
==
NULL
||
pWindowResInfo
->
capacity
==
0
||
pWindowResInfo
->
size
==
0
||
num
==
0
)
{
return
;
...
...
@@ -163,7 +171,7 @@ void clearClosedTimeWindow(SQueryRuntimeEnv *pRuntimeEnv) {
}
int32_t
numOfClosed
=
numOfClosedTimeWindow
(
pWindowResInfo
);
clearFirstN
TimeWindow
(
pRuntimeEnv
,
numOfClosed
);
clearFirstN
WindowRes
(
pRuntimeEnv
,
numOfClosed
);
}
int32_t
numOfClosedTimeWindow
(
SWindowResInfo
*
pWindowResInfo
)
{
...
...
tests/script/general/parser/projection_limit_offset.sim
浏览文件 @
5c06bd53
...
...
@@ -28,11 +28,19 @@ sql use $db
sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12))
$i = 0
while $i < $tbNum
$half = $tbNum / 2
while $i < $half
$tb = $tbPrefix . $i
$tg2 = ' . abc
$tg2 = $tg2 . '
$tbId = $i + $half
$tb1 = $tbPrefix . $tbId
sql create table $tb using $mt tags( $i , $tg2 )
sql create table $tb1 using $mt tags( $i , $tg2 )
$x = 0
while $x < $rowNum
...
...
@@ -49,7 +57,7 @@ while $i < $tbNum
$nchar = $nchar . $c
$nchar = $nchar . '
sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar )
sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar )
$tb1 values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar )
$tstart = $tstart + 1
$x = $x + 1
endw
...
...
tests/script/general/parser/testSuite.sim
浏览文件 @
5c06bd53
sleep 500
run general/parser/alter.sim
sleep 500
run general/parser/alter1.sim
sleep 500
run general/parser/alter_stable.sim
sleep 500
run general/parser/auto_create_tb.sim
sleep 500
run general/parser/auto_create_tb_drop_tb.sim
sleep 500
run general/parser/col_arithmetic_operation.sim
sleep 500
run general/parser/columnValue.sim
sleep 500
run general/parser/commit.sim
sleep 500
run general/parser/create_db.sim
sleep 500
run general/parser/create_mt.sim
sleep 500
run general/parser/create_tb.sim
sleep 500
run general/parser/dbtbnameValidate.sim
sleep 500
run general/parser/fill.sim
sleep 500
run general/parser/fill_stb.sim
sleep 500
#run general/parser/fill_us.sim #
sleep 500
run general/parser/first_last.sim
sleep 500
run general/parser/import_commit1.sim
sleep 500
run general/parser/import_commit2.sim
sleep 500
run general/parser/import_commit3.sim
sleep 500
#run general/parser/import_file.sim
sleep 500
run general/parser/insert_tb.sim
sleep 500
run general/parser/tags_dynamically_specifiy.sim
sleep 500
run general/parser/interp.sim
sleep 500
run general/parser/lastrow.sim
sleep 500
run general/parser/limit.sim
#
sleep 500
#
run general/parser/alter.sim
#
sleep 500
#
run general/parser/alter1.sim
#
sleep 500
#
run general/parser/alter_stable.sim
#
sleep 500
#
run general/parser/auto_create_tb.sim
#
sleep 500
#
run general/parser/auto_create_tb_drop_tb.sim
#
sleep 500
#
run general/parser/col_arithmetic_operation.sim
#
sleep 500
#
run general/parser/columnValue.sim
#
sleep 500
#
run general/parser/commit.sim
#
sleep 500
#
run general/parser/create_db.sim
#
sleep 500
#
run general/parser/create_mt.sim
#
sleep 500
#
run general/parser/create_tb.sim
#
sleep 500
#
run general/parser/dbtbnameValidate.sim
#
sleep 500
#
run general/parser/fill.sim
#
sleep 500
#
run general/parser/fill_stb.sim
#
sleep 500
#
#
run general/parser/fill_us.sim #
#
sleep 500
#
run general/parser/first_last.sim
#
sleep 500
#
run general/parser/import_commit1.sim
#
sleep 500
#
run general/parser/import_commit2.sim
#
sleep 500
#
run general/parser/import_commit3.sim
#
sleep 500
#
#
run general/parser/import_file.sim
#
sleep 500
#
run general/parser/insert_tb.sim
#
sleep 500
#
run general/parser/tags_dynamically_specifiy.sim
#
sleep 500
#
run general/parser/interp.sim
#
sleep 500
#
run general/parser/lastrow.sim
#
sleep 500
#
run general/parser/limit.sim
sleep 500
run general/parser/limit1.sim
sleep 500
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录