[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/mal/crackers crackers.mx, , 1.16, 1.17 crackers_sideways.mx, , 1.21, 1.22

Stratos Idreos S.Idreos at cwi.nl
Thu Sep 17 00:39:49 CEST 2009


On Sep 17, 2009, at 12:22 AM, Stefan Manegold wrote:

> 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 CRKdProject_ at 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 CRKdPositionProject_ at 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 CRKProjectH_ at 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 CRKMarkedProject_ at 1_@2(int *res, int *bid, int  
>> *pbid, int *pivot, @1 *low, @1 *hgh, bit *inclusiveLow, bit  
>> *inclusiveHgh);
>> crackers_export str CRKPositionProject_ at 1_@2(int *res, int *bid,  
>> int *pbid, int *PositionPivot, @1 *low, @1 *hgh, bit *inclusiveLow,  
>> bit *inclusiveHgh);
>> crackers_export str CRKdProject_ at 1_@2(int *res, int *bid, int  
>> *pbid, int *pivot);
>> +crackers_export str CRKdPositionProject_ at 1_@2(int *res, int *bid,  
>> int *pbid, int *pivot);
>> @
>>
>> @{
>> @@ -1025,6 +1026,63 @@
>>
>>         return MAL_SUCCEED;
>> }
>> +
>> +str
>> +CRKdPositionProject_ at 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, at 2)@		
>> +		BBPkeepref(b->batCacheid);
>> +		BBPkeepref(c->batCacheid);
>> +	}	
>> +
>> +	/* Align the map based on the cracker tape of this set */
>> +	Sync_ at 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
nothing
a forgotten leftover after copy pasting a block of code from a  
different operator
thanks, eagle eye :)

> ...
>
> 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® 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-12, 2009. Register  
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Monetdb-checkins mailing list
>> Monetdb-checkins at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
>>
>
> -- 
> | Dr. Stefan Manegold | mailto:Stefan.Manegold at 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       |





More information about the developers-list mailing list