Merge pull request #14973 from taosdata/szhou/feature/user-tags

fix: enable tag scan optimization when the scan cols is empty before adding ts col
This commit is contained in:
shenglian-zhou 2022-07-16 09:29:40 +08:00 committed by GitHub
commit f8276707e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -2113,7 +2113,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) ||