Changeset: 3db75b2ec791 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3db75b2ec791
Modified Files:
        monetdb5/optimizer/opt_multiplex.c
Branch: default
Log Message:

Fix iterator use.
The iterator now iterates over the BUN and tail values.  This means we
can't just use the first (i.e. BUN) value as if it was the head of the
iterator bat.  We need to fetch the value from the bat to get the head
value.


diffs (37 lines):

diff --git a/monetdb5/optimizer/opt_multiplex.c 
b/monetdb5/optimizer/opt_multiplex.c
--- a/monetdb5/optimizer/opt_multiplex.c
+++ b/monetdb5/optimizer/opt_multiplex.c
@@ -48,6 +48,7 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
 {
        int i = 2, resB, iter = 0, cr;
        int hvar, tvar;
+       int x, y;
        str mod, fcn;
        int *alias;
        InstrPtr q;
@@ -130,12 +131,24 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
                        q = pushArgument(mb, q, getArg(pci, i));
                }
 
+       /* x := bat.reverse(A1); y := algebra.fetch(x,h); */
+       x = newTmpVariable(mb, newBatType(getTailType(getVarType(mb,iter)),
+                                                                         
getHeadType(getVarType(mb,iter))));
+       q = newFcnCall(mb, batRef, reverseRef);
+       getArg(q, 0) = x;
+       q = pushArgument(mb, q, iter);
+       y = newTmpVariable(mb, getHeadType(getVarType(mb,iter)));
+       q = newFcnCall(mb, algebraRef, "fetch");
+       getArg(q, 0) = y;
+       q = pushArgument(mb, q, x);
+       q = pushArgument(mb, q, hvar);
+
        /* insert(resB,h,cr);  
           not append(resB, cr); the head type (oid) may dynamically change */
        
        q = newFcnCall(mb, batRef, insertRef);
        q= pushArgument(mb, q, resB);
-       q= pushArgument(mb, q, hvar);
+       q= pushArgument(mb, q, y);
        (void) pushArgument(mb, q, cr);
 
 /* redo (h,r):= iterator.next(refBat); */
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to