3

2022-38: Iteration 22 汇报

 1 year ago
source link: https://xuanwo.io/reports/2022-38/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

2022-38: Iteration 22 汇报

Iteration 22 从 9/12 开始到 9/25 结束,为期两周。这个周期我的主要工作是删代码:

github.png

经过了几个版本的迭代之后,Databend 已经完成了 New Executor,New Planner 的重构,目前正在进行 New Expression。伴随着对 JOIN 的正式支持等新特性的增加,Databend 的代码库也出现了比较严重的腐化现象:陈旧的代码散落在项目的各个角落,不少新的功能实现还在依赖已经被弃用的逻辑。我从清理 Old Planner 入手开始尝试缓解这个问题:最开始的计划只是想奋斗三天,删除掉对 sqlparser-rs 的依赖,但是最后发现 Databend 对它的依赖如此深入以至于这变成了跨越数个迭代周期的大型工作。

很久之前我在 Databend 中加入了 See you again: refactor: Dedicate See you again to the old planner,通过在旧的 DfStatement 中引入一个 Dummy Statement SeeYouAgain,将绝大部分操作都直接转发给了 New Planner。现在我发起了新的项目: refactor: Old Planner Never See Again (Part 1)。这个项目旨在彻底删除掉 Old Planner,将过时的代码完全清理掉。执行到 Part 2 的时候我发现事情并不简单,很多复杂的问题被交织在一起,过去因为同在一个 crate 中没有暴露出来的复杂依赖关系一下子都暴露了出来。为了能够顺利的删除掉旧代码,我被迫做了很多铺垫工作:

在完成了上述这些工作之后,我删除 sqlparser-rs 的工作才完成了将将一半,接下来我还会需要:

  • 调整 Table API,让它不再依赖任何 Plan,使得 catalog crate 不需要依赖 planner (因为 planner 依赖了 catalog)
  • 调整 Fuse Table 的时候,在根据 Scalar 构建 Expression,而不是由 Binder 来进行构建
  • 调整 TableScan PhysicalPlan,让他不再依赖 ReadDataSourcePlan
  • 调整 ReadDataSourcePlan,让他不再依赖 Expression

希望下个周期能完成这些工作,跟 Old Planner 正式说再见~



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK