Changeset: b5eef0268fda for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5eef0268fda
Modified Files:
        
Branch: default
Log Message:

Merged from Apr2011


diffs (truncated from 463 to 300 lines):

diff --git a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.err 
b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.err
--- a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.err
+++ b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.err
@@ -10,13 +10,14 @@
 # 11:37:42 >  mclient -lsql -umonetdb -Pmonetdb --host=alf --port=30423 
 # 11:37:42 >  
 
-MAPI  = monetdb@rig:30424
+MAPI  = monetdb@alf:35630
 QUERY = COPY 1 RECORDS INTO nodes from STDIN USING DELIMITERS ',', '\n';
-ERROR = !SQLException:sql:value ''POINT(52.0697 4.3723)'' while parsing 
''POINT(52.0697 4.3723)'' from line 0 field 1 not inserted, expecting type wkb
-        !SQLException:importTable:failed to import table
-        !ERROR: ParseException: Unknown type: ''POINT'
+        45111956, 'POINT(52.0697 4.3723)'
+        
+ERROR = !SQLException:importTable:value ' 'POINT(52.0697 4.3723)'' from line 1 
field 2 not inserted, expecting type point
+        !failed to import table
 
-# 11:37:42 >  
-# 11:37:42 >  Done.
-# 11:37:42 >  
+# 13:33:18 >  
+# 13:33:18 >  Done.
+# 13:33:18 >  
 
diff --git a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out 
b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
--- a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
+++ b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
@@ -15,6 +15,7 @@
 
 
 Ready.
+!ERROR: ParseException: Unknown type: ''POINT'
 
 Over..
 
diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx
--- a/geom/monetdb5/geom.mx
+++ b/geom/monetdb5/geom.mx
@@ -1197,7 +1197,7 @@
                throw(MAL, "geom.@1", "wkb2geos(*a) and wkb2geos(*b) both 
failed");
        }
 
-       *out = @2(ga, gb, @4);
+       *out = @2(ga, gb, * @4);
 
        GEOSGeom_destroy(ga);
        GEOSGeom_destroy(gb);
@@ -1213,7 +1213,7 @@
 @:spatial(Within,GEOSWithin)@
 @:spatial(Contains,GEOSContains)@
 @:spatial(Overlaps,GEOSOverlaps)@
-@:spatial2(Relate,GEOSRelatePattern,char*,pattern)@
+@:spatial2(Relate,GEOSRelatePattern,str*,pattern)@
 
 @= analysis
 geom_export str
diff --git a/geom/sql/Tests/relation.sql b/geom/sql/Tests/relation.sql
--- a/geom/sql/Tests/relation.sql
+++ b/geom/sql/Tests/relation.sql
@@ -24,4 +24,6 @@
 
 SELECT a.g, b.g, Relate(a.g,b.g,'Touches') FROM geoms a, geoms b where a.g is 
not NULL and b.g is not NULL;
 
+SELECT a.g, b.g, Relate(a.g,b.g,'*F**T**F*') FROM geoms a, geoms b where a.g 
is not NULL and b.g is not NULL;
+
 DROP TABLE geoms;
diff --git a/geom/sql/Tests/relation.stable.err 
b/geom/sql/Tests/relation.stable.err
--- a/geom/sql/Tests/relation.stable.err
+++ b/geom/sql/Tests/relation.stable.err
@@ -10,34 +10,38 @@
 # 22:42:46 >  Mtimeout -timeout 60 MapiClient -lsql -umonetdb -Pmonetdb 
--host=koala --port=32262 
 # 22:42:46 >  
 
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING(10 10)');
 ERROR = !MALException:wkb.FromText:IllegalArgumentException: point array must 
contain 0 or >1 elements
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING(10)');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING()');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT(10)');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT()');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:30183
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-# 20:50:35 >  
-# 20:50:35 >  Done.
-# 20:50:35 >  
+MAPI  = monetdb@alf:33463
+QUERY = SELECT a.g, b.g, Relate(a.g,b.g,'Touches') FROM geoms a, geoms b where 
a.g is not NULL and b.g is not NULL;
+ERROR = !MALException:!ERROR: IllegalArgumentException: 
IllegalArgumentException: Should be length 9, is [Touches] instead
 
+# 14:48:45 >  
+# 14:48:45 >  Done.
+# 14:48:45 >  
+
diff --git a/geom/sql/Tests/relation.stable.out 
b/geom/sql/Tests/relation.stable.out
--- a/geom/sql/Tests/relation.stable.out
+++ b/geom/sql/Tests/relation.stable.out
@@ -85,20 +85,20 @@
 % g,   g,      relate_g # name
 % geometry,    geometry,       boolean # type
 % 0,   0,      5 # length
