Update of /cvsroot/monetdb/MonetDB/src/gdk
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14560/src/gdk
Modified Files:
Makefile.ag gdk_relop.mx
Log Message:
added nested loop implementation of a rangejoin
join(l, rl, rh, l_in, h_in) { rl <(?l_in=) l <(?h_in=) rh }
moved bandjoin into the new gdk_rangejoin.mx file
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/Makefile.ag,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- Makefile.ag 9 Dec 2007 13:03:50 -0000 1.36
+++ Makefile.ag 21 Dec 2007 14:58:43 -0000 1.37
@@ -29,6 +29,7 @@
gdk_heap.mx gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
gdk_qsort.mx gdk_ssort.mx gdk_storage.mx gdk_bat.mx \
gdk_delta.mx gdk_relop.mx gdk_system.mx gdk_value.mx \
+ gdk_rangejoin.mx \
gdk_posix.mx gdk_logger.mx bat.feps bat1.feps bat2.feps
LIBS = ../common/libmutils ../common/libstream \
$(SOCKET_LIBS) $(Z_LIBS) $(BZ_LIBS) \
@@ -44,6 +45,7 @@
gdk_heap.mx gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
gdk_qsort.mx gdk_ssort.mx gdk_storage.mx gdk_bat.mx \
gdk_delta.mx gdk_relop.mx gdk_system.mx gdk_value.mx \
+ gdk_rangejoin.mx \
gdk_posix.mx gdk_logger.mx bat.feps bat1.feps bat2.feps
}
Index: gdk_relop.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_relop.mx,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- gdk_relop.mx 14 Nov 2007 12:40:55 -0000 1.137
+++ gdk_relop.mx 21 Dec 2007 14:58:44 -0000 1.138
@@ -1643,99 +1643,6 @@
@}
[EMAIL PROTECTED] Bandjoin
-A non-equi join of two relations R and S is called a Band-join if
-the join predicate requires the values of R to fall within a given range.
-This kind of joins is encountered in real world domains, such as those
-involved with time and distance.
-
-The boundary conditions for the bandjoin are constants or a NULL value.
-The latter enables encoding of arbitrary theta joins using the more
-general bandjoin.
-Incidentally note that c1 = c2 = 0 leads to an equi-join.
-
-The straight forward implementation uses a nested loop.
-The current implementation does not optimize processing, because
-the impact of the choices is not yet clear.
-
-The hash indexing routines have been extended with a Band argument.
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-BAT *
-BATbandjoin(BAT *l, BAT *r, ptr c1, ptr c2)
-{
- BAT *bn;
- BUN p, q;
- BUN v, w;
-
- @:joincheck(BATbandjoin,l->ttype,r->htype)@
- @:joinbat(JOIN_BAND,BATbandjoin(l,r,c1,c2),oid_nil)@
- switch (ATOMstorage(r->htype)) {
- case TYPE_chr:
- @:bandjoin(chr)@
-
- case TYPE_bte:
- @:bandjoin(bte)@
-
- case TYPE_sht:
- @:bandjoin(sht)@
-
- case TYPE_int:
- @:bandjoin(int)@
-
- case TYPE_flt:
- @:bandjoin(flt)@
-
- case TYPE_dbl:
- @:bandjoin(dbl)@
-
- case TYPE_lng:
- @:bandjoin(lng)@
-
- default:
- GDKerror("BATbandjoin: type not implemented\n");
- return NULL;
- }
- /* set sorted flags by hand, because we used BUNfastins() */
- bn->hsorted = BAThordered(l);
- bn->tsorted = FALSE;
-
- ESTIDEBUG THRprintf(GDKout, "#BATbandjoin: actual resultsize: " SZFMT
"\n", BATcount(bn));
-
- return bn;
-}
-
-@
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-The easiest case is to implement a nested loop for band operations.
-Choice point is to determine the status of the NULL values in the final
-result.
[EMAIL PROTECTED]
[EMAIL PROTECTED] bandjoin
-{
- BATiter li = bat_iterator(l);
- BATiter ri = bat_iterator(r);
- @1 *x1;
- @1 *x2;
-
- BATloop(l, p, q) {
- x1 = (@1 *) BUNtloc(li, p);
- BATloop(r, v, w) {
- x2 = (@1 *) BUNhloc(ri, v);
- if ((*x1 >= *x2 - *(@1 *) c1) &&
- (*x1 <= *x2 + *(@1 *) c2)) {
- if (BUNfastins(bn, BUNhead(li, p), BUNtail(ri,
v)) == NULL) {
- BBPreclaim(bn);
- return NULL;
- }
- }
- }
- }
- break;
-}
-@
[EMAIL PROTECTED]
@+ Semijoin
The @%BATsemijoin@ performs a semijoin over @%l@ and @[EMAIL PROTECTED] It
returns
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins