From 3e285cce5e79d54691957404192fd32aa1099f64 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 26 Apr 2022 15:30:27 +0800 Subject: [PATCH] fix: fix coredump if mode function with interval --- src/client/src/tscSQLParser.c | 8 +------- src/query/inc/qResultbuf.h | 8 ++++---- src/query/src/qExecutor.c | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index f5b8879368..d2fb5d6a47 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3362,13 +3362,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col tVariantDump(pVariant, val, TSDB_DATA_TYPE_BIGINT, true); 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); diff --git a/src/query/inc/qResultbuf.h b/src/query/inc/qResultbuf.h index 5191ddab46..30881901f1 100644 --- a/src/query/inc/qResultbuf.h +++ b/src/query/inc/qResultbuf.h @@ -78,10 +78,10 @@ typedef struct SDiskbasedResultBuf { #define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes #define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -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) +#define MAX_UNIQUE_RESULT_ROWS (100000) +#define MAX_UNIQUE_RESULT_SIZE (1024*1024) +#define MAX_MODE_INNER_RESULT_ROWS (100000) +#define MAX_MODE_INNER_RESULT_SIZE (1024*1024) /** * create disk-based result buffer * @param pResultBuf diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 140d0432a6..a4a20b8fff 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -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"); 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 if (idata.pData == NULL) { qError("failed to allocate column buffer for output buffer"); @@ -9556,7 +9556,7 @@ void setResultBufSize(SQueryAttr* pQueryAttr, SRspResultInfo* pResultInfo) { // the minimum number of rows for projection query 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; -- GitLab