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([EMAIL PROTECTED]);
> +      if (order.count() > 1) {
> +        
> pre_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_tgt).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> pre_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_tgt).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> attr_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_tgt).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> attr_cont_tgt.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_tgt).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> pre_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_ins).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> pre_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(pre_cont_ins).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> attr_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_ins).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> attr_cont_ins.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(attr_cont_ins).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> inserts.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(inserts).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +        
> command.access(BAT_WRITE).replace(order.leftjoin(order.mirror().leftjoin(command).access(BAT_WRITE).revert().tmark([EMAIL
>  PROTECTED])));
> +      }

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([EMAIL 
PROTECTED]).leftfetchjoin(redro.tmark([EMAIL PROTECTED]));
        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([EMAIL PROTECTED]); # [j,i] inserts on elements
>        var inserts_attrs := inserts_pre_ins.ord_uselect(oid_nil).hmark([EMAIL 
> PROTECTED]); # [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
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
> 
> 

-- 
| Dr. Stefan Manegold | mailto:[EMAIL PROTECTED] |
| 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to