fix bugs found in regression test.
This commit is contained in:
parent
e9dc2db741
commit
54da5e5f7e
|
@ -3859,10 +3859,11 @@ int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL) {
|
||||||
|
|
||||||
for (int32_t i = numOfFillVal; i < pQueryInfo->fieldsInfo.numOfOutputCols; ++i) {
|
for (int32_t i = numOfFillVal; i < pQueryInfo->fieldsInfo.numOfOutputCols; ++i) {
|
||||||
TAOS_FIELD* pFields = tscFieldInfoGetField(pQueryInfo, i);
|
TAOS_FIELD* pFields = tscFieldInfoGetField(pQueryInfo, i);
|
||||||
tVariantDump(&lastItem->pVar, (char*)&pQueryInfo->defaultVal[i], pFields->type);
|
|
||||||
|
|
||||||
if (pFields->type == TSDB_DATA_TYPE_BINARY || pFields->type == TSDB_DATA_TYPE_NCHAR) {
|
if (pFields->type == TSDB_DATA_TYPE_BINARY || pFields->type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
setNull((char*)(&pQueryInfo->defaultVal[i]), pFields->type, pFields->bytes);
|
setNull((char*)(&pQueryInfo->defaultVal[i]), pFields->type, pFields->bytes);
|
||||||
|
} else {
|
||||||
|
tVariantDump(&lastItem->pVar, (char*)&pQueryInfo->defaultVal[i], pFields->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -424,7 +424,7 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
|
||||||
// if data block is not loaded, it must be the intermediate blocks
|
// if data block is not loaded, it must be the intermediate blocks
|
||||||
assert((pBlock->keyFirst >= pQuery->lastKey && pBlock->keyLast <= pQuery->ekey && QUERY_IS_ASC_QUERY(pQuery)) ||
|
assert((pBlock->keyFirst >= pQuery->lastKey && pBlock->keyLast <= pQuery->ekey && QUERY_IS_ASC_QUERY(pQuery)) ||
|
||||||
(pBlock->keyFirst >= pQuery->ekey && pBlock->keyLast <= pQuery->lastKey && !QUERY_IS_ASC_QUERY(pQuery)));
|
(pBlock->keyFirst >= pQuery->ekey && pBlock->keyLast <= pQuery->lastKey && !QUERY_IS_ASC_QUERY(pQuery)));
|
||||||
nextKey = QUERY_IS_ASC_QUERY(pQuery)? pBlock->keyFirst:pBlock->keyLast;
|
nextKey = QUERY_IS_ASC_QUERY(pQuery) ? pBlock->keyFirst : pBlock->keyLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pQuery->intervalTime == 0) {
|
if (pQuery->intervalTime == 0) {
|
||||||
|
@ -1091,18 +1091,15 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
initCtxOutputBuf(pRuntimeEnv);
|
initCtxOutputBuf(pRuntimeEnv);
|
||||||
|
|
||||||
vnodeScanAllData(pRuntimeEnv);
|
vnodeScanAllData(pRuntimeEnv);
|
||||||
|
|
||||||
if (isQueryKilled(pQuery)) {
|
if (isQueryKilled(pQuery)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!Q_STATUS_EQUAL(pQuery->over, QUERY_NOT_COMPLETED));
|
assert(!Q_STATUS_EQUAL(pQuery->over, QUERY_NOT_COMPLETED));
|
||||||
|
|
||||||
doFinalizeResult(pRuntimeEnv);
|
doFinalizeResult(pRuntimeEnv);
|
||||||
|
|
||||||
// int64_t maxOutput = getNumOfResult(pRuntimeEnv);
|
|
||||||
|
|
||||||
// here we can ignore the records in case of no interpolation
|
// here we can ignore the records in case of no interpolation
|
||||||
// todo handle offset, in case of top/bottom interval query
|
// todo handle offset, in case of top/bottom interval query
|
||||||
if ((pQuery->numOfFilterCols > 0 || pRuntimeEnv->pTSBuf != NULL) && pQuery->limit.offset > 0 &&
|
if ((pQuery->numOfFilterCols > 0 || pRuntimeEnv->pTSBuf != NULL) && pQuery->limit.offset > 0 &&
|
||||||
|
@ -1113,30 +1110,17 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
|
||||||
int32_t c = MIN(numOfClosed, pQuery->limit.offset);
|
int32_t c = MIN(numOfClosed, pQuery->limit.offset);
|
||||||
clearFirstNTimeWindow(pRuntimeEnv, c);
|
clearFirstNTimeWindow(pRuntimeEnv, c);
|
||||||
pQuery->limit.offset -= c;
|
pQuery->limit.offset -= c;
|
||||||
} else {
|
|
||||||
// pQuery->pointsRead += maxOutput;
|
|
||||||
// forwardCtxOutputBuf(pRuntimeEnv, maxOutput);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Q_STATUS_EQUAL(pQuery->over, QUERY_NO_DATA_TO_CHECK | QUERY_COMPLETED)) {
|
if (Q_STATUS_EQUAL(pQuery->over, QUERY_NO_DATA_TO_CHECK | QUERY_COMPLETED)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load the data block for the next retrieve
|
||||||
loadRequiredBlockIntoMem(pRuntimeEnv, &pRuntimeEnv->nextPos);
|
loadRequiredBlockIntoMem(pRuntimeEnv, &pRuntimeEnv->nextPos);
|
||||||
if (Q_STATUS_EQUAL(pQuery->over, QUERY_RESBUF_FULL)) {
|
if (Q_STATUS_EQUAL(pQuery->over, QUERY_RESBUF_FULL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /*
|
|
||||||
// * the scan limitation mechanism is upon here,
|
|
||||||
// * 1. since there is only one(k) record is generated in one scan operation
|
|
||||||
// * 2. remain space is not sufficient for next query output, abort
|
|
||||||
// */
|
|
||||||
// if ((pQuery->pointsRead % pQuery->pointsToRead == 0 && pQuery->pointsRead != 0) ||
|
|
||||||
// ((pQuery->pointsRead + maxOutput) > pQuery->pointsToRead)) {
|
|
||||||
// setQueryStatus(pQuery, QUERY_RESBUF_FULL);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,7 +1246,9 @@ void vnodeSingleTableQuery(SSchedMsg *pMsg) {
|
||||||
// here we have scan all qualified data in both data file and cache
|
// here we have scan all qualified data in both data file and cache
|
||||||
if (Q_STATUS_EQUAL(pQuery->over, QUERY_NO_DATA_TO_CHECK | QUERY_COMPLETED)) {
|
if (Q_STATUS_EQUAL(pQuery->over, QUERY_NO_DATA_TO_CHECK | QUERY_COMPLETED)) {
|
||||||
// continue to get push data from the group result
|
// continue to get push data from the group result
|
||||||
if (isGroupbyNormalCol(pQuery->pGroupbyExpr) || pQuery->intervalTime > 0) {
|
if (isGroupbyNormalCol(pQuery->pGroupbyExpr) ||
|
||||||
|
(pQuery->intervalTime > 0 && pQInfo->pointsReturned < pQuery->limit.limit)) {
|
||||||
|
//todo limit the output for interval query?
|
||||||
pQuery->pointsRead = 0;
|
pQuery->pointsRead = 0;
|
||||||
pSupporter->subgroupIdx = 0; // always start from 0
|
pSupporter->subgroupIdx = 0; // always start from 0
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "taosmsg.h"
|
#include "taosmsg.h"
|
||||||
#include "textbuffer.h"
|
#include "textbuffer.h"
|
||||||
|
@ -47,7 +44,7 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t timeRange, char
|
||||||
char** tzname = _tzname;
|
char** tzname = _tzname;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int64_t t = (precision == TSDB_TIME_PRECISION_MILLI)?MILLISECOND_PER_SECOND:MILLISECOND_PER_SECOND*1000L;
|
int64_t t = (precision == TSDB_TIME_PRECISION_MILLI) ? MILLISECOND_PER_SECOND : MILLISECOND_PER_SECOND * 1000L;
|
||||||
|
|
||||||
int64_t revStartime = (startTime / timeRange) * timeRange + timezone * t;
|
int64_t revStartime = (startTime / timeRange) * timeRange + timezone * t;
|
||||||
int64_t revEndtime = revStartime + timeRange - 1;
|
int64_t revEndtime = revStartime + timeRange - 1;
|
||||||
|
@ -78,14 +75,14 @@ void taosInitInterpoInfo(SInterpolationInfo* pInterpoInfo, int32_t order, int64_
|
||||||
}
|
}
|
||||||
|
|
||||||
// the SInterpolationInfo itself will not be released
|
// the SInterpolationInfo itself will not be released
|
||||||
void taosDestoryInterpoInfo(SInterpolationInfo *pInterpoInfo) {
|
void taosDestoryInterpoInfo(SInterpolationInfo* pInterpoInfo) {
|
||||||
if (pInterpoInfo == NULL) {
|
if (pInterpoInfo == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(pInterpoInfo->prevValues);
|
tfree(pInterpoInfo->prevValues);
|
||||||
tfree(pInterpoInfo->nextValues);
|
tfree(pInterpoInfo->nextValues);
|
||||||
|
|
||||||
tfree(pInterpoInfo->pTags);
|
tfree(pInterpoInfo->pTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +91,7 @@ void taosInterpoSetStartInfo(SInterpolationInfo* pInterpoInfo, int32_t numOfRawD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pInterpoInfo->rowIdx = 0;//INTERPOL_IS_ASC_INTERPOL(pInterpoInfo) ? 0 : numOfRawDataInRows - 1;
|
pInterpoInfo->rowIdx = 0; // INTERPOL_IS_ASC_INTERPOL(pInterpoInfo) ? 0 : numOfRawDataInRows - 1;
|
||||||
pInterpoInfo->numOfRawDataInRows = numOfRawDataInRows;
|
pInterpoInfo->numOfRawDataInRows = numOfRawDataInRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,14 +115,9 @@ int32_t taosGetNumOfResWithoutLimit(SInterpolationInfo* pInterpoInfo, int64_t* p
|
||||||
if (numOfAvailRawData > 0) {
|
if (numOfAvailRawData > 0) {
|
||||||
int32_t finalNumOfResult = 0;
|
int32_t finalNumOfResult = 0;
|
||||||
|
|
||||||
// if (pInterpoInfo->order == TSQL_SO_ASC) {
|
// get last timestamp, calculate the result size
|
||||||
// get last timestamp, calculate the result size
|
int64_t lastKey = pPrimaryKeyArray[pInterpoInfo->numOfRawDataInRows - 1];
|
||||||
int64_t lastKey = pPrimaryKeyArray[pInterpoInfo->numOfRawDataInRows - 1];
|
finalNumOfResult = (int32_t)(labs(lastKey - pInterpoInfo->startTimestamp) / nInterval) + 1;
|
||||||
finalNumOfResult = (int32_t)(labs(lastKey - pInterpoInfo->startTimestamp) / nInterval) + 1;
|
|
||||||
// } else { // todo error less than one!!!
|
|
||||||
// TSKEY lastKey = pPrimaryKeyArray[0];
|
|
||||||
// finalNumOfResult = (int32_t)((pInterpoInfo->startTimestamp - lastKey) / nInterval) + 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
assert(finalNumOfResult >= numOfAvailRawData);
|
assert(finalNumOfResult >= numOfAvailRawData);
|
||||||
return finalNumOfResult;
|
return finalNumOfResult;
|
||||||
|
@ -140,7 +132,9 @@ int32_t taosGetNumOfResWithoutLimit(SInterpolationInfo* pInterpoInfo, int64_t* p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosHasRemainsDataForInterpolation(SInterpolationInfo* pInterpoInfo) { return taosNumOfRemainPoints(pInterpoInfo) > 0; }
|
bool taosHasRemainsDataForInterpolation(SInterpolationInfo* pInterpoInfo) {
|
||||||
|
return taosNumOfRemainPoints(pInterpoInfo) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t taosNumOfRemainPoints(SInterpolationInfo* pInterpoInfo) {
|
int32_t taosNumOfRemainPoints(SInterpolationInfo* pInterpoInfo) {
|
||||||
if (pInterpoInfo->rowIdx == -1 || pInterpoInfo->numOfRawDataInRows == 0) {
|
if (pInterpoInfo->rowIdx == -1 || pInterpoInfo->numOfRawDataInRows == 0) {
|
||||||
|
@ -197,28 +191,22 @@ int taosDoLinearInterpolation(int32_t type, SPoint* point1, SPoint* point2, SPoi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* getPos(char* data, int32_t bytes, int32_t order, int32_t capacity, int32_t index) {
|
static char* getPos(char* data, int32_t bytes, int32_t index) { return data + index * bytes; }
|
||||||
// if (order == TSQL_SO_ASC) {
|
|
||||||
return data + index * bytes;
|
|
||||||
// } else {
|
|
||||||
// return data + (capacity - index - 1) * bytes;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setTagsValueInInterpolation(tFilePage** data, char** pTags, SColumnModel* pModel, int32_t order, int32_t start,
|
static void setTagsValueInInterpolation(tFilePage** data, char** pTags, SColumnModel* pModel, int32_t order,
|
||||||
int32_t capacity, int32_t num) {
|
int32_t start, int32_t capacity, int32_t num) {
|
||||||
for (int32_t j = 0, i = start; i < pModel->numOfCols; ++i, ++j) {
|
for (int32_t j = 0, i = start; i < pModel->numOfCols; ++i, ++j) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, order, capacity, num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, num);
|
||||||
assignVal(val1, pTags[j], pSchema->bytes, pSchema->type);
|
assignVal(val1, pTags[j], pSchema->bytes, pSchema->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interpoType, tFilePage** data,
|
static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interpoType, tFilePage** data,
|
||||||
SColumnModel* pModel, int32_t* num, char** srcData, int64_t nInterval, int64_t* defaultVal,
|
SColumnModel* pModel, int32_t* num, char** srcData, int64_t nInterval,
|
||||||
int64_t currentTimestamp, int32_t capacity, int32_t numOfTags, char** pTags,
|
int64_t* defaultVal, int64_t currentTimestamp, int32_t capacity, int32_t numOfTags,
|
||||||
bool outOfBound) {
|
char** pTags, bool outOfBound) {
|
||||||
char** prevValues = &pInterpoInfo->prevValues;
|
char** prevValues = &pInterpoInfo->prevValues;
|
||||||
char** nextValues = &pInterpoInfo->nextValues;
|
char** nextValues = &pInterpoInfo->nextValues;
|
||||||
|
|
||||||
|
@ -226,7 +214,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
|
|
||||||
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pInterpoInfo->order);
|
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pInterpoInfo->order);
|
||||||
|
|
||||||
char* val = getPos(data[0]->data, TSDB_KEYSIZE, pInterpoInfo->order, capacity, *num);
|
char* val = getPos(data[0]->data, TSDB_KEYSIZE, *num);
|
||||||
*(TSKEY*)val = pInterpoInfo->startTimestamp;
|
*(TSKEY*)val = pInterpoInfo->startTimestamp;
|
||||||
|
|
||||||
int32_t numOfValCols = pModel->numOfCols - numOfTags;
|
int32_t numOfValCols = pModel->numOfCols - numOfTags;
|
||||||
|
@ -237,9 +225,9 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
if (pInterpolationData != NULL) {
|
if (pInterpolationData != NULL) {
|
||||||
for (int32_t i = 1; i < numOfValCols; ++i) {
|
for (int32_t i = 1; i < numOfValCols; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
int16_t offset = getColumnModelOffset(pModel, i);
|
int16_t offset = getColumnModelOffset(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, *num);
|
||||||
|
|
||||||
if (isNull(pInterpolationData + offset, pSchema->type)) {
|
if (isNull(pInterpolationData + offset, pSchema->type)) {
|
||||||
setNull(val1, pSchema->type, pSchema->bytes);
|
setNull(val1, pSchema->type, pSchema->bytes);
|
||||||
|
@ -250,8 +238,8 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
} else { /* no prev value yet, set the value for null */
|
} else { /* no prev value yet, set the value for null */
|
||||||
for (int32_t i = 1; i < numOfValCols; ++i) {
|
for (int32_t i = 1; i < numOfValCols; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, *num);
|
||||||
setNull(val1, pSchema->type, pSchema->bytes);
|
setNull(val1, pSchema->type, pSchema->bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,10 +250,10 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
if (*prevValues != NULL && !outOfBound) {
|
if (*prevValues != NULL && !outOfBound) {
|
||||||
for (int32_t i = 1; i < numOfValCols; ++i) {
|
for (int32_t i = 1; i < numOfValCols; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
int16_t offset = getColumnModelOffset(pModel, i);
|
int16_t offset = getColumnModelOffset(pModel, i);
|
||||||
|
|
||||||
int16_t type = pSchema->type;
|
int16_t type = pSchema->type;
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, *num);
|
||||||
|
|
||||||
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) {
|
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) {
|
||||||
setNull(val1, type, pSchema->bytes);
|
setNull(val1, type, pSchema->bytes);
|
||||||
|
@ -283,8 +271,8 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
} else {
|
} else {
|
||||||
for (int32_t i = 1; i < numOfValCols; ++i) {
|
for (int32_t i = 1; i < numOfValCols; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, *num);
|
||||||
setNull(val1, pSchema->type, pSchema->bytes);
|
setNull(val1, pSchema->type, pSchema->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,8 +281,8 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
|
||||||
} else { /* default value interpolation */
|
} else { /* default value interpolation */
|
||||||
for (int32_t i = 1; i < numOfValCols; ++i) {
|
for (int32_t i = 1; i < numOfValCols; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, *num);
|
||||||
assignVal(val1, (char*)&defaultVal[i], pSchema->bytes, pSchema->type);
|
assignVal(val1, (char*)&defaultVal[i], pSchema->bytes, pSchema->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,9 +332,9 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
|
||||||
if (*nextValues == NULL) {
|
if (*nextValues == NULL) {
|
||||||
*nextValues = calloc(1, pModel->rowSize);
|
*nextValues = calloc(1, pModel->rowSize);
|
||||||
for (int i = 1; i < pModel->numOfCols; i++) {
|
for (int i = 1; i < pModel->numOfCols; i++) {
|
||||||
int16_t offset = getColumnModelOffset(pModel, i);
|
int16_t offset = getColumnModelOffset(pModel, i);
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
setNull(*nextValues + offset, pSchema->type, pSchema->bytes);
|
setNull(*nextValues + offset, pSchema->type, pSchema->bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,33 +342,36 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
|
||||||
int32_t offset = pInterpoInfo->rowIdx;
|
int32_t offset = pInterpoInfo->rowIdx;
|
||||||
for (int32_t tlen = 0, i = 0; i < pModel->numOfCols - numOfTags; ++i) {
|
for (int32_t tlen = 0, i = 0; i < pModel->numOfCols - numOfTags; ++i) {
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
memcpy(*nextValues + tlen, srcData[i] + offset * pSchema->bytes, pSchema->bytes);
|
memcpy(*nextValues + tlen, srcData[i] + offset * pSchema->bytes, pSchema->bytes);
|
||||||
tlen += pSchema->bytes;
|
tlen += pSchema->bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (((pInterpoInfo->startTimestamp < currentTimestamp && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
if (((pInterpoInfo->startTimestamp < currentTimestamp && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
||||||
(pInterpoInfo->startTimestamp > currentTimestamp && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo))) &&
|
(pInterpoInfo->startTimestamp > currentTimestamp && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo))) &&
|
||||||
num < outputRows) {
|
num < outputRows) {
|
||||||
doInterpoResultImpl(pInterpoInfo, interpoType, data, pModel, &num, srcData, nInterval, defaultVal,
|
while (((pInterpoInfo->startTimestamp < currentTimestamp && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
||||||
currentTimestamp, bufSize, numOfTags, pTags, false);
|
(pInterpoInfo->startTimestamp > currentTimestamp && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo))) &&
|
||||||
}
|
num < outputRows) {
|
||||||
|
doInterpoResultImpl(pInterpoInfo, interpoType, data, pModel, &num, srcData, nInterval, defaultVal,
|
||||||
|
currentTimestamp, bufSize, numOfTags, pTags, false);
|
||||||
|
}
|
||||||
|
|
||||||
/* output buffer is full, abort */
|
/* output buffer is full, abort */
|
||||||
if ((num == outputRows && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
if ((num == outputRows && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
||||||
(num < 0 && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo))) {
|
(num < 0 && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo))) {
|
||||||
pInterpoInfo->numOfTotalInterpo += pInterpoInfo->numOfCurrentInterpo;
|
pInterpoInfo->numOfTotalInterpo += pInterpoInfo->numOfCurrentInterpo;
|
||||||
return outputRows;
|
return outputRows;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if (pInterpoInfo->startTimestamp == currentTimestamp) {
|
// if (pInterpoInfo->startTimestamp == currentTimestamp) {
|
||||||
if (*prevValues == NULL) {
|
if (*prevValues == NULL) {
|
||||||
*prevValues = calloc(1, pModel->rowSize);
|
*prevValues = calloc(1, pModel->rowSize);
|
||||||
for (int i = 1; i < pModel->numOfCols; i++) {
|
for (int i = 1; i < pModel->numOfCols; i++) {
|
||||||
int16_t offset = getColumnModelOffset(pModel, i);
|
int16_t offset = getColumnModelOffset(pModel, i);
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
setNull(*prevValues + offset, pSchema->type, pSchema->bytes);
|
setNull(*prevValues + offset, pSchema->type, pSchema->bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,17 +379,16 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
|
||||||
// assign rows to dst buffer
|
// assign rows to dst buffer
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
for (int32_t tlen = 0; i < pModel->numOfCols - numOfTags; ++i) {
|
for (int32_t tlen = 0; i < pModel->numOfCols - numOfTags; ++i) {
|
||||||
int16_t offset = getColumnModelOffset(pModel, i);
|
int16_t offset = getColumnModelOffset(pModel, i);
|
||||||
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
SSchema* pSchema = getColumnModelSchema(pModel, i);
|
||||||
|
|
||||||
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, bufSize, num);
|
char* val1 = getPos(data[i]->data, pSchema->bytes, num);
|
||||||
|
|
||||||
if (i == 0 ||
|
if (i == 0 ||
|
||||||
(functionIDs[i] != TSDB_FUNC_COUNT &&
|
(functionIDs[i] != TSDB_FUNC_COUNT &&
|
||||||
!isNull(srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->type)) ||
|
!isNull(srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->type)) ||
|
||||||
(functionIDs[i] == TSDB_FUNC_COUNT &&
|
(functionIDs[i] == TSDB_FUNC_COUNT &&
|
||||||
*(int64_t*)(srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes) != 0)) {
|
*(int64_t*)(srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes) != 0)) {
|
||||||
|
|
||||||
assignVal(val1, srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->bytes, pSchema->type);
|
assignVal(val1, srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->bytes, pSchema->type);
|
||||||
memcpy(*prevValues + tlen, srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->bytes);
|
memcpy(*prevValues + tlen, srcData[i] + pInterpoInfo->rowIdx * pSchema->bytes, pSchema->bytes);
|
||||||
} else { // i > 0 and isNULL, do interpolation
|
} else { // i > 0 and isNULL, do interpolation
|
||||||
|
@ -416,11 +406,11 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
|
||||||
/* set the tag value for final result */
|
/* set the tag value for final result */
|
||||||
setTagsValueInInterpolation(data, pTags, pModel, pInterpoInfo->order, pModel->numOfCols - numOfTags, bufSize,
|
setTagsValueInInterpolation(data, pTags, pModel, pInterpoInfo->order, pModel->numOfCols - numOfTags, bufSize,
|
||||||
num);
|
num);
|
||||||
}
|
|
||||||
|
|
||||||
pInterpoInfo->startTimestamp += (nInterval * step);
|
pInterpoInfo->startTimestamp += (nInterval * step);
|
||||||
pInterpoInfo->rowIdx += 1;
|
pInterpoInfo->rowIdx += 1;
|
||||||
num += 1;
|
num += 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((pInterpoInfo->rowIdx >= pInterpoInfo->numOfRawDataInRows && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
if ((pInterpoInfo->rowIdx >= pInterpoInfo->numOfRawDataInRows && INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) ||
|
||||||
(pInterpoInfo->rowIdx < 0 && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) || num >= outputRows) {
|
(pInterpoInfo->rowIdx < 0 && !INTERPOL_IS_ASC_INTERPOL(pInterpoInfo)) || num >= outputRows) {
|
||||||
|
|
Loading…
Reference in New Issue