提交 3e285cce 编写于 作者: wmmhello's avatar wmmhello

fix: fix coredump if mode function with interval

上级 93daebb9
...@@ -3362,14 +3362,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3362,14 +3362,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tVariantDump(pVariant, val, TSDB_DATA_TYPE_BIGINT, true); tVariantDump(pVariant, val, TSDB_DATA_TYPE_BIGINT, true);
if(functionId == TSDB_FUNC_UNIQUE){ // consider of memory size 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;
} }
}
int64_t numRowsSelected = GET_INT64_VAL(val); int64_t numRowsSelected = GET_INT64_VAL(val);
if (functionId != TSDB_FUNC_UNIQUE && (numRowsSelected <= 0 || numRowsSelected > 100)) { // todo use macro if (functionId != TSDB_FUNC_UNIQUE && (numRowsSelected <= 0 || numRowsSelected > 100)) { // todo use macro
......
...@@ -78,10 +78,10 @@ typedef struct SDiskbasedResultBuf { ...@@ -78,10 +78,10 @@ typedef struct SDiskbasedResultBuf {
#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes #define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes
#define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -1} #define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -1}
#define MAX_UNIQUE_RESULT_ROWS (10000) #define MAX_UNIQUE_RESULT_ROWS (100000)
#define MAX_UNIQUE_RESULT_SIZE (1024*1024*10) #define MAX_UNIQUE_RESULT_SIZE (1024*1024)
#define MAX_MODE_INNER_RESULT_ROWS (1000000) #define MAX_MODE_INNER_RESULT_ROWS (100000)
#define MAX_MODE_INNER_RESULT_SIZE (1024*1024*10) #define MAX_MODE_INNER_RESULT_SIZE (1024*1024)
/** /**
* create disk-based result buffer * create disk-based result buffer
* @param pResultBuf * @param pResultBuf
......
...@@ -334,7 +334,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO ...@@ -334,7 +334,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
qError("size is too large, failed to allocate column buffer for output buffer"); qError("size is too large, failed to allocate column buffer for output buffer");
goto _clean; goto _clean;
} }
int32_t size = (int32_t)MAX(tmp, minSize); size_t size = (size_t)MAX(tmp, minSize);
idata.pData = calloc(1, size); // at least to hold a pointer on x64 platform idata.pData = calloc(1, size); // at least to hold a pointer on x64 platform
if (idata.pData == NULL) { if (idata.pData == NULL) {
qError("failed to allocate column buffer for output buffer"); qError("failed to allocate column buffer for output buffer");
...@@ -9556,7 +9556,7 @@ void setResultBufSize(SQueryAttr* pQueryAttr, SRspResultInfo* pResultInfo) { ...@@ -9556,7 +9556,7 @@ void setResultBufSize(SQueryAttr* pQueryAttr, SRspResultInfo* pResultInfo) {
// the minimum number of rows for projection query // the minimum number of rows for projection query
const int32_t MIN_ROWS_FOR_PRJ_QUERY = 8192; const int32_t MIN_ROWS_FOR_PRJ_QUERY = 8192;
const int32_t DEFAULT_MIN_ROWS = 4096; const int32_t DEFAULT_MIN_ROWS = 1024;
const float THRESHOLD_RATIO = 0.85f; const float THRESHOLD_RATIO = 0.85f;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册