Stratos (and others ;-)),

please find below some comments, hints and questions.

Stefan

On Wed, Sep 16, 2009 at 09:53:56PM +0000, stratos wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers
> In directory 
> 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11656/src/modules/mal/crackers
> 
> Modified Files:
>       crackers.mx crackers_sideways.mx 
> Log Message:
> position-based tuple reconstruction to use in sideways plans with crack joins
> 
> 
> U crackers.mx
> Index: crackers.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers/crackers.mx,v
> retrieving revision 1.16
> retrieving revision 1.17
> diff -u -d -r1.16 -r1.17
> --- crackers.mx       30 Apr 2009 18:43:40 -0000      1.16
> +++ crackers.mx       16 Sep 2009 21:53:53 -0000      1.17
> @@ -504,6 +504,10 @@
>  address crkdproje...@1_@2
>  comment "Sync the cracking pair and project the tail. Use for disjunctive 
> queries that require a larger bit vector";
>  
> +command positionproject( 
> b:bat[:oid,:@1],bp:bat[:oid,:@2],pivot:bat[:oid,:oid]):bat[:oid,:@2]
> +address crkdpositionproje...@1_@2
> +comment "Sync the cracking pair and project the tail. Use position based 
> pivot";
> +
>  command projectH( 
> b:bat[:oid,:@1],bp:bat[:oid,:@2],l:@1,h:@1,li:bit,hi:bit):bat[:oid,:@1]
>  address crkprojec...@1_@2
>  comment "Sync the cracking pair and project the head";
> 
> U crackers_sideways.mx
> Index: crackers_sideways.mx
> ===================================================================
> RCS file: 
> /cvsroot/monetdb/MonetDB5/src/modules/mal/crackers/crackers_sideways.mx,v
> retrieving revision 1.21
> retrieving revision 1.22
> diff -u -d -r1.21 -r1.22
> --- crackers_sideways.mx      30 Apr 2009 18:43:40 -0000      1.21
> +++ crackers_sideways.mx      16 Sep 2009 21:53:53 -0000      1.22
> @@ -153,6 +153,7 @@
>  crackers_export str crkmarkedproje...@1_@2(int *res, int *bid, int *pbid, 
> int *pivot, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh);
>  crackers_export str crkpositionproje...@1_@2(int *res, int *bid, int *pbid, 
> int *PositionPivot, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh);
>  crackers_export str crkdproje...@1_@2(int *res, int *bid, int *pbid, int 
> *pivot);
> +crackers_export str crkdpositionproje...@1_@2(int *res, int *bid, int *pbid, 
> int *pivot);
>  @
>  
>  @{
> @@ -1025,6 +1026,63 @@
>  
>          return MAL_SUCCEED;
>  }
> +
> +str
> +crkdpositionproje...@1_@2(int *res, int *bid, int *pbid,int *pivot){
> +        BAT *b, *p, *r, *c;
> +        @2 *pairt, *rest;
> +     oid *pivott;
> +        oid size;
> +     int m;
> +     oid j;
> +
> +     /* If the necessary map does not exits, then create it */       
> +     m = existsCrackerIndexSideways(*bid, *pbid);
> +     if (m==-1){     
> +             @:CreateCrackerMap(@1,@2)@              
> +             BBPkeepref(b->batCacheid);
> +             BBPkeepref(c->batCacheid);
> +     }       
> +
> +     /* Align the map based on the cracker tape of this set */
> +     sy...@1_@2(m,existsCrackerIndexSideways(*bid, -1));
> +
> +     /* Get the map */
> +        if ((b = BATdescriptor(CrackerIndex[m].cbid)) == NULL) 
> +                throw(MAL, "crackers.CRKProject", "Cannot access 
> descriptor");
> +     
> +        if ((p = BATdescriptor(*pivot)) == NULL) 
> +                throw(MAL, "crackers.CRKProject", "Cannot access 
> descriptor");
> +
> +        size = BATcount(p);
> +     r = BATnew(TYPE_void,b->ttype,size);

This might fail. Error handling?

> +
> +        pairt  = (@2 *)Tloc(b, BUNfirst(b));
> +        pivott = (oid*)Tloc(p, BUNfirst(p));
> +        rest   = (@2 *)Tloc(r, BUNfirst(r));
> +
> +     for (j = 0; j<size; j++){
> +             *rest = *(pairt + *pivott); 
> +             rest ++;
> +             pivott ++;

What about replacing the above three lines by

                rest[j] = pairt[pivott[j]];

?

> +     }
> +
> +     BATmark(BATmirror(p),0);
        ^^^^^^^^^^^^^^^^^^!^^^^^

What's is the purpose/intention of this statement?
It IMHO represents a side-effect, since it marks one of the input operands
...

Stefan

> +
> +        BATsetcount(r, size);
> +
> +     r->hsorted = FALSE;
> +        r->tsorted = FALSE;
> +        r->hdense = FALSE;
> +        r->tdense = FALSE;
> +
> +        *res = r->batCacheid;
> +        BBPkeepref(r->batCacheid);
> +        BBPunfix(p->batCacheid);
> +        BBPunfix(b->batCacheid);
> +
> +        return MAL_SUCCEED;
> +}
>  @
>  
>  @- Local support functions and macros
> 
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Monetdb-checkins mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/monetdb-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       |

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to