The term materialized is used to indicate a sequence that results from a database query. Sequences that are the result of operations on other sequences are typically non-materialized. Some analytics operations such as append and search can only be performed on materialized sequences. The following sections illustrate the use of materialized and non-materialized sequences for different native language APIs.
C API
In the following code snippet the sequence iterator
close_iterator
manages a materialized sequence because it is extracted from a "row" of the "result set" cursorquote_cursor;
whereasmax_iterator
is the non-materialized result sequence of the grid aggregate max operation:mco_trans_h trans; mco_cursor_t quote_cursor; Quote quote; mco_seq_iterator_t close_iterator, max_iterator; MCO_RET rc; mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &trans); Quote_by_sym_index_cursor(trans, "e_cursor); for (rc = mco_cursor_first(trans, "e_cursor); rc != MCO_S_CURSOR_END; rc = mco_cursor_next(trans, "e_cursor)) { /* Get current object */ Quote_from_cursor(trans, "e_cursor, "e); /* Materialize the close iterator */ Quote_close_iterator("e, &close_iterator); /* Produce the non-materialized max sequence */ rc = mco_seq_grid_agg_max_float(&max_iterator, &close_iterator, 7); ... } rc = mco_trans_commit(trans);Python
In the following code snippet the sequence iterator
quote.close
manages a materialized sequence because it is extracted from a "row" of the "result set" Quote cursor; whereasmaxit
is the non-materialized result sequence of the grid aggregate max operation:con.startTransaction(exdb.Transaction.MCO_READ_ONLY) cursor = con.cursor("Quote", "by_sym") for quote in cursor: # Produce the non-materialized max sequence from materialized sequence quote.close maxit = quote.close.grid_agg_max(7) ... con.commit()