未验证 提交 91da69d5 编写于 作者: S shenglian-zhou 提交者: GitHub

Merge pull request #10699 from taosdata/feature/TD-11208-new2

modify size for unique
......@@ -3354,8 +3354,14 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
}
if(functionId == TSDB_FUNC_UNIQUE){
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS;
if(functionId == TSDB_FUNC_UNIQUE){ // consider of memory size
if(pSchema->bytes < 10){
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS * 100;
}else if(pSchema->bytes < 100){
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS * 10;
}else{
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS;
}
}
// todo REFACTOR
// set the first column ts for top/bottom query
......
......@@ -78,8 +78,8 @@ typedef struct SDiskbasedResultBuf {
#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes
#define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -1}
#define MAX_UNIQUE_RESULT_ROWS (1000)
#define MAX_UNIQUE_RESULT_SIZE (1024*1024*1)
#define MAX_UNIQUE_RESULT_ROWS (10000)
#define MAX_UNIQUE_RESULT_SIZE (1024*1024*10)
#define MAX_MODE_INNER_RESULT_ROWS (1000000)
#define MAX_MODE_INNER_RESULT_SIZE (1024*1024*10)
/**
......
......@@ -5346,7 +5346,7 @@ static void unique_function(SQLFunctionCtx *pCtx) {
do_unique_function(pCtx, pInfo, k, pData, NULL, pCtx->inputBytes, pCtx->inputType);
if (sizeof(SUniqueFuncInfo) + pInfo->num * (sizeof(UniqueUnit) + pCtx->inputBytes + pCtx->tagInfo.tagsLen) >= MAX_UNIQUE_RESULT_SIZE
|| (pInfo->num > MAX_UNIQUE_RESULT_ROWS)){
|| (pInfo->num > pCtx->param[0].i64)){
GET_RES_INFO(pCtx)->numOfRes = -1; // mark out of memory
return;
}
......@@ -5367,7 +5367,7 @@ static void unique_function_merge(SQLFunctionCtx *pCtx) {
do_unique_function(pCtx, pOutput, timestamp, data, tags, pCtx->outputBytes, pCtx->outputType);
if (sizeof(SUniqueFuncInfo) + pOutput->num * (sizeof(UniqueUnit) + pCtx->outputBytes + pCtx->tagInfo.tagsLen) >= MAX_UNIQUE_RESULT_SIZE
|| (pOutput->num > MAX_UNIQUE_RESULT_ROWS)){
|| (pOutput->num > pCtx->param[0].i64)){
GET_RES_INFO(pCtx)->numOfRes = -1; // mark out of memory
return;
}
......
......@@ -39,13 +39,10 @@ int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, boo
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_BOTTOM ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_SAMPLE ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_HISTOGRAM ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_TAIL) {
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_TAIL ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_UNIQUE) {
return (int32_t)pQueryAttr->pExpr1[i].base.param[0].i64;
}
if (pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_UNIQUE){
return MAX_UNIQUE_RESULT_ROWS;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册