Turi Create  4.0
turi::group_aggregate_value Class Referenceabstract

#include <core/storage/sframe_data/group_aggregate_value.hpp>

Public Member Functions

virtual group_aggregate_valuenew_instance () const =0
 
virtual void add_element (const std::vector< flexible_type > &values)
 
virtual void add_element_simple (const flexible_type &flex)=0
 
virtual void partial_finalize ()
 
virtual void combine (const group_aggregate_value &other)=0
 
virtual flexible_type emit () const =0
 
virtual bool support_type (flex_type_enum type) const =0
 
virtual flex_type_enum set_input_types (const std::vector< flex_type_enum > &types)
 
virtual std::string name () const =0
 
virtual void save (oarchive &oarc) const =0
 
virtual void load (iarchive &iarc)=0
 
virtual ~group_aggregate_value ()
 
virtual void print (std::ostream &os) const
 

Detailed Description

The base class specification for representing the intermediate state as well as the computation (aggregation, combining and output) for an aggregation operation.

Essentially, the group_aggregate_value must describe a parallel reduction in the following form:

for streamid in data_stream:
for data in stream[streamid]:
value[streamid].add_element(data)
value[streamid].partial_finalize()
for streamid in data_stream:
final_value.combine(value[streamid])
output = final_value.emit()

Each value could have an arbitrary number of elements inserted into it. When all insertions are complete, partial_finalize() is called on the value. Values can be combined with each other to form a final value, which then emits a response.

Definition at line 45 of file group_aggregate_value.hpp.

Constructor & Destructor Documentation

◆ ~group_aggregate_value()

virtual turi::group_aggregate_value::~group_aggregate_value ( )
inlinevirtual

Destruction

Definition at line 125 of file group_aggregate_value.hpp.

Member Function Documentation

◆ add_element()

virtual void turi::group_aggregate_value::add_element ( const std::vector< flexible_type > &  values)
inlinevirtual

Adds an element to the aggregate. Elements to be added will be either the input_type (as set by set_input_type()) or UNDEFINED.

Operator that expects more than one input values need to overwrite this function

Reimplemented in turi::groupby_operators::zip_dict, turi::groupby_operators::argmax, and turi::groupby_operators::argmin.

Definition at line 60 of file group_aggregate_value.hpp.

◆ add_element_simple()

◆ combine()

◆ emit()

◆ load()

◆ name()

◆ new_instance()

◆ partial_finalize()

virtual void turi::group_aggregate_value::partial_finalize ( )
inlinevirtual

No more elements will be added to this value. However, this value may still be combined with other values.

Reimplemented in turi::groupby_operators::quantile.

Definition at line 75 of file group_aggregate_value.hpp.

◆ print()

virtual void turi::group_aggregate_value::print ( std::ostream &  os) const
inlinevirtual

Override this function for allowing the operator to be easily printed.

std::cout << aggregator <<s std::endl;

Reimplemented in turi::groupby_operators::variance.

Definition at line 134 of file group_aggregate_value.hpp.

◆ save()

◆ set_input_types()

virtual flex_type_enum turi::group_aggregate_value::set_input_types ( const std::vector< flex_type_enum > &  types)
inlinevirtual

Sets the input types and returns the output type. For instance, a sum aggregator when summing integers will return an integer, and when summing doubles will return doubles.

Default implementation assumes there is ony one input, and output type is the same as input type.

Reimplemented in turi::groupby_operators::zip_list, turi::groupby_operators::zip_dict, turi::groupby_operators::non_null_count, turi::groupby_operators::count, turi::groupby_operators::argmax, and turi::groupby_operators::argmin.

Definition at line 102 of file group_aggregate_value.hpp.

◆ support_type()


The documentation for this class was generated from the following file: