MonetDB: Oct2014 - upgrade code fixes.

2014-08-17 Thread Niels Nes
Changeset: 027be675347f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=027be675347f
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_scenario.c
sql/include/sql_catalog.h
sql/server/rel_select.c
sql/server/sql_parser.y
sql/storage/bat/bat_logger.c
sql/storage/sql_catalog.c
Branch: Oct2014
Log Message:

upgrade code fixes.
the union functions are now dropped and recreated, this is
needed to solve the storage of multiple return types.


diffs (truncated from 720 to 300 lines):

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
@@ -899,6 +899,49 @@ create_func(mvc *sql, char *sname, sql_f
return MAL_SUCCEED;
 }
 
+str
+UPGdrop_func(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+   mvc *sql = NULL;
+   str msg = MAL_SUCCEED;
+   int id = *(int *) getArgReference(stk, pci, 1);
+   sql_func *func;
+
+   if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL)
+   return msg;
+   if ((msg = checkSQLContext(cntxt)) != NULL)
+   return msg;
+
+   func = sql_trans_find_func(sql->session->tr, id);
+   if (func) 
+   mvc_drop_func(sql, func->s, func, 0);
+   return msg;
+}
+
+str
+UPGcreate_func(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+   mvc *sql = NULL;
+   str msg = MAL_SUCCEED;
+   str func = *(str *) getArgReference(stk, pci, 1);
+   stmt *s;
+
+   if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL)
+   return msg;
+   if ((msg = checkSQLContext(cntxt)) != NULL)
+   return msg;
+   s = sql_parse(sql, sa_create(), func, 0);
+   if (s && s->type == st_catalog) {
+   char *schema = 
((stmt*)s->op1->op4.lval->h->data)->op4.aval->data.val.sval;
+   sql_func *func = 
(sql_func*)((stmt*)s->op1->op4.lval->t->data)->op4.aval->data.val.pval;
+
+   msg = create_func(sql, schema, func);
+   } else {
+   throw(SQL, "sql.catalog", "function creation failed '%s'", 
func);
+   }
+   return msg;
+}
+
 static char *
 create_trigger(mvc *sql, char *sname, char *tname, char *triggername, int 
time, int orientation, int event, char *old_name, char *new_name, char 
*condition, char *query)
 {
diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h
--- a/sql/backends/monet5/sql.h
+++ b/sql/backends/monet5/sql.h
@@ -109,6 +109,9 @@ sql5_export str mvc_declared_table_colum
 sql5_export str mvc_drop_declared_table_wrap(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
 sql5_export str mvc_drop_declared_tables_wrap(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
 
+sql5_export str UPGdrop_func(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str UPGcreate_func(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+
 sql5_export str mvc_affected_rows_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
 sql5_export str mvc_export_result_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
 sql5_export str mvc_export_head_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
@@ -322,4 +325,5 @@ sql5_export str STRindex_bte(bte *res, s
 sql5_export str BATSTRindex_bte(bat *res, bat *src, bit *u);
 sql5_export str STRstrings(str *res, str src);
 sql5_export str BATSTRstrings(bat *res, bat *src);
+
 #endif /* _SQL_H */
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -305,6 +305,14 @@ pattern dropDeclaredTables{unsafe}( nr:i
 address mvc_drop_declared_tables_wrap
 comment "drop top n declared tables"; 
 
+pattern drop_func_upgrade_oct2014(id:int) :int
+address UPGdrop_func
+comment "Drop the function identified by id, needed for the Oct2014 upgrade";
+
+pattern create_func_upgrade_oct2014(f:str) :int
+address UPGcreate_func
+comment "Create the function described by f, needed for the Oct2014 upgrade";
+
 pattern exportHead{unsafe}(s:streams, res_id:int) :void
 address mvc_export_head_wrap
 comment "Export a result (in order) to stream s"; 
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -598,10 +598,6 @@ sql_update_feb2013_sp3(Client c)
return err; /* usually MAL_SUCCEED */
 }
 
-/*
- * TODO
- * update all table functions, ie make them type F_UNION
- */
 static str
 sql_update_jan2014(Client c)
 {
@@ -877,6 +873,21 @@ sql_update_oct2014(Client c)
pos += snprintf(buf + pos, bufsize - pos, "delete from _columns where 
table_id in (select id from _tables where name like '#%%');\n");
pos += snprintf(buf + pos, bufsize - pos, "delete f

MonetDB: Oct2014 - Recreated system functions need to be marked ...

2014-08-17 Thread Sjoerd Mullender
Changeset: 356f82fec85d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=356f82fec85d
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out
Branch: Oct2014
Log Message:

Recreated system functions need to be marked as such; approved upgrade output.


diffs (94 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1069,7 +1069,7 @@ create aggregate json.tojsonarray( x dou
F_FUNC);
 
pos += snprintf(buf + pos, bufsize - pos,
-   "insert into sys.systemfunctions (select f.id from 
sys.functions f, sys.schemas s where f.name in ('bbp', 'generate_series', 
'storage', 'storagemodel') and f.type = %d and f.schema_id = s.id and s.name = 
'sys');\n",
+   "insert into sys.systemfunctions (select f.id from 
sys.functions f, sys.schemas s where f.name in ('bbp', 'db_users', 'env', 
'generate_series', 'storage', 'storagemodel', 'var') and f.type = %d and 
f.schema_id = s.id and s.name = 'sys');\n",
F_UNION);
 
if (schema) {
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
@@ -21,8 +21,28 @@ stdout of test 'upgrade` in directory 's
 Ready.
 Running database upgrade commands:
 set schema "sys";
+delete from _columns where table_id not in (select id from _tables);
+insert into _columns values( (select max(id)+1 from _columns), 'system', 
'boolean', 1, 0, (select _tables.id from _tables join schemas on 
_tables.schema_id=schemas.id where schemas.name='sys' and 
_tables.name='schemas'), NULL, true, 4, NULL);
+insert into _columns values( (select max(id)+1 from _columns), 'varres', 
'boolean', 1, 0, (select _tables.id from _tables join schemas on 
_tables.schema_id=schemas.id where schemas.name='sys' and 
_tables.name='functions'), NULL, true, 7, NULL);
+insert into _columns values( (select max(id)+1 from _columns), 'vararg', 
'boolean', 1, 0, (select _tables.id from _tables join schemas on 
_tables.schema_id=schemas.id where schemas.name='sys' and 
_tables.name='functions'), NULL, true, 8, NULL);
+insert into _columns values( (select max(id)+1 from _columns), 'inout', 
'tinyint', 8, 0, (select _tables.id from _tables join schemas on 
_tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='args'), 
NULL, true, 6, NULL);
+insert into _columns values( (select max(id)+1 from _columns), 'language', 
'int', 32, 0, (select _tables.id from _tables join schemas on 
_tables.schema_id=schemas.id where schemas.name='sys' and 
_tables.name='functions'), NULL, true, 9, NULL);
+delete from _columns where table_id in (select _tables.id from _tables join 
schemas on _tables.schema_id=schemas.id where schemas.name='sys' and 
_tables.name='functions') and name='sql';
+update _columns set number='9' where name = 'schema_id' and table_id in 
(select _tables.id from _tables join schemas on _tables.schema_id=schemas.id 
where schemas.name='sys' and _tables.name='functions');
+update _columns set number='7' where name = 'number' and table_id in (select 
_tables.id from _tables join schemas on _tables.schema_id=schemas.id where 
schemas.name='sys' and _tables.name='args');
+update _columns set number='4' where name = 'language' and table_id in (select 
_tables.id from _tables join schemas on _tables.schema_id=schemas.id where 
schemas.name='sys' and _tables.name='functions');
 delete from _columns where table_id in (select id from _tables where name like 
'#%');
 delete from _tables where name like '#%';
+create table upgradeOct2014 as (select * from functions where type = 5 and 
language <> 0) with data;
+create table upgradeOct2014_changes (c bigint);
+create function drop_func_upgrade_oct2014( id integer ) returns int external 
name sql.drop_func_upgrade_oct2014;
+insert into upgradeOct2014_changes select drop_func_upgrade_oct2014(id) from 
upgradeOct2014;
+drop function drop_func_upgrade_oct2014;
+create function create_func_upgrade_oct2014( f string ) returns int external 
name sql.create_func_upgrade_oct2014;
+insert into upgradeOct2014_changes select create_func_upgrade_oct2014(func) 
from upgradeOct2014;
+drop function create_func_upgrade_oct2014;
+drop table upgradeOct2014_changes;
+drop table upgradeOct2014;
 drop function sys.bbp;
 create function sys.bbp() returns table (id int, name string, htype string, 
ttype string, count BIGINT, refcnt int, lrefcnt int, location string, heat int, 
dirty string, status string, kind string) external name bbp.get;
 create schema json;
@@ -149,7 +169,7 @@ create function sys.generate_series(firs
 returns table (value time

MonetDB: mosaic - Administrative reshuffling of the code

2014-08-17 Thread Martin Kersten
Changeset: c70e531e5970 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c70e531e5970
Added Files:
monetdb5/modules/mal/mosaic_hdr.h
monetdb5/modules/mal/mosaic_none.h
monetdb5/modules/mal/mosaic_rle.h
monetdb5/modules/mal/mosaic_zone.c
Modified Files:
monetdb5/modules/mal/Makefile.ag
monetdb5/modules/mal/Tests/All
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic.h
monetdb5/modules/mal/mosaic_dict.c
monetdb5/modules/mal/mosaic_hdr.c
monetdb5/modules/mal/mosaic_none.c
monetdb5/modules/mal/mosaic_rle.c
Branch: mosaic
Log Message:

Administrative reshuffling of the code
Added the first part of zones and pre-filtering on oid candidate lists


diffs (truncated from 1526 to 300 lines):

diff --git a/monetdb5/modules/mal/Makefile.ag b/monetdb5/modules/mal/Makefile.ag
--- a/monetdb5/modules/mal/Makefile.ag
+++ b/monetdb5/modules/mal/Makefile.ag
@@ -63,6 +63,11 @@ lib_mal = {
sample.c sample.h \
json_util.c json_util.h \
mosaic.c mosaic.h \
+   mosaic_hdr.c mosaic_hdr.h \
+   mosaic_none.c mosaic_none.h \
+   mosaic_rle.c mosaic_rle.h \
+   mosaic_dict.c mosaic_dict.h \
+   mosaic_zone.c mosaic_zone.h \
calc.c batcalc.c
 }
 
diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -71,6 +71,7 @@ mosaic_none
 mosaic_rle
 mosaic_mix
 mosaic_dict
+mosaic_zone
 
 mosaic_none_double
 
diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -25,117 +25,13 @@
 
 #include "monetdb_config.h"
 #include "mosaic.h"
-#include "mtime.h"
-#include "math.h"
-#include "opt_prelude.h"
-#include "algebra.h"
+#include "mosaic_hdr.h"
+#include "mosaic_none.h"
+#include "mosaic_rle.h"
+#include "mosaic_dict.h"
+#include "mosaic_zone.h"
 
-//#define _DEBUG_MOSAIC_
-
-#define MOSAIC_VERSION 20140808
-
-/* do not invest in compressing BATs smaller than this */
-#define MIN_INPUT_COUNT 1
-
-/* The compressor kinds currently hardwired */
-#define MOSAIC_METHODS 6
-#define MOSAIC_NONE 0  // no compression at all
-#define MOSAIC_RLE  1  // use run-length encoding
-#define MOSAIC_DICT 2  // local dictionary encoding
-#define MOSAIC_DELTA   3   // use delta encoding
-#define MOSAIC_BITMAP  4   // use limited set of bitmaps
-#define MOSAIC_ZONES5  // zone map over non-compressed data
-#define MOSAIC_EOL 6   // marker for the last block
-
-static char *filtername[]={"none","rle","dict","delta","bitmap","zones","EOL"};
-
-//Compression should have a significant reduction to apply.
-#define COMPRESS_THRESHOLD 50   //percent
-
-/*
- * The header is reserved for meta information, e.g. oid indices.
- * The block header encodes the information needed for the chunk decompressor
- */
-#define MOSAICINDEX 4  //> 2 elements
-typedef struct MOSAICHEADER{
-   int version;
-   int top;
-   oid index[MOSAICINDEX];
-   BUN offset[MOSAICINDEX];
-} * MosaicHdr;
-
-typedef struct MOSAICBLOCK{
-   bte tag;// method applied in chunk
-   bte prop[7];// properties needed by compression scheme.
-   BUN cnt;// compression specific information
-} *MosaicBlk;
-
-#define wordaligned(SZ) \
-((SZ) +  ((SZ) % sizeof(int)? sizeof(int) - ((SZ)%sizeof(int)) : 0))
-
-#define MosaicHdrSize  wordaligned(sizeof(struct MOSAICHEADER))
-#define MosaicBlkSize  wordaligned(sizeof(struct MOSAICBLOCK))
-
-
-typedef struct MOSTASK{
-   int type;   // one of the permissible types
-   MosaicHdr hdr;  // start of the destination heap
-   MosaicBlk blk;  // current block header
-   char *dst;  // write pointer into current compressed blocks
-
-   BUN elm;// elements left to compress
-   char *src;  // read pointer into source
-
-   oid *lb, *rb;   // Collected oids from operations
-   oid *cl;// candidate admin
-   lng n;  // element count in candidate list
-
-   BAT *lbat, *rbat; // for the joins, where we dont know their size 
upfront
-
-   // collect compression statistics for the particular task
-   lng time[MOSAIC_METHODS];
-   lng wins[MOSAIC_METHODS];   
-   lng elms[MOSAIC_METHODS];   
-} *MOStask;
-
-/* we keep a condensed OID index anchored to the compressed blocks */
-
-typedef struct MOSINDEX{
-   lng offset; // header location within compressed heap
-   lng nullcnt;// number of nulls encountered
-   ValRecord low,hgh; // zone value markers for fix-length types
-} *mosaicindex;
-
-/* Run through a column to pr

MonetDB: Oct2014 - approved output

2014-08-17 Thread Niels Nes
Changeset: 93ad4be3fdda for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=93ad4be3fdda
Modified Files:
sql/benchmarks/tpch/Tests/20-explain.stable.out
sql/benchmarks/tpch/Tests/20-plan.stable.out
Branch: Oct2014
Log Message:

approved output


diffs (174 lines):

diff --git a/sql/benchmarks/tpch/Tests/20-explain.stable.out 
b/sql/benchmarks/tpch/Tests/20-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/20-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/20-explain.stable.out
@@ -94,12 +94,12 @@ function user.s2_1{autoCommit=true}(A0:s
 X_55:bat[:oid,:int]  := algebra.leftfetchjoinPath(X_43,X_33,X_54);
 (X_56,r1_59) := algebra.join(X_31,X_55);
 X_58 := algebra.tinter(X_32,X_56);
-X_282 := algebra.leftfetchjoin(X_58,X_23);
+X_278 := algebra.leftfetchjoin(X_58,X_23);
 X_59 := 
sql.bind_idxbat(X_8,"sys","partsupp","partsupp_ps_partkey_ps_suppkey_pkey",0);
 (X_62,r1_65) := 
sql.bind_idxbat(X_8,"sys","partsupp","partsupp_ps_partkey_ps_suppkey_pkey",2);
 X_64 := 
sql.bind_idxbat(X_8,"sys","partsupp","partsupp_ps_partkey_ps_suppkey_pkey",1);
 X_65 := sql.delta(X_59,X_62,r1_65,X_64);
-X_66:bat[:oid,:wrd]  := algebra.leftfetchjoin(X_282,X_65);
+X_66:bat[:oid,:wrd]  := algebra.leftfetchjoin(X_278,X_65);
 X_67:bat[:oid,:oid]  := sql.tid(X_8,"sys","lineitem");
 X_69 := sql.bind(X_8,"sys","lineitem","l_shipdate",0);
 (X_71,r1_75) := sql.bind(X_8,"sys","lineitem","l_shipdate",2);
@@ -108,17 +108,17 @@ function user.s2_1{autoCommit=true}(A0:s
 X_75 := algebra.leftfetchjoin(X_67,X_74);
 X_76 := mtime.addmonths(A3,A4);
 X_77 := algebra.subselect(X_75,A2,X_76,true,false,false);
-X_283 := algebra.leftfetchjoin(X_77,X_67);
+X_279 := algebra.leftfetchjoin(X_77,X_67);
 X_80 := sql.bind(X_8,"sys","lineitem","l_suppkey",0);
 (X_84,r1_91) := sql.bind(X_8,"sys","lineitem","l_suppkey",2);
 X_87 := sql.bind(X_8,"sys","lineitem","l_suppkey",1);
 X_89 := sql.delta(X_80,X_84,r1_91,X_87);
-X_90:bat[:oid,:int]  := algebra.leftfetchjoin(X_283,X_89);
+X_90:bat[:oid,:int]  := algebra.leftfetchjoin(X_279,X_89);
 X_91 := sql.bind(X_8,"sys","lineitem","l_partkey",0);
 (X_93,r1_101) := sql.bind(X_8,"sys","lineitem","l_partkey",2);
 X_95 := sql.bind(X_8,"sys","lineitem","l_partkey",1);
 X_96 := sql.delta(X_91,X_93,r1_101,X_95);
-X_97:bat[:oid,:int]  := algebra.leftfetchjoin(X_283,X_96);
+X_97:bat[:oid,:int]  := algebra.leftfetchjoin(X_279,X_96);
 (X_98,r1_107,r2_107) := group.subgroup(X_97);
 (X_101,r1_110,r2_110) := group.subgroupdone(X_90,X_98);
 X_104 := algebra.leftfetchjoin(r1_110,X_97);
@@ -127,7 +127,7 @@ function user.s2_1{autoCommit=true}(A0:s
 (X_154,r1_176) := sql.bind(X_8,"sys","lineitem","l_quantity",2);
 X_157 := sql.bind(X_8,"sys","lineitem","l_quantity",1);
 X_159 := sql.delta(X_149,X_154,r1_176,X_157);
-X_160:bat[:oid,:int]  := algebra.leftfetchjoin(X_283,X_159);
+X_160:bat[:oid,:int]  := algebra.leftfetchjoin(X_279,X_159);
 X_161:bat[:oid,:lng]  := aggr.subsum(X_160,X_101,r1_110,true,true);
 X_105:bat[:oid,:wrd]  := mal.manifold("mkey","hash",X_104);
 X_110:bat[:oid,:wrd]  := mkey.bulk_rotate_xor_hash(X_105,22,X_109);
@@ -141,7 +141,7 @@ function user.s2_1{autoCommit=true}(A0:s
 (X_125,r1_139) := sql.bind(X_8,"sys","partsupp","ps_suppkey",2);
 X_128 := sql.bind(X_8,"sys","partsupp","ps_suppkey",1);
 X_130 := sql.delta(X_120,X_125,r1_139,X_128);
-X_131:bat[:oid,:int]  := algebra.leftfetchjoin(X_282,X_130);
+X_131:bat[:oid,:int]  := algebra.leftfetchjoin(X_278,X_130);
 X_132 := algebra.leftfetchjoin(X_119,X_131);
 X_133 := algebra.leftfetchjoin(X_117,r1_121);
 X_134 := algebra.leftfetchjoin(X_133,X_109);
@@ -152,7 +152,7 @@ function user.s2_1{autoCommit=true}(A0:s
 (X_140,r1_156) := sql.bind(X_8,"sys","partsupp","ps_availqty",2);
 X_142 := sql.bind(X_8,"sys","partsupp","ps_availqty",1);
 X_143 := sql.delta(X_138,X_140,r1_156,X_142);
-X_144:bat[:oid,:int]  := algebra.leftfetchjoinPath(X_137,X_282,X_143);
+X_144:bat[:oid,:int]  := algebra.leftfetchjoinPath(X_137,X_278,X_143);
 X_145:bat[:oid,:lng]  := batcalc.lng(X_144,19,2);
 X_147 := calc.lng(1,A1,11,1);
 X_163:bat[:oid,:lng]  := algebra.leftfetchjoinPath(X_136,X_133,X_161);
@@ -161,47 +161,45 @@ function user.s2_1{autoCommit=true}(A0:s
 X_166:bat[:oid,:bit]  := batcalc.>(X_145,X_165);
 X_167 := algebra.subselect(X_166,true,true,true,true,false);
 X_169:bat[:oid,:int]  := algebra.leftfetchjoinPath(X_167,X_137,X_131);
-(X_170,r1_196,r2_196) := group.subgroupdone(X_169);
-X_173 := algebra.leftfetchjoin(r1_196,X_169);
-(X_174,r1_200) := algebra.join(X_21,X_173);
-X_176 := algebra.tinter(X_22,X_174);
-X_284 := algebra.leftfetchjoin(X_176,X_9);
-X_177 := sql.bind(X_8,"sys","supplier","s_nationkey",0);
-(X_180,r1_206) := sql.bind(X_8,"sys","supplier","s_nationkey",2);
-X_183 :=

MonetDB: Oct2014 - fixed crash in in handling

2014-08-17 Thread Niels Nes
Changeset: f34a80054a36 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f34a80054a36
Modified Files:
sql/server/rel_select.c
Branch: Oct2014
Log Message:

fixed crash in in handling


diffs (12 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -3010,7 +3010,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
l->card != CARD_ATOM && has_nil(l)) {
e = rel_unop_(sql, l, NULL, "isnull", 
card_value);
e = exp_compare(sql->sa, e, 
exp_atom_bool(sql->sa, 0), cmp_equal);
-   if (!is_select(rel->op) && !rel_is_ref(rel))
+   if (!is_select(rel->op) || rel_is_ref(rel))
left = rel = rel_select(sql->sa, rel, 
e);
else
rel_select_add_exp(sql->sa, rel, e);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - restore error message for single column in st...

2014-08-17 Thread Niels Nes
Changeset: 235399f6dab0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=235399f6dab0
Modified Files:
sql/server/rel_select.c
Branch: Oct2014
Log Message:

restore error message for single column in statements


diffs (16 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -3133,8 +3133,11 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
 
/* list through all left/right expressions */
rexps = right->exps;
-   if (!is_project(right->op) || list_length(ll) != 
list_length(rexps))
+   if (!is_project(right->op) || list_length(ll) != 
list_length(rexps)) {
+   if (list_length(ll) == 1)
+   return sql_error(sql, 02, "IN: iinner 
query should return a single column");
return NULL;
+   }
 
for (n=ll->h, m=rexps->h; n && m; n = n->next, m = 
m->next) {
sql_exp *l = n->data;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Finalizing the zone

2014-08-17 Thread Martin Kersten
Changeset: d98dece8ba74 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d98dece8ba74
Added Files:
monetdb5/modules/mal/Tests/mosaic_zone.mal
monetdb5/modules/mal/Tests/mosaic_zone.stable.err
monetdb5/modules/mal/Tests/mosaic_zone.stable.out
monetdb5/modules/mal/Tests/mosaic_zone_joins.mal
monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.err
monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out
monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal
monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.err
monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out
monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal
monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.err
monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out
monetdb5/modules/mal/mosaic_zone.h
Modified Files:
monetdb5/modules/mal/Tests/All
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic_zone.c
Branch: mosaic
Log Message:

Finalizing the zone
For the time being a single min/max pair is maintained.
Further improvements should come from breaking the zone blocks
based on the coverage of the underlying domain.


diffs (truncated from 1471 to 300 lines):

diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -78,16 +78,19 @@ mosaic_none_double
 mosaic_none_subselect
 mosaic_rle_subselect
 mosaic_dict_subselect
+mosaic_zone_subselect
 mosaic_mix_subselect
 
 mosaic_none_thetasubselect
 mosaic_rle_thetasubselect
 mosaic_dict_thetasubselect
+mosaic_zone_thetasubselect
 mosaic_mix_thetasubselect
 
 mosaic_none_joins
 mosaic_rle_joins
 mosaic_dict_joins
+mosaic_zone_joins
 mosaic_mix_joins
 
 #HAVE_RAPTOR?rdf
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone.mal 
b/monetdb5/modules/mal/Tests/mosaic_zone.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/mosaic_zone.mal
@@ -0,0 +1,12 @@
+#zone compression
+b:= bat.new(:oid,:int);
+bat.append(b,50);
+bat.append(b,19531015);
+bat.append(b,9);
+b:= bat.append(b,b);
+
+io.print(b);
+x:= mosaic.compress(b,"zone");
+mosaic.dump(x);
+z:= mosaic.decompress(x);
+io.print(z);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone.stable.err 
b/monetdb5/modules/mal/Tests/mosaic_zone.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/mosaic_zone.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'mosaic_zone` in directory 'monetdb5/modules/mal` itself:
+
+
+# 17:24:13 >  
+# 17:24:13 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=33832" "--set" 
"mapi_usock=/var/tmp/mtest-18516/.s.monetdb.33832" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
 "mosaic_zone.mal"
+# 17:24:13 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/mk/mosaic//Linux/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 = 5
+# 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 = 33832
+# cmdline opt  mapi_usock = /var/tmp/mtest-18516/.s.monetdb.33832
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbpath = 
/export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal
+# cmdline opt  gdk_debug = 536870922
+
+# 17:24:13 >  
+# 17:24:13 >  "Done."
+# 17:24:13 >  
+
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_zone.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/mosaic_zone.stable.out
@@ -0,0 +1,72 @@
+stdout of test 'mosaic_zone` in directory 'monetdb5/modules/mal` itself:
+
+
+# 17:24:13 >  
+# 17:24:13 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=33832" "--set" 
"mapi_usock=/var/tmp/mtest-18516/.s.monetdb.33832" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
 "mosaic_zone.mal"
+# 17:24:13 >  
+
+# MonetDB 5 server v11.20.0
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_modules_mal', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit 
integers dynamically linked
+# Found 15.591 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:mon

MonetDB: mosaic - Use the correct tests to fix errors

2014-08-17 Thread Martin Kersten
Changeset: 45ea23a3053c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=45ea23a3053c
Modified Files:
monetdb5/modules/mal/Tests/mosaic_zone_joins.mal
monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out
monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal
monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out
monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal
monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic.h
monetdb5/modules/mal/mosaic_zone.c
monetdb5/modules/mal/mosaic_zone.h
Branch: mosaic
Log Message:

Use the correct tests to fix errors


diffs (268 lines):

diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_joins.mal 
b/monetdb5/modules/mal/Tests/mosaic_zone_joins.mal
--- a/monetdb5/modules/mal/Tests/mosaic_zone_joins.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_joins.mal
@@ -7,7 +7,7 @@ bat.append(b,9);
 b:= bat.append(b,b);
 
 io.print(b);
-x:= mosaic.compress(b,"none");
+x:= mosaic.compress(b,"zone");
 
 c:= bat.new(:oid,:oid);
 bat.append(c,0@0);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_joins.stable.out
@@ -25,7 +25,7 @@ function user.main():void;
 bat.append(b,9);
 b := bat.append(b,b);
 io.print(b);
-x := mosaic.compress(b,"none");
+x := mosaic.compress(b,"zone");
 c := bat.new(:oid,:oid);
 bat.append(c,0@0);
 bat.append(c,2@0);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal 
b/monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal
--- a/monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_subselect.mal
@@ -8,7 +8,7 @@ bat.append(b,9);
 b:= bat.append(b,b);
 
 io.print(b);
-x:= mosaic.compress(b,"none");
+x:= mosaic.compress(b,"zone");
 #mosaic.dump(x);
 s:= algebra.subselect(b,0,50,false,false,false);
 io.print(s);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_subselect.stable.out
@@ -25,7 +25,7 @@ function user.main():void;
 bat.append(b,9);
 b := bat.append(b,b);
 io.print(b);
-x := mosaic.compress(b,"none");
+x := mosaic.compress(b,"zone");
 #mosaic.dump(x); 
 s := algebra.subselect(b,0,50,false,false,false);
 io.print(s);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal 
b/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal
--- a/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.mal
@@ -7,7 +7,7 @@ bat.append(b,9);
 b:= bat.append(b,b);
 
 io.print(b);
-x:= mosaic.compress(b,"none");
+x:= mosaic.compress(b,"zone");
 
 s:= algebra.thetasubselect(b,50,"<");
 io.print(s);
diff --git a/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_zone_thetasubselect.stable.out
@@ -25,7 +25,7 @@ function user.main():void;
 bat.append(b,9);
 b := bat.append(b,b);
 io.print(b);
-x := mosaic.compress(b,"none");
+x := mosaic.compress(b,"zone");
 s := algebra.thetasubselect(b,50,"<");
 io.print(s);
 xs := mosaic.thetasubselect(x,50,"<");
diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -311,6 +311,13 @@ MOScompressInternal(Client cntxt, int *r
case MOSAIC_ZONE:
if( task->blk->cnt == 0)
task->dst += 2 * MosaicBlkSize;
+   if ( task->blk->cnt > MAXZONESIZE){
+   MOSupdateHeader(cntxt,task);
+   MOSadvance_zone(task);
+   task->dst = ((char*) task->blk)+ MosaicBlkSize;
+   task->blk->tag = MOSAIC_EOL;
+   task->blk->cnt = 0;
+   }
MOScompress_zone(cntxt,task);
break;
default :
@@ -588,6 +595,11 @@ MOSsubselect(Client cntxt, MalBlkPtr mb,
first += task->blk->cnt;
MOSskip_dict(task);
break;
+   case MOSAIC_ZONE:
+   MOSsubselect_zone(cntxt,task,first,first + 
task->blk->cnt,low,hgh,li,hi,anti);
+   first += task->blk->cnt;
+   MOSskip_zone(task);
+   

MonetDB: rdf - Limit for the table size is 1000

2014-08-17 Thread Minh-Duc Pham
Changeset: afad07ade530 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=afad07ade530
Modified Files:
monetdb5/extras/rdf/rdfparams.c
monetdb5/extras/rdf/rdfschema.c
monetdb5/extras/rdf/rdfschema.h
Branch: rdf
Log Message:

Limit for the table size is 1000


diffs (52 lines):

diff --git a/monetdb5/extras/rdf/rdfparams.c b/monetdb5/extras/rdf/rdfparams.c
--- a/monetdb5/extras/rdf/rdfparams.c
+++ b/monetdb5/extras/rdf/rdfparams.c
@@ -39,7 +39,7 @@ void createDefaultParamsFile(void){
paramFile = fopen("params.ini", "wt");

fprintf(paramFile, "dimensionFactor 1000\n");
-   fprintf(paramFile, "upperboundNumTables 1000");
+   fprintf(paramFile, "upperboundNumTables 1000\n");
fprintf(paramFile, "simTfidfThreshold 0.75");
 
fclose(paramFile); 
diff --git a/monetdb5/extras/rdf/rdfschema.c b/monetdb5/extras/rdf/rdfschema.c
--- a/monetdb5/extras/rdf/rdfschema.c
+++ b/monetdb5/extras/rdf/rdfschema.c
@@ -244,6 +244,7 @@ char getStringName(oid objOid, str *objS
 
 
 char isCSTable(CS item, oid name){
+   (void) name; 
if (item.parentFreqIdx != -1) return 0; 
 
if (item.type == DIMENSIONCS) return 1; 
@@ -251,13 +252,11 @@ char isCSTable(CS item, oid name){
#if REMOVE_SMALL_TABLE
if (item.support > acceptableTableSize) return 1;
 
-   if (item.coverage < MINIMUM_TABLE_SIZE) return 0;
-   
+   //if (item.coverage < MINIMUM_TABLE_SIZE) return 0;
//More strict with table which does not have name
-   if ((name == BUN_NONE) && item.support < MINIMUM_TABLE_SIZE) return 0; 
+   //if ((name == BUN_NONE) && item.support < MINIMUM_TABLE_SIZE) return 
0; 
+   if (item.support < MINIMUM_TABLE_SIZE) return 0; 
#endif  
-   
-   
 
return 1; 
 }
diff --git a/monetdb5/extras/rdf/rdfschema.h b/monetdb5/extras/rdf/rdfschema.h
--- a/monetdb5/extras/rdf/rdfschema.h
+++ b/monetdb5/extras/rdf/rdfschema.h
@@ -258,7 +258,7 @@ typedef struct SubCSSet{
 #define UPDATE_NAME_BASEDON_POPULARTABLE 1//Update table name from merging 
multiple freqCS by using the most popular one
 
 //#define MIN_FROMTABLE_SIZE_S5 1  /* For example data */
-#define MINIMUM_TABLE_SIZE 1   //The minimum number of triples coverred by 
a table (i.e., a final CS) 
+#define MINIMUM_TABLE_SIZE 1000   //The minimum number of triples coverred by 
a table (i.e., a final CS) 
 //#define MINIMUM_TABLE_SIZE 1   // For example dataset only 
 #define HIGH_REFER_THRESHOLD 5
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Added missing file

2014-08-17 Thread Martin Kersten
Changeset: 4e4296680358 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4e4296680358
Added Files:
monetdb5/modules/mal/mosaic_dict.h
Branch: mosaic
Log Message:

Added missing file


diffs (49 lines):

diff --git a/monetdb5/modules/mal/mosaic_dict.h 
b/monetdb5/modules/mal/mosaic_dict.h
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/mosaic_dict.h
@@ -0,0 +1,44 @@
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.monetdb.org/Legal/MonetDBLicense
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ ** Copyright August 2008-2014 MonetDB B.V.
+ * All Rights Reserved.
+ */
+
+/*
+ * (c)2014 author Martin Kersten
+ */
+
+#ifndef _MOSAIC_DICT_
+#define _MOSAIC_DICT_
+
+#include 
+#include "mal_interpreter.h"
+#include "mal_client.h"
+
+#define DICTSIZE 128 
+mosaic_export int dictsize;
+
+mosaic_export void MOSdump_dict(Client cntxt, MOStask task);
+mosaic_export void MOSadvance_dict(MOStask task);
+mosaic_export void MOSskip_dict(MOStask task);
+mosaic_export lng MOSestimate_dict(Client cntxt, MOStask task);
+mosaic_export void MOScompress_dict(Client cntxt, MOStask task);
+mosaic_export void MOSdecompress_dict(Client cntxt, MOStask task);
+mosaic_export str MOSsubselect_dict(Client cntxt,  MOStask task, BUN first, 
BUN last, void *low, void *hgh, bit *li, bit *hi, bit *anti);
+mosaic_export str MOSthetasubselect_dict(Client cntxt,  MOStask task, BUN 
first, BUN last, void *val, str oper);
+mosaic_export str MOSleftfetchjoin_dict(Client cntxt,  MOStask task, BUN 
first, BUN last);
+mosaic_export str MOSjoin_dict(Client cntxt,  MOStask task, BUN first, BUN 
last);
+#endif /* _MOSAIC_DICT_ */
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list