Mercurial > hg > MonetDB-extend
changeset 13:a3465119dc5b
Updated comments for (not so) new MonetDB.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Thu, 07 Dec 2017 16:46:57 +0100 (2017-12-07) |
parents | 99b60d4e57ba |
children | 5a5167adae4a |
files | reverse/README.rst |
diffstat | 1 files changed, 12 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/reverse/README.rst Thu Dec 07 16:40:52 2017 +0100 +++ b/reverse/README.rst Thu Dec 07 16:46:57 2017 +0100 @@ -239,24 +239,19 @@ know that the size of the BAT will be the same as the input BAT. Hence we can use this code:: - bn = BATnew(TYPE_void, TYPE_str, BATcount(b), TRANSIENT); + bn = COLnew(b->hseqbase, TYPE_str, BATcount(b), TRANSIENT); -The arguments of ``BATnew`` are the types of the *head* and *tail* -columns, the initial size of the to-be-allocated BAT, and -``TRANSIENT`` to indicate that this BAT is temporary. ``BATnew`` -guarantees that there is space for at least the specified number of -elements, or it returns ``NULL``. Since we call ``BUNappend`` to add -entries to the BAT, we're actually not concerned about the size of the -new BAT (``BUNappend`` takes care of resizing if necessary), but from -an efficiency point of view, it's better to create the BAT with the -required size (growing a BAT can be expensive). Note that the type of -the *head* column must always be ``TYPE_void`` (this argument will -likely be removed in a future version of MonetDB). - -We then set the sequence base for the head column of the new BAT to be -the same as that of the input BAT:: - - BATseqbase(bn, b->hseqbase); +The arguments of ``COLnew`` are the seqbase for the *head* and the +type of the *tail* columns, the initial size of the to-be-allocated +BAT, and ``TRANSIENT`` to indicate that this BAT is temporary. +``COLnew`` guarantees that there is space for at least the specified +number of elements, or it returns ``NULL``. Since we call +``BUNappend`` to add entries to the BAT, we're actually not concerned +about the size of the new BAT (``BUNappend`` takes care of resizing if +necessary), but from an efficiency point of view, it's better to +create the BAT with the required size (growing a BAT can be +expensive). We set the sequence base for the head column of the new +BAT to be the same as that of the input BAT. Iterating through the source BAT is done using a standard mechanism::