Changeset: 36a0f76e4df9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36a0f76e4df9
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geomBulk.c
Branch: sfcgal
Log Message:

Improve the error message and debug messages


diffs (truncated from 611 to 300 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -12,7 +12,7 @@
  */
 
 #include "geom.h"
-//#define GEOMBULK_DEBUG 1
+#define GEOMBULK_DEBUG 1
 
 int TYPE_mbr;
 
@@ -9047,7 +9047,7 @@ IsTypesubjoin(bat *lres, bat *rres, bat 
     if (*estimate != lng_nil)
         throw(MAL, "IsTypesubjoin", "It has estimate");
 
-    return IsTypesubjoin_intern(lres, rres, lid, rid, NULL, "geom.IsType");
+    return IsTypesubjoin_intern(lres, rres, lid, rid, NULL, 
"geom.IsTypesubjoin");
 }
 
 /***************************************************************************/
@@ -9302,7 +9302,7 @@ Intersectssubjoin(bat *lres, bat *rres, 
     if (*estimate != lng_nil)
         throw(MAL, "Intersectssubjoin", "It has estimate");
 
-    return WKBWKBtoBITsubjoin_intern(lres, rres, lid, rid, GEOSIntersects, 
"geom.Intersects");
+    return WKBWKBtoBITsubjoin_intern(lres, rres, lid, rid, GEOSIntersects, 
"geom.Intersectssubjoin");
 }
 
 str
@@ -9315,7 +9315,7 @@ Containssubjoin(bat *lres, bat *rres, ba
     if (*estimate != lng_nil)
         throw(MAL, "Containssubjoin", "It has estimate");
 
-    return WKBWKBtoBITsubjoin_intern(lres, rres, lid, rid, GEOSContains, 
"geom.Contains");
+    return WKBWKBtoBITsubjoin_intern(lres, rres, lid, rid, GEOSContains, 
"geom.Containssubjoin");
 }
 
 /***************************************************************************/
@@ -9414,7 +9414,7 @@ IsValidsubjoin(bat *lres, bat *rres, bat
     if (*estimate != lng_nil)
         throw(MAL, "IsValidsubjoin", "It has estimate");
 
-    return WKBtoBITsubjoin_intern(lres, rres, lid, GEOSisValid, 
"geom.IsValid");
+    return WKBtoBITsubjoin_intern(lres, rres, lid, GEOSisValid, 
"geom.IsValidsubjoin");
 }
 
 /***************************************************************************/
@@ -9422,7 +9422,7 @@ IsValidsubjoin(bat *lres, bat *rres, bat
 /***************************************************************************/
 
 static str
-IntersectsXYZsubjoin_intern(bat *lres, bat *rres, bat *lid, bat *xid, bat*yid, 
bat *zid, int *srid)
+IntersectsXYZsubjoin_intern(bat *lres, bat *rres, bat *lid, bat *xid, bat*yid, 
bat *zid, int *srid, const char* name)
 {
     str msg = MAL_SUCCEED;
        BAT *xl, *xr, *bl, *bx, *by, *bz;
@@ -9439,24 +9439,24 @@ IntersectsXYZsubjoin_intern(bat *lres, b
 #endif
 
        if( (bl= BATdescriptor(*lid)) == NULL )
-               throw(MAL, "algebra.Intersects", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
 
        if( (bx= BATdescriptor(*xid)) == NULL ){
                BBPunfix(*lid);
-               throw(MAL, "algebra.Intersects", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
        }
 
        if( (by= BATdescriptor(*yid)) == NULL ){
                BBPunfix(*lid);
                BBPunfix(*xid);
-               throw(MAL, "algebra.Intersects", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
        }
 
        if( (bz= BATdescriptor(*zid)) == NULL ){
                BBPunfix(*lid);
                BBPunfix(*xid);
                BBPunfix(*yid);
-               throw(MAL, "algebra.Intersects", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
        }
 
        xl = COLnew(0, TYPE_oid, 0, TRANSIENT);
@@ -9465,7 +9465,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                BBPunfix(*xid);
                BBPunfix(*yid);
                BBPunfix(*zid);
-               throw(MAL, "algebra.Intersects", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
        }
 
        xr = COLnew(0, TYPE_oid, 0, TRANSIENT);
@@ -9475,7 +9475,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                BBPunfix(*yid);
                BBPunfix(*zid);
                BBPunfix(xl->batCacheid);
-               throw(MAL, "algebra.Intersects", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
        }
 
     if ( !BATcount(bx) || !BATcount(bl)) {
@@ -9502,7 +9502,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                BBPunfix(*zid);
                BBPunfix(xl->batCacheid);
                BBPunfix(xr->batCacheid);
-               throw(MAL, "algebra.Intersects", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
     }
     if ( ( BATcount(bx)) && (rMBRs = (mbr**) GDKzalloc(sizeof(mbr*) * 
BATcount(bx))) == NULL) {
         GDKfree(rGeometries);
@@ -9512,7 +9512,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                BBPunfix(*zid);
                BBPunfix(xl->batCacheid);
                BBPunfix(xr->batCacheid);
-               throw(MAL, "algebra.Intersects", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
     }
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&start, NULL);
@@ -9537,7 +9537,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                 for (j = 0; j < px-1;j++) {
                     GEOSGeom_destroy(rGeometries[j]);
                 }
-                msg = createException(MAL, "algebra.Intersects", 
"GEOSCoordSeq_create failed");
+                msg = createException(MAL, name, "GEOSCoordSeq_create failed");
                 break;
             }
 
@@ -9547,7 +9547,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                 for (j = 0; j < px-1;j++) {
                     GEOSGeom_destroy(rGeometries[j]);
                 }
-                msg = createException(MAL, "algebra.Intersects", 
"GEOSCoordSeq_setOrdinate failed");
+                msg = createException(MAL, name, "GEOSCoordSeq_setOrdinate 
failed");
                 break;
             }
 
@@ -9555,7 +9555,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
                 for (j = 0; j < px-1;j++) {
                     GEOSGeom_destroy(rGeometries[j]);
                 }
-                msg = createException(MAL, "algebra.Intersects", "Failed to 
create GEOSGeometry from the coordinates");
+                msg = createException(MAL, name, "Failed to create 
GEOSGeometry from the coordinates");
                 break;
             }
 
@@ -9569,7 +9569,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
             for (j = 0; j < px;j++) {
                 GEOSGeom_destroy(rGeometries[j]);
             }
-            msg = createException(MAL, "algebra.Intersects", "Failed to create 
mbrFromGeos");
+            msg = createException(MAL, name, "Failed to create mbrFromGeos");
             break;
         }
 
@@ -9579,10 +9579,10 @@ IntersectsXYZsubjoin_intern(bat *lres, b
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&stop, NULL);
     t = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 
1000;
-    fprintf(stdout, "IntersectsXYZ first BATloop %llu ms\n", t);
+    fprintf(stdout, "%s first BATloop %llu ms\n", name, t);
 #endif
     if ( (msg ==MAL_SUCCEED) && BATcount(bx) && (outs = (bit*) 
GDKzalloc(sizeof(bit)*BATcount(bx))) == NULL) {
-        msg = createException(MAL, "algebra.Intersects", MAL_MALLOC_FAIL);
+        msg = createException(MAL, name, MAL_MALLOC_FAIL);
     }
 
     if (msg != MAL_SUCCEED) {
@@ -9615,20 +9615,20 @@ IntersectsXYZsubjoin_intern(bat *lres, b
 
         lGeometry = wkb2geos(lWKB);
         if ( !lGeometry ) {
-            createException(MAL, "algebra.Intersects", "wkb2geos failed");
+            createException(MAL, name, "wkb2geos failed");
             break;
         }
 
         if (GEOSGetSRID(lGeometry) != *srid) {
             GEOSGeom_destroy(lGeometry);
-            msg = createException(MAL, "geom.Intersects", "Geometries of 
different SRID");
+            msg = createException(MAL, name, "Geometries of different SRID");
             break;
         }
 
            lMBR = mbrFromGeos(lGeometry);
            if (lMBR == NULL || mbr_isnil(lMBR)) {
             GEOSGeom_destroy(lGeometry);
-            msg  = createException(MAL, "algebra.Intersects", "mbrFromGeos 
failed");
+            msg  = createException(MAL, name, "mbrFromGeos failed");
             break;
         }
 
@@ -9656,7 +9656,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
             } else if (outs[j]) {
                 outs[j] = 0;
                 if ((outs[j] = GEOSIntersects(lGeometry, rGeometry)) == 2){
-                    msg = createException(MAL, "geom.Intersects", 
"GEOSIntersects failed");
+                    msg = createException(MAL, name, "GEOSIntersects failed");
 #ifdef OPENMP
                     #pragma omp cancelregion
 #else
@@ -9683,7 +9683,7 @@ IntersectsXYZsubjoin_intern(bat *lres, b
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&stop, NULL);
     t = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 
1000;
-    fprintf(stdout, "IntersectsXYZ second BATloop %llu ms\n", t);
+    fprintf(stdout, "%s second BATloop %llu ms\n", name, t);
 #endif
     if (outs)
         GDKfree(outs);
@@ -9722,11 +9722,11 @@ IntersectsXYZsubjoin(bat *lres, bat *rre
     if (*estimate != lng_nil)
         throw(MAL, "IntersectsXYZsubjoin", "It has estimate");
 
-    return IntersectsXYZsubjoin_intern(lres, rres, lid, xid, yid, zid, srid);
+    return IntersectsXYZsubjoin_intern(lres, rres, lid, xid, yid, zid, srid, 
"geom.IntersectsXYZsubjoin");
 }
 
 static str
-DWithinsubjoin_intern(bat *lres, bat *rres, bat *lid, bat *rid, double *dist)
+DWithinsubjoin_intern(bat *lres, bat *rres, bat *lid, bat *rid, double *dist, 
const char *name)
 {
     str msg = MAL_SUCCEED;
        BAT *xl, *xr, *bl, *br;
@@ -9743,18 +9743,18 @@ DWithinsubjoin_intern(bat *lres, bat *rr
 #endif
 
        if( (bl= BATdescriptor(*lid)) == NULL )
-               throw(MAL, "algebra.DWithin", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
 
        if( (br= BATdescriptor(*rid)) == NULL ){
                BBPunfix(*lid);
-               throw(MAL, "algebra.DWithin", RUNTIME_OBJECT_MISSING);
+               throw(MAL, name, RUNTIME_OBJECT_MISSING);
        }
 
        xl = COLnew(0, TYPE_oid, 0, TRANSIENT);
        if ( xl == NULL){
                BBPunfix(*lid);
                BBPunfix(*rid);
-               throw(MAL, "algebra.DWithin", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
        }
 
        xr = COLnew(0, TYPE_oid, 0, TRANSIENT);
@@ -9762,7 +9762,7 @@ DWithinsubjoin_intern(bat *lres, bat *rr
                BBPunfix(*lid);
                BBPunfix(*rid);
                BBPunfix(xl->batCacheid);
-               throw(MAL, "algebra.DWithin", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
        }
 
     if ( !BATcount(br) || !BATcount(bl)) {
@@ -9782,7 +9782,7 @@ DWithinsubjoin_intern(bat *lres, bat *rr
                BBPunfix(*rid);
                BBPunfix(xl->batCacheid);
                BBPunfix(xr->batCacheid);
-               throw(MAL, "algebra.DWithin", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
     }
     if ( (rSRIDs = (int*) GDKzalloc(sizeof(int) * BATcount(br))) == NULL) {
         GDKfree(rGeometries);
@@ -9790,7 +9790,7 @@ DWithinsubjoin_intern(bat *lres, bat *rr
                BBPunfix(*rid);
                BBPunfix(xl->batCacheid);
                BBPunfix(xr->batCacheid);
-               throw(MAL, "algebra.DWithin", MAL_MALLOC_FAIL);
+               throw(MAL, name, MAL_MALLOC_FAIL);
     }
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&start, NULL);
@@ -9807,17 +9807,17 @@ DWithinsubjoin_intern(bat *lres, bat *rr
                BBPunfix(*rid);
                BBPunfix(xl->batCacheid);
                BBPunfix(xr->batCacheid);
-               throw(MAL, "algebra.DWithin", "wkb2geos failed");
+               throw(MAL, name, "wkb2geos failed");
         }
         rSRIDs[pr] = GEOSGetSRID(rGeometries[pr]);
     }
 #ifdef GEOMBULK_DEBUG
     gettimeofday(&stop, NULL);
     t = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 
1000;
-    fprintf(stdout, "DWithin first BATloop %llu ms\n", t);
+    fprintf(stdout, "%s first BATloop %llu ms\n", name, t);
 #endif
     if ( (msg == MAL_SUCCEED) && BATcount(br) && (outs = (bit*) 
GDKzalloc(sizeof(bit)*BATcount(br))) == NULL) {
-        msg = createException(MAL,  "algebra.DWithin", MAL_MALLOC_FAIL);
+        msg = createException(MAL,  name, MAL_MALLOC_FAIL);
     }
 
 #ifdef GEOMBULK_DEBUG
@@ -9833,7 +9833,7 @@ DWithinsubjoin_intern(bat *lres, bat *rr
         lWKB = (wkb *) BUNtail(lBAT_iter, pl);
         lGeometry = wkb2geos(lWKB);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to