forked from cmu-db/peloton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AbstractNode will provide interface for Operator and eventually AbstractExpressions as well. Note there are a few road blocks before the rest of the rewriter can be changed to cleanly use abstract classes: (1) Similarly abstract OperatorExpressions. (2) We will have to find a good place to hide OpType, which is currently an enum type (cannot be abstracted) and pervades the code base. This may be solved by abstracting at the group level, but will have to look into it. (3) Need to clean up and separate interfaces between AbstractNode, OperatorNode, and Operator classes.
- Loading branch information
Showing
7 changed files
with
198 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Peloton | ||
// | ||
// abstract_node.h | ||
// | ||
// Identification: src/include/optimizer/abstract_node.h | ||
// | ||
// Copyright (c) 2015-16, Carnegie Mellon University Database Group | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "optimizer/property_set.h" | ||
#include "util/hash_util.h" | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
namespace peloton { | ||
namespace optimizer { | ||
|
||
enum class OpType { | ||
Undefined = 0, | ||
// Special match operators | ||
Leaf, | ||
// Logical ops | ||
Get, | ||
LogicalExternalFileGet, | ||
LogicalQueryDerivedGet, | ||
LogicalProjection, | ||
LogicalFilter, | ||
LogicalMarkJoin, | ||
LogicalDependentJoin, | ||
LogicalSingleJoin, | ||
InnerJoin, | ||
LeftJoin, | ||
RightJoin, | ||
OuterJoin, | ||
SemiJoin, | ||
LogicalAggregateAndGroupBy, | ||
LogicalInsert, | ||
LogicalInsertSelect, | ||
LogicalDelete, | ||
LogicalUpdate, | ||
LogicalLimit, | ||
LogicalDistinct, | ||
LogicalExportExternalFile, | ||
// Separate between logical and physical ops | ||
LogicalPhysicalDelimiter, | ||
// Physical ops | ||
DummyScan, /* Dummy Physical Op for SELECT without FROM*/ | ||
SeqScan, | ||
IndexScan, | ||
ExternalFileScan, | ||
QueryDerivedScan, | ||
OrderBy, | ||
PhysicalLimit, | ||
Distinct, | ||
InnerNLJoin, | ||
LeftNLJoin, | ||
RightNLJoin, | ||
OuterNLJoin, | ||
InnerHashJoin, | ||
LeftHashJoin, | ||
RightHashJoin, | ||
OuterHashJoin, | ||
Insert, | ||
InsertSelect, | ||
Delete, | ||
Update, | ||
Aggregate, | ||
HashGroupBy, | ||
SortGroupBy, | ||
ExportExternalFile, | ||
}; | ||
|
||
//===--------------------------------------------------------------------===// | ||
// Abstract Node | ||
//===--------------------------------------------------------------------===// | ||
//TODO(ncx): dependence on OperatorVisitor | ||
class OperatorVisitor; | ||
|
||
struct AbstractNode { | ||
AbstractNode() {} | ||
|
||
~AbstractNode() {} | ||
|
||
virtual void Accept(OperatorVisitor *v) const = 0; | ||
|
||
virtual std::string GetName() const = 0; | ||
|
||
// TODO(ncx): problematic dependence on OpType | ||
virtual OpType GetType() const = 0; | ||
|
||
virtual bool IsLogical() const = 0; | ||
|
||
virtual bool IsPhysical() const = 0; | ||
|
||
virtual hash_t Hash() const { | ||
OpType t = GetType(); | ||
return HashUtil::Hash(&t); | ||
} | ||
|
||
virtual bool operator==(const AbstractNode &r) { | ||
return GetType() == r.GetType(); | ||
} | ||
|
||
virtual bool IsDefined() const { return node != nullptr; } | ||
|
||
private: | ||
std::shared_ptr<AbstractNode> node; | ||
}; | ||
|
||
} // namespace optimizer | ||
} // namespace peloton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.