fix(analysis): fix compiler error on windows.
This commit is contained in:
parent
237be3319e
commit
d6dc966ed1
|
@ -166,7 +166,9 @@ IF(${BUILD_WITH_ANALYSIS})
|
|||
set(BUILD_WITH_S3 ON)
|
||||
ENDIF()
|
||||
|
||||
set(BUILD_WITH_ANALYSIS ON)
|
||||
IF(${TD_LINUX})
|
||||
set(BUILD_WITH_ANALYSIS ON)
|
||||
ENDIF()
|
||||
|
||||
IF(${BUILD_S3})
|
||||
|
||||
|
@ -207,13 +209,6 @@ option(
|
|||
off
|
||||
)
|
||||
|
||||
|
||||
option(
|
||||
BUILD_WITH_NURAFT
|
||||
"If build with NuRaft"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_UV
|
||||
"If build with libuv"
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#define _DEFAULT_SOURCE
|
||||
#include "tanalytics.h"
|
||||
#include "ttypes.h"
|
||||
#include "tutil.h"
|
||||
|
||||
#ifdef USE_ANALYTICS
|
||||
#include <curl/curl.h>
|
||||
#define ANALYTICS_ALOG_SPLIT_CHAR ","
|
||||
|
||||
|
@ -215,19 +215,19 @@ static size_t taosCurlWriteData(char *pCont, size_t contLen, size_t nmemb, void
|
|||
return 0;
|
||||
}
|
||||
|
||||
int64_t newDataSize = (int64_t) contLen * nmemb;
|
||||
int64_t newDataSize = (int64_t)contLen * nmemb;
|
||||
int64_t size = pRsp->dataLen + newDataSize;
|
||||
|
||||
if (pRsp->data == NULL) {
|
||||
pRsp->data = taosMemoryMalloc(size + 1);
|
||||
if (pRsp->data == NULL) {
|
||||
uError("failed to prepare recv buffer for post rsp, len:%d, code:%s", (int32_t) size + 1, tstrerror(terrno));
|
||||
uError("failed to prepare recv buffer for post rsp, len:%d, code:%s", (int32_t)size + 1, tstrerror(terrno));
|
||||
return 0; // return the recv length, if failed, return 0
|
||||
}
|
||||
} else {
|
||||
char* p = taosMemoryRealloc(pRsp->data, size + 1);
|
||||
char *p = taosMemoryRealloc(pRsp->data, size + 1);
|
||||
if (p == NULL) {
|
||||
uError("failed to prepare recv buffer for post rsp, len:%d, code:%s", (int32_t) size + 1, tstrerror(terrno));
|
||||
uError("failed to prepare recv buffer for post rsp, len:%d, code:%s", (int32_t)size + 1, tstrerror(terrno));
|
||||
return 0; // return the recv length, if failed, return 0
|
||||
}
|
||||
|
||||
|
@ -762,33 +762,35 @@ static int32_t taosAnalBufGetCont(SAnalyticBuf *pBuf, char **ppCont, int64_t *pC
|
|||
}
|
||||
}
|
||||
|
||||
//#else
|
||||
//
|
||||
//int32_t taosAnalyticsInit() { return 0; }
|
||||
//void taosAnalyticsCleanup() {}
|
||||
//SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalyticBuf *pBuf) { return NULL; }
|
||||
//
|
||||
//int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; }
|
||||
//bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue, int32_t optMaxLen) { return true; }
|
||||
//bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValue) { return true; }
|
||||
//int64_t taosAnalGetVersion() { return 0; }
|
||||
//void taosAnalUpdate(int64_t newVer, SHashObj *pHash) {}
|
||||
//
|
||||
//int32_t tsosAnalBufOpen(SAnalyticBuf *pBuf, int32_t numOfCols) { return 0; }
|
||||
//int32_t taosAnalBufWriteOptStr(SAnalyticBuf *pBuf, const char *optName, const char *optVal) { return 0; }
|
||||
//int32_t taosAnalBufWriteOptInt(SAnalyticBuf *pBuf, const char *optName, int64_t optVal) { return 0; }
|
||||
//int32_t taosAnalBufWriteOptFloat(SAnalyticBuf *pBuf, const char *optName, float optVal) { return 0; }
|
||||
//int32_t taosAnalBufWriteColMeta(SAnalyticBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName) { return 0; }
|
||||
//int32_t taosAnalBufWriteDataBegin(SAnalyticBuf *pBuf) { return 0; }
|
||||
//int32_t taosAnalBufWriteColBegin(SAnalyticBuf *pBuf, int32_t colIndex) { return 0; }
|
||||
//int32_t taosAnalBufWriteColData(SAnalyticBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue) { return 0; }
|
||||
//int32_t taosAnalBufWriteColEnd(SAnalyticBuf *pBuf, int32_t colIndex) { return 0; }
|
||||
//int32_t taosAnalBufWriteDataEnd(SAnalyticBuf *pBuf) { return 0; }
|
||||
//int32_t taosAnalBufClose(SAnalyticBuf *pBuf) { return 0; }
|
||||
//void taosAnalBufDestroy(SAnalyticBuf *pBuf) {}
|
||||
//
|
||||
//const char *taosAnalAlgoStr(EAnalAlgoType algoType) { return 0; }
|
||||
//EAnalAlgoType taosAnalAlgoInt(const char *algoName) { return 0; }
|
||||
//const char *taosAnalAlgoUrlStr(EAnalAlgoType algoType) { return 0; }
|
||||
//
|
||||
//#endif
|
||||
#else
|
||||
|
||||
int32_t taosAnalyticsInit() { return 0; }
|
||||
void taosAnalyticsCleanup() {}
|
||||
SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalyticBuf *pBuf) { return NULL; }
|
||||
|
||||
int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; }
|
||||
bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue, int32_t optMaxLen) { return true; }
|
||||
bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValue) { return true; }
|
||||
int64_t taosAnalGetVersion() { return 0; }
|
||||
void taosAnalUpdate(int64_t newVer, SHashObj *pHash) {}
|
||||
|
||||
int32_t tsosAnalBufOpen(SAnalyticBuf *pBuf, int32_t numOfCols) { return 0; }
|
||||
int32_t taosAnalBufWriteOptStr(SAnalyticBuf *pBuf, const char *optName, const char *optVal) { return 0; }
|
||||
int32_t taosAnalBufWriteOptInt(SAnalyticBuf *pBuf, const char *optName, int64_t optVal) { return 0; }
|
||||
int32_t taosAnalBufWriteOptFloat(SAnalyticBuf *pBuf, const char *optName, float optVal) { return 0; }
|
||||
int32_t taosAnalBufWriteColMeta(SAnalyticBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName) {
|
||||
return 0;
|
||||
}
|
||||
int32_t taosAnalBufWriteDataBegin(SAnalyticBuf *pBuf) { return 0; }
|
||||
int32_t taosAnalBufWriteColBegin(SAnalyticBuf *pBuf, int32_t colIndex) { return 0; }
|
||||
int32_t taosAnalBufWriteColData(SAnalyticBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue) { return 0; }
|
||||
int32_t taosAnalBufWriteColEnd(SAnalyticBuf *pBuf, int32_t colIndex) { return 0; }
|
||||
int32_t taosAnalBufWriteDataEnd(SAnalyticBuf *pBuf) { return 0; }
|
||||
int32_t taosAnalBufClose(SAnalyticBuf *pBuf) { return 0; }
|
||||
void taosAnalBufDestroy(SAnalyticBuf *pBuf) {}
|
||||
|
||||
const char *taosAnalAlgoStr(EAnalAlgoType algoType) { return 0; }
|
||||
EAnalAlgoType taosAnalAlgoInt(const char *algoName) { return 0; }
|
||||
const char *taosAnalAlgoUrlStr(EAnalAlgoType algoType) { return 0; }
|
||||
|
||||
#endif
|
|
@ -16,10 +16,10 @@ if(TD_ENTERPRISE)
|
|||
ELSEIF(${BUILD_WITH_COS})
|
||||
add_definitions(-DUSE_COS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${BUILD_WITH_ANALYSIS})
|
||||
if(${BUILD_WITH_ANALYSIS})
|
||||
add_definitions(-DUSE_ANALYTICS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(mnode STATIC ${MNODE_SRC})
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "tanalytics.h"
|
||||
#include "tjson.h"
|
||||
|
||||
#ifdef USE_ANALYTICS
|
||||
|
||||
#define TSDB_ANODE_VER_NUMBER 1
|
||||
#define TSDB_ANODE_RESERVE_SIZE 64
|
||||
|
||||
|
@ -878,3 +880,25 @@ _OVER:
|
|||
tFreeRetrieveAnalAlgoRsp(&rsp);
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static int32_t mndProcessUnsupportReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; }
|
||||
static int32_t mndRetrieveUnsupport(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t mndInitAnode(SMnode *pMnode) {
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ANODE, mndProcessUnsupportReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_UPDATE_ANODE, mndProcessUnsupportReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_ANODE, mndProcessUnsupportReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_RETRIEVE_ANAL_ALGO, mndProcessUnsupportReq);
|
||||
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE, mndRetrieveUnsupport);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE_FULL, mndRetrieveUnsupport);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mndCleanupAnode(SMnode *pMnode) {}
|
||||
|
||||
#endif
|
|
@ -26,6 +26,8 @@
|
|||
#include "tjson.h"
|
||||
#include "ttime.h"
|
||||
|
||||
#ifdef USE_ANALYTICS
|
||||
|
||||
typedef struct {
|
||||
SArray* blocks; // SSDataBlock*
|
||||
SArray* windows; // STimeWindow
|
||||
|
@ -657,3 +659,13 @@ _OVER:
|
|||
|
||||
return code;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo,
|
||||
SOperatorInfo** pOptrInfo) {
|
||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||
}
|
||||
void destroyForecastInfo(void* param) {}
|
||||
|
||||
#endif
|
|
@ -12,13 +12,12 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "executorInt.h"
|
||||
#include "filter.h"
|
||||
#include "function.h"
|
||||
#include "functionMgt.h"
|
||||
#include "operator.h"
|
||||
#include "querytask.h"
|
||||
#include "storageapi.h"
|
||||
#include "tanalytics.h"
|
||||
#include "tcommon.h"
|
||||
#include "tcompare.h"
|
||||
|
@ -26,6 +25,8 @@
|
|||
#include "tfill.h"
|
||||
#include "ttime.h"
|
||||
|
||||
#ifdef USE_ANALYTICS
|
||||
|
||||
typedef struct {
|
||||
char algoName[TSDB_ANALYTIC_ALGO_NAME_LEN];
|
||||
char algoUrl[TSDB_ANALYTIC_ALGO_URL_LEN];
|
||||
|
@ -176,7 +177,6 @@ static int32_t forecastCloseBuf(SForecastSupp* pSupp) {
|
|||
code = taosAnalBufWriteOptInt(pBuf, "start", start);
|
||||
if (code != 0) return code;
|
||||
|
||||
|
||||
bool hasEvery = taosAnalGetOptInt(pSupp->algoOpt, "every", &every);
|
||||
if (!hasEvery) {
|
||||
qDebug("forecast every not found from %s, use %" PRId64, pSupp->algoOpt, every);
|
||||
|
@ -660,3 +660,11 @@ static void destroyForecastInfo(void* param) {
|
|||
taosMemoryFreeClear(param);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int32_t createForecastOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
|
||||
SOperatorInfo** pOptrInfo) {
|
||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue