Repository navigation
Fix: no need to do the qual-clause twice - #396
Merged
Merged
Conversation
Contributor
|
This is my plan for heap table: |
Contributor
|
So, should we handle hash Subplan correctly in Pax? |
yjhjstz
approved these changes
Aug 9, 2024
my-ship-it
approved these changes
Aug 16, 2024
jiaqizho
force-pushed
the
fix-pushdown-qual-clause
branch
from
August 16, 2024 03:13
8adcd8f to
8d136ac
Compare
Alena0704
added a commit
to Alena0704/cloudberry
that referenced
this pull request
Aug 25, 2026
Port of Greengage PR apache#342 / open-gpdb PR apache#396 ("Fix cross-slice interaction detection for subplans") to Cloudberry. The code part of the original fix is not needed here. In GPDB 6 the shareinput walkers processed glob->subplans separately from the main plan tree, so the motion stack contained only the default motion id (0) and a Shared Scan consumer inside a SubPlan was never marked as cross-slice. Cloudberry (GPDB 7 based) already tracks the slice of every SubPlan reference point: the planner records it in glob->subplan_sliceIds (build_slice_table_walker dives into SubPlans in place), ORCA records it in CContextDXLToPlStmt::AddSubplan, and apply_shareinput_xslice pushes that slice id onto the motion stack before walking each subplan. The executor-side ExecSliceDependencyNode change does not apply either: cross-slice Shared Scan synchronization was rewritten to use shared-memory IPC in nodeShareInputScan.c. Likewise, glob->subroots stays aligned with glob->subplans when subplans are duplicated (adjust_appendrel_attrs_mutator), so the fixup_subplan_walker change has no counterpart. Verified on a demo cluster: both scenarios from the original patch produce the same plan shape (Shared Scan consumer under a SubPlan in a different slice than the producer), are correctly marked cross-slice and return correct results under both planners. What is ported is the regression coverage, to guard against future regressions in this area: - both test queries from the original patch (planner and ORCA answer files), with tables renamed to xslice_t1/xslice_t2 to avoid clashing with t1/t2 already created by this test; - a new fault injection point shareinput_writer_pre_freeze, the Cloudberry analog of material_pre_tuplestore_flush from the original patch: it delays the producer right before it publishes the tuplestore, so a consumer that fails to wait (e.g. because it was not marked cross-slice) yields a stable wrong result instead of a flaky one. The pax_storage copy of shared_scan is intentionally left untouched, consistent with how the previous shared_scan addition was handled.
Alena0704
added a commit
to Alena0704/cloudberry
that referenced
this pull request
Aug 25, 2026
Port of Greengage PR apache#342 / open-gpdb PR apache#396 ("Fix cross-slice interaction detection for subplans") to Cloudberry. The code part of the original fix is not needed here. In GPDB 6 the shareinput walkers processed glob->subplans separately from the main plan tree, so the motion stack contained only the default motion id (0) and a Shared Scan consumer inside a SubPlan was never marked as cross-slice. Cloudberry (GPDB 7 based) already tracks the slice of every SubPlan reference point: the planner records it in glob->subplan_sliceIds (build_slice_table_walker dives into SubPlans in place), ORCA records it in CContextDXLToPlStmt::AddSubplan, and apply_shareinput_xslice pushes that slice id onto the motion stack before walking each subplan. The executor-side ExecSliceDependencyNode change does not apply either: cross-slice Shared Scan synchronization was rewritten to use shared-memory IPC in nodeShareInputScan.c. Likewise, glob->subroots stays aligned with glob->subplans when subplans are duplicated (adjust_appendrel_attrs_mutator), so the fixup_subplan_walker change has no counterpart. Verified on a demo cluster: both scenarios from the original patch produce the same plan shape (Shared Scan consumer under a SubPlan in a different slice than the producer), are correctly marked cross-slice and return correct results under both planners. What is ported is the regression coverage, to guard against future regressions in this area: - both test queries from the original patch (planner and ORCA answer files), with tables renamed to xslice_t1/xslice_t2 to avoid clashing with t1/t2 already created by this test; - a new fault injection point shareinput_writer_pre_freeze, the Cloudberry analog of material_pre_tuplestore_flush from the original patch: it delays the producer right before it publishes the tuplestore, so a consumer that fails to wait (e.g. because it was not marked cross-slice) yields a stable wrong result instead of a flaky one. The pax_storage copy of shared_scan is intentionally left untouched, consistent with how the previous shared_scan addition was handled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #ISSUE_Number
Change logs
CBDB already support pushdown qual-clause. If current qual-clause have been process in access method, Then ExprState inside PlanState should reset to NULL, In this time,
ExecScanshould not exec it again.Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?
Contributor's Checklist
Here are some reminders and checklists before/when submitting your pull request, please check them:
make installcheckmake -C src/test installcheck-cbdb-parallelcloudberrydb/devteam for review and approval when your PR is ready🥳