提交 9c773bc1 编写于 作者: wmmhello's avatar wmmhello

modify size for unique

上级 2dc55641
...@@ -3354,9 +3354,15 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3354,9 +3354,15 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
} }
if(functionId == TSDB_FUNC_UNIQUE){ 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; GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS;
} }
}
// todo REFACTOR // todo REFACTOR
// set the first column ts for top/bottom query // set the first column ts for top/bottom query
SColumnIndex index1 = {index.tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX}; SColumnIndex index1 = {index.tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX};
......
...@@ -5346,7 +5346,7 @@ static void unique_function(SQLFunctionCtx *pCtx) { ...@@ -5346,7 +5346,7 @@ static void unique_function(SQLFunctionCtx *pCtx) {
do_unique_function(pCtx, pInfo, k, pData, NULL, pCtx->inputBytes, pCtx->inputType); 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 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 GET_RES_INFO(pCtx)->numOfRes = -1; // mark out of memory
return; return;
} }
...@@ -5367,7 +5367,7 @@ static void unique_function_merge(SQLFunctionCtx *pCtx) { ...@@ -5367,7 +5367,7 @@ static void unique_function_merge(SQLFunctionCtx *pCtx) {
do_unique_function(pCtx, pOutput, timestamp, data, tags, pCtx->outputBytes, pCtx->outputType); 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 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 GET_RES_INFO(pCtx)->numOfRes = -1; // mark out of memory
return; return;
} }
......
...@@ -39,13 +39,10 @@ int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, boo ...@@ -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_BOTTOM ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_SAMPLE || pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_SAMPLE ||
pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_HISTOGRAM || 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; 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.
先完成此消息的编辑!
想要评论请 注册