“5c2fa8c0b36489ee0bfa5ed30f4dfc0e02982ebe”上不存在“...device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md”
提交 b3915310 编写于 作者: H Haojun Liao

fix(query): check for null ptr before extract sort execution information.

上级 5d5538a1
...@@ -732,12 +732,13 @@ void destroyMultiwayMergeOperatorInfo(void* param) { ...@@ -732,12 +732,13 @@ void destroyMultiwayMergeOperatorInfo(void* param) {
int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) {
ASSERT(pOptr != NULL); ASSERT(pOptr != NULL);
SSortExecInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SSortExecInfo* pSortExecInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo));
SMultiwayMergeOperatorInfo* pOperatorInfo = (SMultiwayMergeOperatorInfo*)pOptr->info; SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)pOptr->info;
*pSortExecInfo = tsortGetSortExecInfo(pInfo->pSortHandle);
*pOptrExplain = pSortExecInfo;
*pInfo = tsortGetSortExecInfo(pOperatorInfo->pSortHandle);
*pOptrExplain = pInfo;
*len = sizeof(SSortExecInfo); *len = sizeof(SSortExecInfo);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -831,14 +831,19 @@ uint64_t tsortGetGroupId(STupleHandle* pVHandle) { return pVHandle->pBlock->info ...@@ -831,14 +831,19 @@ uint64_t tsortGetGroupId(STupleHandle* pVHandle) { return pVHandle->pBlock->info
SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle) { SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle) {
SSortExecInfo info = {0}; SSortExecInfo info = {0};
info.sortBuffer = pHandle->pageSize * pHandle->numOfPages; if (pHandle == NULL) {
info.sortMethod = pHandle->inMemSort ? SORT_QSORT_T : SORT_SPILLED_MERGE_SORT_T; info.sortMethod = SORT_QSORT_T; // by default
info.loops = pHandle->loops; info.sortBuffer = 2 * 1048576; // 2mb by default
} else {
if (pHandle->pBuf != NULL) { info.sortBuffer = pHandle->pageSize * pHandle->numOfPages;
SDiskbasedBufStatis st = getDBufStatis(pHandle->pBuf); info.sortMethod = pHandle->inMemSort ? SORT_QSORT_T : SORT_SPILLED_MERGE_SORT_T;
info.writeBytes = st.flushBytes; info.loops = pHandle->loops;
info.readBytes = st.loadBytes;
if (pHandle->pBuf != NULL) {
SDiskbasedBufStatis st = getDBufStatis(pHandle->pBuf);
info.writeBytes = st.flushBytes;
info.readBytes = st.loadBytes;
}
} }
return info; return info;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册