The C
mco_seq_agg_max_TYPE()
,mco_seq_agg_min_TYPE()
andmco_seq_agg_min_max_TYPE()
functions extract the maximum and minimum values for the input sequence.Example
Following is an example code snippet demonstrating these functions:
void grand_aggregate(mco_db_h db) { mco_trans_h trans; mco_cursor_t quote_cursor; Quote quote; mco_seq_iterator_t close_iterator, max_iterator, min_iterator, max_min_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); /* Initialize iterators */ Quote_close_iterator("e, &close_iterator)); /* Construct operator's pipeline */ mco_seq_agg_max_float(&max_iterator, &close_iterator); mco_seq_agg_min_float(&min_iterator, &close_iterator); // Get min and max in a single call mco_seq_agg_min__max_float(&max_min_iterator, &close_iterator); ... } }