Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/runtime pf_support.mx, XQuery_0-24, 1.299.2.3, 1.299.2.4
On Fri, Jun 06, 2008 at 09:00:53PM +0000, Lefteris Sidirourgos wrote:
Update of /cvsroot/monetdb/pathfinder/runtime In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9671/runtime
Modified Files: Tag: XQuery_0-24 pf_support.mx Log Message: A rather aggresive fix for the order of attributes and nodes in updates.
Now we reverse in algebra the order of insert as last and insert before at runtime like the MPS. This fix the bug [1981844] PF/alg: result order differs from mps. Also it fix the test Update/update.xq (which makes unnecessary the algebra specific output). Also other failing tests of updates are fixed in tests/BugTrack.
However, now the test insert_test_order_seq fails:( However, this is a different error that should be addressed with a diffrent fix.
To be continued...
U pf_support.mx Index: pf_support.mx =================================================================== RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v retrieving revision 1.299.2.3 retrieving revision 1.299.2.4 diff -u -d -r1.299.2.3 -r1.299.2.4 --- pf_support.mx 29 May 2008 16:45:15 -0000 1.299.2.3 +++ pf_support.mx 6 Jun 2008 21:00:46 -0000 1.299.2.4 @@ -3321,9 +3321,27 @@ { var inserts := command.ord_select(UPDATE_INSERT_FIRST, UPDATE_REPLACENODE); # [i,insertcommand] if (inserts.count() > 0) { + + # UPDATE_INSERT_LAST and UPDATE_INSERT_BEFORE commands must be executed in reverse order + var order := inserts.ord_uselect(UPDATE_INSERT_LAST, UPDATE_INSERT_BEFORE).copy().mark(0@0); + if (order.count() > 1) { + pre_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_tgt).access(BAT_WRITE).revert().tmark(0@0))); + pre_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_tgt).access(BAT_WRITE).revert().tmark(0@0))); + attr_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_tgt).access(BAT_WRITE).revert().tmark(0@0))); + attr_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_tgt).access(BAT_WRITE).revert().tmark(0@0))); + pre_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_ins).access(BAT_WRITE).revert().tmark(0@0))); + pre_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_ins).access(BAT_WRITE).revert().tmark(0@0))); + attr_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_ins).access(BAT_WRITE).revert().tmark(0@0))); + attr_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_ins).access(BAT_WRITE).revert().tmark(0@0))); + inserts.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(inserts).access(BAT_WRITE).revert().tmark(0@0))); + command.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(command).access(BAT_WRITE).revert().tmark(0@0))); + }
Lefteris, thanks for the fix! I'm not completely sure, whether I understand what your above code does, or better, whether I understand how is does what *I think* it is supposed to do, i.e. revert the order of BUNs that are related to UPDATE_INSERT_LAST and UPDATE_INSERT_BEFORE commands in all BATs. However given my idea of what it is supposed to do, wouldn't the following solution look "simpler" and be more efficient? ======== var order := inserts.ord_uselect(UPDATE_INSERT_LAST, UPDATE_INSERT_BEFORE); if (order.count() > 1) { var redro := order.copy().access(BAT_WRITE).revert().access(BAT_READ); var order_redro := order.mark(0@0).leftfetchjoin(redro.tmark(0@0)); pre_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(pre_tgt) ).access(BAT_READ); pre_cont_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(pre_cont_tgt) ).access(BAT_READ); attr_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(attr_tgt) ).access(BAT_READ); attr_cont_tgt.access(BAT_WRITE).replace( order_redro.leftjoin(attr_cont_tgt) ).access(BAT_READ); pre_ins .access(BAT_WRITE).replace( order_redro.leftjoin(pre_ins) ).access(BAT_READ); pre_cont_ins .access(BAT_WRITE).replace( order_redro.leftjoin(pre_cont_ins) ).access(BAT_READ); attr_ins .access(BAT_WRITE).replace( order_redro.leftjoin(attr_ins) ).access(BAT_READ); attr_cont_ins.access(BAT_WRITE).replace( order_redro.leftjoin(attr_cont_ins) ).access(BAT_READ); inserts .access(BAT_WRITE).replace( order_redro.leftjoin(inserts) ).access(BAT_READ); command .access(BAT_WRITE).replace( order_redro.leftjoin(command) ).access(BAT_READ); } ======== ... just an idea; might be completely wrong ... let's think about anc check it tomorrow or "live" on Monday ... Good night
+ var inserts_pre_ins := inserts.mirror().leftfetchjoin(pre_ins); # [i,PRE] var inserts_elems := inserts_pre_ins.ord_uselect(oid_nil, oid_nil).hmark(0@0); # [j,i] inserts on elements var inserts_attrs := inserts_pre_ins.ord_uselect(oid_nil).hmark(0@0); # [k,i] inserts on attributes + + if (inserts_attrs.count() > 0) { do_update_insert_attributes(ws, inserts_attrs.leftjoin(pre_tgt), inserts_attrs.leftjoin(pre_cont_tgt), inserts_attrs.leftjoin(attr_ins), inserts_attrs.leftjoin(attr_cont_ins)); }
------------------------------------------------------------------------- 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-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
Hi Stefan,
thanx for your comments, I will re-check my implementation and yours
tomorrow and see if they are equivalent (I am too tired to do it
now:)). The idea is that we should revert the order of applying insert
as last and insert before to get the same results as the ones in MPS
and to be correct according to common sense (since this is
implementation specific).
Also, I just re-run the tests and it turns out that all update tests
are correct, including the one that I thought it was wrong in my
commit logs. Lets see what the night testweb has to say and I will
re-examine that issue tomorrow.
lefteris
On Sat, Jun 7, 2008 at 12:09 AM, Stefan Manegold
On Fri, Jun 06, 2008 at 09:00:53PM +0000, Lefteris Sidirourgos wrote:
Update of /cvsroot/monetdb/pathfinder/runtime In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9671/runtime
Modified Files: Tag: XQuery_0-24 pf_support.mx Log Message: A rather aggresive fix for the order of attributes and nodes in updates.
Now we reverse in algebra the order of insert as last and insert before at runtime like the MPS. This fix the bug [1981844] PF/alg: result order differs from mps. Also it fix the test Update/update.xq (which makes unnecessary the algebra specific output). Also other failing tests of updates are fixed in tests/BugTrack.
However, now the test insert_test_order_seq fails:( However, this is a different error that should be addressed with a diffrent fix.
To be continued...
U pf_support.mx Index: pf_support.mx =================================================================== RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v retrieving revision 1.299.2.3 retrieving revision 1.299.2.4 diff -u -d -r1.299.2.3 -r1.299.2.4 --- pf_support.mx 29 May 2008 16:45:15 -0000 1.299.2.3 +++ pf_support.mx 6 Jun 2008 21:00:46 -0000 1.299.2.4 @@ -3321,9 +3321,27 @@ { var inserts := command.ord_select(UPDATE_INSERT_FIRST, UPDATE_REPLACENODE); # [i,insertcommand] if (inserts.count() > 0) { + + # UPDATE_INSERT_LAST and UPDATE_INSERT_BEFORE commands must be executed in reverse order + var order := inserts.ord_uselect(UPDATE_INSERT_LAST, UPDATE_INSERT_BEFORE).copy().mark(0@0); + if (order.count() > 1) { + pre_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_tgt).access(BAT_WRITE).revert().tmark(0@0))); + pre_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_tgt).access(BAT_WRITE).revert().tmark(0@0))); + attr_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_tgt).access(BAT_WRITE).revert().tmark(0@0))); + attr_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_tgt).access(BAT_WRITE).revert().tmark(0@0))); + pre_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_ins).access(BAT_WRITE).revert().tmark(0@0))); + pre_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_ins).access(BAT_WRITE).revert().tmark(0@0))); + attr_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_ins).access(BAT_WRITE).revert().tmark(0@0))); + attr_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_ins).access(BAT_WRITE).revert().tmark(0@0))); + inserts.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(inserts).access(BAT_WRITE).revert().tmark(0@0))); + command.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(command).access(BAT_WRITE).revert().tmark(0@0))); + }
Lefteris,
thanks for the fix!
I'm not completely sure, whether I understand what your above code does, or better, whether I understand how is does what *I think* it is supposed to do, i.e. revert the order of BUNs that are related to UPDATE_INSERT_LAST and UPDATE_INSERT_BEFORE commands in all BATs.
However given my idea of what it is supposed to do, wouldn't the following solution look "simpler" and be more efficient?
======== var order := inserts.ord_uselect(UPDATE_INSERT_LAST, UPDATE_INSERT_BEFORE); if (order.count() > 1) { var redro := order.copy().access(BAT_WRITE).revert().access(BAT_READ); var order_redro := order.mark(0@0).leftfetchjoin(redro.tmark(0@0)); pre_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(pre_tgt) ).access(BAT_READ); pre_cont_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(pre_cont_tgt) ).access(BAT_READ); attr_tgt .access(BAT_WRITE).replace( order_redro.leftjoin(attr_tgt) ).access(BAT_READ); attr_cont_tgt.access(BAT_WRITE).replace( order_redro.leftjoin(attr_cont_tgt) ).access(BAT_READ); pre_ins .access(BAT_WRITE).replace( order_redro.leftjoin(pre_ins) ).access(BAT_READ); pre_cont_ins .access(BAT_WRITE).replace( order_redro.leftjoin(pre_cont_ins) ).access(BAT_READ); attr_ins .access(BAT_WRITE).replace( order_redro.leftjoin(attr_ins) ).access(BAT_READ); attr_cont_ins.access(BAT_WRITE).replace( order_redro.leftjoin(attr_cont_ins) ).access(BAT_READ); inserts .access(BAT_WRITE).replace( order_redro.leftjoin(inserts) ).access(BAT_READ); command .access(BAT_WRITE).replace( order_redro.leftjoin(command) ).access(BAT_READ); } ========
... just an idea; might be completely wrong ... let's think about anc check it tomorrow or "live" on Monday ...
Good night
+ var inserts_pre_ins := inserts.mirror().leftfetchjoin(pre_ins); # [i,PRE] var inserts_elems := inserts_pre_ins.ord_uselect(oid_nil, oid_nil).hmark(0@0); # [j,i] inserts on elements var inserts_attrs := inserts_pre_ins.ord_uselect(oid_nil).hmark(0@0); # [k,i] inserts on attributes + + if (inserts_attrs.count() > 0) { do_update_insert_attributes(ws, inserts_attrs.leftjoin(pre_tgt), inserts_attrs.leftjoin(pre_cont_tgt), inserts_attrs.leftjoin(attr_ins), inserts_attrs.leftjoin(attr_cont_ins)); }
------------------------------------------------------------------------- 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-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
------------------------------------------------------------------------- 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
participants (2)
-
Lefteris
-
Stefan Manegold