[Bug] Correct classification of plan nodes

未关闭
#2,268 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, postgresql
领域
backend, databases

调研方向

Read is_plan_node in src/backend/cdb/cdbllize.c and inspect the node definitions in plannodes.h that determine the T_Plan_Start..T_Plan_End range. Check whether the range and the listed exceptions classify plan nodes correctly, then add or update focused tests for serialization classification. Done means non-plan nodes are excluded and actual plan nodes are recognized.

由索引模型根据 Issue 内容生成。

描述

type: Bug
Apache Cloudberry version

main

What happened

Some nodes that are not plan nodes have been incorrectly categorized as plan nodes, while some actual plan nodes have failed to be classified as such. We need to categorize these nodes correctly; otherwise, it could lead to issues regarding the correctness of serialization. What follows may not be exhaustive.

diff --git a/src/backend/cdb/cdbllize.c b/src/backend/cdb/cdbllize.c
index 31749f0305b..b4bdf5bf863 100644
--- a/src/backend/cdb/cdbllize.c
+++ b/src/backend/cdb/cdbllize.c
@@ -1430,6 +1430,24 @@ is_plan_node(Node *node)
 	if (node == NULL)
 		return false;
 
+	/*
+	 * Node tags are generated in the order the structs appear in
+	 * plannodes.h, so the T_Plan_Start..T_Plan_End range is not exact:
+	 * NestLoopParam and ExternalScanInfo are defined among the plan nodes
+	 * but are not Plans, and PartitionSelector is defined after
+	 * PlanRowMark but is one.
+	 */
+	switch (nodeTag(node))
+	{
+		case T_NestLoopParam:
+		case T_ExternalScanInfo:
+			return false;
+		case T_PartitionSelector:
+			return true;
+		default:
+			break;
+	}
+
 	if (nodeTag(node) >= T_Plan_Start && nodeTag(node) < T_Plan_End)
 		return true;
 	return false;
What you think should happen instead

No response

How to reproduce

Cannot be exhaustively listed

Operating System

NAME="Rocky Linux" VERSION="9.5 (Blue Onyx)"

Anything else

No response

Are you willing to submit PR?
  • Yes, I am willing to submit a PR!
Code of Conduct
主要语言
C
星标
1.4k
派生
273
平均合并
4 天 6 小时
30 天内合并 PR
105

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudberry 的其他 Issue

查看 apache/cloudberry 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。