[td-225] refactor subquery codes
This commit is contained in:
parent
3206bf9641
commit
5dc2c5cdff
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TDENGINE_TSCSECONARYMERGE_H
|
#ifndef TDENGINE_TSCLOCALMERGE_H
|
||||||
#define TDENGINE_TSCSECONARYMERGE_H
|
#define TDENGINE_TSCLOCALMERGE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -27,14 +27,7 @@ extern "C" {
|
||||||
#include "tsclient.h"
|
#include "tsclient.h"
|
||||||
|
|
||||||
#define MAX_NUM_OF_SUBQUERY_RETRY 3
|
#define MAX_NUM_OF_SUBQUERY_RETRY 3
|
||||||
|
|
||||||
/*
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2018/01/05
|
|
||||||
* @author liaohj
|
|
||||||
* management of client-side reducer for metric query
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct SQLFunctionCtx;
|
struct SQLFunctionCtx;
|
||||||
|
|
||||||
typedef struct SLocalDataSource {
|
typedef struct SLocalDataSource {
|
||||||
|
@ -60,7 +53,6 @@ typedef struct SLocalReducer {
|
||||||
char * prevRowOfInput;
|
char * prevRowOfInput;
|
||||||
tFilePage * pResultBuf;
|
tFilePage * pResultBuf;
|
||||||
int32_t nResultBufSize;
|
int32_t nResultBufSize;
|
||||||
// char * pBufForInterpo; // intermediate buffer for interpolation
|
|
||||||
tFilePage * pTempBuffer;
|
tFilePage * pTempBuffer;
|
||||||
struct SQLFunctionCtx *pCtx;
|
struct SQLFunctionCtx *pCtx;
|
||||||
int32_t rowSize; // size of each intermediate result.
|
int32_t rowSize; // size of each intermediate result.
|
||||||
|
@ -81,13 +73,8 @@ typedef struct SLocalReducer {
|
||||||
} SLocalReducer;
|
} SLocalReducer;
|
||||||
|
|
||||||
typedef struct SSubqueryState {
|
typedef struct SSubqueryState {
|
||||||
/*
|
int32_t numOfRemain; // the number of remain unfinished subquery
|
||||||
* the number of completed retrieval subquery, once this value equals to numOfVnodes,
|
int32_t numOfTotal; // the number of total sub-queries
|
||||||
* all retrieval are completed.Local merge is launched.
|
|
||||||
*/
|
|
||||||
int32_t numOfCompleted;
|
|
||||||
int32_t numOfTotal; // number of total sub-queries
|
|
||||||
int32_t code; // code from subqueries
|
|
||||||
uint64_t numOfRetrievedRows; // total number of points in this query
|
uint64_t numOfRetrievedRows; // total number of points in this query
|
||||||
} SSubqueryState;
|
} SSubqueryState;
|
||||||
|
|
||||||
|
@ -128,4 +115,4 @@ int32_t tscDoLocalMerge(SSqlObj *pSql);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TDENGINE_TSCSECONARYMERGE_H
|
#endif // TDENGINE_TSCLOCALMERGE_H
|
||||||
|
|
|
@ -26,11 +26,9 @@ extern "C" {
|
||||||
void tscFetchDatablockFromSubquery(SSqlObj* pSql);
|
void tscFetchDatablockFromSubquery(SSqlObj* pSql);
|
||||||
|
|
||||||
void tscSetupOutputColumnIndex(SSqlObj* pSql);
|
void tscSetupOutputColumnIndex(SSqlObj* pSql);
|
||||||
int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql);
|
|
||||||
void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code);
|
void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code);
|
||||||
|
|
||||||
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index);
|
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index);
|
||||||
void tscDestroyJoinSupporter(SJoinSupporter* pSupporter);
|
|
||||||
|
|
||||||
int32_t tscHandleMasterJoinQuery(SSqlObj* pSql);
|
int32_t tscHandleMasterJoinQuery(SSqlObj* pSql);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ typedef struct SJoinSupporter {
|
||||||
SSubqueryState* pState;
|
SSubqueryState* pState;
|
||||||
SSqlObj* pObj; // parent SqlObj
|
SSqlObj* pObj; // parent SqlObj
|
||||||
int32_t subqueryIndex; // index of sub query
|
int32_t subqueryIndex; // index of sub query
|
||||||
int64_t interval; // interval time
|
int64_t intervalTime; // interval time
|
||||||
|
int64_t slidingTime; // sliding time
|
||||||
SLimitVal limit; // limit info
|
SLimitVal limit; // limit info
|
||||||
uint64_t uid; // query meter uid
|
uint64_t uid; // query meter uid
|
||||||
SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution
|
SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1216,7 +1216,6 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl
|
||||||
|
|
||||||
// interval query with limit applied
|
// interval query with limit applied
|
||||||
int32_t numOfRes = 0;
|
int32_t numOfRes = 0;
|
||||||
|
|
||||||
if (isIntervalQuery(pQuery)) {
|
if (isIntervalQuery(pQuery)) {
|
||||||
numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo);
|
numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue