提交 5c06bd53 编写于 作者: H Haojun Liao

[TD-225]

上级 c0ea91ef
......@@ -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 clearFirstNTimeWindow(SQueryRuntimeEnv *pRuntimeEnv, int32_t num);
void clearFirstNWindowRes(SQueryRuntimeEnv *pRuntimeEnv, int32_t num);
void clearClosedTimeWindow(SQueryRuntimeEnv* pRuntimeEnv);
int32_t numOfClosedTimeWindow(SWindowResInfo* pWindowResInfo);
......
......@@ -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));
clearFirstNTimeWindow(pRuntimeEnv, c);
clearFirstNWindowRes(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);
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
clearFirstNWindowRes(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
clearFirstNTimeWindow(pRuntimeEnv, (int32_t) pQuery->limit.offset);
clearFirstNWindowRes(pRuntimeEnv, (int32_t) pQuery->limit.offset);
pQuery->rec.rows = 0;
pQInfo->groupIndex = 0;
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
clearFirstNWindowRes(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);
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
clearFirstNWindowRes(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);
......
......@@ -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 clearFirstNTimeWindow(SQueryRuntimeEnv *pRuntimeEnv, int32_t num) {
void clearFirstNWindowRes(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);
clearFirstNTimeWindow(pRuntimeEnv, numOfClosed);
clearFirstNWindowRes(pRuntimeEnv, numOfClosed);
}
int32_t numOfClosedTimeWindow(SWindowResInfo *pWindowResInfo) {
......
......@@ -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
......
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.
先完成此消息的编辑!
想要评论请 注册