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
doublevalue except for mco_seq_agg_count() which returns auint8value and the two functionsmco_seq_agg_approxdc()andmco_seq_agg_approxdc_hash()which returnuint4values.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:
Count of all elements.mco_seq_agg_count_not_null()Count of non-NULL elements, returned as oneuint8result; an empty or all-NULL input returns zero.Maximum element value.Minimum element value.Both maximum and minimum element value.Sum of all elements.Product of all elements.Average of all elements.Variance of elements.Sample Variance of elements.Standard Deviation of elements.Sample Standard Deviation of elements.Approximate count of distinct values.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_h quote_cursor; Quote quote; mco_seq_iterator_h 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); ... } ... }