-[ "POINT (10 10)",     "POINT (10 10)",        true    ]
-[ "POINT (10 10)",     "LINESTRING (10 10, 20 20, 30 40)",     true    ]
-[ "POINT (10 10)",     "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",        
true    ]
-[ "POINT (10 10)",     "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 
15 20, 10 15, 15 15))",  true    ]
-[ "LINESTRING (10 10, 20 20, 30 40)",  "POINT (10 10)",        true    ]
+[ "POINT (10 10)",     "POINT (10 10)",        false   ]
+[ "POINT (10 10)",     "LINESTRING (10 10, 20 20, 30 40)",     false   ]
+[ "POINT (10 10)",     "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",        
false   ]
+[ "POINT (10 10)",     "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 
15 20, 10 15, 15 15))",  false   ]
+[ "LINESTRING (10 10, 20 20, 30 40)",  "POINT (10 10)",        false   ]
 [ "LINESTRING (10 10, 20 20, 30 40)",  "LINESTRING (10 10, 20 20, 30 40)",     
true    ]
-[ "LINESTRING (10 10, 20 20, 30 40)",  "POLYGON ((10 10, 10 20, 20 20, 20 15, 
10 10))",        true    ]
-[ "LINESTRING (10 10, 20 20, 30 40)",  "POLYGON ((10 10, 10 20, 20 20, 20 15, 
10 10), (15 15, 15 20, 10 15, 15 15))",  true    ]
-[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "POINT (10 10)",        
true    ]
-[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "LINESTRING (10 10, 20 
20, 30 40)",     true    ]
+[ "LINESTRING (10 10, 20 20, 30 40)",  "POLYGON ((10 10, 10 20, 20 20, 20 15, 
10 10))",        false   ]
+[ "LINESTRING (10 10, 20 20, 30 40)",  "POLYGON ((10 10, 10 20, 20 20, 20 15, 
10 10), (15 15, 15 20, 10 15, 15 15))",  false   ]
+[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "POINT (10 10)",        
false   ]
+[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "LINESTRING (10 10, 20 
20, 30 40)",     false   ]
 [ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "POLYGON ((10 10, 10 
20, 20 20, 20 15, 10 10))",        true    ]
-[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "POLYGON ((10 10, 10 
20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 15))",  true    ]
-[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "POINT (10 10)",        true    ]
-[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "LINESTRING (10 10, 20 20, 30 40)",     true    ]
+[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",     "POLYGON ((10 10, 10 
20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 15))",  false   ]
+[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "POINT (10 10)",        false   ]
+[ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "LINESTRING (10 10, 20 20, 30 40)",     false   ]
 [ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))",        true    ]
 [ "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 15, 15 
15))",       "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10), (15 15, 15 20, 10 
15, 15 15))",  true    ]
 
diff --git a/geom/sql/Tests/spatial.stable.err 
b/geom/sql/Tests/spatial.stable.err
--- a/geom/sql/Tests/spatial.stable.err
+++ b/geom/sql/Tests/spatial.stable.err
@@ -10,31 +10,31 @@
 # 22:58:03 >  Mtimeout -timeout 60 MapiClient -lsql -umonetdb -Pmonetdb 
--host=koala --port=35790 
 # 22:58:03 >  
 
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING(10 10)');
 ERROR = !MALException:wkb.FromText:IllegalArgumentException: point array must 
contain 0 or >1 elements
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING(10)');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING()');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('LINESTRING');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT(10)');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT()');
 ERROR = !MALException:wkb.FromText:ParseException: Expected number but 
encountered ')'
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('POINT');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
-MAPI  = monetdb@koolmees:38689
+MAPI  = monetdb@alf:33463
 QUERY = INSERT INTO geoms values ('');
 ERROR = !MALException:wkb.FromText:ParseException: Expected word but 
encountered end of stream
 
diff --git a/geom/sql/Tests/spatial.stable.out 
b/geom/sql/Tests/spatial.stable.out
--- a/geom/sql/Tests/spatial.stable.out
+++ b/geom/sql/Tests/spatial.stable.out
@@ -52,10 +52,11 @@
 % area_g,      length_g,       buffer_g,       convexhull_g # name
 % double,      double, geometry,       geometry # type
 % 22,  22,     0,      0 # length
