ehn(query): remove some redundant codes in executor.
This commit is contained in:
parent
33e51fda3e
commit
0252fa49db
|
@ -152,11 +152,6 @@ typedef struct SOperatorCostInfo {
|
||||||
uint64_t totalCost;
|
uint64_t totalCost;
|
||||||
} SOperatorCostInfo;
|
} SOperatorCostInfo;
|
||||||
|
|
||||||
typedef struct SOrder {
|
|
||||||
uint32_t order;
|
|
||||||
SColumn col;
|
|
||||||
} SOrder;
|
|
||||||
|
|
||||||
// The basic query information extracted from the SQueryInfo tree to support the
|
// The basic query information extracted from the SQueryInfo tree to support the
|
||||||
// execution of query in a data node.
|
// execution of query in a data node.
|
||||||
typedef struct STaskAttr {
|
typedef struct STaskAttr {
|
||||||
|
@ -170,7 +165,6 @@ typedef struct STaskAttr {
|
||||||
bool diffQuery; // is diff query
|
bool diffQuery; // is diff query
|
||||||
bool pointInterpQuery; // point interpolation query
|
bool pointInterpQuery; // point interpolation query
|
||||||
int32_t havingNum; // having expr number
|
int32_t havingNum; // having expr number
|
||||||
SOrder order;
|
|
||||||
int16_t numOfCols;
|
int16_t numOfCols;
|
||||||
int16_t numOfTags;
|
int16_t numOfTags;
|
||||||
STimeWindow window;
|
STimeWindow window;
|
||||||
|
|
|
@ -337,11 +337,11 @@ int32_t tsDescOrder(const void* p1, const void* p2) {
|
||||||
|
|
||||||
void orderTheResultRows(STaskRuntimeEnv* pRuntimeEnv) {
|
void orderTheResultRows(STaskRuntimeEnv* pRuntimeEnv) {
|
||||||
__compar_fn_t fn = NULL;
|
__compar_fn_t fn = NULL;
|
||||||
if (pRuntimeEnv->pQueryAttr->order.order == TSDB_ORDER_ASC) {
|
// if (pRuntimeEnv->pQueryAttr->order.order == TSDB_ORDER_ASC) {
|
||||||
fn = tsAscOrder;
|
// fn = tsAscOrder;
|
||||||
} else {
|
// } else {
|
||||||
fn = tsDescOrder;
|
// fn = tsDescOrder;
|
||||||
}
|
// }
|
||||||
|
|
||||||
taosArraySort(pRuntimeEnv->pResultRowArrayList, fn);
|
taosArraySort(pRuntimeEnv->pResultRowArrayList, fn);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ static int32_t mergeIntoGroupResultImplRv(STaskRuntimeEnv *pRuntimeEnv, SGroupRe
|
||||||
|
|
||||||
static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv, SGroupResInfo* pGroupResInfo, SArray *pTableList,
|
static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv, SGroupResInfo* pGroupResInfo, SArray *pTableList,
|
||||||
int32_t* rowCellInfoOffset) {
|
int32_t* rowCellInfoOffset) {
|
||||||
bool ascQuery = QUERY_IS_ASC_QUERY(pRuntimeEnv->pQueryAttr);
|
bool ascQuery = true;
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
@ -413,7 +413,8 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCompSupporter cs = {pTableQueryInfoList, posList, pRuntimeEnv->pQueryAttr->order.order};
|
int32_t order = TSDB_ORDER_ASC;
|
||||||
|
SCompSupporter cs = {pTableQueryInfoList, posList, order};
|
||||||
|
|
||||||
int32_t ret = tMergeTreeCreate(&pTree, numOfTables, &cs, tableResultComparFn);
|
int32_t ret = tMergeTreeCreate(&pTree, numOfTables, &cs, tableResultComparFn);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -990,7 +990,8 @@ static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext,
|
||||||
|
|
||||||
static FORCE_INLINE TSKEY reviseWindowEkey(STaskAttr* pQueryAttr, STimeWindow* pWindow) {
|
static FORCE_INLINE TSKEY reviseWindowEkey(STaskAttr* pQueryAttr, STimeWindow* pWindow) {
|
||||||
TSKEY ekey = -1;
|
TSKEY ekey = -1;
|
||||||
if (QUERY_IS_ASC_QUERY(pQueryAttr)) {
|
int32_t order = TSDB_ORDER_ASC;
|
||||||
|
if (order == TSDB_ORDER_ASC) {
|
||||||
ekey = pWindow->ekey;
|
ekey = pWindow->ekey;
|
||||||
if (ekey > pQueryAttr->window.ekey) {
|
if (ekey > pQueryAttr->window.ekey) {
|
||||||
ekey = pQueryAttr->window.ekey;
|
ekey = pQueryAttr->window.ekey;
|
||||||
|
@ -1961,7 +1962,8 @@ static bool isCachedLastQuery(STaskAttr* pQueryAttr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pQueryAttr->order.order != TSDB_ORDER_DESC || !TSWINDOW_IS_EQUAL(pQueryAttr->window, TSWINDOW_DESC_INITIALIZER)) {
|
int32_t order = TSDB_ORDER_ASC;
|
||||||
|
if (order != TSDB_ORDER_DESC || !TSWINDOW_IS_EQUAL(pQueryAttr->window, TSWINDOW_DESC_INITIALIZER)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2187,7 +2189,7 @@ static bool overlapWithTimeWindow(STaskAttr* pQueryAttr, SDataBlockInfo* pBlockI
|
||||||
TSKEY sk = TMIN(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
TSKEY sk = TMIN(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||||
TSKEY ek = TMAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
TSKEY ek = TMAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||||
|
|
||||||
if (QUERY_IS_ASC_QUERY(pQueryAttr)) {
|
if (true) {
|
||||||
// getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.skey, sk, ek, &w);
|
// getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.skey, sk, ek, &w);
|
||||||
assert(w.ekey >= pBlockInfo->window.skey);
|
assert(w.ekey >= pBlockInfo->window.skey);
|
||||||
|
|
||||||
|
@ -5445,8 +5447,6 @@ static SSDataBlock* doSTableIntervalAgg(SOperatorInfo* pOperator, bool* newgroup
|
||||||
}
|
}
|
||||||
|
|
||||||
STaskAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
STaskAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||||
int32_t order = pQueryAttr->order.order;
|
|
||||||
|
|
||||||
SOperatorInfo* downstream = pOperator->pDownstream[0];
|
SOperatorInfo* downstream = pOperator->pDownstream[0];
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -5462,14 +5462,13 @@ static SSDataBlock* doSTableIntervalAgg(SOperatorInfo* pOperator, bool* newgroup
|
||||||
STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current;
|
STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current;
|
||||||
|
|
||||||
// setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput);
|
// setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput);
|
||||||
setInputDataBlock(pOperator, pIntervalInfo->binfo.pCtx, pBlock, pQueryAttr->order.order);
|
setInputDataBlock(pOperator, pIntervalInfo->binfo.pCtx, pBlock, TSDB_ORDER_ASC);
|
||||||
setIntervalQueryRange(pRuntimeEnv, pBlock->info.window.skey);
|
setIntervalQueryRange(pRuntimeEnv, pBlock->info.window.skey);
|
||||||
|
|
||||||
hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex);
|
hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
pOperator->status = OP_RES_TO_RETURN;
|
pOperator->status = OP_RES_TO_RETURN;
|
||||||
pQueryAttr->order.order = order; // TODO : restore the order
|
|
||||||
doCloseAllTimeWindow(pRuntimeEnv);
|
doCloseAllTimeWindow(pRuntimeEnv);
|
||||||
setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED);
|
setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue