englefly commented on PR #67549: URL: https://github.com/apache/doris/pull/67549#issuecomment-6163941868
按你的结论修了 **1 和 2**(commit 见下),并已实测验证。 **根因**:`copyStatsAndGroupIdFrom` 把 group id 写进节点的 **`MutableState`(KEY_GROUP)**,而 `resetLogicalProperties()` 是"用构造函数重建一个节点"——它传了 `groupExpression` / `physicalProperties` / `statistics`,**没有传 mutable states**,所以刚复制进去的 id 被丢弃;`LazySlotPruning` 又把 copy 放在 reset **之前**,等于自己把结果扔掉。最终节点两条通道全空 ⇒ `resolveGroup` 返回 null ⇒ `no group for PhysicalHashJoin`(且没有 id 后缀,因为状态是"不存在")。 **修改** 1. **顺序**:`LazySlotPruning` 三处改为 `resetLogicalProperties()` 之后(最后一步)再 `copyStatsAndGroupIdFrom(...)`。 2. **机制**:新增 `AbstractTreeNode.copyMutableStatesFrom` 与 `AbstractPlan.rebuildKeepingStates`;**26 个节点的 `resetLogicalProperties()` 全部改为经它返回**,重建时同时保住 mutable states(groupId)与 stats/physical properties。states 是不可变持有(`set` 返回新对象),所以引用共享安全、不会互相串写。 3. 附带把我自己诊断函数里的隐患修掉:不可解析的 group id 不再抛 `NumberFormatException`,而是打印 `no group for X (group id '' is unknown)`。 **验证(本机集群,BE 已换到新端口)** - 原来失败的形状已修复:`select * from hbo_sg_t1 x join hbo_sg_t2 y on x.a=y.a order by x.a limit 10` → `[83] join type=exact literal_mode=no_literal fingerprint='9eeae21f…'`,**与不带 top-n 的同一 join 指纹完全一致** ✓。 - 单测:`GroupStructInfoCompositionTest` 7/7、**`LazyMaterializeTopNTest` 1/1**、**`LazySlotPruningTest` 1/1** ✓(后两个正是被改动的代码)。 - `query_p0/hbo`:**19 套件 / 8 失败**,8 个全是既有 legacy 配置问题,0 个 backend 相关失败 —— **等于基线** ✓。 - 参考查询集的归一化注解对比:只多不少(新增 `with_literal` join 键;另有 1 个此前没有键的 aggregation 现在有了 `type=exact`)✓。 **仍未验证**:`LogicalFileScan` 的端到端(`local(...)` TVF 需要 BE 能列出文件、还要显式 `backend_id`,本机这条路报 `get file list from backend failed`);本机目录里能看到 iceberg catalog,但我没在其中找到可直接查询的表。等有可用的外表/文件源时我会补这一条。 -- 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]
