smp not support agg which without collectfn
This commit is contained in:
@ -9412,27 +9412,7 @@ static List* add_agg_node_to_tlist(List* remote_tlist, Node* expr, Index ressort
|
||||
}
|
||||
return remote_tlist;
|
||||
}
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
static bool check_median_walker(Node* node, void* context)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return false;
|
||||
} else if (IsA(node, Aggref)) {
|
||||
Aggref* agg_node = (Aggref*)node;
|
||||
/* 5555 and 5556 is median's fn oid */
|
||||
if (agg_node->aggfnoid == 5555 || agg_node->aggfnoid == 5556) {
|
||||
errno_t sprintf_rc = sprintf_s(u_sess->opt_cxt.not_shipping_info->not_shipping_reason,
|
||||
NOTPLANSHIPPING_LENGTH,
|
||||
"median aggregate is not supported in stream plan");
|
||||
securec_check_ss_c(sprintf_rc, "\0", "\0");
|
||||
mark_stream_unsupport();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return expression_tree_walker(node, (bool (*)())check_median_walker, context);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* process_agg_targetlist
|
||||
* The function scans the targetlist to check if the we can push anything
|
||||
@ -9470,10 +9450,6 @@ List* process_agg_targetlist(PlannerInfo* root, List** local_tlist)
|
||||
Node* expr = (Node*)local_tle->expr;
|
||||
foreign_qual_context context;
|
||||
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
check_median_walker(expr, NULL);
|
||||
#endif
|
||||
|
||||
foreign_qual_context_init(&context);
|
||||
/*
|
||||
* If the expression is not Aggref but involves aggregates (has Aggref
|
||||
|
||||
@ -1088,6 +1088,12 @@ static bool is_agg_unsupport_dn_compute(Node* node)
|
||||
if (aggref->aggorder || aggref->agglevelsup ||
|
||||
(!aggref->agghas_collectfn && need_adjust_agg_inner_func_type(aggref)) ||
|
||||
IsPolymorphicType(aggref->aggtrantype)) {
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
errno_t sprintf_rc = sprintf_s(u_sess->opt_cxt.not_shipping_info->not_shipping_reason,
|
||||
NOTPLANSHIPPING_LENGTH, "aggregate %d is not supported in stream plan", aggref->aggfnoid);
|
||||
securec_check_ss_c(sprintf_rc, "\0", "\0");
|
||||
mark_stream_unsupport();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -67,6 +67,12 @@ static uint unsupport_func[] = {
|
||||
PGSTATGETBACKENDPIDFUNCOID, // pg_stat_get_backend_pid
|
||||
PERCENTILECONTAGGFUNCOID, // percentile_cont
|
||||
MODEAGGFUNCOID, // mode
|
||||
FLOAT8MEDIANOID, // median(float8)
|
||||
INTERVALMEDIANOID, // median(interval)
|
||||
FIRSTAGGFUNCOID, // first
|
||||
LASTAGGFUNCOID, // last
|
||||
JSONAGGFUNCOID, // json_agg
|
||||
JSONOBJECTAGGFUNCOID // json_object_agg
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -485,7 +485,7 @@ bool need_adjust_agg_inner_func_type(Aggref* aggref)
|
||||
* You can extend here when you need support stream plan for other agg which
|
||||
* also have no collect function, e.g. array_agg,listagg and so on.
|
||||
*/
|
||||
if (aggref->aggfnoid == STRINGAGGFUNCOID)
|
||||
if (aggref->aggfnoid == STRINGAGGFUNCOID || aggref->aggfnoid == ARRAYAGGFUNCOID)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
@ -411,6 +411,10 @@ typedef FormData_pg_proc *Form_pg_proc;
|
||||
#define PERCENTILECONTAGGFUNCOID 4452
|
||||
#define MODEAGGFUNCOID 4461
|
||||
#define PGCHECKAUTHIDFUNCOID 3228
|
||||
#define FLOAT8MEDIANOID 5555
|
||||
#define INTERVALMEDIANOID 5556
|
||||
#define FIRSTAGGFUNCOID 6560
|
||||
#define LASTAGGFUNCOID 6561
|
||||
#define DB4AI_PREDICT_BY_BOOL_OID 7101
|
||||
#define DB4AI_PREDICT_BY_INT32_OID 7102
|
||||
#define DB4AI_PREDICT_BY_INT64_OID 7103
|
||||
@ -418,8 +422,8 @@ typedef FormData_pg_proc *Form_pg_proc;
|
||||
#define DB4AI_PREDICT_BY_FLOAT8_OID 7106
|
||||
#define DB4AI_PREDICT_BY_NUMERIC_OID 7107
|
||||
#define DB4AI_PREDICT_BY_TEXT_OID 7108
|
||||
#define JSONAGGFUNCOID 5206
|
||||
#define JSONOBJECTAGGFUNCOID 5209
|
||||
#define JSONAGGFUNCOID 3124
|
||||
#define JSONOBJECTAGGFUNCOID 3403
|
||||
|
||||
/*
|
||||
* Symbolic values for prokind column
|
||||
|
||||
@ -566,6 +566,19 @@ select median(a) from t1;
|
||||
50.5
|
||||
(1 row)
|
||||
|
||||
explain (costs off) select first(a) from t1;
|
||||
QUERY PLAN
|
||||
----------------------
|
||||
Aggregate
|
||||
-> Seq Scan on t1
|
||||
(2 rows)
|
||||
|
||||
select first(a) from t1;
|
||||
first
|
||||
-------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
explain (costs off) select sum(b)+median(a) as result from t1;
|
||||
QUERY PLAN
|
||||
----------------------
|
||||
|
||||
@ -34,6 +34,9 @@ select a, avg(b), sum(c) from t1 group by a order by 1,2,3;
|
||||
explain (costs off) select median(a) from t1;
|
||||
select median(a) from t1;
|
||||
|
||||
explain (costs off) select first(a) from t1;
|
||||
select first(a) from t1;
|
||||
|
||||
explain (costs off) select sum(b)+median(a) as result from t1;
|
||||
select sum(b)+median(a) as result from t1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user