fix: nested query can be used as table for join together
This commit is contained in:
parent
1e391ad27c
commit
d992ab1401
|
@ -248,12 +248,25 @@ static bool stbSplNeedSplitWindow(bool streamQuery, SLogicNode* pNode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool stbSplNeedSplitJoin(bool streamQuery, SJoinLogicNode* pJoin) {
|
||||||
|
if (pJoin->isSingleTableJoin) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SNode* pChild = NULL;
|
||||||
|
FOREACH(pChild, pJoin->node.pChildren) {
|
||||||
|
if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pChild) && QUERY_NODE_LOGIC_PLAN_JOIN != nodeType(pChild)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool stbSplNeedSplit(bool streamQuery, SLogicNode* pNode) {
|
static bool stbSplNeedSplit(bool streamQuery, SLogicNode* pNode) {
|
||||||
switch (nodeType(pNode)) {
|
switch (nodeType(pNode)) {
|
||||||
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
||||||
return stbSplIsMultiTbScan(streamQuery, (SScanLogicNode*)pNode);
|
return stbSplIsMultiTbScan(streamQuery, (SScanLogicNode*)pNode);
|
||||||
case QUERY_NODE_LOGIC_PLAN_JOIN:
|
case QUERY_NODE_LOGIC_PLAN_JOIN:
|
||||||
return !(((SJoinLogicNode*)pNode)->isSingleTableJoin);
|
return stbSplNeedSplitJoin(streamQuery, (SJoinLogicNode*)pNode);
|
||||||
case QUERY_NODE_LOGIC_PLAN_PARTITION:
|
case QUERY_NODE_LOGIC_PLAN_PARTITION:
|
||||||
return stbSplIsMultiTbScanChild(streamQuery, pNode);
|
return stbSplIsMultiTbScanChild(streamQuery, pNode);
|
||||||
case QUERY_NODE_LOGIC_PLAN_AGG:
|
case QUERY_NODE_LOGIC_PLAN_AGG:
|
||||||
|
|
|
@ -37,7 +37,7 @@ sql select * from stb1 where c8 < 'nuLl';
|
||||||
sql select * from stb1 where c9 > 'nuLl';
|
sql select * from stb1 where c9 > 'nuLl';
|
||||||
sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b;
|
sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b;
|
||||||
sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60;
|
sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60;
|
||||||
sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and ((a.c1 > 50 and a.c1 < 60) or (b.c2 > 60));
|
sql select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and ((a.c1 > 50 and a.c1 < 60) or (b.c2 > 60));
|
||||||
sql select * from stb1 where 'c2' is null;
|
sql select * from stb1 where 'c2' is null;
|
||||||
sql select * from stb1 where 'c2' is not null;
|
sql select * from stb1 where 'c2' is not null;
|
||||||
|
|
||||||
|
@ -1475,66 +1475,66 @@ if $data20 != @21-05-05 18:19:25.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
#sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 order by ts;
|
sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 order by ts;
|
||||||
#sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50;
|
sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50;
|
||||||
#if $rows != 4 then
|
if $rows != 4 then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data00 != @21-05-05 18:19:20.000@ then
|
if $data00 != @21-05-05 18:19:20.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data10 != @21-05-05 18:19:21.000@ then
|
if $data10 != @21-05-05 18:19:21.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data20 != @21-05-05 18:19:24.000@ then
|
if $data20 != @21-05-05 18:19:24.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data30 != @21-05-05 18:19:25.000@ then
|
if $data30 != @21-05-05 18:19:25.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
|
|
||||||
#sql select a.ts,a.c1,a.c8,a.c9 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts;
|
sql select a.ts,a.c1,a.c8,a.c9 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts;
|
||||||
#sql select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts;
|
sql select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts;
|
||||||
#if $rows != 2 then
|
if $rows != 2 then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data00 != @21-05-05 18:19:20.000@ then
|
if $data00 != @21-05-05 18:19:20.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data10 != @21-05-05 18:19:21.000@ then
|
if $data10 != @21-05-05 18:19:21.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#
|
|
||||||
#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5) order by ts;
|
sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5) order by ts;
|
||||||
#if $rows != 4 then
|
if $rows != 4 then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data00 != @21-05-05 18:19:00.000@ then
|
if $data00 != @21-05-05 18:19:00.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data10 != @21-05-05 18:19:02.000@ then
|
if $data10 != @21-05-05 18:19:02.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data20 != @21-05-05 18:19:12.000@ then
|
if $data20 != @21-05-05 18:19:12.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data30 != @21-05-05 18:19:14.000@ then
|
if $data30 != @21-05-05 18:19:14.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#
|
|
||||||
#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5 order by ts;
|
sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5 order by ts;
|
||||||
#if $rows != 3 then
|
if $rows != 3 then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data00 != @21-05-05 18:19:04.000@ then
|
if $data00 != @21-05-05 18:19:04.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data10 != @21-05-05 18:19:06.000@ then
|
if $data10 != @21-05-05 18:19:06.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
#if $data20 != @21-05-05 18:19:10.000@ then
|
if $data20 != @21-05-05 18:19:10.000@ then
|
||||||
# return -1
|
return -1
|
||||||
#endi
|
endi
|
||||||
|
|
||||||
sql select * from stb1 where c1 is null and c1 is not null;
|
sql select * from stb1 where c1 is null and c1 is not null;
|
||||||
if $rows != 0 then
|
if $rows != 0 then
|
||||||
|
@ -2574,7 +2574,7 @@ sql select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1
|
||||||
sql select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1
|
sql select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1
|
||||||
sql select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3)
|
sql select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3)
|
||||||
sql select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1
|
sql select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1
|
||||||
sql_error select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.t1=b.t1;
|
sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.t1=b.t1;
|
||||||
|
|
||||||
sql select * from stb1 where c1 < 63 and t1 > 5
|
sql select * from stb1 where c1 < 63 and t1 > 5
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
|
|
Loading…
Reference in New Issue