MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
#include <hash_group_by_physical_operator.h>
Public 成员函数 | |
HashGroupByPhysicalOperator (vector< unique_ptr< Expression > > &&group_by_exprs, vector< Expression * > &&expressions) | |
PhysicalOperatorType | type () const override |
OpType | get_op_type () const override |
RC | open (Trx *trx) override |
RC | next () override |
RC | close () override |
Tuple * | current_tuple () override |
![]() | |
GroupByPhysicalOperator (vector< Expression * > &&expressions) | |
![]() | |
virtual string | name () const |
virtual string | param () const |
bool | is_physical () const override |
bool | is_logical () const override |
virtual PhysicalOperatorType | type () const =0 |
virtual RC | open (Trx *trx)=0 |
virtual RC | next () |
virtual RC | next (Chunk &chunk) |
virtual RC | close ()=0 |
virtual Tuple * | current_tuple () |
virtual RC | tuple_schema (TupleSchema &schema) const |
void | add_child (unique_ptr< PhysicalOperator > oper) |
vector< unique_ptr< PhysicalOperator > > & | children () |
![]() | |
virtual OpType | get_op_type () const |
virtual bool | is_physical () const =0 |
virtual bool | is_logical () const =0 |
virtual uint64_t | hash () const |
virtual bool | operator== (const OperatorNode &other) const |
virtual unique_ptr< LogicalProperty > | find_log_prop (const vector< LogicalProperty * > &log_props) |
Generate the logical property of the operator node using the input logical properties. 更多... | |
virtual double | calculate_cost (LogicalProperty *prop, const vector< LogicalProperty * > &child_log_props, CostModel *cm) |
Calculates the cost of a logical operation. 更多... | |
void | add_general_child (OperatorNode *child) |
vector< OperatorNode * > & | get_general_children () |
Private 类型 | |
using | AggregatorList = GroupByPhysicalOperator::AggregatorList |
using | GroupValueType = GroupByPhysicalOperator::GroupValueType |
using | GroupType = tuple< ValueListTuple, GroupValueType > |
聚合出来的一组数据 | |
Private 成员函数 | |
RC | find_group (const Tuple &child_tuple, GroupType *&found_group) |
Private 属性 | |
vector< unique_ptr< Expression > > | group_by_exprs_ |
vector< GroupType > | groups_ |
一组一条数据 pair的first是group by 的值列表,second是计算出来的表达式值列表 TODO 改成hash/unordered_map | |
vector< GroupType >::iterator | current_group_ |
bool | first_emited_ = false |
额外继承的成员函数 | |
![]() | |
using | AggregatorList = vector< unique_ptr< Aggregator > > |
using | GroupValueType = tuple< AggregatorList, CompositeTuple > |
聚合出来的一组数据 更多... | |
![]() | |
void | create_aggregator_list (AggregatorList &aggregator_list) |
RC | aggregate (AggregatorList &aggregator_list, const Tuple &tuple) |
聚合一条记录 更多... | |
RC | evaluate (GroupValueType &group_value) |
所有tuple聚合结束后,运算最终结果 | |
![]() | |
vector< Expression * > | aggregate_expressions_ |
vector< Expression * > | value_expressions_ |
聚合表达式 | |
![]() | |
vector< unique_ptr< PhysicalOperator > > | children_ |
![]() | |
vector< OperatorNode * > | general_children_ |
Group By Hash 方式物理算子
通过 hash 的方式进行 group by 操作。当聚合函数存在 group by 表达式时,默认采用这个物理算子(当前也只有这个物理算子)。 NOTE: 当前并没有使用hash方式实现,而是每次使用线性查找的方式。
|
overridevirtual |
实现了 PhysicalOperator.
|
overridevirtual |
重载 PhysicalOperator .
|
inlineoverridevirtual |
TODO: add this function TODO: unify logical and physical OpType
重载 OperatorNode .
|
overridevirtual |
重载 PhysicalOperator .
|
overridevirtual |
实现了 PhysicalOperator.
|
inlineoverridevirtual |
实现了 PhysicalOperator.