修复并行查询下ctescan的coredump问题
This commit is contained in:
@ -6291,7 +6291,15 @@ static FunctionScan* make_functionscan(List* qptlist, List* qpqual, Index scanre
|
||||
* if functionscan is disallowed to smp, and cursorPlan has stream node,
|
||||
* rebuild non-smp plan. For example, subplan is not support smp.
|
||||
*/
|
||||
|
||||
/* we must restore is_stream/is_stream_support cause they would be change during pgxc_planner */
|
||||
bool outer_is_stream = u_sess->opt_cxt.is_stream;
|
||||
bool outer_is_stream_support = u_sess->opt_cxt.is_stream_support;
|
||||
|
||||
ce->plan = (Node*)ReBuildNonSmpPlanForCursorExpr(pstrdup(ce->raw_query_str));
|
||||
|
||||
u_sess->opt_cxt.is_stream = outer_is_stream;
|
||||
u_sess->opt_cxt.is_stream_support = outer_is_stream_support;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
||||
@ -711,8 +711,7 @@ static Node* make_subplan(
|
||||
|
||||
/* Reset u_sess->opt_cxt.query_dop. */
|
||||
u_sess->opt_cxt.query_dop = outerDop;
|
||||
/* Reset is_stream/is_stream_support because cursorExpr in subquery would change them */
|
||||
set_default_stream();
|
||||
|
||||
/* Isolate the params needed by this specific subplan */
|
||||
plan_params = root->plan_params;
|
||||
root->plan_params = NIL;
|
||||
|
||||
@ -1461,6 +1461,34 @@ where no_o_id not in ( with tmp as (select w_id from bmsql_warehouse where bmsql
|
||||
0
|
||||
(1 row)
|
||||
|
||||
set query_dop = 1002;
|
||||
create table store_sales(ss_quantity integer, ss_list_price decimal(7,2));
|
||||
create table item(i_brand_id integer);
|
||||
create table catalog_sales(cs_quantity integer, cs_list_price decimal(7,2));
|
||||
with avg_sales as
|
||||
(select avg(quantity*list_price) average_sales
|
||||
from (select ss_quantity quantity
|
||||
,ss_list_price list_price
|
||||
from store_sales) x)
|
||||
select 'store' channel
|
||||
from store_sales
|
||||
,item
|
||||
group by i_brand_id
|
||||
having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)
|
||||
union all
|
||||
select 'catalog' channel
|
||||
from catalog_sales
|
||||
,item
|
||||
group by i_brand_id
|
||||
having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales)
|
||||
;
|
||||
channel
|
||||
---------
|
||||
(0 rows)
|
||||
|
||||
drop table store_sales;
|
||||
drop table item;
|
||||
drop table catalog_sales;
|
||||
--clean
|
||||
set search_path=public;
|
||||
drop schema test_smp cascade;
|
||||
|
||||
@ -234,6 +234,35 @@ where no_o_id not in ( with tmp as (select w_id from bmsql_warehouse where bmsql
|
||||
( select count(*) from bmsql_item group by i_im_id,i_im_id having i_im_id like f1('0')
|
||||
) tb2;
|
||||
|
||||
set query_dop = 1002;
|
||||
create table store_sales(ss_quantity integer, ss_list_price decimal(7,2));
|
||||
create table item(i_brand_id integer);
|
||||
|
||||
create table catalog_sales(cs_quantity integer, cs_list_price decimal(7,2));
|
||||
|
||||
with avg_sales as
|
||||
(select avg(quantity*list_price) average_sales
|
||||
from (select ss_quantity quantity
|
||||
,ss_list_price list_price
|
||||
from store_sales) x)
|
||||
|
||||
select 'store' channel
|
||||
from store_sales
|
||||
,item
|
||||
group by i_brand_id
|
||||
having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)
|
||||
union all
|
||||
select 'catalog' channel
|
||||
from catalog_sales
|
||||
,item
|
||||
group by i_brand_id
|
||||
having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales)
|
||||
;
|
||||
|
||||
drop table store_sales;
|
||||
drop table item;
|
||||
drop table catalog_sales;
|
||||
|
||||
--clean
|
||||
set search_path=public;
|
||||
drop schema test_smp cascade;
|
||||
|
||||
Reference in New Issue
Block a user