[TD-2096]<fix>: apercentile on super table crash
This commit is contained in:
parent
325bb79aab
commit
961757ffca
|
@ -2701,11 +2701,12 @@ static void apercentile_func_second_merge(SQLFunctionCtx *pCtx) {
|
||||||
memcpy(pHisto, pInput->pHisto, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1));
|
memcpy(pHisto, pInput->pHisto, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1));
|
||||||
pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo));
|
pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo));
|
||||||
} else {
|
} else {
|
||||||
|
//TODO(dengyihao): avoid memcpy
|
||||||
pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo));
|
pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo));
|
||||||
|
|
||||||
SHistogramInfo *pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN);
|
SHistogramInfo *pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN);
|
||||||
tHistogramDestroy(&pOutput->pHisto);
|
memcpy(pHisto, pRes, sizeof(SHistogramInfo) + sizeof(SHistBin) * MAX_HISTOGRAM_BIN);
|
||||||
pOutput->pHisto = pRes;
|
pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo));
|
||||||
|
tHistogramDestroy(&pRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
|
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||||
|
|
|
@ -44,6 +44,8 @@ typedef struct SHistogramInfo {
|
||||||
int32_t numOfEntries;
|
int32_t numOfEntries;
|
||||||
int32_t maxEntries;
|
int32_t maxEntries;
|
||||||
|
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
#if defined(USE_ARRAYLIST)
|
#if defined(USE_ARRAYLIST)
|
||||||
SHistBin* elems;
|
SHistBin* elems;
|
||||||
#else
|
#else
|
||||||
|
@ -52,9 +54,6 @@ typedef struct SHistogramInfo {
|
||||||
int32_t maxIndex;
|
int32_t maxIndex;
|
||||||
bool ordered;
|
bool ordered;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double min;
|
|
||||||
double max;
|
|
||||||
} SHistogramInfo;
|
} SHistogramInfo;
|
||||||
|
|
||||||
SHistogramInfo* tHistogramCreate(int32_t numOfBins);
|
SHistogramInfo* tHistogramCreate(int32_t numOfBins);
|
||||||
|
|
Loading…
Reference in New Issue