[Monetdb-developers] what should happen when appending to a nil bat?

Arjen P. de Vries Arjen.de.Vries at cwi.nl
Wed Dec 21 21:31:43 CET 2005


Note that the void type has more hidden semantics that are not yet
mentioned in behaviours 1 and 2...

Some people use/have used insert(nil) meaning to say insert(lastoid++) -
For example:

MonetDB>var a := new(oid,void);
MonetDB>a.insert(oid(0),nil);
MonetDB>a.print();
#-----------------#
# h     t         # name
# oid   void      # type
#-----------------#
[ 0 at 0,    nil     ]
MonetDB>a.reverse().seqbase(oid(0));
MonetDB>a.print();
#-----------------#
# h     t         # name
# oid   void      # type
#-----------------#
[ 0 at 0,    0 at 0     ]
MonetDB>a.insert(oid(1),nil);
MonetDB>a.print();
#-----------------#
# h     t         # name
# oid   void      # type
#-----------------#
[ 0 at 0,    0 at 0     ]
[ 1 at 0,    1 at 0     ]

Note that this latter result is inconsistent with the decision for option 2!!
(while it is consistent with that of option 1 - seqbase is nil!)

| Note that this solution also means that when you insert a non-nil value
| into a nil column, the column should get materialized as well (this is
| currently not the case):

BTW, in principle nil-values could be represented in other ways to avoid
materialisation - e.g., a bit-vector, or a list of all nil-values;
this may be interesting alternatives when columns contain only a small
number of nil values (though affecting all current operators of course).

Arjen

| 
| mil>var a := new(oid,void).insert(0 at 0,nil);
| mil>a.print();
| #-----------------#
| # h     t         # name
| # oid   void      # type
| #-----------------#
| [ 0 at 0,    nil     ]
| mil>a.insert(1 at 0,1 at 0);
| mil>a.print();
| #-----------------#
| # h     t         # name
| # oid   oid       # type
| #-----------------#
| [ 0 at 0,    nil     ]
| [ 1 at 0,    1 at 0     ]




More information about the developers-list mailing list