fix: disable eliminate projection when repeat proj column name
This commit is contained in:
parent
9bb21ebbc2
commit
056301fb7b
|
@ -235,7 +235,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
|
||||||
terrno = code;
|
terrno = code;
|
||||||
return code;
|
return code;
|
||||||
} else {
|
} else {
|
||||||
qDebug("sucess to get tableIds, size: %d, suid: %" PRIu64 "", (int)taosArrayGetSize(res), tableUid);
|
qDebug("success to get tableIds, size: %d, suid: %" PRIu64 "", (int)taosArrayGetSize(res), tableUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(res); i++) {
|
for (int i = 0; i < taosArrayGetSize(res); i++) {
|
||||||
|
@ -319,12 +319,10 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool foundSource = false;
|
|
||||||
SColMatchInfo* info = NULL;
|
SColMatchInfo* info = NULL;
|
||||||
for (int32_t j = 0; j < taosArrayGetSize(pList); ++j) {
|
for (int32_t j = 0; j < taosArrayGetSize(pList); ++j) {
|
||||||
info = taosArrayGet(pList, j);
|
info = taosArrayGet(pList, j);
|
||||||
if (info->targetSlotId == pNode->slotId) {
|
if (info->targetSlotId == pNode->slotId) {
|
||||||
foundSource = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +330,6 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
|
||||||
if (pNode->output) {
|
if (pNode->output) {
|
||||||
(*numOfOutputCols) += 1;
|
(*numOfOutputCols) += 1;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(foundSource);
|
|
||||||
info->output = false;
|
info->output = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,10 +592,10 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray
|
||||||
while (i < numOfSrcCols && j < taosArrayGetSize(pColMatchInfo)) {
|
while (i < numOfSrcCols && j < taosArrayGetSize(pColMatchInfo)) {
|
||||||
SColumnInfoData* p = taosArrayGet(pCols, i);
|
SColumnInfoData* p = taosArrayGet(pCols, i);
|
||||||
SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, j);
|
SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, j);
|
||||||
// if (!pmInfo->output) {
|
if (!pmInfo->output) {
|
||||||
// j++;
|
j++;
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (p->info.colId == pmInfo->colId) {
|
if (p->info.colId == pmInfo->colId) {
|
||||||
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, pmInfo->targetSlotId);
|
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, pmInfo->targetSlotId);
|
||||||
|
|
|
@ -1092,14 +1092,27 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHashObj* pProjColNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||||
SNode* pProjection;
|
SNode* pProjection;
|
||||||
FOREACH(pProjection, pProjectNode->pProjections) {
|
FOREACH(pProjection, pProjectNode->pProjections) {
|
||||||
SExprNode* pExprNode = (SExprNode*)pProjection;
|
SExprNode* pExprNode = (SExprNode*)pProjection;
|
||||||
if (QUERY_NODE_COLUMN != nodeType(pExprNode)) {
|
if (QUERY_NODE_COLUMN != nodeType(pExprNode)) {
|
||||||
|
taosHashCleanup(pProjColNameHash);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* projColumnName = ((SColumnNode*)pProjection)->colName;
|
||||||
|
int32_t* pExist = taosHashGet(pProjColNameHash, projColumnName, strlen(projColumnName));
|
||||||
|
if (NULL != pExist) {
|
||||||
|
taosHashCleanup(pProjColNameHash);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
int32_t exist = 1;
|
||||||
|
taosHashPut(pProjColNameHash, projColumnName, strlen(projColumnName), &exist, sizeof(exist));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosHashCleanup(pProjColNameHash);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,13 +1123,14 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
|
||||||
SNode* pProjection = NULL;
|
SNode* pProjection = NULL;
|
||||||
FOREACH(pProjection, pProjectNode->pProjections) {
|
FOREACH(pProjection, pProjectNode->pProjections) {
|
||||||
SColumnNode* projColumn = (SColumnNode*)pProjection;
|
SColumnNode* projColumn = (SColumnNode*)pProjection;
|
||||||
|
char* projColumnName = projColumn->colName;
|
||||||
SNode* pChildTarget = NULL;
|
SNode* pChildTarget = NULL;
|
||||||
FOREACH(pChildTarget, pChild->pTargets) {
|
FOREACH(pChildTarget, pChild->pTargets) {
|
||||||
SExprNode* childExpr = (SExprNode*)pChildTarget;
|
SExprNode* childExpr = (SExprNode*)pChildTarget;
|
||||||
char* projColumnName = projColumn->colName;
|
|
||||||
if (QUERY_NODE_COLUMN == nodeType(childExpr) && strcmp(projColumnName, ((SColumnNode*)childExpr)->colName) == 0 ||
|
if (QUERY_NODE_COLUMN == nodeType(childExpr) && strcmp(projColumnName, ((SColumnNode*)childExpr)->colName) == 0 ||
|
||||||
strcmp(projColumnName, childExpr->aliasName) == 0) {
|
strcmp(projColumnName, childExpr->aliasName) == 0) {
|
||||||
nodesListAppend(pNewChildTargets, nodesCloneNode(pChildTarget));
|
nodesListAppend(pNewChildTargets, nodesCloneNode(pChildTarget));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex
|
||||||
atomic_store_8(&ctx->taskType, taskType);
|
atomic_store_8(&ctx->taskType, taskType);
|
||||||
atomic_store_8(&ctx->explain, explain);
|
atomic_store_8(&ctx->explain, explain);
|
||||||
|
|
||||||
/*QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg);*/
|
QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg);
|
||||||
|
|
||||||
code = qStringToSubplan(qwMsg->msg, &plan);
|
code = qStringToSubplan(qwMsg->msg, &plan);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
|
Loading…
Reference in New Issue