yjhjstz commented on code in PR #1311:
URL: https://github.com/apache/cloudberry/pull/1311#discussion_r2334061443
##########
src/backend/optimizer/path/allpaths.c:
##########
@@ -1839,8 +1839,38 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo
*rel,
* estimate.
*/
partial_rows = appendpath->path.rows;
- /* Add the path if subpath has not Motion.*/
- if (appendpath->path.parallel_safe &&
appendpath->path.motionHazard == false)
+
+ if (enable_parallel_append)
+ {
+ /* Add the path if subpath didn't encounter
motion hazard.*/
+ if (appendpath->path.parallel_safe &&
(appendpath->path.motionHazard == false))
+ add_partial_path(rel, (Path
*)appendpath);
+ else
+ {
+ /*
+ * CBDB_PARALLEL:
+ * When a parallel-aware Append is
dropped due to motion hazard,
+ * we attempt a second pass using
parallel-oblivious Append.
+ *
+ * This approach is feasible in CBDB
because:
+ * 1. All Motions in a parallel plan
handle tuples individually
+ * 2. Parallel Append might miss
executing slices containing Motions,
+ * whereas regular Append does not
have this problem
+ *
+ * This behavior is conceptually
similar to UPSTREAM's Append node
+ * with partial paths implementation.
+ */
+ appendpath = create_append_path(root,
rel, NIL, partial_subpaths,
+
NIL, NULL, parallel_workers,
+
false /*enable_parallel_append*/,
+
-1);
+ partial_rows = appendpath->path.rows;
Review Comment:
why update partial_rows again ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]