This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 13a3dc4dfc6 Fix invalid attribute mapping when runtime filter pushdown
is enabled.
13a3dc4dfc6 is described below
commit 13a3dc4dfc6b8a3c730f3c8b3fed837df473c177
Author: zhangyue <[email protected]>
AuthorDate: Wed Jul 16 12:48:44 2025 +0800
Fix invalid attribute mapping when runtime filter pushdown is enabled.
Seqscan is a special case, it's targetlist is a projection of the
relation's attributes, so we need to find the attribute number of
the column in the relation.
While TargetEntry::resno is just the attribute number for dynamic
seqscan.
---
src/backend/executor/nodeHashjoin.c | 12 ++++++++++++
src/test/regress/expected/gp_runtime_filter.out | 4 ++--
src/test/regress/sql/gp_runtime_filter.sql | 4 ++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/backend/executor/nodeHashjoin.c
b/src/backend/executor/nodeHashjoin.c
index b14446dc953..9ec70f16e31 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -2341,6 +2341,18 @@ CheckTargetNode(PlanState *node, AttrNumber attno,
AttrNumber *lattno)
if (!IsA(te->expr, Var))
return false;
+ if (IsA(node, DynamicSeqScanState))
+ {
+ *lattno = te->resno;
+ return true;
+ }
+
+ /*
+ * seqscan is a special case, it's targetlist is a projection of the
+ * relation's attributes. so we need to find the attribute number of the
+ * column in the relation, because PassByBloomFilter runs before
+ * projection in seqscan.
+ */
var = castNode(Var, te->expr);
/* system column is not allowed */
diff --git a/src/test/regress/expected/gp_runtime_filter.out
b/src/test/regress/expected/gp_runtime_filter.out
index 32287b63d01..cb47862576c 100644
--- a/src/test/regress/expected/gp_runtime_filter.out
+++ b/src/test/regress/expected/gp_runtime_filter.out
@@ -548,7 +548,7 @@ INSERT INTO t2 SELECT generate_series(51, 51),
generate_series(51, 51);
ANALYZE;
SET optimizer TO on;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
-SELECT * FROM t1, t2 WHERE t1.c2 = t2.c2;
+SELECT t1.c2 FROM t1, t2 WHERE t1.c2 = t2.c2;
QUERY PLAN
-------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=96 loops=1)
@@ -567,7 +567,7 @@ SELECT * FROM t1, t2 WHERE t1.c2 = t2.c2;
SET gp_enable_runtime_filter_pushdown TO on;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
-SELECT * FROM t1, t2 WHERE t1.c2 = t2.c2;
+SELECT t1.c2 FROM t1, t2 WHERE t1.c2 = t2.c2;
QUERY PLAN
-------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (actual rows=96 loops=1)
diff --git a/src/test/regress/sql/gp_runtime_filter.sql
b/src/test/regress/sql/gp_runtime_filter.sql
index 6a0c6e0cafb..d221c04958e 100644
--- a/src/test/regress/sql/gp_runtime_filter.sql
+++ b/src/test/regress/sql/gp_runtime_filter.sql
@@ -242,12 +242,12 @@ ANALYZE;
SET optimizer TO on;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
-SELECT * FROM t1, t2 WHERE t1.c2 = t2.c2;
+SELECT t1.c2 FROM t1, t2 WHERE t1.c2 = t2.c2;
SET gp_enable_runtime_filter_pushdown TO on;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
-SELECT * FROM t1, t2 WHERE t1.c2 = t2.c2;
+SELECT t1.c2 FROM t1, t2 WHERE t1.c2 = t2.c2;
RESET gp_enable_runtime_filter_pushdown;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]