提交 9fa5b304 编写于 作者: H Hongze Cheng

Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/alter_table

...@@ -2114,6 +2114,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO ...@@ -2114,6 +2114,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
} }
} }
static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep);
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) { void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
if (pFilterNode == NULL) { if (pFilterNode == NULL) {
return; return;
...@@ -2128,43 +2129,60 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) { ...@@ -2128,43 +2129,60 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
code = filterSetDataFromSlotId(filter, &param1); code = filterSetDataFromSlotId(filter, &param1);
int8_t* rowRes = NULL; int8_t* rowRes = NULL;
// todo the keep seems never to be True??
bool keep = filterExecute(filter, pBlock, &rowRes, NULL, param1.numOfCols); bool keep = filterExecute(filter, pBlock, &rowRes, NULL, param1.numOfCols);
filterFreeInfo(filter); filterFreeInfo(filter);
SSDataBlock* px = createOneDataBlock(pBlock, false); extractQualifiedTupleByFilterResult(pBlock, rowRes, keep);
blockDataEnsureCapacity(px, pBlock->info.rows); blockDataUpdateTsWindow(pBlock);
}
// todo extract method void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep) {
int32_t numOfRow = 0; if (keep) {
for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { return;
SColumnInfoData* pDst = taosArrayGet(px->pDataBlock, i); }
SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, i);
if (keep) { if (rowRes != NULL) {
colDataAssign(pDst, pSrc, pBlock->info.rows); SSDataBlock* px = createOneDataBlock(pBlock, false);
numOfRow = pBlock->info.rows; blockDataEnsureCapacity(px, pBlock->info.rows);
} else if (NULL != rowRes) {
numOfRow = 0; int32_t totalRows = pBlock->info.rows;
for (int32_t j = 0; j < pBlock->info.rows; ++j) {
for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) {
SColumnInfoData* pDst = taosArrayGet(px->pDataBlock, i);
SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, i);
// For the reserved column, the value is not filled yet, so the whole column data may be NULL.
if (pSrc->pData == NULL) {
continue;
}
int32_t numOfRows = 0;
for (int32_t j = 0; j < totalRows; ++j) {
if (rowRes[j] == 0) { if (rowRes[j] == 0) {
continue; continue;
} }
if (colDataIsNull_s(pSrc, j)) { if (colDataIsNull_s(pSrc, j)) {
colDataAppendNULL(pDst, numOfRow); colDataAppendNULL(pDst, numOfRows);
} else { } else {
colDataAppend(pDst, numOfRow, colDataGetData(pSrc, j), false); colDataAppend(pDst, numOfRows, colDataGetData(pSrc, j), false);
} }
numOfRow += 1; numOfRows += 1;
} }
} else {
numOfRow = 0;
}
*pSrc = *pDst; if (pBlock->info.rows == totalRows) {
} pBlock->info.rows = numOfRows;
} else {
ASSERT(pBlock->info.rows == numOfRows);
}
pBlock->info.rows = numOfRow; *pSrc = *pDst;
blockDataUpdateTsWindow(pBlock); }
} else {
// do nothing
pBlock->info.rows = 0;
}
} }
void doSetTableGroupOutputBuf(SAggOperatorInfo* pAggInfo, int32_t numOfOutput, uint64_t groupId, void doSetTableGroupOutputBuf(SAggOperatorInfo* pAggInfo, int32_t numOfOutput, uint64_t groupId,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册