提交 4e0bdd14 编写于 作者: X Xiaoyu Wang

TD-14177 bugfix

上级 c5bb4a51
......@@ -475,6 +475,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_PORT TAOS_DEF_ERROR_CODE(0, 0x2612)
#define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613)
#define TSDB_CODE_PAR_EXPRIE_STATEMENT TAOS_DEF_ERROR_CODE(0, 0x2614)
#define TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2615)
#ifdef __cplusplus
}
......
......@@ -824,11 +824,30 @@ static int32_t translateGroupBy(STranslateContext* pCxt, SNodeList* pGroupByList
return translateExprList(pCxt, pGroupByList);
}
static int32_t translateIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* pInterval) {
SValueNode* pIntervalVal = (SValueNode*)pInterval->pInterval;
SValueNode* pIntervalOffset = (SValueNode*)pInterval->pOffset;
SValueNode* pSliding = (SValueNode*)pInterval->pSliding;
if (pIntervalVal->datum.i <= 0) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL, pIntervalVal->literal);
}
return TSDB_CODE_SUCCESS;
}
static int32_t doTranslateWindow(STranslateContext* pCxt, SNode* pWindow) {
switch (nodeType(pWindow)) {
case QUERY_NODE_INTERVAL_WINDOW:
return translateIntervalWindow(pCxt, (SIntervalWindowNode*)pWindow);
default:
break;
}
return TSDB_CODE_SUCCESS;
}
static int32_t translateWindow(STranslateContext* pCxt, SNode* pWindow) {
if (NULL == pWindow) {
return TSDB_CODE_SUCCESS;
}
pCxt->currClause = SQL_CLAUSE_WINDOW;
int32_t code = translateExpr(pCxt, pWindow);
if (TSDB_CODE_SUCCESS == code) {
......
......@@ -59,6 +59,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "Endpoint should be in the format of 'fqdn:port'";
case TSDB_CODE_PAR_EXPRIE_STATEMENT:
return "This statement is no longer supported";
case TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL:
return "This interval value is too small : %s";
case TSDB_CODE_OUT_OF_MEMORY:
return "Out of memory";
default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册