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

fix error in sort logic

上级 225cf618
...@@ -192,6 +192,9 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co ...@@ -192,6 +192,9 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
return numOfRow1; return numOfRow1;
} }
if (pSource->hasNull) {
pColumnInfoData->hasNull = pSource->hasNull;
}
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
// Handle the bitmap // Handle the bitmap
char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2)); char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2));
...@@ -313,9 +316,9 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock) { ...@@ -313,9 +316,9 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock) {
} }
int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) { int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
assert(pSrc != NULL && pDest != NULL && pDest->info.numOfCols == pSrc->info.numOfCols); assert(pSrc != NULL && pDest != NULL);
int32_t numOfCols = pSrc->info.numOfCols; int32_t numOfCols = pDest->info.numOfCols;
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pCol2 = taosArrayGet(pDest->pDataBlock, i); SColumnInfoData* pCol2 = taosArrayGet(pDest->pDataBlock, i);
SColumnInfoData* pCol1 = taosArrayGet(pSrc->pDataBlock, i); SColumnInfoData* pCol1 = taosArrayGet(pSrc->pDataBlock, i);
......
...@@ -52,6 +52,11 @@ typedef struct SMsortComparParam { ...@@ -52,6 +52,11 @@ typedef struct SMsortComparParam {
SArray *orderInfo; // SArray<SBlockOrderInfo> SArray *orderInfo; // SArray<SBlockOrderInfo>
} SMsortComparParam; } SMsortComparParam;
struct STupleHandle {
SSDataBlock* pBlock;
int32_t rowIndex;
};
typedef struct SSortHandle SSortHandle; typedef struct SSortHandle SSortHandle;
typedef struct STupleHandle STupleHandle; typedef struct STupleHandle STupleHandle;
......
...@@ -302,10 +302,6 @@ SSDataBlock* createOutputBuf_rv1(SDataBlockDescNode* pNode) { ...@@ -302,10 +302,6 @@ SSDataBlock* createOutputBuf_rv1(SDataBlockDescNode* pNode) {
} }
taosArrayPush(pBlock->pDataBlock, &idata); taosArrayPush(pBlock->pDataBlock, &idata);
if (IS_VAR_DATA_TYPE(idata.info.type)) {
pBlock->info.hasVarCol = true;
}
} }
return pBlock; return pBlock;
...@@ -4748,7 +4744,8 @@ static void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHan ...@@ -4748,7 +4744,8 @@ static void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHan
for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) {
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, i);
bool isNull = tsortIsNullVal(pTupleHandle, i); SColumnInfoData* pColInfoSrc = taosArrayGet(pTupleHandle->pBlock->pDataBlock, i);
bool isNull = colDataIsNull(pColInfoSrc, 0, pTupleHandle->rowIndex, NULL);
if (isNull) { if (isNull) {
colDataAppend(pColInfo, pBlock->info.rows, NULL, true); colDataAppend(pColInfo, pBlock->info.rows, NULL, true);
} else { } else {
......
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
#include "tutil.h" #include "tutil.h"
#include "tcompare.h" #include "tcompare.h"
struct STupleHandle {
SSDataBlock* pBlock;
int32_t rowIndex;
};
struct SSortHandle { struct SSortHandle {
int32_t type; int32_t type;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册