fix(gpt): limit the forecast rows.
This commit is contained in:
parent
32d48a8e85
commit
f42ce412ae
|
@ -29,9 +29,10 @@ extern "C" {
|
|||
#define ANALY_FORECAST_DEFAULT_CONF 95
|
||||
#define ANALY_FORECAST_DEFAULT_WNCHECK 1
|
||||
#define ANALY_FORECAST_MAX_ROWS 40000
|
||||
#define ANALY_FORECAST_RES_MAX_ROWS 1024
|
||||
#define ANALY_ANOMALY_WINDOW_MAX_ROWS 40000
|
||||
#define ANALY_DEFAULT_TIMEOUT 60
|
||||
#define ANALY_MAX_TIMEOUT 600
|
||||
#define ANALY_DEFAULT_TIMEOUT 60
|
||||
#define ANALY_MAX_TIMEOUT 600
|
||||
|
||||
typedef struct {
|
||||
EAnalAlgoType type;
|
||||
|
|
|
@ -434,7 +434,7 @@ static int32_t taosAnalyJsonBufWriteStr(SAnalyticBuf *pBuf, const char *buf, int
|
|||
|
||||
static int32_t taosAnalyJsonBufWriteStart(SAnalyticBuf *pBuf) { return taosAnalyJsonBufWriteStr(pBuf, "{\n", 0); }
|
||||
|
||||
static int32_t tsosAnalJsonBufOpen(SAnalyticBuf *pBuf, int32_t numOfCols) {
|
||||
static int32_t tsosAnalyJsonBufOpen(SAnalyticBuf *pBuf, int32_t numOfCols) {
|
||||
pBuf->filePtr = taosOpenFile(pBuf->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||
if (pBuf->filePtr == NULL) {
|
||||
return terrno;
|
||||
|
@ -666,7 +666,7 @@ void taosAnalyBufDestroy(SAnalyticBuf *pBuf) {
|
|||
|
||||
int32_t tsosAnalyBufOpen(SAnalyticBuf *pBuf, int32_t numOfCols) {
|
||||
if (pBuf->bufType == ANALYTICS_BUF_TYPE_JSON || pBuf->bufType == ANALYTICS_BUF_TYPE_JSON_COL) {
|
||||
return tsosAnalJsonBufOpen(pBuf, numOfCols);
|
||||
return tsosAnalyJsonBufOpen(pBuf, numOfCols);
|
||||
} else {
|
||||
return TSDB_CODE_ANA_BUF_INVALID_TYPE;
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ static int32_t anomalyAnalysisWindow(SOperatorInfo* pOperator) {
|
|||
SAnalyticBuf analyBuf = {.bufType = ANALYTICS_BUF_TYPE_JSON};
|
||||
char dataBuf[64] = {0};
|
||||
int32_t code = 0;
|
||||
int64_t ts = 0;
|
||||
int64_t ts = taosGetTimestampMs();
|
||||
int32_t lino = 0;
|
||||
const char* pId = GET_TASKID(pOperator->pTaskInfo);
|
||||
|
||||
|
|
|
@ -158,8 +158,8 @@ static int32_t forecastCloseBuf(SForecastSupp* pSupp, const char* id) {
|
|||
qDebug("%s forecast rows not found from %s, use default:%" PRId64, id, pSupp->algoOpt, pSupp->optRows);
|
||||
}
|
||||
|
||||
if (pSupp->optRows > ANALY_FORECAST_MAX_ROWS) {
|
||||
qError("%s required too many forecast rows, max allowed:%d, required:%" PRId64, id, ANALY_FORECAST_MAX_ROWS,
|
||||
if (pSupp->optRows > ANALY_FORECAST_RES_MAX_ROWS) {
|
||||
qError("%s required too many forecast rows, max allowed:%d, required:%" PRId64, id, ANALY_FORECAST_RES_MAX_ROWS,
|
||||
pSupp->optRows);
|
||||
return TSDB_CODE_ANA_ANODE_TOO_MANY_ROWS;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,9 @@ class _ArimaService(AbstractForecastService):
|
|||
if self.list is None or len(self.list) < self.period:
|
||||
raise ValueError("number of input data is less than the periods")
|
||||
|
||||
if len(self.list) > 3000:
|
||||
raise ValueError("number of input data is too large")
|
||||
|
||||
if self.fc_rows <= 0:
|
||||
raise ValueError("fc rows is not specified yet")
|
||||
|
||||
|
|
Loading…
Reference in New Issue