From d8aa6d935521438019b786d3a68e4b099dac4ec9 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sun, 5 Apr 2020 15:50:41 +0800 Subject: [PATCH] [TD-98] suppress compiler warnings and fix some typo --- src/client/inc/tscUtil.h | 1 + src/client/src/tscLocal.c | 6 +- src/client/src/tscSchemaUtil.c | 2 +- src/client/src/tscServer.c | 20 ++-- src/client/src/tscSql.c | 6 +- src/client/src/tscSubquery.c | 18 ++-- src/client/src/tscUtil.c | 14 --- src/common/inc/name.h | 2 +- src/common/src/name.c | 4 +- src/mnode/src/mgmtTable.c | 3 +- src/query/inc/queryUtil.h | 2 + src/query/src/qparserImpl.c | 170 --------------------------------- src/query/src/queryExecutor.c | 49 +++++----- src/rpc/src/rpcMain.c | 4 + src/util/src/tutil.c | 2 +- src/vnode/tsdb/src/tsdbRead.c | 17 ++-- 16 files changed, 75 insertions(+), 245 deletions(-) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 344152f7d4..0b6ae06416 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -134,6 +134,7 @@ void tscFieldInfoSetBinExpr(SFieldInfo* pFieldInfo, int32_t index, SSqlFunctionE void tscFieldInfoCalOffset(SQueryInfo* pQueryInfo); void tscFieldInfoCopy(SFieldInfo* src, SFieldInfo* dst, const int32_t* indexList, int32_t size); void tscFieldInfoCopyAll(SFieldInfo* dst, SFieldInfo* src); +void tscFieldInfoUpdateOffsetForInterResult(SQueryInfo* pQueryInfo); TAOS_FIELD* tscFieldInfoGetField(SQueryInfo* pQueryInfo, int32_t index); int16_t tscFieldInfoGetOffset(SQueryInfo* pQueryInfo, int32_t index); diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 42b04d7a16..1c738ecb3d 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -343,10 +343,10 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) { } static int tscBuildMetricTagSqlFunctionResult(SSqlObj *pSql) { - SSqlCmd *pCmd = &pSql->cmd; - SSqlRes *pRes = &pSql->res; +// SSqlCmd *pCmd = &pSql->cmd; +// SSqlRes *pRes = &pSql->res; - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); +// SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); #if 0 SSuperTableMeta *pMetricMeta = tscGetMetaInfo(pQueryInfo, 0)->pMetricMeta; int32_t totalNumOfResults = 1; // count function only produce one result diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index 2492352284..b487d5d6db 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -131,7 +131,7 @@ bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols) { SSchema* tscGetTableColumnSchema(const STableMeta* pTableMeta, int32_t startCol) { assert(pTableMeta != NULL); - SSchema* pSchema = pTableMeta->schema; + SSchema* pSchema = (SSchema*) pTableMeta->schema; #if 0 if (pTableMeta->tableType == TSDB_CHILD_TABLE) { assert (pTableMeta->pSTable != NULL); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 87ddd704d2..c5c737f3a8 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1420,10 +1420,10 @@ int tscProcessDescribeTableRsp(SSqlObj *pSql) { } int tscProcessTagRetrieveRsp(SSqlObj *pSql) { - SSqlCmd *pCmd = &pSql->cmd; +// SSqlCmd *pCmd = &pSql->cmd; - SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); +// SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); +// STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); int32_t numOfRes = 0; #if 0 @@ -1569,7 +1569,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { return pCmd->payloadLen; } -static int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { +static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { const int32_t defaultSize = minMsgSize() + sizeof(SSuperTableMetaMsg) + sizeof(SMgmtHead) + sizeof(int16_t) * TSDB_MAX_TAGS; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); @@ -1884,10 +1884,10 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { * |...... 1B 1B 4B **/ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) { - uint8_t ieType; - int32_t totalNum; - int32_t i; - +// uint8_t ieType; +// int32_t totalNum; +// int32_t i; +#if 0 char *rsp = pSql->res.pRsp; ieType = *rsp; @@ -1985,6 +1985,8 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) { pSql->res.code = TSDB_CODE_SUCCESS; pSql->res.numOfTotal = i; tscTrace("%p load multi-metermeta resp complete num:%d", pSql, pSql->res.numOfTotal); +#endif + return TSDB_CODE_SUCCESS; } @@ -2467,7 +2469,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) { SSqlCmd *pCmd = &pSql->cmd; //the query condition is serialized into pCmd->payload, we need to rebuild key for stable meta info in cache. - bool required = false; +// bool required = false; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, clauseIndex); if (pQueryInfo->pTableMetaInfo[0]->vgroupIdList != NULL) { diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a3cc785876..bbfd8645bd 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -535,11 +535,11 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) { continue; } - SSqlRes *pRes1 = &pSql->pSubs[i]->res; +// SSqlRes *pRes1 = &pSql->pSubs[i]->res; SSqlCmd *pCmd1 = &pSql->pSubs[i]->cmd; SQueryInfo * pQueryInfo1 = tscGetQueryInfoDetail(pCmd1, pCmd1->clauseIndex); - STableMetaInfo *pMetaInfo = tscGetMetaInfo(pQueryInfo1, 0); +// STableMetaInfo *pMetaInfo = tscGetMetaInfo(pQueryInfo1, 0); assert(pQueryInfo1->numOfTables == 1); @@ -576,7 +576,7 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) { return hasData; } -static void **tscBuildResFromSubqueries(SSqlObj *pSql) { +static UNUSED_FUNC void **tscBuildResFromSubqueries(SSqlObj *pSql) { SSqlRes *pRes = &pSql->res; while (1) { diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 1c57287b22..039cc966f0 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -279,7 +279,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) { assert(pSubQueryInfo->exprsInfo.numOfExprs == 1); // ts_comp query only requires one resutl columns taos_free_result(pPrevSub); - SSqlObj *pNew = createSubqueryObj(pSql, (int16_t) i, tscJoinQueryCallback, TSDB_SQL_SELECT, pSupporter, NULL); + SSqlObj *pNew = createSubqueryObj(pSql, (int16_t) i, tscJoinQueryCallback, pSupporter, TSDB_SQL_SELECT, NULL); if (pNew == NULL) { tscDestroyJoinSupporter(pSupporter); success = false; @@ -538,7 +538,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { } if (tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0) && numOfRows == 0) { - STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); +// STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); assert(pQueryInfo->numOfTables == 1); // for projection query, need to try next vnode if current vnode is exhausted @@ -606,7 +606,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) { SSqlRes *pRes = &pSql->pSubs[i]->res; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->pSubs[i]->cmd, 0); - STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); +// STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); if (tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { // if (pRes->row >= pRes->numOfRows && pTableMetaInfo->vnodeIndex < pTableMetaInfo->pMetricMeta->numOfVnodes && @@ -834,7 +834,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu } } - SSqlObj *pNew = createSubqueryObj(pSql, tableIndex, tscJoinQueryCallback, TSDB_SQL_SELECT, pSupporter, NULL); + SSqlObj *pNew = createSubqueryObj(pSql, tableIndex, tscJoinQueryCallback, pSupporter, TSDB_SQL_SELECT, NULL); if (pNew == NULL) { return TSDB_CODE_CLI_OUT_OF_MEMORY; } @@ -1237,7 +1237,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); // data in from current vnode is stored in cache and disk - uint32_t numOfRowsFromSubquery = trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->numOfElems; +// uint32_t numOfRowsFromSubquery = trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->numOfElems; // tscTrace("%p sub:%p all data retrieved from ip:%u,vid:%d, numOfRows:%d, orderOfSub:%d", pPObj, pSql, pSvd->ip, // pSvd->vnode, numOfRowsFromSubquery, idx); @@ -1333,7 +1333,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR SSqlRes * pRes = &pSql->res; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); - STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); +// STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); // SVnodeSidList *vnodeInfo = tscGetVnodeSidList(pTableMetaInfo->pMetricMeta, idx); // SVnodeSidList *vnodeInfo = 0; @@ -1409,10 +1409,10 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) { SSqlObj* pParentSql = trsupport->pParentSqlObj; SSqlObj* pSql = (SSqlObj *)tres; - STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); +// STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); assert(pSql->cmd.numOfClause == 1 && pSql->cmd.pQueryInfo[0]->numOfTables == 1); - int32_t idx = pTableMetaInfo->vnodeIndex; +// int32_t idx = pTableMetaInfo->vnodeIndex; SVnodeSidList *vnodeInfo = NULL; SVnodeDesc * pSvd = NULL; @@ -1459,7 +1459,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) { pState->code = -TSDB_CODE_CLI_OUT_OF_MEMORY; trsupport->numOfRetry = MAX_NUM_OF_SUBQUERY_RETRY; } else { - SQueryInfo *pNewQueryInfo = tscGetQueryInfoDetail(&pNew->cmd, 0); +// SQueryInfo *pNewQueryInfo = tscGetQueryInfoDetail(&pNew->cmd, 0); // assert(pNewQueryInfo->pTableMetaInfo[0]->pTableMeta != NULL && pNewQueryInfo->pTableMetaInfo[0]->pMetricMeta != NULL); tscProcessSql(pNew); return; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index a56d042ece..9b1771164d 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -993,20 +993,6 @@ void tscFieldInfoCalOffset(SQueryInfo* pQueryInfo) { } void tscFieldInfoUpdateOffsetForInterResult(SQueryInfo* pQueryInfo) { -// SFieldInfo* pFieldInfo = &pQueryInfo->fieldsInfo; -// if (pFieldInfo->numOfOutputCols == 0) { -// return; -// } -// -// pFieldInfo->pOffset[0] = 0; -// -// /* -// * the retTypeLen is used to store the intermediate result length -// * for potential secondary merge exists -// */ -// for (int32_t i = 1; i < pFieldInfo->numOfOutputCols; ++i) { -// pFieldInfo->pOffset[i] = pFieldInfo->pOffset[i - 1] + tscSqlExprGet(pQueryInfo, i - 1)->resBytes; -// } SSqlExprInfo* pExprInfo = &pQueryInfo->exprsInfo; if (pExprInfo->numOfExprs == 0) { return; diff --git a/src/common/inc/name.h b/src/common/inc/name.h index 31a6d8fbeb..bafa003609 100644 --- a/src/common/inc/name.h +++ b/src/common/inc/name.h @@ -19,7 +19,7 @@ typedef struct SColumnInfoEx { void* pData; // the corresponding block data in memory } SColumnInfoEx; -int32_t extractTableName(const char *tableId, char *name); +void extractTableName(const char *tableId, char *name); char* extractDBName(const char *tableId, char *name); diff --git a/src/common/src/name.c b/src/common/src/name.c index cf1eaa2bf1..b0411d742c 100644 --- a/src/common/src/name.c +++ b/src/common/src/name.c @@ -24,11 +24,11 @@ static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) { return len; } -int32_t extractTableName(const char* tableId, char* name) { +void extractTableName(const char* tableId, char* name) { size_t offset = strcspn(tableId, &TS_PATH_DELIMITER[0]); offset = strcspn(&tableId[offset], &TS_PATH_DELIMITER[0]); - return strncpy(name, &tableId[offset], TSDB_TABLE_NAME_LEN); + strncpy(name, &tableId[offset], TSDB_TABLE_NAME_LEN); // char* r = skipSegments(tableId, TS_PATH_DELIMITER[0], 2); // return copy(name, r, TS_PATH_DELIMITER[0]); diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 9f9630c781..38b26514cb 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -2011,9 +2011,8 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, } char tableName[TSDB_TABLE_NAME_LEN] = {0}; - memset(tableName, 0, tListLen(tableName)); - // pattern compare for meter name + // pattern compare for table name mgmtExtractTableName(pTable->info.tableId, tableName); if (pShow->payloadLen > 0 && diff --git a/src/query/inc/queryUtil.h b/src/query/inc/queryUtil.h index 06a716b750..677ddf6378 100644 --- a/src/query/inc/queryUtil.h +++ b/src/query/inc/queryUtil.h @@ -36,4 +36,6 @@ bool isWindowResClosed(SWindowResInfo *pWindowResInfo, int32_t slot); void createQueryResultInfo(SQuery *pQuery, SWindowResult *pResultRow, bool isSTableQuery, SPosInfo *posInfo); +char *getPosInResultPage(SQueryRuntimeEnv *pRuntimeEnv, int32_t columnIndex, SWindowResult *pResult); + #endif // TDENGINE_QUERYUTIL_H diff --git a/src/query/src/qparserImpl.c b/src/query/src/qparserImpl.c index a40b1bb8d2..f5763cfb45 100644 --- a/src/query/src/qparserImpl.c +++ b/src/query/src/qparserImpl.c @@ -900,174 +900,4 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) { pDBInfo->keep = NULL; memset(&pDBInfo->precision, 0, sizeof(SSQLToken)); -} - -static bool isExprLeafNode(tSQLExpr* pExpr) { - return (pExpr->pRight == NULL && pExpr->pLeft == NULL) && - (pExpr->nSQLOptr == TK_ID || (pExpr->nSQLOptr >= TK_BOOL && pExpr->nSQLOptr <= TK_NCHAR) || - pExpr->nSQLOptr == TK_SET); -} - -static bool isExprParentOfLeafNode(tSQLExpr* pExpr) { - return (pExpr->pLeft != NULL && pExpr->pRight != NULL) && - (isExprLeafNode(pExpr->pLeft) && isExprLeafNode(pExpr->pRight)); -} - -static int32_t tSQLExprNodeToString(tSQLExpr* pExpr, SStringBuilder* pBuilder) { - if (pExpr->nSQLOptr == TK_ID) { // column name -// strncpy(*str, pExpr->colInfo.z, pExpr->colInfo.n); -// *str += pExpr->colInfo.n; - - } else if (pExpr->nSQLOptr >= TK_BOOL && pExpr->nSQLOptr <= TK_STRING) { // value -// *str += tVariantToString(&pExpr->val, *str); -// taosStringBuilderAppendStringLen() - } else if (pExpr->nSQLOptr >= TK_COUNT && pExpr->nSQLOptr <= TK_AVG_IRATE) { - taosStringBuilderAppendStringLen(pBuilder, pExpr->operand.z, pExpr->operand.n); - } else { // not supported operation - assert(false); - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t optrToString(tSQLExpr* pExpr, char** exprString) { - const char* le = "<="; - const char* ge = ">="; - const char* ne = "<>"; - const char* likeOptr = "LIKE"; - - switch (pExpr->nSQLOptr) { - case TK_LE: { - *(int16_t*)(*exprString) = *(int16_t*)le; - *exprString += 1; - break; - } - case TK_GE: { - *(int16_t*)(*exprString) = *(int16_t*)ge; - *exprString += 1; - break; - } - case TK_NE: { - *(int16_t*)(*exprString) = *(int16_t*)ne; - *exprString += 1; - break; - } - - case TK_LT: - *(*exprString) = '<'; - break; - case TK_GT: - *(*exprString) = '>'; - break; - case TK_EQ: - *(*exprString) = '='; - break; - case TK_PLUS: - *(*exprString) = '+'; - break; - case TK_MINUS: - *(*exprString) = '-'; - break; - case TK_STAR: - *(*exprString) = '*'; - break; - case TK_DIVIDE: - *(*exprString) = '/'; - break; - case TK_REM: - *(*exprString) = '%'; - break; - case TK_LIKE: { - int32_t len = sprintf(*exprString, " %s ", likeOptr); - *exprString += (len - 1); - break; - } - default: - return TSDB_CODE_INVALID_SQL; - } - - *exprString += 1; - return TSDB_CODE_SUCCESS; -} - -static int32_t tSQLExprLeafToBinary(tSQLExpr* pExpr, SStringBuilder* pBuilder) { - if (!isExprParentOfLeafNode(pExpr)) { - return TSDB_CODE_INVALID_SQL; - } - - tSQLExpr* pLeft = pExpr->pLeft; - tSQLExpr* pRight = pExpr->pRight; - -// if (addParentheses) { -// *(*output) = '('; -// *output += 1; -// } - - tSQLExprNodeToString(pLeft, pBuilder); - tSQLExprNodeToString(pRight, pBuilder); - - if (optrToString(pExpr, pBuilder) != TSDB_CODE_SUCCESS) { - return TSDB_CODE_INVALID_SQL; - } - -// if (addParentheses) { -// *(*output) = ')'; -// *output += 1; -// } - - return TSDB_CODE_SUCCESS; -} - -static void relToString(tSQLExpr* pExpr, SStringBuilder* pBuilder) { - assert(pExpr->nSQLOptr == TK_AND || pExpr->nSQLOptr == TK_OR); - - const char* or = "OR"; - const char*and = "AND"; - - // if (pQueryInfo->tagCond.relType == TSQL_STABLE_QTYPE_COND) { -// if (pExpr->nSQLOptr == TK_AND) { -// strcpy(*str, and); -// *str += strlen(and); -// } else { -// strcpy(*str, or); -// *str += strlen(or); -// } -} - -static int32_t doSQLExprToBinary(tSQLExpr* pExpr, SStringBuilder* pBuilder) { - if (pExpr == NULL) { - return TSDB_CODE_SUCCESS; - } - - if (!isExprParentOfLeafNode(pExpr)) { -// *(*str) = '('; -// *str += 1; - - int32_t ret = doSQLExprToBinary(pExpr->pLeft, pBuilder); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - ret = doSQLExprToBinary(pExpr->pRight, pBuilder); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - relToString(pExpr, pBuilder); - -// *(*str) = ')'; -// *str += 1; - - return ret; - } - - return tSQLExprLeafToBinary(pExpr, pBuilder); -} - -// post order seralize to binary data -int32_t tSQLExprToBinary(tSQLExpr* pExpr, SStringBuilder* pBuilder) { - assert(pExpr != NULL && pBuilder != NULL); - - - } \ No newline at end of file diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index 20697f3227..4c4014996e 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -47,7 +47,7 @@ #define SET_SUPPLEMENT_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN) #define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) -#define GET_QINFO_ADDR(x) ((char *)(x)-offsetof(SQInfo, runtimeEnv)) +#define GET_QINFO_ADDR(x) ((void*)((char *)(x)-offsetof(SQInfo, runtimeEnv))) #define GET_COL_DATA_POS(query, index, step) ((query)->pos + (index) * (step)) @@ -1140,13 +1140,13 @@ static int32_t rowwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStat bool hasNull = hasNullValue(pQuery, k, pDataBlockInfo, pStatis, &pColStatis); char *dataBlock = getDataBlocks(pRuntimeEnv, &sasArray[k], k, pDataBlockInfo->size, pDataBlock); - setExecParams(pQuery, &pCtx[k], dataBlock, (char *)primaryKeyCol, pDataBlockInfo->size, functionId, pColStatis, + setExecParams(pQuery, &pCtx[k], dataBlock, primaryKeyCol, pDataBlockInfo->size, functionId, pColStatis, hasNull, &sasArray[k], pRuntimeEnv->scanFlag); } // set the input column data for (int32_t k = 0; k < pQuery->numOfFilterCols; ++k) { - SSingleColumnFilterInfo *pFilterInfo = &pQuery->pFilterInfo[k]; +// SSingleColumnFilterInfo *pFilterInfo = &pQuery->pFilterInfo[k]; assert(0); /* * NOTE: here the tbname/tags column cannot reach here, since it will never be a filter column, @@ -1465,7 +1465,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, SColumnModel pRuntimeEnv->offset[0] = 0; for (int32_t i = 0; i < pQuery->numOfOutputCols; ++i) { SSqlFuncExprMsg *pSqlFuncMsg = &pQuery->pSelectExpr[i].pBase; - SColIndexEx * pColIndexEx = &pSqlFuncMsg->colInfo; +// SColIndexEx * pColIndexEx = &pSqlFuncMsg->colInfo; SQLFunctionCtx *pCtx = &pRuntimeEnv->pCtx[i]; pCtx->inputType = GET_COLUMN_TYPE(pQuery, i); @@ -1586,7 +1586,7 @@ static bool isQueryKilled(SQInfo *pQInfo) { #endif } -static bool setQueryKilled(SQInfo* pQInfo) { +static void setQueryKilled(SQInfo* pQInfo) { pQInfo->code = TSDB_CODE_QUERY_CANCELLED; } @@ -1738,6 +1738,7 @@ static UNUSED_FUNC bool doGetQueryPos(TSKEY key, SQInfo *pQInfo, SPointInterpoSu } } #endif + return true; } static UNUSED_FUNC bool doSetDataInfo(SQInfo *pQInfo, SPointInterpoSupporter *pPointInterpSupporter, void *pMeterObj, @@ -2924,11 +2925,11 @@ int32_t tableResultComparFn(const void *pLeft, const void *pRight, void *param) } int32_t mergeResultsToGroup(SQInfo *pQInfo) { - SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; - SQuery * pQuery = pRuntimeEnv->pQuery; +// SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; +// SQuery * pQuery = pRuntimeEnv->pQuery; - int64_t st = taosGetTimestampMs(); - int32_t ret = TSDB_CODE_SUCCESS; +// int64_t st = taosGetTimestampMs(); +// int32_t ret = TSDB_CODE_SUCCESS; // while (pQInfo->subgroupIdx < pQInfo->pSidSet->numOfSubSet) { // int32_t start = pQInfo->pSidSet->starterPos[pQInfo->subgroupIdx]; @@ -2994,7 +2995,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) { for (int32_t i = 0; i < pQuery->numOfOutputCols; ++i) { int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes; - char * pDest = pQuery->sdata[i]; + char * pDest = pQuery->sdata[i]->data; memcpy(pDest + offset * bytes, pData->data + pRuntimeEnv->offset[i] * pData->numOfElems, bytes * pData->numOfElems); @@ -3033,7 +3034,7 @@ int64_t getNumOfResultWindowRes(SQueryRuntimeEnv *pRuntimeEnv, SWindowResult *pW return maxOutput; } -int32_t doMergeMetersResultsToGroupRes(SQInfo *pQInfo, STableDataInfo *pTableDataInfo, int32_t start, int32_t end) { +UNUSED_FUNC int32_t doMergeMetersResultsToGroupRes(SQInfo *pQInfo, STableDataInfo *pTableDataInfo, int32_t start, int32_t end) { SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; SQuery * pQuery = pQInfo->runtimeEnv.pQuery; @@ -3204,7 +3205,7 @@ int32_t flushFromResultBuf(SQInfo *pQInfo) { void resetMergeResultBuf(SQuery *pQuery, SQLFunctionCtx *pCtx, SResultInfo *pResultInfo) { for (int32_t k = 0; k < pQuery->numOfOutputCols; ++k) { - pCtx[k].aOutputBuf = pQuery->sdata[k] - pCtx[k].outputBytes; + pCtx[k].aOutputBuf = pQuery->sdata[k]->data - pCtx[k].outputBytes; pCtx[k].size = 1; pCtx[k].startOffset = 0; pCtx[k].resultInfo = &pResultInfo[k]; @@ -3561,7 +3562,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { } // set the correct start position, and load the corresponding block in buffer for next round scan all data blocks. - int32_t ret = tsdbDataBlockSeek(pRuntimeEnv->pQueryHandle, pos); + /*int32_t ret =*/ tsdbDataBlockSeek(pRuntimeEnv->pQueryHandle, pos); status = pQuery->status; pRuntimeEnv->windowResInfo.curIndex = activeSlot; @@ -3582,7 +3583,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { pQuery->window.skey = skey; pQuery->window.ekey = pQuery->lastKey - step; - tsdbpos_t current = tsdbDataBlockTell(pRuntimeEnv->pQueryHandle); + /*tsdbpos_t current =*/ tsdbDataBlockTell(pRuntimeEnv->pQueryHandle); doSingleMeterSupplementScan(pRuntimeEnv); @@ -3591,7 +3592,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { pQuery->lastKey = lkey; pQuery->window.ekey = ekey; - STimeWindow win = {.skey = pQuery->window.skey, .ekey = pQuery->window.ekey}; +// STimeWindow win = {.skey = pQuery->window.skey, .ekey = pQuery->window.ekey}; // tsdbResetQuery(pRuntimeEnv->pQueryHandle, &win, current, pQuery->order.order); // tsdbNextDataBlock(pRuntimeEnv->pQueryHandle); } @@ -4020,7 +4021,7 @@ bool vnodeHasRemainResults(void *handle) { // query has completed if (Q_STATUS_EQUAL(pQuery->status, QUERY_COMPLETED)) { - TSKEY ekey = taosGetRevisedEndKey(pQuery->window.ekey, pQuery->order.order, pQuery->intervalTime, + /*TSKEY ekey =*/ taosGetRevisedEndKey(pQuery->window.ekey, pQuery->order.order, pQuery->intervalTime, pQuery->slidingTimeUnit, pQuery->precision); // int32_t numOfTotal = taosGetNumOfResultWithInterpo(pInterpoInfo, (TSKEY // *)pRuntimeEnv->pInterpoBuf[0]->data, @@ -4088,8 +4089,8 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data int32_t vnodeQueryResultInterpolate(SQInfo *pQInfo, tFilePage **pDst, tFilePage **pDataSrc, int32_t numOfRows, int32_t *numOfInterpo) { - SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; - SQuery * pQuery = pRuntimeEnv->pQuery; +// SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; +// SQuery * pQuery = pRuntimeEnv->pQuery; #if 0 while (1) { numOfRows = taosNumOfRemainPoints(&pRuntimeEnv->interpoInfo); @@ -4390,8 +4391,8 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) { static bool multimeterMultioutputHelper(SQInfo *pQInfo, bool *dataInDisk, bool *dataInCache, int32_t index, int32_t start) { // STableIdInfo **pMeterSidExtInfo = pQInfo->pMeterSidExtInfo; - SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; - SQuery * pQuery = &pRuntimeEnv->pQuery; +// SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; +// SQuery * pQuery = pRuntimeEnv->pQuery; #if 0 setQueryStatus(pQuery, QUERY_NOT_COMPLETED); @@ -4438,7 +4439,7 @@ static bool multimeterMultioutputHelper(SQInfo *pQInfo, bool *dataInDisk, bool * #endif - initCtxOutputBuf(pRuntimeEnv); +// initCtxOutputBuf(pRuntimeEnv); return true; } @@ -5457,8 +5458,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, } static int32_t buildAirthmeticExprFromMsg(SSqlFunctionExpr *pExpr, SQueryTableMsg *pQueryMsg) { - SSqlBinaryExprInfo *pBinaryExprInfo = &pExpr->binExprInfo; - SColumnInfo * pColMsg = pQueryMsg->colList; +// SSqlBinaryExprInfo *pBinaryExprInfo = &pExpr->binExprInfo; +// SColumnInfo * pColMsg = pQueryMsg->colList; #if 0 tExprNode* pBinExpr = NULL; SSchema* pSchema = toSchema(pQueryMsg, pColMsg, pQueryMsg->numOfCols); @@ -5874,7 +5875,7 @@ static bool isValidQInfo(void *param) { * pQInfo->signature may be changed by another thread, so we assign value of signature * into local variable, then compare by using local variable */ - uint64_t sig = pQInfo->signature; + uint64_t sig = (uint64_t) pQInfo->signature; return (sig == (uint64_t)pQInfo); } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 8dbbb97a1a..f60c686089 100755 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1100,6 +1100,10 @@ static void rpcProcessConnError(void *param, void *id) { SRpcInfo *pRpc = pContext->pRpc; SRpcMsg rpcMsg; + if (pRpc == NULL) { + return; + } + tTrace("%s connection error happens", pRpc->label); if ( pContext->numOfTry >= pContext->ipSet.numOfIps ) { diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 4c689a5bcd..cadb2e706c 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -645,7 +645,7 @@ void * taosbsearch(const void *key, const void *base, size_t nmemb, size_t size, } } - if ((*compar)(key, elePtrAt(base, size, idx) < 0)) { + if ((*compar)(key, elePtrAt(base, size, idx)) < 0) { return elePtrAt(base, size, idx); } else { if (idx + 1 > nmemb - 1) { diff --git a/src/vnode/tsdb/src/tsdbRead.c b/src/vnode/tsdb/src/tsdbRead.c index a625770160..cf75f21a45 100644 --- a/src/vnode/tsdb/src/tsdbRead.c +++ b/src/vnode/tsdb/src/tsdbRead.c @@ -301,6 +301,7 @@ tsdb_query_handle_t *tsdbQueryByTableId(tsdb_repo_t* tsdb, STsdbQueryCond *pCond .pCompInfo = calloc(1, 1024), }; + assert(info.pTableObj != NULL); taosArrayPush(pQueryHandle->pTableCheckInfo, &info); } @@ -1008,17 +1009,21 @@ SArray *tsdbRetrieveDataBlock(tsdb_query_handle_t *pQueryHandle, SArray *pIdList } } -int32_t tsdbResetQuery(tsdb_query_handle_t *pQueryHandle, STimeWindow *window, tsdbpos_t position, int16_t order) {} +int32_t tsdbResetQuery(tsdb_query_handle_t *pQueryHandle, STimeWindow *window, tsdbpos_t position, int16_t order) { + return 0; +} -int32_t tsdbDataBlockSeek(tsdb_query_handle_t *pQueryHandle, tsdbpos_t pos) {} +int32_t tsdbDataBlockSeek(tsdb_query_handle_t *pQueryHandle, tsdbpos_t pos) { return 0;} tsdbpos_t tsdbDataBlockTell(tsdb_query_handle_t *pQueryHandle) { return NULL; } -SArray *tsdbRetrieveDataRow(tsdb_query_handle_t *pQueryHandle, SArray *pIdList, SQueryRowCond *pCond) {} +SArray *tsdbRetrieveDataRow(tsdb_query_handle_t *pQueryHandle, SArray *pIdList, SQueryRowCond *pCond) { return NULL;} -tsdb_query_handle_t *tsdbQueryFromTagConds(STsdbQueryCond *pCond, int16_t stableId, const char *pTagFilterStr) {} +tsdb_query_handle_t *tsdbQueryFromTagConds(STsdbQueryCond *pCond, int16_t stableId, const char *pTagFilterStr) { + return NULL; +} -SArray *tsdbGetTableList(tsdb_query_handle_t *pQueryHandle) {} +SArray *tsdbGetTableList(tsdb_query_handle_t *pQueryHandle) { return NULL; } static SArray* createTableIdArrayList(STsdbRepo* tsdb, int64_t uid) { STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid); @@ -1303,7 +1308,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, const char* pCond STColumn* stcol = schemaColAt(pSTable->tagSchema, 0); tExprNode* pExpr = NULL; - tSQLBinaryExprFromString(&pExpr, stcol, schemaNCols(pSTable->tagSchema), pCond, strlen(pCond)); + tSQLBinaryExprFromString(&pExpr, stcol, schemaNCols(pSTable->tagSchema), (char*) pCond, strlen(pCond)); // failed to build expression, no result, return immediately if (pExpr == NULL) { -- GitLab