MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
Public 成员函数 | Protected 类型 | Protected 成员函数 | Protected 属性 | 所有成员列表
GroupByPhysicalOperator类 参考

Group By 物理算子基类 更多...

#include <group_by_physical_operator.h>

类 GroupByPhysicalOperator 继承关系图:
PhysicalOperator OperatorNode HashGroupByPhysicalOperator ScalarGroupByPhysicalOperator

Public 成员函数

 GroupByPhysicalOperator (vector< Expression * > &&expressions)
 
- Public 成员函数 继承自 PhysicalOperator
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 Tuplecurrent_tuple ()
 
virtual RC tuple_schema (TupleSchema &schema) const
 
void add_child (unique_ptr< PhysicalOperator > oper)
 
vector< unique_ptr< PhysicalOperator > > & children ()
 
- Public 成员函数 继承自 OperatorNode
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< LogicalPropertyfind_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 ()
 

Protected 类型

using AggregatorList = vector< unique_ptr< Aggregator > >
 
using GroupValueType = tuple< AggregatorList, CompositeTuple >
 聚合出来的一组数据 更多...
 

Protected 成员函数

void create_aggregator_list (AggregatorList &aggregator_list)
 
RC aggregate (AggregatorList &aggregator_list, const Tuple &tuple)
 聚合一条记录 更多...
 
RC evaluate (GroupValueType &group_value)
 所有tuple聚合结束后,运算最终结果
 

Protected 属性

vector< Expression * > aggregate_expressions_
 
vector< Expression * > value_expressions_
 聚合表达式
 
- Protected 属性 继承自 PhysicalOperator
vector< unique_ptr< PhysicalOperator > > children_
 
- Protected 属性 继承自 OperatorNode
vector< OperatorNode * > general_children_
 

详细描述

Group By 物理算子基类

成员类型定义说明

◆ GroupValueType

using GroupByPhysicalOperator::GroupValueType = tuple<AggregatorList, CompositeTuple>
protected

聚合出来的一组数据

第一个参数是聚合函数列表,比如需要计算 sum(a), avg(b), count(c)。 第二个参数是聚合的最终结果,它也包含两个元素,第一个是缓存下来的元组,第二个是聚合函数计算的结果。 第二个参数中,之所以要缓存下来一个元组,是要解决这个问题: select a, b, sum(a) from t group by a; 我们需要知道b的值是什么,虽然它不确定。

成员函数说明

◆ aggregate()

RC GroupByPhysicalOperator::aggregate ( AggregatorList &  aggregator_list,
const Tuple tuple 
)
protected

聚合一条记录

参数
aggregator_list需要执行聚合运算的列表
tuple执行聚合运算的一条记录

该类的文档由以下文件生成: