Did you see what I had done on the head branch for this problem? On 2008-11-03 22:51, Stefan Manegold wrote:
Update of /cvsroot/monetdb/MonetDB4/src/modules/contrib In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6583/MonetDB4/src/modules/contrib
Modified Files: Tag: MonetDB_4-24 malalgebra.mx Log Message:
attempt to fix bug in Peter's new {band,left}mergejoin_limit() functions that was reported by Riham:
While {band,left}mergejoin_limit() internally use a limit of type size_t, the MIL level uses type lng; hence, we need to properly convert the types back and forth (and check for potential under-/overflows).
(For now, I did not dare to change the MIL interface to use the more suitable type wrd that (unlike lng) grows with system word size just like size_t.)
Riham,
could you please check, whether this fixes your problem? Thanks!
U malalgebra.mx Index: malalgebra.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB4/src/modules/contrib/malalgebra.mx,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -u -d -r1.8.2.2 -r1.8.2.3 --- malalgebra.mx 28 Oct 2008 17:49:34 -0000 1.8.2.2 +++ malalgebra.mx 3 Nov 2008 21:51:09 -0000 1.8.2.3 @@ -263,28 +263,50 @@ }
int -CMDbandmergejoin_limit(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus, bit *li, bit *hi, lng* limit) +CMDbandmergejoin_limit(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus, bit *li, bit *hi, lng* _limit) { - size_t cutoff = *limit; + lng limit = *_limit; + size_t cutoff = (size_t) limit; + assert(limit >= 0); +#if SIZEOF_SIZE_T == SIZEOF_INT + assert(limit <= GDK_int_max); +#endif *result = BATbandmergejoin_limit(left, right, minus, plus, *li, *hi, &cutoff); if (*result) { bat bid = (*result)->batCacheid; *result = BATnew(TYPE_lng, TYPE_bat, 1); - if (*result) BUNins(*result, &cutoff, &bid, FALSE); + if (*result) { +#if SIZEOF_SIZE_T == SIZEOF_LNG + assert(cutoff <= (size_t) GDK_lng_max); +#endif + limit = (lng) cutoff; + BUNins(*result, &limit, &bid, FALSE); + } BBPunfix(bid); } return (*result)?GDK_SUCCEED:GDK_FAIL; }
int -CMDleftmergejoin_limit(BAT **result, BAT *left, BAT *right, lng* limit) +CMDleftmergejoin_limit(BAT **result, BAT *left, BAT *right, lng* _limit) { - size_t cutoff = *limit; + lng limit = *_limit; + size_t cutoff = (size_t) limit; + assert(limit >= 0); +#if SIZEOF_SIZE_T == SIZEOF_INT + assert(limit <= GDK_int_max); +#endif *result = BATleftmergejoin_limit(left, right, cutoff, &cutoff); if (*result) { bat bid = (*result)->batCacheid; *result = BATnew(TYPE_lng, TYPE_bat, 1); - if (*result) BUNins(*result, &cutoff, &bid, FALSE); + if (*result) { +#if SIZEOF_SIZE_T == SIZEOF_LNG + assert(cutoff <= (size_t) GDK_lng_max); +#endif + limit = (lng) cutoff; + BUNins(*result, &limit, &bid, FALSE); + } BBPunfix(bid); } return (*result)?GDK_SUCCEED:GDK_FAIL;
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- Sjoerd Mullender