Merge pull request #21258 from taosdata/szhou/fix-td24084
fix: bypass projection pruning if union set op and subquery
This commit is contained in:
commit
0c744e864b
|
@ -388,6 +388,9 @@ static bool isSetUselessCol(SSetOperator* pSetOp, int32_t index, SExprNode* pPro
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) {
|
static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) {
|
||||||
|
if (subquery && pSetOp->opType == SET_OP_TYPE_UNION) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
SNode* pProj = NULL;
|
SNode* pProj = NULL;
|
||||||
WHERE_EACH(pProj, pSetOp->pProjectionList) {
|
WHERE_EACH(pProj, pSetOp->pProjectionList) {
|
||||||
|
|
|
@ -19,6 +19,14 @@
|
||||||
#include "scalar.h"
|
#include "scalar.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
|
||||||
|
static void debugPrintNode(SNode* pNode) {
|
||||||
|
char* pStr = NULL;
|
||||||
|
nodesNodeToString(pNode, false, &pStr, NULL);
|
||||||
|
printf("%s\n", pStr);
|
||||||
|
taosMemoryFree(pStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static void dumpQueryPlan(SQueryPlan* pPlan) {
|
static void dumpQueryPlan(SQueryPlan* pPlan) {
|
||||||
if (!tsQueryPlannerTrace) {
|
if (!tsQueryPlannerTrace) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,4 +25,21 @@ if $data05 != @0021001@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql create table st (ts timestamp, f int) tags (t int);
|
||||||
|
sql insert into ct1 using st tags(1) values(now, 1)(now+1s, 2)
|
||||||
|
sql insert into ct2 using st tags(2) values(now+2s, 3)(now+3s, 4)
|
||||||
|
sql select count(*) from (select * from ct1 union all select * from ct2)
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 4 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from (select * from ct1 union select * from ct2)
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 4 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
Loading…
Reference in New Issue