cmu15-445 Project #3 - Query Execution

这个project的目标是在原来的基础上增加语句执行,实现执行器中的获取查询计划节点并且执行,以及实现执行器中的sequential scans,inserts,hash join, aggregations等功能。执行器使用volcano model,每一个查询计划执行器都实现Next函数,Next会返回一个元组或者返回空。

TASK #1 - CREATING A CATALOG TABLE

数据库需要维护一个内部的catalog去记录数据库的元信息,例如用用于记录数据库中有什么table以及这些table的在哪里。请添加图片描述
在task1中只需实现src/include/catalog/simple_catalog.h中的CreateTable,GetTable(const std::string &table_name), 和GetTable(table_oid_t table_oid)这三个函数,只需要查看SimpleCatalog和TableMetaData这两个类的构造函数然后传入正确的参数即可。在SimpleCatalog中通过names_来记录table name和table_oid的映射,通过tables_来记录table_oid和TableMetadata的映射,在GetTable中如果找不到对应的table则抛出std::out_of_range异常。

TASK #2 - EXECUTORS

在Task 2中将会实现sequential scans、inserts、hash joins和aggregations的executors,对于每一种算子都要实现Init函数和Next函数,其中Init函数用于初始化算法(如获取对应的表),Next每次调用都会返回一个tuple。
算子对应的实现位于以下文件:

src/include/execution/executors/seq_scan_executor.h
src/include/execution/executors/insert_executor.h
src/include/execution/executors/hash_join_executor.h
src/include/execution/executors/aggregation_executor.h

如果想要了解executors是如何在运行时被创建的,参考文件
src/include/execution/executor_factory.h中的ExecutorFactory类。每个executor都有成员ExecutorContext(src/include/execution/executor_context.h),其中维护了query的相关信息。

ExecutorFactory中的成员函数为CreateExecutor,其中CreateExecutor的声明如下:

std::uniqu
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值