fix(query): prepare buffer before copying data.
This commit is contained in:
parent
300f35188e
commit
d3d258caa9
|
@ -120,6 +120,8 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
|
|||
}
|
||||
|
||||
if (p->info.rows > 0) {
|
||||
blockDataEnsureCapacity(pDataBlock, capacity);
|
||||
|
||||
// todo extract function to handle this
|
||||
int32_t numOfCols = taosArrayGetSize(pColMatchInfo);
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
|
@ -132,7 +134,6 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
|
|||
}
|
||||
|
||||
pDataBlock->info.rows = p->info.rows;
|
||||
pDataBlock->info.capacity = p->info.rows;
|
||||
}
|
||||
|
||||
blockDataDestroy(p);
|
||||
|
@ -258,6 +259,7 @@ typedef struct SGroupSortOperatorInfo {
|
|||
SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity,
|
||||
SArray* pColMatchInfo, SGroupSortOperatorInfo* pInfo) {
|
||||
blockDataCleanup(pDataBlock);
|
||||
blockDataEnsureCapacity(pDataBlock, capacity);
|
||||
|
||||
SSDataBlock* p = tsortGetSortedDataBlock(pHandle);
|
||||
if (p == NULL) {
|
||||
|
@ -571,7 +573,8 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
|
|||
}
|
||||
}
|
||||
|
||||
if (p->info.rows > 0) {
|
||||
if (p->info.rows > 0) {// todo extract method
|
||||
blockDataEnsureCapacity(pDataBlock, p->info.rows);
|
||||
int32_t numOfCols = taosArrayGetSize(pColMatchInfo);
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i);
|
||||
|
@ -583,7 +586,6 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
|
|||
}
|
||||
|
||||
pDataBlock->info.rows = p->info.rows;
|
||||
pDataBlock->info.capacity = p->info.rows;
|
||||
pDataBlock->info.groupId = pInfo->groupId;
|
||||
}
|
||||
|
||||
|
|
|
@ -1081,7 +1081,6 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
|
|||
int32_t start = pInput->startRowIndex;
|
||||
int32_t numOfRows = pInput->numOfRows;
|
||||
|
||||
|
||||
SSDataBlock* pTempBlock = createDataBlock();
|
||||
pTempBlock->info.rows = pInput->totalRows;
|
||||
pTempBlock->info.uid = pInput->uid;
|
||||
|
|
|
@ -44,6 +44,7 @@ endi
|
|||
sql create function n02 as '/tmp/normal' outputtype bool;
|
||||
sql show functions;
|
||||
if $rows != 1 then
|
||||
print expect 1, actual $rows
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ endi
|
|||
|
||||
sql select udf2(f) from t;
|
||||
if $rows != 1 then
|
||||
print expect 1, actual $rows
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2.236067977 then
|
||||
|
|
Loading…
Reference in New Issue