-[ 0,   0,      "POLYGON ((12 10, 10 8, 8 10, 10 12, 12 10))",  "POINT (10 10)" 
]
-[ 0,   36.502815398728849,     "POLYGON ((18.35629117 21.18471829, 28.21114562 
40.89442719, 28.21114562 40.89442719, 30.89442719 41.78885438, 31.78885438 
39.10557281, 21.78885438 19.10557281, 21.41421356 18.58578644, 11.41421356 
8.585786438, 11.41421356 8.585786438, 8.585786438 8.585786438, 8.585786438 
11.41421356, 18.35629117 21.18471829))",       "POLYGON ((10 10, 30 40, 20 20, 
10 10))"        ]
-[ 75,  36.180339887498945,     "POLYGON ((10.89442719 8.211145618, 10.89442719 
8.211145618, 8 10, 8 20, 10 22, 20 22, 22 20, 22 15, 20.89442719 13.21114562, 
10.89442719 8.211145618))",       "POLYGON ((10 10, 10 20, 20 20, 20 15, 10 
10))" ]
-[ 62.5,        53.251407699364421,     "POLYGON ((10.89442719 8.211145618, 
10.89442719 8.211145618, 8 10, 8 20, 10 22, 20 22, 22 20, 22 15, 20.89442719 
13.21114562, 10.89442719 8.211145618))",       "POLYGON ((10 10, 10 20, 20 20, 
20 15, 10 10))" ]
+[ 0,   0,      "POLYGON ((12 10, 11.96157056 9.609819356, 11.84775907 
9.234633135, 11.66293922 8.888859534, 11.41421356 8.585786438, 11.11114047 
8.337060775, 10.76536686 8.152240935, 10.39018064 8.038429439, 10 8, 
9.609819356 8.038429439, 9.234633135 8.152240935, 8.888859534 8.337060775, 
8.585786438 8.585786438, 8.337060775 8.888859534, 8.152240935 9.234633135, 
8.038429439 9.609819356, 8 10, 8.038429439 10.39018064, 8.152240935 
10.76536686, 8.337060775 11.11114047, 8.585786438 11.41421356, 8.888859534 
11.66293922, 9.234633135 11.84775907, 9.609819356 11.96157056, 10 12, 
10.39018064 11.96157056, 10.76536686 11.84775907, 11.11114047 11.66293922, 
11.41421356 11.41421356, 11.66293922 11.11114047, 11.84775907 10.76536686, 
11.96157056 10.39018064, 12 10))",      "POINT (10 10)" ]
+[ 0,   36.5028154,     "POLYGON ((18.35629117 21.18471829, 28.21114562 
40.89442719, 28.42001204 41.2262292, 28.68959652 41.51090791, 29.00953906 
41.73752328, 29.36754447 41.8973666, 29.74985478 41.98429518, 30.14177804 
41.99496842, 30.52825285 41.92897614, 30.89442719 41.78885438, 31.2262292 
41.57998796, 31.51090791 41.31040348, 31.73752328 40.99046094, 31.8973666 
40.63245553, 31.98429518 40.25014522, 31.99496842 39.85822196, 31.92897614 
39.47174715, 31.78885438 39.10557281, 21.63758456 18.85152983, 21.60738418 
18.80962903, 11.41421356 8.585786438, 11.11114047 8.337060775, 10.76536686 
8.152240935, 10.39018064 8.038429439, 10 8, 9.609819356 8.038429439, 
9.234633135 8.152240935, 8.888859534 8.337060775, 8.585786438 8.585786438, 
8.337060775 8.888859534, 8.152240935 9.234633135, 8.038429439 9.609819356, 8 
10, 8.038429439 10.39018064, 8.152240935 10.76536686, 8.337060775 11.11114047, 
8.585786438 11.41421356, 18.35629117 21.18471829))",       "POLYGON ((10 10, 30 
40, 20 20, 10 10))"        ]
+[ 75,  36.18033989,    "POLYGON ((9.755412201 7.800022564, 8.14166335 
8.797374203, 8.171572875 21, 9 21.82842712, 21 21.82842712, 21.82842712 21, 
21.85833665 14.2026258, 21.54426658 13.69444975, 9.755412201 7.800022564))", 
"POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))" ]
+[ 62.5,        53.2514077,     "POLYGON ((9.755412201 7.800022564, 8.14166335 
8.797374203, 8.171572875 21, 9 21.82842712, 21 21.82842712, 21.82842712 21, 
21.85833665 14.2026258, 21.54426658 13.69444975, 9.755412201 7.800022564))", 
"POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))" ]
+#SELECT a.g, b.g, Distance(a.g,b.g), Intersection(a.g,b.g), "Union"(a.g,b.g), 
Difference(a.g,b.g), SymDifference(a.g,b.g) FROM geoms a, geoms b where a.g is 
not NULL and b.g is not NULL;
 % sys.a,       sys.b,  sys.,   sys.,   sys.,   sys.,   sys. # table_name
 % g,   g,      distance_g,     intersection_g, Union_g,        difference_g,   
