Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f803fa44
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f803fa44
编写于
2月 03, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): set the correct number of rows when calculating using sma for min/max function.
上级
84f8c767
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
59 deletion
+44
-59
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+9
-42
source/libs/function/src/detail/tminmax.c
source/libs/function/src/detail/tminmax.c
+3
-10
tests/script/tsim/parser/regressiontest.sim
tests/script/tsim/parser/regressiontest.sim
+32
-7
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
f803fa44
...
...
@@ -2839,12 +2839,11 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
ASSERT
(
pBlockInfo
!=
NULL
);
if
(
pBlockInfo
!=
NULL
)
{
pScanInfo
=
*
(
STableBlockScanInfo
**
)
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
));
}
else
{
pScanInfo
=
*
pReader
->
status
.
pTableIter
;
}
// if (pBlockInfo != NULL) {
pScanInfo
=
*
(
STableBlockScanInfo
**
)
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
pBlockInfo
->
uid
,
sizeof
(
pBlockInfo
->
uid
));
// } else {
// pScanInfo = *pReader->status.pTableIter;
// }
if
(
pScanInfo
==
NULL
)
{
tsdbError
(
"failed to get table scan-info, %s"
,
pReader
->
idStr
);
...
...
@@ -2852,46 +2851,14 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
return
code
;
}
if
(
pBlockInfo
!=
NULL
)
{
pBlock
=
getCurrentBlock
(
pBlockIter
);
}
//
if (pBlockInfo != NULL) {
pBlock
=
getCurrentBlock
(
pBlockIter
);
//
}
initLastBlockReader
(
pLastBlockReader
,
pScanInfo
,
pReader
);
TSDBKEY
keyInBuf
=
getCurrentKeyInBuf
(
pScanInfo
,
pReader
);
/*if (pBlockInfo == NULL) { // build data block from last data file
SBlockData* pBData = &pReader->status.fileBlockData;
tBlockDataReset(pBData);
SSDataBlock* pResBlock = pReader->pResBlock;
tsdbDebug("load data in last block firstly, due to desc scan data, %s", pReader->idStr);
int64_t st = taosGetTimestampUs();
while (1) {
bool hasBlockLData = hasDataInLastBlock(pLastBlockReader);
// no data in last block and block, no need to proceed.
if (hasBlockLData == false) {
break;
}
buildComposedDataBlockImpl(pReader, pScanInfo, &pReader->status.fileBlockData, pLastBlockReader);
if (pResBlock->info.rows >= pReader->capacity) {
break;
}
}
double el = (taosGetTimestampUs() - st) / 1000.0;
updateComposedBlockInfo(pReader, el, pScanInfo);
if (pResBlock->info.rows > 0) {
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
" rows:%d, elapsed time:%.2f ms %s",
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
pResBlock->info.rows, el, pReader->idStr);
}
} else*/
if
(
fileBlockShouldLoad
(
pReader
,
pBlockInfo
,
pBlock
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
))
{
if
(
fileBlockShouldLoad
(
pReader
,
pBlockInfo
,
pBlock
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
))
{
code
=
doLoadFileBlockData
(
pReader
,
pBlockIter
,
&
pStatus
->
fileBlockData
,
pScanInfo
->
uid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
source/libs/function/src/detail/tminmax.c
浏览文件 @
f803fa44
...
...
@@ -714,26 +714,18 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
pBuf
->
type
=
type
;
if
(
IS_NULL_TYPE
(
type
))
{
numOfElems
=
0
;
goto
_over
;
}
// data in current data block are qualified to the query
if
(
pInput
->
colDataSMAIsSet
)
{
numOfElems
=
pInput
->
numOfRows
-
pAgg
->
numOfNull
;
if
(
numOfElems
==
0
)
{
goto
_over
;
}
void
*
tval
=
NULL
;
int16_t
index
=
0
;
if
(
isMinFunc
)
{
tval
=
&
pInput
->
pColumnDataAgg
[
0
]
->
min
;
}
else
{
tval
=
&
pInput
->
pColumnDataAgg
[
0
]
->
max
;
}
void
*
tval
=
(
isMinFunc
)
?
&
pInput
->
pColumnDataAgg
[
0
]
->
min
:
&
pInput
->
pColumnDataAgg
[
0
]
->
max
;
if
(
!
pBuf
->
assign
)
{
if
(
type
==
TSDB_DATA_TYPE_FLOAT
)
{
...
...
@@ -824,8 +816,9 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
}
}
numOfElems
=
1
;
pBuf
->
assign
=
true
;
return
TSDB_CODE_SUCCESS
;
goto
_over
;
}
int32_t
start
=
pInput
->
startRowIndex
;
...
...
tests/script/tsim/parser/regressiontest.sim
浏览文件 @
f803fa44
...
...
@@ -31,13 +31,8 @@ sql insert into $tb values ( $ts , $x )
$x = $x + 1
endw
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql connect
sql flush database $db
sql use $db
sql delete from $tb where ts=1537146000000
sql delete from $tb where ts=1537146409500
...
...
@@ -63,7 +58,6 @@ if $rows != 8198 then
return -1
endi
print ===========================> TD-22077 && TD-21877
sql drop database if exists $db -x step1
sql create database $db vgroups 1;
...
...
@@ -88,6 +82,8 @@ endw
sql flush database $db
print ===========================> TD-22077 && TD-21877
sql insert into t1 values('2018-09-17 09:00:26', 26);
sql insert into t2 values('2018-09-17 09:00:25', 25);
...
...
@@ -97,4 +93,33 @@ sql flush database reg_db0;
sql delete from st1 where ts<='2018-9-17 09:00:26';
sql select * from st1;
sql drop table t1
sql drop table t2
print =========================================>TD-22196
sql create table t1 using st1 tags(1);
$i = 0
$ts = 1674977959000
$rowNum = 200
$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into t1 values ( $ts , $x )
$x = $x + 1
$ts = $ts + 1000
endw
sql flush database $db
sql select min(c),max(c) from t1
if $data00 != 0 then
return -1
endi
if $data01 != 199 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录