Changeset: c99aa741431e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c99aa741431e
Added Files:
geom/sql/Tests/functions/Tests/ST_IsEmpty.sql
geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.err
geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.out
Removed Files:
geom/sql/Tests/functions/Tests/isEmpty.sql
Modified Files:
geom/monetdb5/geom.h
geom/monetdb5/geom.mal
geom/monetdb5/geomBulk.c
geom/sql/Tests/functions/Tests/All
Branch: geo
Log Message:
Generale function that handles an input BAT with wkb and an output BAT with bit
ST_IsClosed bat version changed to use the general function
ST_IsEmpty : mtest + Bulk
diffs (215 lines):
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -130,7 +130,10 @@ geom_export str wkbAsText_bat(bat *inBAT
geom_export str wkbAsBinary(char**, wkb**);
geom_export str wkbFromBinary(wkb**, char**);
+
geom_export str wkbIsEmpty(bit*, wkb**);
+geom_export str wkbIsEmpty_bat(bat *inBAT_id, bat *outBAT_id);
+
geom_export str wkbIsSimple(bit*, wkb**);
//Is3D
//IsMeasured
diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -505,7 +505,9 @@ function AsEWKT(w:bat[:oid,:wkb]) :bat[:
end AsEWKT;
command Boundary(w:bat[:oid,:wkb]) :bat[:oid,:wkb] address wkbBoundary_bat;
+
command IsClosed(w:bat[:oid,:wkb]) :bat[:oid,:bit] address wkbIsClosed_bat;
+command IsEmpty(w:bat[:oid,:wkb]) :bat[:oid,:bit] address wkbIsEmpty_bat;
command pbsmIndexCreate(x:bat[:oid,:dbl], y:bat[:oid,:dbl], xmin:dbl,
ymin:dbl, xmax:dbl, ymax:dbl) :bat[:oid,:int] address pbsmIndexCreate_bat;
command geom.pbsmIndexLoad() address pbsmIndexLoad_bat;
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -191,7 +191,7 @@ str wkbBoundary_bat(bat *outBAT_id, bat
return MAL_SUCCEED;
}
-str wkbIsClosed_bat(bat *outBAT_id, bat *inBAT_id) {
+static str wkbBitOut_bat(bat *outBAT_id, bat *inBAT_id, str (*func)(bit*,
wkb**), const char *name) {
BAT *outBAT = NULL, *inBAT = NULL;
wkb *inWKB = NULL;
BUN p =0, q =0;
@@ -199,18 +199,18 @@ str wkbIsClosed_bat(bat *outBAT_id, bat
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
- throw(MAL, "batgeom.wkbIsClosed", RUNTIME_OBJECT_MISSING);
+ throw(MAL, name, RUNTIME_OBJECT_MISSING);
}
if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
BBPreleaseref(inBAT->batCacheid);
- throw(MAL, "batgeom.wkbIsClosed", "The arguments must have
dense and aligned heads");
+ throw(MAL, name, "The arguments must have dense and aligned
heads");
}
//create a new for the output BAT
if ((outBAT = BATnew(TYPE_void, ATOMindex("bit"), BATcount(inBAT),
TRANSIENT)) == NULL) {
BBPreleaseref(inBAT->batCacheid);
- throw(MAL, "batgeom.wkbIsClosed", MAL_MALLOC_FAIL);
+ throw(MAL, name, MAL_MALLOC_FAIL);
}
//set the first idx of the new BAT equal to that of the input BAT
BATseqbase(outBAT, inBAT->hseqbase);
@@ -222,8 +222,8 @@ str wkbIsClosed_bat(bat *outBAT_id, bat
bit outSingle;
inWKB = (wkb*) BUNtail(inBAT_iter, p);
- if ((err = wkbIsClosed(&outSingle, &inWKB)) != MAL_SUCCEED) {
- str msg = createException(MAL, "batgeom.wkbIsClosed",
"%s", err);
+ if ((err = (*func)(&outSingle, &inWKB)) != MAL_SUCCEED) {
+ str msg = createException(MAL, name, "%s", err);
GDKfree(err);
BBPreleaseref(inBAT->batCacheid);
@@ -241,9 +241,15 @@ str wkbIsClosed_bat(bat *outBAT_id, bat
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
+
}
-
+str wkbIsClosed_bat(bat *outBAT_id, bat *inBAT_id) {
+ return wkbBitOut_bat(outBAT_id, inBAT_id, wkbIsClosed,
"batgeom.wkbIsClosed");
+}
+str wkbIsEmpty_bat(bat *outBAT_id, bat *inBAT_id) {
+ return wkbBitOut_bat(outBAT_id, inBAT_id, wkbIsEmpty,
"batgeom.wkbIsEmpty");
+}
/*******************************/
/********* Two inputs **********/
diff --git a/geom/sql/Tests/functions/Tests/All
b/geom/sql/Tests/functions/Tests/All
--- a/geom/sql/Tests/functions/Tests/All
+++ b/geom/sql/Tests/functions/Tests/All
@@ -14,7 +14,9 @@ loadTestGeometries
ST_AsText
ST_IsClosed
-#isSimple
+#ST_IsSimple
+ST_IsEmpty
+
#isValid
#isRing
#coordinates
diff --git a/geom/sql/Tests/functions/Tests/isEmpty.sql
b/geom/sql/Tests/functions/Tests/ST_IsEmpty.sql
rename from geom/sql/Tests/functions/Tests/isEmpty.sql
rename to geom/sql/Tests/functions/Tests/ST_IsEmpty.sql
--- a/geom/sql/Tests/functions/Tests/isEmpty.sql
+++ b/geom/sql/Tests/functions/Tests/ST_IsEmpty.sql
@@ -1,3 +1,5 @@
SELECT ST_IsEmpty(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'));
SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))'));
SELECT ST_IsEmpty(ST_GeomFromText('LINESTRING EMPTY'));
+
+SELECT geom AS "GEOMETRY" FROM geometries WHERE ST_IsEmpty(geom);
diff --git a/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.err
b/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.err
new file mode 100644
--- /dev/null
+++ b/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.err
@@ -0,0 +1,36 @@
+stderr of test 'ST_IsEmpty` in directory 'geom/sql/Tests/functions` itself:
+
+
+# 13:55:10 >
+# 13:55:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=31132" "--set"
"mapi_usock=/var/tmp/mtest-32588/.s.monetdb.31132" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions"
"--set" "mal_listing=0"
+# 13:55:10 >
+
+# builtin opt gdk_dbpath =
/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 31132
+# cmdline opt mapi_usock = /var/tmp/mtest-32588/.s.monetdb.31132
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions
+# cmdline opt mal_listing = 0
+# cmdline opt gdk_debug = 536870922
+
+# 13:55:10 >
+# 13:55:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-32588" "--port=31132"
+# 13:55:10 >
+
+
+# 13:55:11 >
+# 13:55:11 > "Done."
+# 13:55:11 >
+
diff --git a/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.out
b/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.out
new file mode 100644
--- /dev/null
+++ b/geom/sql/Tests/functions/Tests/ST_IsEmpty.stable.out
@@ -0,0 +1,55 @@
+stdout of test 'ST_IsEmpty` in directory 'geom/sql/Tests/functions` itself:
+
+
+# 13:55:10 >
+# 13:55:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=31132" "--set"
"mapi_usock=/var/tmp/mtest-32588/.s.monetdb.31132" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions"
"--set" "mal_listing=0"
+# 13:55:10 >
+
+# MonetDB 5 server v11.20.0
+# This is an unreleased version
+# Serving database 'mTests_geom_sql_Tests_functions', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit
integers dynamically linked
+# Found 15.356 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://sibuyan.da.cwi.nl:31132/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-32588/.s.monetdb.31132
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 13:55:10 >
+# 13:55:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-32588" "--port=31132"
+# 13:55:10 >
+
+#SELECT ST_IsEmpty(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'));
+% .L # table_name
+% st_geomfromtext_single_value # name
+% boolean # type
+% 5 # length
+[ true ]
+#SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))'));
+% .L # table_name
+% st_geomfromtext_single_value # name
+% boolean # type
+% 5 # length
+[ false ]
+#SELECT ST_IsEmpty(ST_GeomFromText('LINESTRING EMPTY'));
+% .L # table_name
+% st_geomfromtext_single_value # name
+% boolean # type
+% 5 # length
+[ true ]
+#SELECT geom AS "GEOMETRY" FROM geometries WHERE ST_IsEmpty(geom);
+% sys.L # table_name
+% GEOMETRY # name
+% geometry # type
+% 0 # length
+[ "MULTIPOLYGON EMPTY" ]
+
+# 13:55:11 >
+# 13:55:11 > "Done."
+# 13:55:11 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list