fix: enable tag scan optimization when the scan cols is empty before adding ts col
This commit is contained in:
parent
73b1b239d7
commit
cede4b7624
|
@ -78,6 +78,7 @@ typedef struct SScanLogicNode {
|
||||||
SNodeList* pGroupTags;
|
SNodeList* pGroupTags;
|
||||||
bool groupSort;
|
bool groupSort;
|
||||||
int8_t cacheLastMode;
|
int8_t cacheLastMode;
|
||||||
|
bool hasNormalCols; // neither tag column nor primary key tag column
|
||||||
} SScanLogicNode;
|
} SScanLogicNode;
|
||||||
|
|
||||||
typedef struct SJoinLogicNode {
|
typedef struct SJoinLogicNode {
|
||||||
|
|
|
@ -278,6 +278,10 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
||||||
|
|
||||||
pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType);
|
pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType);
|
||||||
|
|
||||||
|
if (NULL != pScan->pScanCols) {
|
||||||
|
pScan->hasNormalCols = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = addPrimaryKeyCol(pScan->tableId, &pScan->pScanCols);
|
code = addPrimaryKeyCol(pScan->tableId, &pScan->pScanCols);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2112,7 +2112,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
|
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
|
||||||
if (NULL != pScan->pScanCols) {
|
if (pScan->hasNormalCols) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (NULL == pNode->pParent || QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) ||
|
if (NULL == pNode->pParent || QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) ||
|
||||||
|
|
Loading…
Reference in New Issue