MonetDB: default - moved the alter table add/del table and alter...

2015-05-16 Thread Niels Nes
Changeset: ecd08de36217 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ecd08de36217
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql.mal
sql/include/sql_relation.h
sql/server/rel_schema.c
sql/storage/store.c
sql/test/BugTracker-2015/Tests/adddrop_unknown_table.Bug-3718.stable.err
sql/test/mergetables/Tests/doubletable.stable.err
sql/test/mergetables/Tests/mergedropcrash.stable.err
Branch: default
Log Message:

moved the alter table add/del table and alter table set read/append only 
/writable to the mal part only. Reduces a lot of copying of table-structures.
only flush log changes after 1M changes.


diffs (truncated from 540 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -40509,6 +40509,14 @@ pattern sql.clear_table{unsafe}(sname:st
 address mvc_clear_table_wrap;
 comment Clear table
 
+pattern 
sql.catalog(type:int,msname:str,mtname:str,psname:str,ptname:str,action:int):void
 
+address SQLcatalog;
+comment a alter table add/del table catalog statement
+
+pattern sql.catalog(type:int,sname:str,tname:str,access:int):void 
+address SQLcatalog;
+comment a alter table access statement
+
 pattern sql.catalog(type:int,iname:str,itype:int,sname:str,tname:str...):void 
 address SQLcatalog;
 comment a create index catalog statement
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -51444,6 +51444,14 @@ pattern sql.clear_table{unsafe}(sname:st
 address mvc_clear_table_wrap;
 comment Clear table
 
+pattern 
sql.catalog(type:int,msname:str,mtname:str,psname:str,ptname:str,action:int):void
 
+address SQLcatalog;
+comment a alter table add/del table catalog statement
+
+pattern sql.catalog(type:int,sname:str,tname:str,access:int):void 
+address SQLcatalog;
+comment a alter table access statement
+
 pattern sql.catalog(type:int,iname:str,itype:int,sname:str,tname:str...):void 
 address SQLcatalog;
 comment a create index catalog statement
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4371,7 +4371,7 @@ rel2bin_ddl(mvc *sql, sql_rel *rel, list
} else if (rel-flag = DDL_ALTER_TABLE) {
s = rel2bin_catalog_table(sql, rel, refs);
sql-type = Q_SCHEMA;
-   } else if (rel-flag = DDL_DROP_ROLE) {
+   } else if (rel-flag = DDL_ALTER_TABLE_SET_ACCESS) {
s = rel2bin_catalog2(sql, rel, refs);
sql-type = Q_SCHEMA;
}
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -516,29 +516,6 @@ alter_table(mvc *sql, char *sname, sql_t
}
}
 
-   if (t-access != nt-access) {
-   if (t-access  table_has_updates(sql-session-tr, nt)) 
-   return sql_message(4!ALTER TABLE: set READ or 
INSERT ONLY not possible with outstanding updates (wait until updates are 
flushed)\n);
-   mvc_access(sql, nt, t-access);
-   }
-
-   /* check for changes */
-   if (t-tables.dset)
-   for (n = t-tables.dset-h; n; n = n-next) {
-   /* propagate alter table .. drop table */
-   sql_table *at = n-data;
-   sql_table *pt = mvc_bind_table(sql, nt-s, 
at-base.name);
-
-   sql_trans_del_table(sql-session-tr, nt, pt, 
at-drop_action);
-   }
-   for (n = t-tables.nelm; n; n = n-next) {
-   /* propagate alter table .. add table */
-   sql_table *at = n-data;
-   sql_table *pt = mvc_bind_table(sql, nt-s, at-base.name);
-
-   sql_trans_add_table(sql-session-tr, nt, pt);
-   }
-
/* check for changes */
if (t-columns.dset)
for (n = t-columns.dset-h; n; n = n-next) {
@@ -1042,6 +1019,108 @@ drop_trigger(mvc *sql, char *sname, char
 }
 
 static char *
+rel_check_tables(sql_table *nt, sql_table *nnt)
+{
+   node *n, *m;
+
+   if (cs_size(nt-columns) != cs_size(nnt-columns)) 
+   return sql_message(3F000!ALTER MERGE TABLE: to be added table 
doesn't match MERGE TABLE definition);
+   for (n = nt-columns.set-h, m = nnt-columns.set-h; n  m; n = 
n-next, m = m-next) {
+   sql_column *nc = n-data;
+   sql_column *mc = m-data;
+
+   if (subtype_cmp(nc-type, mc-type) != 0) 
+   return 

MonetDB: default - use inplace converts also for atom's within t...

2015-05-16 Thread Niels Nes
Changeset: 461f6af0705a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=461f6af0705a
Modified Files:
sql/benchmarks/ssbm/Tests/01-plan.stable.out
sql/benchmarks/ssbm/Tests/02-plan.stable.out
sql/benchmarks/ssbm/Tests/03-plan.stable.out
sql/benchmarks/ssbm/Tests/04-plan.stable.out
sql/benchmarks/ssbm/Tests/05-plan.stable.out
sql/benchmarks/ssbm/Tests/06-plan.stable.out
sql/benchmarks/ssbm/Tests/07-plan.stable.out
sql/benchmarks/ssbm/Tests/08-plan.stable.out
sql/benchmarks/ssbm/Tests/09-plan.stable.out
sql/benchmarks/ssbm/Tests/10-plan.stable.out
sql/benchmarks/ssbm/Tests/11-plan.stable.out
sql/benchmarks/ssbm/Tests/12-plan.stable.out
sql/benchmarks/ssbm/Tests/13-plan.stable.out
sql/benchmarks/tpch/Tests/02-plan.stable.out
sql/benchmarks/tpch/Tests/03-plan.stable.out
sql/benchmarks/tpch/Tests/03-plan.stable.out.int128
sql/benchmarks/tpch/Tests/05-plan.stable.out
sql/benchmarks/tpch/Tests/05-plan.stable.out.int128
sql/benchmarks/tpch/Tests/07-plan.stable.out.int128
sql/benchmarks/tpch/Tests/08-plan.stable.out
sql/benchmarks/tpch/Tests/08-plan.stable.out.int128
sql/benchmarks/tpch/Tests/09-plan.stable.out
sql/benchmarks/tpch/Tests/09-plan.stable.out.int128
sql/benchmarks/tpch/Tests/11-plan.stable.out
sql/benchmarks/tpch/Tests/11-plan.stable.out.int128
sql/benchmarks/tpch/Tests/12-plan.stable.out
sql/benchmarks/tpch/Tests/13-plan.stable.out
sql/benchmarks/tpch/Tests/14-plan.stable.out.int128
sql/benchmarks/tpch/Tests/16-plan.stable.out
sql/benchmarks/tpch/Tests/17-plan.stable.out
sql/benchmarks/tpch/Tests/17-plan.stable.out.int128
sql/benchmarks/tpch/Tests/19-plan.stable.out.int128
sql/benchmarks/tpch/Tests/20-plan.stable.out
sql/benchmarks/tpch/Tests/20-plan.stable.out.int128
sql/benchmarks/tpch/Tests/21-plan.stable.out
sql/benchmarks/tpch/Tests/22-plan.stable.out
sql/server/rel_optimizer.c
sql/server/rel_select.c
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out.int128
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit
sql/test/Triggers/trigger_activation.sql
Branch: default
Log Message:

use inplace converts also for atom's within the sql_exp (not
only for atom's on the sql stack). This aligns behaviour
with or without caching.


diffs (truncated from 955 to 300 lines):

diff --git a/sql/benchmarks/ssbm/Tests/01-plan.stable.out 
b/sql/benchmarks/ssbm/Tests/01-plan.stable.out
--- a/sql/benchmarks/ssbm/Tests/01-plan.stable.out
+++ b/sql/benchmarks/ssbm/Tests/01-plan.stable.out
@@ -41,10 +41,10 @@ project (
 | | join (
 | | | select (
 | | | | table(sys.lineorder) [ lineorder.lo_quantity, 
lineorder.lo_extendedprice, lineorder.lo_discount, 
lineorder.%lineorder_lo_orderdate_fkey NOT NULL JOINIDX 
sys.lineorder.lineorder_lo_orderdate_fkey ] COUNT 
-| | | ) [ int[tinyint 1] = lineorder.lo_discount = int[tinyint 3], 
lineorder.lo_quantity  int[tinyint 25] ],
+| | | ) [ int 1 = lineorder.lo_discount = int 3, lineorder.lo_quantity  
int 25 ],
 | | | select (
 | | | | table(sys.dwdate) [ dwdate.d_year, dwdate.%TID% NOT NULL ] COUNT 
-| | | ) [ dwdate.d_year = int[smallint 1993] ]
+| | | ) [ dwdate.d_year = int 1993 ]
 | | ) [ lineorder.%lineorder_lo_orderdate_fkey NOT NULL = dwdate.%TID% NOT 
NULL JOINIDX sys.lineorder.lineorder_lo_orderdate_fkey ]
 | ) [  ] [ sys.sum no nil (sys.sql_mul(bigint[lineorder.lo_extendedprice] as 
lineorder.lo_extendedprice, lineorder.lo_discount)) as L1.L1 ]
 ) [ L1 as L1.revenue ]
diff --git a/sql/benchmarks/ssbm/Tests/02-plan.stable.out 
b/sql/benchmarks/ssbm/Tests/02-plan.stable.out
--- a/sql/benchmarks/ssbm/Tests/02-plan.stable.out
+++ b/sql/benchmarks/ssbm/Tests/02-plan.stable.out
@@ -41,7 +41,7 @@ project (
 | | join (
 | | | select (
 | | | | table(sys.lineorder) [ lineorder.lo_quantity, 
lineorder.lo_extendedprice, lineorder.lo_discount, 
lineorder.%lineorder_lo_orderdate_fkey NOT NULL JOINIDX 
sys.lineorder.lineorder_lo_orderdate_fkey ] COUNT 
-| | | ) [ int[tinyint 4] = lineorder.lo_discount = int[tinyint 6], 
int[tinyint 26] = lineorder.lo_quantity = int[tinyint 35] ],
+| | | ) [ int 4 = lineorder.lo_discount = int 6, int 26 = 
lineorder.lo_quantity = int 35 ],
 | | | select (
 | | | | table(sys.dwdate) [ dwdate.d_yearmonthnum, dwdate.%TID% NOT NULL ] 
COUNT 
 | | | ) [ dwdate.d_yearmonthnum = int 199401 ]
diff --git a/sql/benchmarks/ssbm/Tests/03-plan.stable.out 
b/sql/benchmarks/ssbm/Tests/03-plan.stable.out
--- a/sql/benchmarks/ssbm/Tests/03-plan.stable.out
+++ b/sql/benchmarks/ssbm/Tests/03-plan.stable.out
@@ -41,10 +41,10 @@ project (
 | | join (
 | | | select (