symdifference_g # name
 % geometry,    geometry,       double, geometry,       geometry,       
geometry,       geometry # type
diff --git a/sql/common/sql_mem.c b/sql/common/sql_mem.c
--- a/sql/common/sql_mem.c
+++ b/sql/common/sql_mem.c
@@ -157,3 +157,17 @@
 { 
        return sa_strndup( sa, s, strlen(s));
 }
+
+char *sa_strconcat( sql_allocator *sa, const char *s1, const char *s2 )
+{
+       size_t l1 = strlen(s1);
+       size_t l2 = strlen(s2);
+       char *r = sa_alloc(sa, l1+l2+1);
+
+       if (l1) 
+               memcpy(r, s1, l1);
+       if (l2)
+               memcpy(r+l1, s2, l2);
+       r[l1+l2] = 0;
+       return r;
+}
diff --git a/sql/include/sql_mem.h b/sql/include/sql_mem.h
--- a/sql/include/sql_mem.h
+++ b/sql/include/sql_mem.h
@@ -79,6 +79,7 @@
 extern void sa_destroy( sql_allocator *sa );
 extern char *sa_strndup( sql_allocator *sa, const char *s, size_t l);
 extern char *sa_strdup( sql_allocator *sa, const char *s);
+extern char *sa_strconcat( sql_allocator *sa, const char *s1, const char *s2);
 
 #define SA_NEW( sa, type ) ((type*)sa_alloc( sa, sizeof(type)) )
 #define SA_ZNEW( sa, type ) ((type*)sa_zalloc( sa, sizeof(type)) )
diff --git a/sql/server/rel_bin.c b/sql/server/rel_bin.c
--- a/sql/server/rel_bin.c
+++ b/sql/server/rel_bin.c
@@ -483,12 +483,13 @@
                        sql_idx *i = p->value;
                        sql_exp *el = e->l;
                        sql_exp *er = e->r;
+                       char *iname = sa_strconcat(sql->sa, "%", i->base.name);
 
                        /* find out left and right */
-                       l = bin_find_column(sql->sa, left, el->l, i->base.name);
+                       l = bin_find_column(sql->sa, left, el->l, iname);
                        if (!l) {
                                swapped = 1;
-                               l = bin_find_column(sql->sa, right, el->l, 
i->base.name);
+                               l = bin_find_column(sql->sa, right, el->l, 
iname);
                                r = bin_find_column(sql->sa, left, er->l, TID);
                        } else {
                                r = bin_find_column(sql->sa, right, er->l, TID);
@@ -698,7 +699,8 @@
                        sql_idx *i = n->data;
                        stmt *sc = stmt_idxbat(sql->sa, i, RDONLY);
 
-                       sc = stmt_alias(sql->sa, sc, rnme, sa_strdup(sql->sa, 
i->base.name));
+                       /* index names are prefixed, to make them independent */
+                       sc = stmt_alias(sql->sa, sc, rnme, 
sa_strconcat(sql->sa, "%", i->base.name));
                        list_append(l, sc);
                }
        }
@@ -745,7 +747,8 @@
                        stmt *sc = stmt_idxbat(sql->sa, i, RDONLY);
                        char *rnme = sa_strdup(sql->sa, t->base.name);
 
-                       sc = stmt_alias(sql->sa, sc, rnme, sa_strdup(sql->sa, 
i->base.name));
+                       /* index names are prefixed, to make them independent */
+                       sc = stmt_alias(sql->sa, sc, rnme, 
sa_strconcat(sql->sa, "%", i->base.name));
                        list_append(l, sc);
                }
        }
@@ -1588,7 +1591,7 @@
        stmt *bits = stmt_atom_int(sql->sa, 1 + 
((sizeof(wrd)*8)-1)/(list_length(i->columns)+1));
        sql_exp *e = en->data;
        sql_exp *l = e->l;
-       stmt *idx = bin_find_column(sql->sa, sub, l->l, i->base.name);
+       stmt *idx = bin_find_column(sql->sa, sub, l->l, sa_strconcat(sql->sa, 
"%", i->base.name));
 
        /* TODO should be in key order! */
        for( en = rel->exps->h; en; en = en->next ) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to