[Monetdb-developers] Why has a BAT no more the same order after a bat.delete(...)
Hello, I'm developing in MAL accessing commands and functions from C++ over the MAPI-library. My task is to delete some BUNs from a BAT. The problem: The BAT with some deleted BUNs has a different order than before. I do it the following way: c:bat[:oid,:int] := bbp.bind("joe"); slice:bat[:oid,:int] := algebra.slice(c,4,6); bat.delete(c,slice); The original BAT "joe": #-----------------# # h t # name # oid int # type #-----------------# [ 0@0, -1 ] [ 1@0, 2 ] [ 2@0, 3 ] [ 3@0, -1 ] [ 4@0, -2 ] <- to be deleted [ 5@0, 5 ] <- to be deleted [ 6@0, -2 ] <- to be deleted After delete: The original BAT "joe": #-----------------# # h t # name # oid int # type #-----------------# [ 3@0, -1 ] <- not in right order, why? [ 0@0, -1 ] [ 1@0, 2 ] [ 2@0, 3 ] Why is this so and how can I prevent MonetDB to change the order, while deleting BUNs. The order is important, because I'd like to work with position and slices to read my BUNs. Thanks for helping!
On Tue, Jul 01, 2008 at 05:44:56PM +0200, Simon Berther wrote:
Hello, I'm developing in MAL accessing commands and functions from C++ over the MAPI-library. My task is to delete some BUNs from a BAT. The problem: The BAT with some deleted BUNs has a different order than before. I do it the following way: c:bat[:oid,:int] := bbp.bind("joe"); slice:bat[:oid,:int] := algebra.slice(c,4,6); bat.delete(c,slice); The original BAT "joe": #-----------------# # h t # name # oid int # type #-----------------# [ 0@0, -1 ] [ 1@0, 2 ] [ 2@0, 3 ] [ 3@0, -1 ] [ 4@0, -2 ] <- to be deleted [ 5@0, 5 ] <- to be deleted [ 6@0, -2 ] <- to be deleted After delete: The original BAT "joe": #-----------------# # h t # name # oid int # type #-----------------# [ 3@0, -1 ] <- not in right order, why? [ 0@0, -1 ] [ 1@0, 2 ] [ 2@0, 3 ] Why is this so and how can I prevent MonetDB to change the order, while deleting BUNs. Thats is indeed and correct. We simply move the deleted values into the delta part (ie the area before the first valid value), this is needed for transactions. The order is important, because I'd like to work with position and slices to read my BUNs. Ie you want 'void' head bats. Then you can never 'really' delete a value. But instead write a nil value into it (using bat.replace(b, h, t, true). Or keep an extra bat with the deleted oids.
Niels
Thanks for helping!
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
participants (2)
-
Niels Nes
-
Simon Berther