fix: enable tag scan optimization when the scan cols is empty before adding ts col

This commit is contained in:
shenglian zhou 2022-07-15 18:01:04 +08:00
parent 73b1b239d7
commit cede4b7624
3 changed files with 6 additions and 1 deletions

View File

@ -78,6 +78,7 @@ typedef struct SScanLogicNode {
SNodeList* pGroupTags;
bool groupSort;
int8_t cacheLastMode;
bool hasNormalCols; // neither tag column nor primary key tag column
} SScanLogicNode;
typedef struct SJoinLogicNode {

View File

@ -278,6 +278,10 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType);
if (NULL != pScan->pScanCols) {
pScan->hasNormalCols = true;
}
if (TSDB_CODE_SUCCESS == code) {
code = addPrimaryKeyCol(pScan->tableId, &pScan->pScanCols);
}

View File

@ -2112,7 +2112,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
return false;
}
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
if (NULL != pScan->pScanCols) {
if (pScan->hasNormalCols) {
return false;
}
if (NULL == pNode->pParent || QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) ||