Changeset: 67eb25036fbc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=67eb25036fbc Modified Files: clients/Tests/MAL-signatures_all.stable.out clients/Tests/MAL-signatures_all.stable.out.int128 clients/Tests/MAL-signatures_fits_geom.stable.out clients/Tests/MAL-signatures_fits_geom.stable.out.int128 clients/Tests/MAL-signatures_geom.stable.out clients/Tests/MAL-signatures_geom.stable.out.int128 clients/Tests/MAL-signatures_none.stable.out clients/Tests/MAL-signatures_none.stable.out.int128 clients/Tests/exports.stable.out monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal Branch: BDCC Log Message:
Yet another merge diffs (truncated from 365 to 300 lines): diff --git a/clients/Tests/MAL-signatures_all.stable.out b/clients/Tests/MAL-signatures_all.stable.out --- a/clients/Tests/MAL-signatures_all.stable.out +++ b/clients/Tests/MAL-signatures_all.stable.out @@ -2507,6 +2507,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_all.stable.out.int128 b/clients/Tests/MAL-signatures_all.stable.out.int128 --- a/clients/Tests/MAL-signatures_all.stable.out.int128 +++ b/clients/Tests/MAL-signatures_all.stable.out.int128 @@ -3024,6 +3024,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out b/clients/Tests/MAL-signatures_fits_geom.stable.out --- a/clients/Tests/MAL-signatures_fits_geom.stable.out +++ b/clients/Tests/MAL-signatures_fits_geom.stable.out @@ -2508,6 +2508,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out.int128 b/clients/Tests/MAL-signatures_fits_geom.stable.out.int128 --- a/clients/Tests/MAL-signatures_fits_geom.stable.out.int128 +++ b/clients/Tests/MAL-signatures_fits_geom.stable.out.int128 @@ -3024,6 +3024,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_geom.stable.out b/clients/Tests/MAL-signatures_geom.stable.out --- a/clients/Tests/MAL-signatures_geom.stable.out +++ b/clients/Tests/MAL-signatures_geom.stable.out @@ -2508,6 +2508,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_geom.stable.out.int128 b/clients/Tests/MAL-signatures_geom.stable.out.int128 --- a/clients/Tests/MAL-signatures_geom.stable.out.int128 +++ b/clients/Tests/MAL-signatures_geom.stable.out.int128 @@ -3024,6 +3024,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_none.stable.out b/clients/Tests/MAL-signatures_none.stable.out --- a/clients/Tests/MAL-signatures_none.stable.out +++ b/clients/Tests/MAL-signatures_none.stable.out @@ -2507,6 +2507,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/MAL-signatures_none.stable.out.int128 b/clients/Tests/MAL-signatures_none.stable.out.int128 --- a/clients/Tests/MAL-signatures_none.stable.out.int128 +++ b/clients/Tests/MAL-signatures_none.stable.out.int128 @@ -3022,6 +3022,14 @@ pattern algebra.semijoinPath(l:bat[:any, address ALGjoinPath; comment Routine to handle join paths. The type analysis is rather tricky. +command algebra.subrangejoin(l:bat[:oid,:any_1],r1:bat[:oid,:any_1],r2:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],li:bit,hi:bit,estimate:lng) (X_9:bat[:oid,:oid],X_10:bat[:oid,:oid]) +address ALGsubrangejoin; +comment Range join: values in l and r1/r2 match if r1 <[=] l <[=] r2 + +command algebra.subbandjoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],c1:any_1,c2:any_1,li:bit,hi:bit,estimate:lng) (X_10:bat[:oid,:oid],X_11:bat[:oid,:oid]) +address ALGsubbandjoin; +comment Band join: values in l and r match if r - c1 <[=] l <[=] r + c2 + command algebra.subthetajoin(l:bat[:oid,:any_1],r:bat[:oid,:any_1],sl:bat[:oid,:oid],sr:bat[:oid,:oid],op:int,nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) address ALGsubthetajoin; comment Theta join with candidate lists diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -797,9 +797,11 @@ str ALGssort(int *result, int *bid); str ALGssort_rev(int *result, int *bid); str ALGstdev(dbl *res, int *bid); str ALGstdevp(dbl *res, int *bid); -str ALGsubjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, bit *nil_matches, lng *estimate); -str ALGsubleftjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, bit *nil_matches, lng *estimate); -str ALGsubouterjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, bit *nil_matches, lng *estimate); +str ALGsubbandjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, const void *low, const void *high, const bit *li, const bit *hi, const lng *estimate); +str ALGsubjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, const bit *nil_matches, const lng *estimate); +str ALGsubleftjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, const bit *nil_matches, const lng *estimate); +str ALGsubouterjoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, const bit *nil_matches, const lng *estimate); +str ALGsubrangejoin(bat *r1, bat *r2, bat *lid, bat *rlid, bat *rhid, bat *slid, bat *srid, const bit *li, const bit *hi, const lng *estimate); str ALGsubselect1(bat *result, bat *bid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti); str ALGsubselect2(bat *result, bat *bid, bat *sid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti); str ALGsubslice_wrd(int *ret, bat *bid, wrd *start, wrd *end); @@ -812,7 +814,7 @@ str ALGsubsort23(bat *result, bat *norde str ALGsubsort31(bat *result, bat *bid, bat *order, bat *group, bit *reverse, bit *stable); str ALGsubsort32(bat *result, bat *norder, bat *bid, bat *order, bat *group, bit *reverse, bit *stable); str ALGsubsort33(bat *result, bat *norder, bat *ngroup, bat *bid, bat *order, bat *group, bit *reverse, bit *stable); -str ALGsubthetajoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, int *op, bit *nil_matches, lng *estimate); +str ALGsubthetajoin(bat *r1, bat *r2, bat *l, bat *r, bat *sl, bat *sr, int *op, const bit *nil_matches, const lng *estimate); str ALGsubunique1(bat *result, bat *bid); str ALGsubunique2(bat *result, bat *bid, bat *sid); str ALGtdiff(int *result, int *lid, int *rid); diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c --- a/monetdb5/modules/kernel/algebra.c +++ b/monetdb5/modules/kernel/algebra.c @@ -684,16 +684,26 @@ ALGrangejoin(int *result, int *lid, int } static str -do_join(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, - int op, bit *nil_matches, lng *estimate, - gdk_return (*joinfunc)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *, int, BUN), - gdk_return (*thetafunc)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *, int, int, BUN), +do_join(bat *r1, bat *r2, bat *lid, bat *rid, bat *r2id, bat *slid, bat *srid, + int op, const void *c1, const void *c2, int li, int hi, + const bit *nil_matches, const lng *estimate, + gdk_return (*joinfunc)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *, + int, BUN), + gdk_return (*thetafunc)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *, + int, int, BUN), + gdk_return (*bandfunc)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *, + const void *, const void *, int, int, BUN), + gdk_return (*rangefunc)(BAT **, BAT **, BAT *, BAT *, BAT *, + BAT *, BAT *, int, int, BUN), const char *funcname) { - BAT *left = NULL, *right = NULL, *candleft = NULL, *candright = NULL; + BAT *left = NULL, *right = NULL, *right2 = NULL; + BAT *candleft = NULL, *candright = NULL; BAT *result1, *result2; BUN est; + assert(r2id == NULL || rangefunc != NULL); + if ((left = BATdescriptor(*lid)) == NULL) goto fail; if ((right = BATdescriptor(*rid)) == NULL) @@ -709,11 +719,25 @@ do_join(bat *r1, bat *r2, bat *lid, bat if (thetafunc) { assert(joinfunc == NULL); + assert(bandfunc == NULL); + assert(rangefunc == NULL); if ((*thetafunc)(&result1, &result2, left, right, candleft, candright, op, *nil_matches, est) == GDK_FAIL) goto fail; - } else { + } else if (joinfunc) { + assert(bandfunc == NULL); + assert(rangefunc == NULL); if ((*joinfunc)(&result1, &result2, left, right, candleft, candright, *nil_matches, est) == GDK_FAIL) goto fail; + } else if (bandfunc) { + assert(rangefunc == NULL); + if ((*bandfunc)(&result1, &result2, left, right, candleft, candright, c1, c2, li, hi, est) == GDK_FAIL) + goto fail; + } else { + if ((right2 = BATdescriptor(*r2id)) == NULL) + goto fail; + if ((*rangefunc)(&result1, &result2, left, right, right2, candleft, candright, li, hi, est) == GDK_FAIL) + goto fail; + BBPreleaseref(right2->batCacheid); } *r1 = result1->batCacheid; *r2 = result2->batCacheid; @@ -732,6 +756,8 @@ do_join(bat *r1, bat *r2, bat *lid, bat BBPreclaim(left); if (right) BBPreclaim(right); + if (right2) + BBPreclaim(right2); if (candleft) BBPreclaim(candleft); if (candright) @@ -740,31 +766,57 @@ do_join(bat *r1, bat *r2, bat *lid, bat } str -ALGsubjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, bit *nil_matches, lng *estimate) +ALGsubjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, + const bit *nil_matches, const lng *estimate) { - return do_join(r1, r2, lid, rid, slid, srid, 0, nil_matches, estimate, - BATsubjoin, NULL, "algebra.subjoin"); + return do_join(r1, r2, lid, rid, NULL, slid, srid, 0, NULL, NULL, 0, 0, + nil_matches, estimate, + BATsubjoin, NULL, NULL, NULL, "algebra.subjoin"); } str -ALGsubleftjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, bit *nil_matches, lng *estimate) +ALGsubleftjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, + const bit *nil_matches, const lng *estimate) { - return do_join(r1, r2, lid, rid, slid, srid, 0, nil_matches, estimate, - BATsubleftjoin, NULL, "algebra.subleftjoin"); + return do_join(r1, r2, lid, rid, NULL, slid, srid, 0, NULL, NULL, 0, 0, + nil_matches, estimate, + BATsubleftjoin, NULL, NULL, NULL, "algebra.subleftjoin"); } str -ALGsubouterjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, bit *nil_matches, lng *estimate) +ALGsubouterjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, + const bit *nil_matches, const lng *estimate) { - return do_join(r1, r2, lid, rid, slid, srid, 0, nil_matches, estimate, - BATsubouterjoin, NULL, "algebra.subouterjoin"); + return do_join(r1, r2, lid, rid, NULL, slid, srid, 0, NULL, NULL, 0, 0, + nil_matches, estimate, + BATsubouterjoin, NULL, NULL, NULL, "algebra.subouterjoin"); } str -ALGsubthetajoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, int *op, bit *nil_matches, lng *estimate) +ALGsubthetajoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, + int *op, const bit *nil_matches, const lng *estimate) { - return do_join(r1, r2, lid, rid, slid, srid, *op, nil_matches, estimate, - NULL, BATsubthetajoin, "algebra.subthetajoin"); + return do_join(r1, r2, lid, rid, NULL, slid, srid, *op, NULL, NULL, 0, 0, + nil_matches, estimate, + NULL, BATsubthetajoin, NULL, NULL, "algebra.subthetajoin"); +} + +str +ALGsubbandjoin(bat *r1, bat *r2, bat *lid, bat *rid, bat *slid, bat *srid, + const void *c1, const void *c2, const bit *li, const bit *hi, + const lng *estimate) +{ + return do_join(r1, r2, lid, rid, NULL, slid, srid, 0, c1, c2, *li, *hi, + NULL, estimate, _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list