提交 ec8c6d0c 编写于 作者: H Haojun Liao

[TD-2159]<fix>: fix bugs in limit/offset in group by normal columns.

上级 2ae05f8d
......@@ -681,7 +681,7 @@ static int32_t firstFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, i
}
// no result for first query, data block is required
if (GET_RES_INFO(pCtx)->numOfRes <= 0) {
if (GET_RES_INFO(pCtx) == NULL || GET_RES_INFO(pCtx)->numOfRes <= 0) {
return BLK_DATA_ALL_NEEDED;
} else {
return BLK_DATA_NO_NEEDED;
......@@ -693,7 +693,7 @@ static int32_t lastFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, in
return BLK_DATA_NO_NEEDED;
}
if (GET_RES_INFO(pCtx)->numOfRes <= 0) {
if (GET_RES_INFO(pCtx) == NULL || GET_RES_INFO(pCtx)->numOfRes <= 0) {
return BLK_DATA_ALL_NEEDED;
} else {
return BLK_DATA_NO_NEEDED;
......
......@@ -5583,6 +5583,8 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
pQuery->rec.rows = 0;
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
limitResults(pRuntimeEnv);
}
}
......
......@@ -62,7 +62,7 @@ while $i < $half
$nchar = $nchar . $c
$nchar = $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 )
sql insert into $tb values ($tstart , $c , $c , $x , $x , $c , $c , $c , $binary , $nchar ) $tb1 values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar )
$tstart = $tstart + 1
$x = $x + 1
endw
......@@ -430,8 +430,39 @@ if $data97 != @group_tb0@ then
return -1
endi
print ---------------------------------> group by binary|nchar data add cases
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4;
if $rows != 10000 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data02 != @70-01-01 08:01:40.000@ then
return -1
endi
if $data03 != 0 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4 limit 1;
if $rows != 1 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3),max(c3),sum(c3),avg(c3),sum(c4)/count(c4) from group_tb1 group by c8;
if $rows != 10000 then
return -1
endi
print ---------------------------------> group by binary|nchar data add cases
sql select count(*) from group_tb1 group by c8;
#=========================== group by multi tags ======================
sql create table st (ts timestamp, c int) tags (t1 int, t2 int, t3 int, t4 int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册