You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by re...@apache.org on 2026/08/17 09:43:57 UTC
(cloudberry) branch jdejii updated (65b0b74b863 -> 70f48e44c8a)
This is an automated email from the ASF dual-hosted git repository.
reshke pushed a change to branch jdejii
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
discard 65b0b74b863 Fix JOIN motion type selection for join quals containing outer refs
new 70f48e44c8a Fix JOIN motion type selection for join quals containing outer refs
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (65b0b74b863)
\
N -- N -- N refs/heads/jdejii (70f48e44c8a)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/backend/optimizer/plan/initsplan.c | 2 --
1 file changed, 2 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 01/01: Fix JOIN motion type selection for join quals containing outer refs
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch jdejii
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 70f48e44c8a3ee941e1ecf59638ed41e508940aa
Author: reshke <re...@double.cloud>
AuthorDate: Mon Aug 17 08:39:37 2026 +0000
Fix JOIN motion type selection for join quals containing outer refs
---
src/backend/optimizer/plan/initsplan.c | 3 ---
src/backend/optimizer/util/restrictinfo.c | 9 +++++++++
src/test/regress/sql/join_gp.sql | 8 ++++++++
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index b65897043ca..ce05a4301a4 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -2970,9 +2970,6 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
Relids relids = restrictinfo->required_relids;
RelOptInfo *rel;
- if (contains_outer_params((Node *) restrictinfo->clause, root))
- restrictinfo->contain_outer_query_references = true;
-
switch (bms_membership(relids))
{
case BMS_SINGLETON:
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c
index 45552d53aaf..c1a9404e91d 100644
--- a/src/backend/optimizer/util/restrictinfo.c
+++ b/src/backend/optimizer/util/restrictinfo.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "cdb/cdbmutate.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
@@ -263,6 +264,14 @@ make_restrictinfo_internal(PlannerInfo *root,
restrictinfo->left_hasheqoperator = InvalidOid;
restrictinfo->right_hasheqoperator = InvalidOid;
+ /*
+ * Determine whether this clause references any var in outer query levels.
+ * Such clauses must be evaluated in the same slice as the parent query,
+ * so we set this planner hint to later use in join motion planning.
+ */
+ restrictinfo->contain_outer_query_references =
+ contains_outer_params((Node *) clause, root);
+
return restrictinfo;
}
diff --git a/src/test/regress/sql/join_gp.sql b/src/test/regress/sql/join_gp.sql
index 6a96d9b98e1..528dcc39300 100644
--- a/src/test/regress/sql/join_gp.sql
+++ b/src/test/regress/sql/join_gp.sql
@@ -1316,3 +1316,11 @@ drop table if exists repli_t1_pk;
drop table if exists repli_t2_pk;
drop table if exists repli_t3_pk;
drop table if exists repli_t4_pk;
+
+--
+-- Test that a join qual containing an outer-level reference
+-- is correctly identified as referring to the outer
+-- query, so that the join motion is planned in the parent slice.
+--
+explain (costs off) select * from generate_series(1,2) t1, lateral (select t3.unique1 from int4_tbl t2 join tenk1 t3 on t2.f1 = t3.unique1 + t1 order by 1) z;
+select * from generate_series(1,2) t1, lateral (select t3.unique1 from int4_tbl t2 join tenk1 t3 on t2.f1 = t3.unique1 + t1 order by 1) z;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org