未验证 提交 373a2878 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #10785 from taosdata/feature/TD-14104

fix core if subquery reslut is too large in unique function
......@@ -3359,11 +3359,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
} else {
tVariantDump(pVariant, val, TSDB_DATA_TYPE_BIGINT, true);
int64_t numRowsSelected = GET_INT64_VAL(val);
if (functionId != TSDB_FUNC_UNIQUE && (numRowsSelected <= 0 || numRowsSelected > 100)) { // todo use macro
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
}
if(functionId == TSDB_FUNC_UNIQUE){ // consider of memory size
if(pSchema->bytes < 10){
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS * 100;
......@@ -3373,6 +3368,11 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
GET_INT64_VAL(val) = MAX_UNIQUE_RESULT_ROWS;
}
}
int64_t numRowsSelected = GET_INT64_VAL(val);
if (functionId != TSDB_FUNC_UNIQUE && (numRowsSelected <= 0 || numRowsSelected > 100)) { // todo use macro
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
}
// todo REFACTOR
// set the first column ts for top/bottom query
SColumnIndex index1 = {index.tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX};
......@@ -3385,9 +3385,10 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
aAggs[TSDB_FUNC_TS].name, pExpr);
colIndex += 1; // the first column is ts
getResultDataInfo(pSchema->type, pSchema->bytes, functionId, (int32_t)numRowsSelected, &resultType,
&resultSize, &interResult, 0, false, pUdfInfo);
pExpr = tscExprAppend(pQueryInfo, functionId, &index, resultType, resultSize, getNewResColId(pCmd),
resultSize, false);
interResult, false);
if (functionId == TSDB_FUNC_TAIL){
int64_t offset = 0;
if (taosArrayGetSize(pItem->pNode->Expr.paramList) == 3){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册