Changeset: ab9362c2789b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab9362c2789b
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geom.mal
        monetdb5/optimizer/opt_geospatial.c
Branch: geo
Log Message:

contains can take two BATs but in this case there is no filtering


diffs (75 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -156,7 +156,7 @@ geom_export str wkbTouches(bit*, wkb**, 
 geom_export str wkbCrosses(bit*, wkb**, wkb**);
 geom_export str wkbWithin(bit*, wkb**, wkb**);
 geom_export str wkbContains(bit*, wkb**, wkb**);
-//geom_export str wkbContains_bat(int* outBAT_id, int* aBAT_id, int* bBAT_id);
+geom_export str wkbContains_bat(int* outBAT_id, int* aBAT_id, int* bBAT_id);
 geom_export str wkbContains_geom_bat(int* outBAT_id, wkb** geomWKB, int* 
inBAT_id);
 geom_export str wkbContains_bat_geom(int* outBAT_id, int* inBAT_id, wkb** 
geomWKB);
 geom_export str wkbOverlaps(bit*, wkb**, wkb**);
@@ -2769,7 +2769,6 @@ str wkbContains(bit *out, wkb **geomWKB_
        return MAL_SUCCEED;
 }
 
-/*
 str wkbContains_bat(int* outBAT_id, int* aBAT_id, int* bBAT_id) {
        BAT *outBAT = NULL, *aBAT = NULL, *bBAT = NULL;
        wkb *aWKB = NULL, *bWKB = NULL; //, *aWKB_previous = NULL, 
*bWKB_previous = NULL;
@@ -2835,7 +2834,7 @@ str wkbContains_bat(int* outBAT_id, int*
        
        return MAL_SUCCEED;
 
-}*/
+}
 
 
 str wkbContains_geom_bat(int* outBAT_id, wkb** geomWKB, int* inBAT_id) {
diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -443,8 +443,7 @@ geom.prelude();
 
 module batgeom;
 
-#only one argument is allowed to be a BAT
-#command Contains(a:bat[:oid,:wkb], b:bat[:oid,:wkb]) :bat[:oid,:bit] address 
wkbContains_bat;
+command Contains(a:bat[:oid,:wkb], b:bat[:oid,:wkb]) :bat[:oid,:bit] address 
wkbContains_bat;
 command Contains(a:wkb, b:bat[:oid,:wkb]) :bat[:oid,:bit] address 
wkbContains_geom_bat;
 command Contains(a:bat[:oid,:wkb], b:wkb) :bat[:oid,:bit] address 
wkbContains_bat_geom;
 
diff --git a/monetdb5/optimizer/opt_geospatial.c 
b/monetdb5/optimizer/opt_geospatial.c
--- a/monetdb5/optimizer/opt_geospatial.c
+++ b/monetdb5/optimizer/opt_geospatial.c
@@ -30,15 +30,23 @@ int OPTgeospatialImplementation(Client c
                        if(strcasecmp(getFunctionId(oldInstrPtr[i]), 
"contains") == 0) {
                                int inputBAT = 0;
        
+                               if(isaBatType(getArgType(mb,oldInstrPtr[i],1)))
+                                       inputBAT = 1;
+                               
+                               if(isaBatType(getArgType(mb,oldInstrPtr[i],2))) 
{
+                                       if(inputBAT == 1) {
+                                               //no Filtering when both inputs 
are BATs because it cannot be parallelised)
+                                               pushInstruction(mb, 
oldInstrPtr[i]);
+                                               continue;
+                                       }
+                                       inputBAT=2;
+                               }       
+
                                //create the new instruction
                                newInstrPtr = newStmt(mb, "batgeom", 
"ContainsFilter");
+                       
+
                                //create the return variable of the new 
instruction (it should be of the same type with the input variable (BAT) of the 
old instruction)        
-                               if(isaBatType(getArgType(mb,oldInstrPtr[i],1))) 
{
-                                       inputBAT = 1;
-                               } else 
if(isaBatType(getArgType(mb,oldInstrPtr[i],2))) {
-                                       inputBAT=2;
-                               }
-                               
                                returnBATId = newVariable(mb, 
GDKstrdup("BATfiltered"), getArgType(mb,oldInstrPtr[i],inputBAT));
                                
                                //set the return and input arguments of the new 
instruction
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to