Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Porting Logical Operators

Andy Pavlo edited this page May 22, 2019 · 1 revision

This is originally from PR #232.

Bring over logical and physical operators from Peloton. These objects are direct inputs to the optimizer. These objects are constructed by the binder from parser expressions.

Part I: Individual Operators

The original operators are in:

The physical operators have been ported over already. The ones that remain are some logical operators. They are:

  • LogicalFilter
  • LogicalProjection
  • LogicalDependentJoin
  • LogicalMarkJoin
  • LogicalSingleJoin
  • LogicalInnerJoin
  • LogicalLeftJoin
  • LogicalRightJoin
  • LogicalOuterJoin
  • LogicalSemiJoin
  • LogicalAggregateAndGroupBy
  • LogicalInsertSelect
  • LogicalInsert
  • LogicalMarkJoin
  • LogicalDependentJoin
  • LogicalSIngleJoin
  • LogicalInnerJoin
  • LogicalLeftJoin
  • LogicalRightJoin
  • LogicalOuterJoin
  • LogicalSemiJoin
  • LogicalAggregateAndGroupBy
  • LogicalInsert
  • LogicalInsertSelect
  • LogicalDelete
  • LogicalUpdate
  • LogicalLimit
  • LogicalDistinct
  • LogicalExportExternalFile

Clone my repository git clone git@github.com:wenxuanqiu/terrier.git Then modify only src/include/operators.h and src/include/operators.cpp. Find the operator you want to work on, then do the following:

  1. Copy the corresponding Peloton operator over. Currently, all the operators that Peloton had are in src/include/operator.h, but not src/include/operator.cpp.
  2. Make it compile by changing a number of things:
    • expression::AbstractExpression -> parser::AbstractionExpression
    • hash_t -> common::hash_t
    • string reference to value std::string & -> std::string then use std::move in constructor definition (operator.cpp)
    • replace std::shared_ptr<catalog::TableCatalogEntry> target_table with catalog::db_oid_t database_oid, catalog::namespace_oid_t namespace_oid, catalog::table_oid_t table_oid
    • vector reference to lvalue: std::vector<std::shared_ptr<expression::AbstractExpression>> &columns -> std::vector<std::shared_ptr<parser::AbstractExpression>> &&columns then use std::move in constructor definition (operator.cpp)
    • other case by case changes
  3. Make the class members private and append '_' suffix to indicate that
  4. Add oxygen comments
  5. Implement the constructor, Hash, and operator in operators.cpp. Some examples are in the file.
  6. Fix remaining clang-tidy problems that show up due to check clang-tidy
  7. Commit the change

Part II: DDL Operators

We need DDL statements such as CREATE and DROP to have operators as well. So we need to create them, some of them might have logical and physical versions. For example, LogicalCreateIndex vs. CreateBwTreeIndex, CreateHashIndex, CreateAVLIndex. These operators must have the same interface as the existing operators.