refactor some codes
This commit is contained in:
parent
cf1ae56ebb
commit
ddfa301e14
|
@ -30,10 +30,10 @@ extern "C" {
|
|||
#include "tsdb.h"
|
||||
#include "tscSecondaryMerge.h"
|
||||
|
||||
#define UTIL_METER_IS_METRIC(cmd) (((cmd)->pMeterMeta != NULL) && ((cmd)->pMeterMeta->meterType == TSDB_METER_METRIC))
|
||||
#define UTIL_METER_IS_NOMRAL_METER(cmd) (!(UTIL_METER_IS_METRIC(cmd)))
|
||||
#define UTIL_METER_IS_CREATE_FROM_METRIC(cmd) \
|
||||
(((cmd)->pMeterMeta != NULL) && ((cmd)->pMeterMeta->meterType == TSDB_METER_MTABLE))
|
||||
#define UTIL_METER_IS_METRIC(metaInfo) (((metaInfo)->pMeterMeta != NULL) && ((metaInfo)->pMeterMeta->meterType == TSDB_METER_METRIC))
|
||||
#define UTIL_METER_IS_NOMRAL_METER(metaInfo) (!(UTIL_METER_IS_METRIC(metaInfo)))
|
||||
#define UTIL_METER_IS_CREATE_FROM_METRIC(metaInfo) \
|
||||
(((metaInfo)->pMeterMeta != NULL) && ((metaInfo)->pMeterMeta->meterType == TSDB_METER_MTABLE))
|
||||
|
||||
#define TSDB_COL_IS_TAG(f) (((f)&TSDB_COL_TAG) != 0)
|
||||
|
||||
|
|
|
@ -3779,9 +3779,6 @@ static void getStatics_i64(int64_t *primaryKey, int64_t *data, int32_t numOfRow,
|
|||
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
int64_t lastKey = 0;
|
||||
int64_t lastVal = TSDB_DATA_BIGINT_NULL;
|
||||
|
||||
for (int32_t i = 0; i < numOfRow; ++i) {
|
||||
if (isNull(&data[i], TSDB_DATA_TYPE_BIGINT)) {
|
||||
(*numOfNull) += 1;
|
||||
|
@ -3873,9 +3870,6 @@ static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, do
|
|||
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
int64_t lastKey = 0;
|
||||
double lastVal = TSDB_DATA_DOUBLE_NULL;
|
||||
|
||||
for (int32_t i = 0; i < numOfRow; ++i) {
|
||||
if (isNull(&data[i], TSDB_DATA_TYPE_DOUBLE)) {
|
||||
(*numOfNull) += 1;
|
||||
|
|
|
@ -5668,8 +5668,7 @@ int32_t doFunctionsCompatibleCheck(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
if (IS_MULTIOUTPUT(aAggs[functId].nStatus) && functId != TSDB_FUNC_TOP && functId != TSDB_FUNC_BOTTOM &&
|
||||
functId != TSDB_FUNC_TAGPRJ &&
|
||||
(functId == TSDB_FUNC_PRJ && pExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX)) {
|
||||
functId != TSDB_FUNC_TAGPRJ && functId != TSDB_FUNC_PRJ) {
|
||||
setErrMsg(pCmd, msg1);
|
||||
return TSDB_CODE_INVALID_SQL;
|
||||
}
|
||||
|
@ -5697,6 +5696,8 @@ int32_t doFunctionsCompatibleCheck(SSqlObj* pSql) {
|
|||
setErrMsg(pCmd, msg3);
|
||||
return TSDB_CODE_INVALID_SQL;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
return checkUpdateTagPrjFunctions(pCmd);
|
||||
}
|
||||
|
|
|
@ -723,9 +723,16 @@ int tscProcessSql(SSqlObj *pSql) {
|
|||
#else
|
||||
pSql->maxRetry = 2;
|
||||
#endif
|
||||
|
||||
// the pMeterMetaInfo cannot be NULL
|
||||
if (pMeterMetaInfo == NULL) {
|
||||
pSql->res.code = TSDB_CODE_OTHERS;
|
||||
return pSql->res.code;
|
||||
}
|
||||
|
||||
if (UTIL_METER_IS_NOMRAL_METER(pMeterMetaInfo)) {
|
||||
pSql->index = pMeterMetaInfo->pMeterMeta->index;
|
||||
} else { // it must be the parent SSqlObj for metric query
|
||||
} else { // it must be the parent SSqlObj for super table query
|
||||
if ((pSql->cmd.type & TSDB_QUERY_TYPE_SUBQUERY) != 0) {
|
||||
int32_t idx = pSql->cmd.vnodeIdx;
|
||||
SVnodeSidList *pSidList = tscGetVnodeSidList(pMeterMetaInfo->pMetricMeta, idx);
|
||||
|
@ -3770,7 +3777,7 @@ void tscInitMsgs() {
|
|||
tscProcessMsgRsp[TSDB_SQL_MULTI_META] = tscProcessMultiMeterMetaRsp;
|
||||
|
||||
tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp;
|
||||
tscProcessMsgRsp[TSDB_SQL_RETRIEVE] = tscProcessRetrieveRspFromMgmt;
|
||||
tscProcessMsgRsp[TSDB_SQL_RETRIEVE] = tscProcessRetrieveRspFromVnode; // rsp handled by same function.
|
||||
tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp;
|
||||
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_TAGS] = tscProcessTagRetrieveRsp;
|
||||
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_EMPTY_RESULT] = tscProcessEmptyResultRsp;
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
|||
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <endian.h>
|
||||
#include <float.h>
|
||||
|
@ -61,6 +62,7 @@ extern "C" {
|
|||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
#include <wordexp.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#define taosCloseSocket(x) \
|
||||
{ \
|
||||
|
|
Loading…
Reference in New Issue