englefly commented on PR #67549: URL: https://github.com/apache/doris/pull/67549#issuecomment-6142721175
第二个批次:commit af446bd7f39 —— **用"选中计划的那个 expression"来描述 group**。 **问题**:之前固定用 `group.getFirstLogicalExpression()`,而 memo 里一个 group 有多个 alternative,第一个往往不是最终执行的那个。后果有两个:① 某个节点可能因为**未被选中的 alternative** 无法描述而丢掉指纹(实测:`order by x.a limit 10`,TopN 下推形态落在 join 的 group 里,导致这个本身完全可描述的 join 只剩 JE 行);② EXPLAIN 打印/用户复制的 `struct=` 可能描述的是**不执行的那棵子树**(记录的 scan 基线可能不是查询真正读的那份)。 **改法**: - 描述时优先用 `Group.getChosenGroupExpression()`(由 `chosenGroupExpressionId` 支撑,enforcer 本来就走单独的列表,天然不受影响),选择尚未发生(读侧在挑最优计划之前查表)时回退到第一个 logical expression;选择发生时会**丢弃**之前基于 logical expression 建好的描述,保证 EXPLAIN 与注入始终描述真正执行的那棵计划。 - 为了能跟着**物理** expression 走,`appendPlan` 与 join 链的分派改成对着 algebra 接口(`OlapScan`/`Filter`/`Project`/`Sort`/`Window`/`Join`/`Aggregate`,逻辑与物理算子都实现它们)而不是 `Logical*` 类;`HboScanDescriptor.of` 同样接受 `OlapScan`。宽度门限的 summary 也跟着同一个 expression,避免"门限按 A 数、描述按 B 走"。 **验证**:FE 编译通过、`GroupStructInfoCompositionTest` 4/4 通过。**注解逐字节对比与 `query_p0/hbo` 套件这一轮仍未跑成**——本机 BE 心跳停了(`show backends` 里 `Alive=false`,进程还在),建不了表就没法 plan。BE 恢复后要确认的两点:① `... order by x.a limit 10` 的 join 恢复 `type=exact` 行;② CTE 双消费者仍为 `unsupported=PhysicalCTEConsumer`(CTE 支持属于下一个批次)。 一并提一句这一批**未做**、但已确认设计的部分:允许重复访问 group(含"重复必须两侧一致"这个前提)、链信息记忆化(被上一项解锁)、身份模式的字面量编码(limit/topn、Generate 参数、set-op 比较列)、`Repeat` 按多 group key 支持,以及 J/A key 的常量敏感性。 -- 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]
