englefly commented on PR #67549:
URL: https://github.com/apache/doris/pull/67549#issuecomment-6143102837

   第三个批次:commit bcf88e726a8 —— **允许一个 group 在一次描述里被到达两次**(CTE 支持的关键一步)。
   
   - **CTE consumer / producer / anchor 对结构匹配透明**:consumer 
的描述就是它消费的那棵子树的描述,anchor 取它的 consumer 
侧;重复到达时改为**再描述一次**,而不是把整棵描述作废。这样"复用一棵子树"的计划与"把子树写两遍"的计划(例如自连接)得到同一个 
canonical/fingerprint,读侧构造的描述也一致,所以一侧记录的条目对另一侧也适用。
   - **复用的子树只读一次**:第二个引用只重复它的 canonical 文本,**不再重复收集它的 scans**。原因:drift 
守卫比的是"查询真正读到的那些表的状态",learned 条目记录的是那次运行真正读到的行数——如果为复用把同一张表记两遍,learned 守卫会拿"1 
次扫描"对"2 次扫描"比,报出并不存在的 drift。
   - 链上的重复(重复的 group 出现在 join 链位置)同样处理:作为**带 repeated 标记的叶子**参与组合。
   
   验证:编译通过、`GroupStructInfoCompositionTest` 4/4 通过。**待复验**(本机 BE 心跳停了 
`Alive=false`,建不了表):CTE 双消费者不再报 `skipped: unsupported=PhysicalCTEConsumer`,其上的 
join 应拿到 fingerprint;以及 `query_p0/hbo` 套件 + 注解逐字节对比。
   
   剩余批次(尚未实施):① 身份模式的字面量编码(不折叠)→ `limit/topn`、`Generate` 的表函数参数(含 outer 
变体)、set-op 的比较列;`Repeat` 按"多套 group key"支持(group key 常量不改变组数,现有折叠安全)、`UNION 
ALL`(分支排序)/`INTERSECT`(全排序)/`EXCEPT`(固定首孩子 + 其余排序);② 链信息记忆化(第 3 批之后 
`ctx.visited` 的阻塞已消除,链遍历可 O(n²)→O(n));③ review 里同源的 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]

Reply via email to