[TD-225] refactor.
This commit is contained in:
parent
9e7234b479
commit
ca5c168964
|
@ -49,7 +49,6 @@ typedef struct SFillInfo {
|
||||||
int32_t numOfTags; // number of tags
|
int32_t numOfTags; // number of tags
|
||||||
int32_t numOfCols; // number of columns, including the tags columns
|
int32_t numOfCols; // number of columns, including the tags columns
|
||||||
int32_t rowSize; // size of each row
|
int32_t rowSize; // size of each row
|
||||||
// char ** pTags; // tags value for current interpolation
|
|
||||||
SFillTagColInfo* pTags; // tags value for filling gap
|
SFillTagColInfo* pTags; // tags value for filling gap
|
||||||
SInterval interval;
|
SInterval interval;
|
||||||
char * prevValues; // previous row of data, to generate the interpolation results
|
char * prevValues; // previous row of data, to generate the interpolation results
|
||||||
|
@ -83,7 +82,7 @@ int64_t getFilledNumOfRes(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRo
|
||||||
|
|
||||||
int32_t taosNumOfRemainRows(SFillInfo *pFillInfo);
|
int32_t taosNumOfRemainRows(SFillInfo *pFillInfo);
|
||||||
|
|
||||||
int taosDoLinearInterpolation(int32_t type, SPoint *point1, SPoint *point2, SPoint *point);
|
int32_t taosGetLinearInterpolationVal(int32_t type, SPoint *point1, SPoint *point2, SPoint *point);
|
||||||
|
|
||||||
int64_t taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_t capacity);
|
int64_t taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_t capacity);
|
||||||
|
|
||||||
|
|
|
@ -733,10 +733,6 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S
|
||||||
assert(pLeft->nodeType == TSQL_NODE_COL && (pRight->nodeType == TSQL_NODE_VALUE || pRight->nodeType == TSQL_NODE_DUMMY));
|
assert(pLeft->nodeType == TSQL_NODE_COL && (pRight->nodeType == TSQL_NODE_VALUE || pRight->nodeType == TSQL_NODE_DUMMY));
|
||||||
|
|
||||||
param->setupInfoFn(pExpr, param->pExtInfo);
|
param->setupInfoFn(pExpr, param->pExtInfo);
|
||||||
if (pSkipList == NULL) {
|
|
||||||
tArrayTraverse(pExpr, param->nodeFilterFn, result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tQueryInfo *pQueryInfo = pExpr->_node.info;
|
tQueryInfo *pQueryInfo = pExpr->_node.info;
|
||||||
if (pQueryInfo->indexed && pQueryInfo->optr != TSDB_RELATION_LIKE) {
|
if (pQueryInfo->indexed && pQueryInfo->optr != TSDB_RELATION_LIKE) {
|
||||||
|
@ -748,10 +744,10 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursive traverse left child branch
|
|
||||||
// The value of hasPK is always 0.
|
// The value of hasPK is always 0.
|
||||||
uint8_t weight = pLeft->_node.hasPK + pRight->_node.hasPK;
|
uint8_t weight = pLeft->_node.hasPK + pRight->_node.hasPK;
|
||||||
assert(weight == 0 && pSkipList != NULL && taosArrayGetSize(result) == 0);
|
assert(weight == 0 && pSkipList != NULL && taosArrayGetSize(result) == 0);
|
||||||
|
|
||||||
//apply the hierarchical expression to every node in skiplist for find the qualified nodes
|
//apply the hierarchical expression to every node in skiplist for find the qualified nodes
|
||||||
tSQLBinaryTraverseOnSkipList(pExpr, result, pSkipList, param);
|
tSQLBinaryTraverseOnSkipList(pExpr, result, pSkipList, param);
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ static double linearInterpolationImpl(double v1, double v2, double k1, double k2
|
||||||
return v1 + (v2 - v1) * (k - k1) / (k2 - k1);
|
return v1 + (v2 - v1) * (k - k1) / (k2 - k1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int taosDoLinearInterpolation(int32_t type, SPoint* point1, SPoint* point2, SPoint* point) {
|
int32_t taosGetLinearInterpolationVal(int32_t type, SPoint* point1, SPoint* point2, SPoint* point) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_INT: {
|
case TSDB_DATA_TYPE_INT: {
|
||||||
*(int32_t*)point->val = (int32_t)linearInterpolationImpl(*(int32_t*)point1->val, *(int32_t*)point2->val, (double)point1->key,
|
*(int32_t*)point->val = (int32_t)linearInterpolationImpl(*(int32_t*)point1->val, *(int32_t*)point2->val, (double)point1->key,
|
||||||
|
@ -343,7 +343,7 @@ static void doFillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* nu
|
||||||
point1 = (SPoint){.key = *(TSKEY*)(prevValues), .val = prevValues + pCol->col.offset};
|
point1 = (SPoint){.key = *(TSKEY*)(prevValues), .val = prevValues + pCol->col.offset};
|
||||||
point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->rowIdx * bytes};
|
point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->rowIdx * bytes};
|
||||||
point = (SPoint){.key = pFillInfo->start, .val = val1};
|
point = (SPoint){.key = pFillInfo->start, .val = val1};
|
||||||
taosDoLinearInterpolation(type, &point1, &point2, &point);
|
taosGetLinearInterpolationVal(type, &point1, &point2, &point);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTagsValue(pFillInfo, data, *num);
|
setTagsValue(pFillInfo, data, *num);
|
||||||
|
|
Loading…
Reference in New Issue