提交 18112c74 编写于 作者: H Haojun Liao

[td-2895] refactor.

上级 5746730a
...@@ -42,6 +42,8 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int ...@@ -42,6 +42,8 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define GET_TABLEGROUP(q, _index) ((SArray*) taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index))) #define GET_TABLEGROUP(q, _index) ((SArray*) taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index)))
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
enum { enum {
// when query starts to execute, this status will set // when query starts to execute, this status will set
QUERY_NOT_COMPLETED = 0x1u, QUERY_NOT_COMPLETED = 0x1u,
...@@ -281,8 +283,7 @@ enum { ...@@ -281,8 +283,7 @@ enum {
typedef struct SOperatorInfo { typedef struct SOperatorInfo {
uint8_t operatorType; uint8_t operatorType;
bool blockingOptr; // block operator or not bool blockingOptr; // block operator or not
uint8_t completed; // denote if current operator is completed uint8_t status; // denote if current operator is completed
uint32_t seed; // operator seed
int32_t numOfOutput; // number of columns of the current operator results int32_t numOfOutput; // number of columns of the current operator results
char *name; // name, used to show the query execution plan char *name; // name, used to show the query execution plan
void *info; // extension attribution void *info; // extension attribution
...@@ -306,7 +307,6 @@ typedef struct SQInfo { ...@@ -306,7 +307,6 @@ typedef struct SQInfo {
SQueryRuntimeEnv runtimeEnv; SQueryRuntimeEnv runtimeEnv;
SQuery query; SQuery query;
SHashObj* arrTableIdInfo; SHashObj* arrTableIdInfo;
/* /*
...@@ -363,13 +363,14 @@ typedef struct STableScanInfo { ...@@ -363,13 +363,14 @@ typedef struct STableScanInfo {
SExprInfo *pExpr; SExprInfo *pExpr;
int32_t numOfOutput; int32_t numOfOutput;
int64_t elapsedTime; int64_t elapsedTime;
} STableScanInfo; } STableScanInfo;
typedef struct STagScanInfo { typedef struct STagScanInfo {
SColumnInfo* pCols; SColumnInfo* pCols;
SSDataBlock* pRes; SSDataBlock* pRes;
int32_t totalTables;
int32_t currentIndex;
} STagScanInfo; } STagScanInfo;
typedef struct SOptrBasicInfo { typedef struct SOptrBasicInfo {
...@@ -379,12 +380,17 @@ typedef struct SOptrBasicInfo { ...@@ -379,12 +380,17 @@ typedef struct SOptrBasicInfo {
SSDataBlock *pRes; SSDataBlock *pRes;
} SOptrBasicInfo; } SOptrBasicInfo;
typedef struct SOptrBasicInfo SAggOperatorInfo; typedef struct SOptrBasicInfo STableIntervalOperatorInfo;
typedef struct SOptrBasicInfo SHashIntervalOperatorInfo;
typedef struct SAggOperatorInfo {
SOptrBasicInfo binfo;
uint32_t seed;
} SAggOperatorInfo;
typedef struct SArithOperatorInfo { typedef struct SArithOperatorInfo {
SOptrBasicInfo binfo; SOptrBasicInfo binfo;
int32_t bufCapacity; int32_t bufCapacity;
uint32_t seed;
} SArithOperatorInfo; } SArithOperatorInfo;
typedef struct SLimitOperatorInfo { typedef struct SLimitOperatorInfo {
...@@ -401,10 +407,10 @@ typedef struct SFillOperatorInfo { ...@@ -401,10 +407,10 @@ typedef struct SFillOperatorInfo {
int64_t totalInputRows; int64_t totalInputRows;
} SFillOperatorInfo; } SFillOperatorInfo;
typedef struct SHashGroupbyOperatorInfo { typedef struct SGroupbyOperatorInfo {
SOptrBasicInfo binfo; SOptrBasicInfo binfo;
int32_t colIndex; int32_t colIndex;
} SHashGroupbyOperatorInfo; } SGroupbyOperatorInfo;
void freeParam(SQueryParam *param); void freeParam(SQueryParam *param);
int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param); int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param);
......
此差异已折叠。
...@@ -246,13 +246,12 @@ bool qTableQuery(qinfo_t qinfo) { ...@@ -246,13 +246,12 @@ bool qTableQuery(qinfo_t qinfo) {
if (isQueryKilled(pQInfo)) { if (isQueryKilled(pQInfo)) {
qDebug("QInfo:%p query is killed", pQInfo); qDebug("QInfo:%p query is killed", pQInfo);
} else if (pRuntimeEnv->outputBuf->info.rows == 0) { } else if (GET_NUM_OF_RESULTS(pRuntimeEnv) == 0) {
qDebug("QInfo:%p over, %" PRIzu " tables queried, %"PRId64" rows are returned", pQInfo, pRuntimeEnv->tableqinfoGroupInfo.numOfTables, qDebug("QInfo:%p over, %" PRIzu " tables queried, %"PRId64" rows are returned", pQInfo, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
pRuntimeEnv->resultInfo.total); pRuntimeEnv->resultInfo.total);
} else { } else {
qDebug("QInfo:%p query paused, %d rows returned, numOfTotal:%" PRId64 " rows", qDebug("QInfo:%p query paused, %d rows returned, numOfTotal:%" PRId64 " rows",
pQInfo, pRuntimeEnv->outputBuf->info.rows, pQInfo, GET_NUM_OF_RESULTS(pRuntimeEnv), pRuntimeEnv->resultInfo.total + GET_NUM_OF_RESULTS(pRuntimeEnv));
pRuntimeEnv->resultInfo.total + pRuntimeEnv->outputBuf->info.rows);
} }
return doBuildResCheck(pQInfo); return doBuildResCheck(pQInfo);
...@@ -289,7 +288,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex ...@@ -289,7 +288,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
if (pQInfo->dataReady == QUERY_RESULT_READY) { if (pQInfo->dataReady == QUERY_RESULT_READY) {
*buildRes = true; *buildRes = true;
qDebug("QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo, pQuery->resultRowSize, qDebug("QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo, pQuery->resultRowSize,
pRuntimeEnv->outputBuf->info.rows, tstrerror(pQInfo->code)); GET_NUM_OF_RESULTS(pRuntimeEnv), tstrerror(pQInfo->code));
} else { } else {
*buildRes = false; *buildRes = false;
qDebug("QInfo:%p retrieve req set query return result after paused", pQInfo); qDebug("QInfo:%p retrieve req set query return result after paused", pQInfo);
...@@ -313,7 +312,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co ...@@ -313,7 +312,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
SQuery *pQuery = pQInfo->runtimeEnv.pQuery; SQuery *pQuery = pQInfo->runtimeEnv.pQuery;
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
int64_t s = pRuntimeEnv->outputBuf->info.rows; int64_t s = GET_NUM_OF_RESULTS(pRuntimeEnv);
size_t size = getResultSize(pQInfo, &s); size_t size = getResultSize(pQInfo, &s);
...@@ -339,7 +338,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co ...@@ -339,7 +338,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
} }
(*pRsp)->precision = htons(pQuery->precision); (*pRsp)->precision = htons(pQuery->precision);
if (pQInfo->runtimeEnv.outputBuf->info.rows > 0 && pQInfo->code == TSDB_CODE_SUCCESS) { if (GET_NUM_OF_RESULTS(&(pQInfo->runtimeEnv)) > 0 && pQInfo->code == TSDB_CODE_SUCCESS) {
doDumpQueryResult(pQInfo, (*pRsp)->data); doDumpQueryResult(pQInfo, (*pRsp)->data);
} else { } else {
setQueryStatus(pQuery, QUERY_OVER); setQueryStatus(pQuery, QUERY_OVER);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册