Grand Aggregate C Sequence Functions
All Grand Aggregate C functions take a single input sequence and produce a result sequence. The result of all Grand Aggregate functions is returned in the first element of the result sequence as a
double
value except for mco_seq_agg_count() which returns auint8
value and the two functionsmco_seq_agg_approxdc()
andmco_seq_agg_approxdc_hash()
which returnuint4
values.The function signatures are of the following form:
MCO_RET mco_seq_agg_operation(mco_seq_iterator_h result, mco_seq_iterator_h input);or
MCO_RET mco_seq_agg_operation_TYPE(mco_seq_iterator_h result, mco_seq_iterator_h input);where TYPE is one of the types listed in the Analytics Functions page and operation is one of the following. Please use the links below to view descriptions and examples of the individual functions:
mco_seq_agg_count() Count of all elements mco_seq_agg_max_TYPE() Maximum element value mco_seq_agg_min_TYPE() Minimum element value mco_seq_agg_min_max_TYPE() Both maximum and minimum element value mco_seq_agg_sum_TYPE() Sum of all elements mco_seq_agg_prd_TYPE() Product of all elements mco_seq_agg_avg_TYPE() Average of all elements mco_seq_agg_var_TYPE() Variance of elements mco_seq_agg_var_samp_TYPE() Sample Variance of elements mco_seq_agg_dev_TYPE() Standard Deviation of elements mco_seq_agg_dev_samp_TYPE() Sample Standard Deviation of elements mco_seq_agg_approxdc() Approximate count of distinct values mco_seq_agg_approxdc_hash() Approximate count of distinct values for multiple sequences Example
Following is an example code snippet demonstrating a grand aggregate function:
{ mco_trans_h trans; mco_cursor_t quote_cursor; Quote quote; mco_seq_iterator_t close_iterator, max_iterator; MCO_RET rc; ... for (rc = mco_cursor_first(trans, "e_cursor); rc != MCO_S_CURSOR_END; rc = mco_cursor_next(trans, "e_cursor)) { Quote_from_cursor(trans, "e_cursor, "e); Quote_close_iterator("e, &close_iterator); ... rc = mco_seq_agg_max_float(&max_iterator, &close_iterator); ... } ... }