[TD-225]
This commit is contained in:
parent
c0ea91ef53
commit
5c06bd53a6
|
@ -34,7 +34,7 @@ int32_t initWindowResInfo(SWindowResInfo* pWindowResInfo, int32_t size, int32_t
|
||||||
|
|
||||||
void cleanupTimeWindowInfo(SWindowResInfo* pWindowResInfo);
|
void cleanupTimeWindowInfo(SWindowResInfo* pWindowResInfo);
|
||||||
void resetTimeWindowInfo(SQueryRuntimeEnv* pRuntimeEnv, 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);
|
void clearClosedTimeWindow(SQueryRuntimeEnv* pRuntimeEnv);
|
||||||
int32_t numOfClosedTimeWindow(SWindowResInfo* pWindowResInfo);
|
int32_t numOfClosedTimeWindow(SWindowResInfo* pWindowResInfo);
|
||||||
|
|
|
@ -3342,12 +3342,9 @@ int32_t initResultRow(SResultRow *pResultRow) {
|
||||||
void resetCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv) {
|
void resetCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||||
|
|
||||||
SResultRow* pRow = NULL;
|
int32_t groupIndex = 0;
|
||||||
// if (pRuntimeEnv->windowResInfo.size == 0) {
|
int32_t uid = 0;
|
||||||
int32_t groupIndex = 0;
|
SResultRow* pRow = doPrepareResultRowFromKey(pRuntimeEnv, &pRuntimeEnv->windowResInfo, (char *)&groupIndex, sizeof(groupIndex), true, uid);
|
||||||
int32_t uid = 0;
|
|
||||||
pRow = doPrepareResultRowFromKey(pRuntimeEnv, &pRuntimeEnv->windowResInfo, (char *)&groupIndex, sizeof(groupIndex), true, uid);
|
|
||||||
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
||||||
SQLFunctionCtx *pCtx = &pRuntimeEnv->pCtx[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 numOfClosed = numOfClosedTimeWindow(&pRuntimeEnv->windowResInfo);
|
||||||
|
|
||||||
int32_t c = (int32_t)(MIN(numOfClosed, pQuery->limit.offset));
|
int32_t c = (int32_t)(MIN(numOfClosed, pQuery->limit.offset));
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, c);
|
clearFirstNWindowRes(pRuntimeEnv, c);
|
||||||
pQuery->limit.offset -= c;
|
pQuery->limit.offset -= c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5565,7 +5562,7 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
|
||||||
pQuery->rec.rows = 0;
|
pQuery->rec.rows = 0;
|
||||||
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
||||||
|
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
|
clearFirstNWindowRes(pRuntimeEnv, pQInfo->groupIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no result generated, abort
|
// 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) {
|
if ((pQuery->limit.offset > 0 && pQuery->limit.offset < numOfClosed) || pQuery->limit.offset == 0) {
|
||||||
// skip offset result rows
|
// skip offset result rows
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, (int32_t) pQuery->limit.offset);
|
clearFirstNWindowRes(pRuntimeEnv, (int32_t) pQuery->limit.offset);
|
||||||
|
|
||||||
pQuery->rec.rows = 0;
|
pQuery->rec.rows = 0;
|
||||||
pQInfo->groupIndex = 0;
|
pQInfo->groupIndex = 0;
|
||||||
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
|
clearFirstNWindowRes(pRuntimeEnv, pQInfo->groupIndex);
|
||||||
|
|
||||||
doSecondaryArithmeticProcess(pQuery);
|
doSecondaryArithmeticProcess(pQuery);
|
||||||
limitResults(pRuntimeEnv);
|
limitResults(pRuntimeEnv);
|
||||||
|
@ -5641,7 +5638,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
|
||||||
|
|
||||||
if (pRuntimeEnv->windowResInfo.size > 0) {
|
if (pRuntimeEnv->windowResInfo.size > 0) {
|
||||||
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
copyFromWindowResToSData(pQInfo, &pRuntimeEnv->windowResInfo);
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex);
|
clearFirstNWindowRes(pRuntimeEnv, pQInfo->groupIndex);
|
||||||
|
|
||||||
if (pQuery->rec.rows > 0) {
|
if (pQuery->rec.rows > 0) {
|
||||||
qDebug("QInfo:%p %"PRId64" rows returned from group results, total:%"PRId64"", pQInfo, pQuery->rec.rows, pQuery->rec.total);
|
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) {
|
if (pWindowResInfo == NULL || pWindowResInfo->capacity == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assert(pWindowResInfo->size == 1);
|
||||||
|
|
||||||
for (int32_t i = 0; i < pWindowResInfo->size; ++i) {
|
for (int32_t i = 0; i < pWindowResInfo->size; ++i) {
|
||||||
SResultRow *pWindowRes = pWindowResInfo->pResult[i];
|
SResultRow *pWindowRes = pWindowResInfo->pResult[i];
|
||||||
clearResultRow(pRuntimeEnv, pWindowRes);
|
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;
|
pWindowResInfo->curIndex = -1;
|
||||||
|
@ -77,7 +85,7 @@ void resetTimeWindowInfo(SQueryRuntimeEnv *pRuntimeEnv, SWindowResInfo *pWindowR
|
||||||
pWindowResInfo->prevSKey = TSKEY_INITIAL_VAL;
|
pWindowResInfo->prevSKey = TSKEY_INITIAL_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearFirstNTimeWindow(SQueryRuntimeEnv *pRuntimeEnv, int32_t num) {
|
void clearFirstNWindowRes(SQueryRuntimeEnv *pRuntimeEnv, int32_t num) {
|
||||||
SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo;
|
SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo;
|
||||||
if (pWindowResInfo == NULL || pWindowResInfo->capacity == 0 || pWindowResInfo->size == 0 || num == 0) {
|
if (pWindowResInfo == NULL || pWindowResInfo->capacity == 0 || pWindowResInfo->size == 0 || num == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -163,7 +171,7 @@ void clearClosedTimeWindow(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfClosed = numOfClosedTimeWindow(pWindowResInfo);
|
int32_t numOfClosed = numOfClosedTimeWindow(pWindowResInfo);
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, numOfClosed);
|
clearFirstNWindowRes(pRuntimeEnv, numOfClosed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfClosedTimeWindow(SWindowResInfo *pWindowResInfo) {
|
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))
|
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
|
$i = 0
|
||||||
while $i < $tbNum
|
$half = $tbNum / 2
|
||||||
|
|
||||||
|
while $i < $half
|
||||||
$tb = $tbPrefix . $i
|
$tb = $tbPrefix . $i
|
||||||
$tg2 = ' . abc
|
$tg2 = ' . abc
|
||||||
$tg2 = $tg2 . '
|
$tg2 = $tg2 . '
|
||||||
|
|
||||||
|
$tbId = $i + $half
|
||||||
|
|
||||||
|
$tb1 = $tbPrefix . $tbId
|
||||||
|
|
||||||
sql create table $tb using $mt tags( $i , $tg2 )
|
sql create table $tb using $mt tags( $i , $tg2 )
|
||||||
|
sql create table $tb1 using $mt tags( $i , $tg2 )
|
||||||
|
|
||||||
$x = 0
|
$x = 0
|
||||||
while $x < $rowNum
|
while $x < $rowNum
|
||||||
|
@ -49,7 +57,7 @@ while $i < $tbNum
|
||||||
$nchar = $nchar . $c
|
$nchar = $nchar . $c
|
||||||
$nchar = $nchar . '
|
$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
|
$tstart = $tstart + 1
|
||||||
$x = $x + 1
|
$x = $x + 1
|
||||||
endw
|
endw
|
||||||
|
|
|
@ -1,53 +1,53 @@
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/alter.sim
|
#run general/parser/alter.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/alter1.sim
|
#run general/parser/alter1.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/alter_stable.sim
|
#run general/parser/alter_stable.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/auto_create_tb.sim
|
#run general/parser/auto_create_tb.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/auto_create_tb_drop_tb.sim
|
#run general/parser/auto_create_tb_drop_tb.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/col_arithmetic_operation.sim
|
#run general/parser/col_arithmetic_operation.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/columnValue.sim
|
#run general/parser/columnValue.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/commit.sim
|
#run general/parser/commit.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/create_db.sim
|
#run general/parser/create_db.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/create_mt.sim
|
#run general/parser/create_mt.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/create_tb.sim
|
#run general/parser/create_tb.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/dbtbnameValidate.sim
|
#run general/parser/dbtbnameValidate.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/fill.sim
|
#run general/parser/fill.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/fill_stb.sim
|
#run general/parser/fill_stb.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
#run general/parser/fill_us.sim #
|
##run general/parser/fill_us.sim #
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/first_last.sim
|
#run general/parser/first_last.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/import_commit1.sim
|
#run general/parser/import_commit1.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/import_commit2.sim
|
#run general/parser/import_commit2.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/import_commit3.sim
|
#run general/parser/import_commit3.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
#run general/parser/import_file.sim
|
##run general/parser/import_file.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/insert_tb.sim
|
#run general/parser/insert_tb.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/tags_dynamically_specifiy.sim
|
#run general/parser/tags_dynamically_specifiy.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/interp.sim
|
#run general/parser/interp.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/lastrow.sim
|
#run general/parser/lastrow.sim
|
||||||
sleep 500
|
#sleep 500
|
||||||
run general/parser/limit.sim
|
#run general/parser/limit.sim
|
||||||
sleep 500
|
sleep 500
|
||||||
run general/parser/limit1.sim
|
run general/parser/limit1.sim
|
||||||
sleep 500
|
sleep 500
|
||||||
|
|
Loading…
Reference in New Issue