Changeset: d4577d235e81 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d4577d235e81
Modified Files:
        gdk/gdk_atoms.c
        monetdb5/optimizer/opt_support.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_optimizer.c
        sql/backends/monet5/sql_result.mx
        sql/backends/monet5/sql_scenario.c
Branch: headless
Log Message:

Merge with default branch.


diffs (truncated from 2420 to 300 lines):

diff --git a/clients/ChangeLog.Aug2011 b/clients/ChangeLog.Aug2011
--- a/clients/ChangeLog.Aug2011
+++ b/clients/ChangeLog.Aug2011
@@ -1,3 +1,8 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Tue Sep 13 2011 Sjoerd Mullender <[email protected]>
+- mclient: fix display of varchar columns with only NULL values.
+- Fixed a bug in mclient/msqldump where an internal error occurred during
+  dump when there are GLOBAL TEMPORARY tables.
+
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1522,7 +1522,8 @@ dump_database(Mapi mid, stream *toConsol
                             "\"sys\".\"_tables\" \"t\" "
                        "WHERE \"t\".\"type\" BETWEEN 0 AND 1 AND "
                              "\"t\".\"system\" = FALSE AND "
-                             "\"s\".\"id\" = \"t\".\"schema_id\" "
+                             "\"s\".\"id\" = \"t\".\"schema_id\" AND "
+                             "\"s\".\"name\" <> 'tmp' "
                        "UNION "
                        "SELECT \"s\".\"name\" AS \"sname\", "
                               "\"tr\".\"name\" AS \"name\", "
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1069,9 +1069,15 @@ SQLrenderer(MapiHdl hdl, char singleinst
                char *s;
 
                len[i] = mapi_get_len(hdl, i);
-               if (len[i] == 0) {
-                       /* no table width known, use maximum, rely on squeezing
-                        * lateron to fix it to whatever is available */
+               if (len[i] == 0 &&
+                   ((s = mapi_get_type(hdl, i)) == NULL ||
+                    strcmp(s, "varchar") != 0)) {
+                       /* no table width known, use maximum, rely on
+                        * squeezing later on to fix it to whatever is
+                        * available; note that for a column type of
+                        * varchar, 0 means the complete column is
+                        * NULL or empty string, so MINCOLSIZE (below)
+                        * will work great */
                        len[i] = pagewidth <= 0 ? DEFWIDTH : pagewidth;
                }
                if (len[i] < MINCOLSIZE)
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1321,7 +1321,7 @@ strPut(Heap *h, var_t *dst, const char *
                memset((char *) h->base + h->free, 0, h->size - h->free);
 #endif
 
-               /* make bucket point into the enw heap */
+               /* make bucket point into the new heap */
                bucket = ((stridx_t *) h->base) + off;
        }
 
diff --git a/monetdb5/modules/mal/sample.c b/monetdb5/modules/mal/sample.c
--- a/monetdb5/modules/mal/sample.c
+++ b/monetdb5/modules/mal/sample.c
@@ -151,3 +151,23 @@ SAMPLEuniform(bat *r, bat *b, ptr s) {
        throw(MAL, "sample.uniform", OPERATION_FAILED "bunfastins");
 }
 
+sample_export str
+SAMPLEuniform_dbl(bat *r, bat *b, ptr p) {
+       BAT *bb;
+       double pr = *(double *)p;
+       wrd s;
+
+       if ( pr < 0.0 || pr > 1.0 ) {
+               throw(MAL, "sample.uniform", ILLEGAL_ARGUMENT " p should be 
between 0 and 1.0" );
+       } else if (pr == 0) {/* special case */
+               s = 0;
+               return SAMPLEuniform(r, b, (ptr)&s);
+       }
+
+       if ((bb = BATdescriptor(*b)) == NULL) {
+               throw(MAL, "sample.uniform", INTERNAL_BAT_ACCESS);
+       }
+       s = (wrd) (pr*(double)BATcount(bb));
+       BBPunfix(bb->batCacheid);
+       return SAMPLEuniform(r, b, (ptr) &s);
+}
diff --git a/monetdb5/modules/mal/sample.h b/monetdb5/modules/mal/sample.h
--- a/monetdb5/modules/mal/sample.h
+++ b/monetdb5/modules/mal/sample.h
@@ -43,4 +43,7 @@
 sample_export str
 SAMPLEuniform(bat *r, bat *b, ptr s);
 
+sample_export str
+SAMPLEuniform_dbl(bat *r, bat *b, ptr p);
+
 #endif
diff --git a/monetdb5/modules/mal/sample.mal b/monetdb5/modules/mal/sample.mal
--- a/monetdb5/modules/mal/sample.mal
+++ b/monetdb5/modules/mal/sample.mal
@@ -26,3 +26,7 @@ module sample;
 command uniform(b:bat[:oid,:any],s:wrd):bat[:oid,:any]
 address SAMPLEuniform
 comment "Returns a uniform sample of size s"
+
+command uniform(b:bat[:oid,:any],p:dbl):bat[:oid,:any]
+address SAMPLEuniform_dbl
+comment "Returns a uniform sample of size = (p x count(b)), where 0 <= p <= 
1.0"
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -1189,7 +1189,7 @@ hasSideEffects(InstrPtr p, int strict)
                /* the update instructions for SQL has side effects.
                   whether this is relevant should be explicitly checked
                   in the environment of the call */
-               if (isUpdateInstruction(p)) return FALSE;
+               if (isUpdateInstruction(p)) return TRUE;
                return TRUE;
        }
        if( getModuleId(p) == languageRef){
diff --git a/sql/ChangeLog.Aug2011 b/sql/ChangeLog.Aug2011
--- a/sql/ChangeLog.Aug2011
+++ b/sql/ChangeLog.Aug2011
@@ -1,3 +1,11 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Fri Sep 16 2011 Sjoerd Mullender <[email protected]>
+- A bug was fixed where deleted rows weren't properly accounted for in
+  all operations.  This was bug 2882.
+- A bug was fixed which caused an update to an internal table to
+  happen too soon.  The bug could be observed on a multicore system
+  with a query INSERT INTO t (SELECT * FROM t) when the table t is
+  "large enough".  This was bug 2883.
+
diff --git a/sql/backends/monet5/LSST/Tests/All 
b/sql/backends/monet5/LSST/Tests/All
--- a/sql/backends/monet5/LSST/Tests/All
+++ b/sql/backends/monet5/LSST/Tests/All
@@ -1,1 +1,2 @@
+lsst
 lsst_htmxmatch
diff --git a/sql/backends/monet5/LSST/Tests/lsst.sql.src 
b/sql/backends/monet5/LSST/Tests/lsst.sql.src
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/LSST/Tests/lsst.sql.src
@@ -0,0 +1,1 @@
+$RELSRCDIR/../lsst.sql
diff --git a/sql/backends/monet5/LSST/Tests/lsst.stable.err 
b/sql/backends/monet5/LSST/Tests/lsst.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/LSST/Tests/lsst.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'lsst` in directory 'backends/monet5/LSST` itself:
+
+
+# 19:55:25 >  
+# 19:55:25 >   mserver5  --debug=10 --set gdk_nr_threads=4  --set 
"gdk_dbfarm=/home/niels/scratch/monetdb/Linux-x86_64/var/MonetDB" --set 
mapi_open=true --set mapi_port=37236 --set monet_prompt= --trace --forcemito 
--set mal_listing=2  "--dbname=mTests_backends_monet5_LSST" --set mal_listing=0 
; echo ; echo Over..
+# 19:55:25 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = 
/home/niels/scratch/monetdb/Linux-x86_64/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# 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 = 4
+# cmdline opt  gdk_dbfarm = 
/home/niels/scratch/monetdb/Linux-x86_64/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 37236
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_backends_monet5_LSST
+# cmdline opt  mal_listing = 0
+
+# 19:55:25 >  
+# 19:55:25 >  mclient -lsql -ftest -i -e --host=niels --port=37236 
+# 19:55:25 >  
+
+
+# 19:55:26 >  
+# 19:55:26 >  Done.
+# 19:55:26 >  
+
diff --git a/sql/backends/monet5/LSST/Tests/lsst.stable.out 
b/sql/backends/monet5/LSST/Tests/lsst.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/LSST/Tests/lsst.stable.out
@@ -0,0 +1,64 @@
+stdout of test 'lsst` in directory 'backends/monet5/LSST` itself:
+
+
+# 19:55:25 >  
+# 19:55:25 >   mserver5  --debug=10 --set gdk_nr_threads=4  --set 
"gdk_dbfarm=/home/niels/scratch/monetdb/Linux-x86_64/var/MonetDB" --set 
mapi_open=true --set mapi_port=37236 --set monet_prompt= --trace --forcemito 
--set mal_listing=2  "--dbname=mTests_backends_monet5_LSST" --set mal_listing=0 
; echo ; echo Over..
+# 19:55:25 >  
+
+# MonetDB 5 server v11.6.0
+# This is an unreleased version
+# Serving database 'mTests_backends_monet5_LSST', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.788 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:37236/
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/09_like.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/10_math.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/11_times.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/12_url.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/13_date.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/14_inet.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/15_history.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/16_tracelog.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/17_compress.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/18_dictionary.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/19_cluster.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/20_vacuum.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/21_dependency_functions.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/22_clients.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/23_skyserver.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/24_zorder.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/25_debug.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/40_geom.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/80_udf.sql
+# SQL loading sql scripts 
/home/niels/scratch/monetdb/Linux-x86_64/lib/monetdb5/createdb/99_system.sql
+
+Over..
+
+# 19:55:25 >  
+# 19:55:25 >  mclient -lsql -ftest -i -e --host=niels --port=37236 
+# 19:55:25 >  
+
+#create function angSep(ra1 double, dec1 double, ra2 double, dec2 double)
+#returns double external name lsst.angsep;
+#create function ptInSphBox(ra1 double, dec1 double, ra_min double,  dec_min 
double, ra_max double, dec_max double)
+#returns int external name lsst.ptinsphbox;
+#create function ptInSphEllipse(ra1 double, dec1 double , ra_cen double, 
dec_cen double, smaa double, smia double, ang double) 
+#returns int external name lsst.ptinsphellipse;
+#create function ptInSphCircle(ra1 double, dec1 double, ra_cen double, dec_cen 
double, radius double) 
+#returns int external name lsst.ptinsphcircle;
+#create function ptInSphPoly(ra1 double, dec1 double, list double)
+#returns int external name lsst.ptinsphpoly;
+#create filter function xmatch(a bigint, b bigint, opt int) external name 
lsst.xmatch;
+
+# 19:55:26 >  
+# 19:55:26 >  Done.
+# 19:55:26 >  
+
diff --git a/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.stable.out 
b/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.stable.out
--- a/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.stable.out
+++ b/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.stable.out
@@ -22,13 +22,37 @@ Ready.
 
 Over..
 
-# 10:09:12 >  
-# 10:09:12 >  mclient -lsql -ftest -i -e --host=rig --port=33762 
-# 10:09:12 >  
+# 21:23:59 >  
+# 21:23:59 >  mclient -lsql -ftest -i -e --host=niels --port=37399 
+# 21:23:59 >  
 
-! to be checked / approved !
+#create table htm( id BIGINT);
+#insert into htm values (100), (101), (102), (103);
+[ 4    ]
+#insert into htm values (110), (111), (112), (113);
+[ 4    ]
+#insert into htm values (120), (121), (122), (123);
+[ 4    ]
+#insert into htm values (130), (131), (132), (133);
+[ 4    ]
+#select  * from htm a, htm b where a.id xmatch(0) b.id;
+% sys.a,       sys.b # table_name
+% id,  id # name
+% bigint,      bigint # type
+% 3,   3 # length
+[ 100, 100     ]
+#select  * from htm a, htm b where a.id xmatch(1) b.id;
+% sys.a,       sys.b # table_name
+% id,  id # name
+% bigint,      bigint # type
+% 3,   3 # length
+[ 100, 100     ]
+[ 101, 100     ]
+[ 102, 100     ]
+[ 103, 100     ]
+#drop table htm;
 
-# 10:09:12 >  
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to