adjust
This commit is contained in:
parent
651b681d4c
commit
52c244d9ec
|
@ -595,13 +595,25 @@ static bool calcNeedCountEmpty(SPhysiPlanContext* pCxt, SScanLogicNode* pScanLog
|
|||
}
|
||||
// limit: root node is select
|
||||
SNode* pRoot = pCxt->pPlanCxt->pAstRoot;
|
||||
if (QUERY_NODE_SELECT_STMT == nodeType(pRoot)
|
||||
&& pCxt->pNode && QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pCxt->pNode)) {
|
||||
SAggLogicNode* pNode = (SAggLogicNode*)pCxt->pNode;
|
||||
if (pNode->isCountByTag) {
|
||||
return true;
|
||||
if (QUERY_NODE_SELECT_STMT == nodeType(pRoot)) {
|
||||
// case1 root select
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pRoot;
|
||||
if (pSelect->hasCountFunc) {
|
||||
if (NULL != pSelect->pGroupByList) {
|
||||
return !keysHasCol(pSelect->pGroupByList);
|
||||
} else if (NULL != pSelect->pPartitionByList) {
|
||||
return !keysHasCol(pSelect->pPartitionByList);
|
||||
}
|
||||
}
|
||||
// case2 inner agg
|
||||
if (pCxt->pNode && QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pCxt->pNode)) {
|
||||
SAggLogicNode* pNode = (SAggLogicNode*)pCxt->pNode;
|
||||
if (pNode->isCountByTag) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class TDTestCase:
|
|||
tdSql.checkData(0, 1, 2)
|
||||
elif 'hyperloglog' == function_name:
|
||||
tdSql.checkData(0, 0, 0)
|
||||
tdSql.checkData(0, 0, 0)
|
||||
tdSql.checkData(0, 1, None)
|
||||
|
||||
def query_empty_ntb(self):
|
||||
tdSql.query(f'select count(*) from {self.ntbname}')
|
||||
|
|
|
@ -83,6 +83,10 @@ class TDTestCase:
|
|||
tdSql.query(f"select count(c1) from {self.dbname}.{self.stable} group by tbname ")
|
||||
tdSql.checkRows(check_num)
|
||||
|
||||
#inner select
|
||||
tdSql.query(f"select * from (select count(c1) from {self.dbname}.{self.stable} group by tbname) ")
|
||||
tdSql.checkRows(check_num)
|
||||
|
||||
# count + sum(col)
|
||||
tdSql.query(f"select count(*), sum(c1) from {self.dbname}.{self.stable} group by tbname ")
|
||||
tdSql.checkRows(check_num)
|
||||
|
@ -146,6 +150,10 @@ class TDTestCase:
|
|||
tdSql.query(f"select count(c1) from {self.dbname}.{self.stable} partition by tbname ")
|
||||
tdSql.checkRows(check_num)
|
||||
|
||||
#inner select
|
||||
tdSql.query(f"select * from (select count(c1) from {self.dbname}.{self.stable} partition by tbname) ")
|
||||
tdSql.checkRows(check_num)
|
||||
|
||||
tdSql.query(f"select count(c1) from {self.dbname}.{self.stable} partition by tbname interval(1d)")
|
||||
tdSql.checkRows(real_num)
|
||||
|
||||
|
@ -196,4 +204,4 @@ class TDTestCase:
|
|||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
|
|
Loading…
Reference in New Issue