You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
backport: Support "Right Semi Join" plan shapes (PG18 aa86129e1)
Cherry-pick of upstream PostgreSQL commit aa86129e1 (Richard Guo,
"Support 'Right Semi Join' plan shapes"). Hash joins can now implement a
semijoin with the LHS on the build (right/inner) side, leveraging
HEAP_TUPLE_HAS_MATCH so only the first match per inner tuple is emitted.
This lets the planner hash the smaller table for IN/EXISTS-style queries.
Conflicts resolved for the Greenplum/Cloudberry tree:
- nodes.h: keep the GPDB-only JOIN_LASJ_NOTIN and add JOIN_RIGHT_SEMI
immediately before JOIN_RIGHT_ANTI.
- joinrels.c: add the JOIN_RIGHT_SEMI path alongside JOIN_SEMI while
preserving the GPDB JOIN_DEDUP_SEMI / replicated-table-DML handling.
- explain.c: add the "Right Semi" label next to the GPDB labels.
GPDB-specific adaptation NOT covered by the upstream patch (would
otherwise hit `elog(ERROR, "unexpected join type")` at plan time):
- cdbpath.c (cdbpath_motion_for_join, both the serial and parallel
switch): handle JOIN_RIGHT_SEMI like JOIN_RIGHT/JOIN_RIGHT_ANTI, i.e.
the inner (build) side must not be replicated, since a right-semi join
emits build-side rows.
Verified that calc_joinrel_size_estimate / build_joinrel_partition_info /
costsize hashjoin paths are never reached with JOIN_RIGHT_SEMI (they use
the relation-level JOIN_SEMI), matching upstream, so no change needed.
Regression .out files kept at the GPDB baseline for now; they will be
regenerated after functional verification.
Cherry picked from commit aa86129e19d704afb93cb84ab9638f33d266ee9d.
0 commit comments