MonetDB: default - Add defense lines against double optimizer calls
Changeset: eb15bb6ea479 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eb15bb6ea479 Modified Files: monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_mitosis.c Branch: default Log Message: Add defense lines against double optimizer calls diffs (24 lines): diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -1569,7 +1569,7 @@ OPTmergetableImplementation(Client cntxt char buf[256]; lng usec = GDKusec(); - if( optimizerIsApplied(mb, "mergetable")) + if( optimizerIsApplied(mb, "mergetable") || optimizerIsApplied(mb,"projectionpath")) return 0; old = mb->stmt; oldtop= mb->stop; diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c --- a/monetdb5/optimizer/opt_mitosis.c +++ b/monetdb5/optimizer/opt_mitosis.c @@ -43,6 +43,8 @@ OPTmitosisImplementation(Client cntxt, M char buf[256]; lng usec = GDKusec(); + if ( optimizerIsApplied(mb,"mitosis") || optimizerIsApplied(mb,"projectionpath")) + return 0; (void) cntxt; (void) stk; if (!eligible(mb)) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2016 - Approve test, add extra testing condition.
Changeset: 01e3ccc5c300 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=01e3ccc5c300 Modified Files: sql/test/emptydb-upgrade-chain/Tests/check.stable.out sql/test/emptydb-upgrade/Tests/check.stable.out sql/test/emptydb/Tests/All sql/test/emptydb/Tests/check.stable.out Branch: Jun2016 Log Message: Approve test, add extra testing condition. diffs (171 lines): diff --git a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out --- a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out +++ b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out @@ -5191,7 +5191,6 @@ drop function pcre_replace(string, strin [ "corr", "public", 16, "monetdb", 0 ] [ "corr", "public", 16, "monetdb", 0 ] [ "corr", "public", 16, "monetdb", 0 ] -[ "corr", "public", 16, "monetdb", 0 ] [ "date_to_str", "public", 16, "monetdb", 0 ] [ "degrees", "public", 16, "monetdb", 0 ] [ "env", "public", 16, NULL, 0 ] @@ -5203,7 +5202,6 @@ drop function pcre_replace(string, strin [ "filter","public", 16, "monetdb", 0 ] [ "filter","public", 16, "monetdb", 0 ] [ "filter","public", 16, "monetdb", 0 ] -[ "filter","public", 16, "monetdb", 0 ] [ "geometrytype", "public", 16, "monetdb", 0 ] [ "get_type", "public", 16, "monetdb", 0 ] [ "getanchor", "public", 16, "monetdb", 0 ] @@ -5256,7 +5254,6 @@ drop function pcre_replace(string, strin [ "median","public", 16, "monetdb", 0 ] [ "median","public", 16, "monetdb", 0 ] [ "median","public", 16, "monetdb", 0 ] -[ "median","public", 16, "monetdb", 0 ] [ "ms_round", "public", 16, "monetdb", 0 ] [ "ms_str","public", 16, "monetdb", 0 ] [ "ms_stuff", "public", 16, "monetdb", 0 ] @@ -5278,7 +5275,6 @@ drop function pcre_replace(string, strin [ "quantile", "public", 16, "monetdb", 0 ] [ "quantile", "public", 16, "monetdb", 0 ] [ "quantile", "public", 16, "monetdb", 0 ] -[ "quantile", "public", 16, "monetdb", 0 ] [ "radians", "public", 16, "monetdb", 0 ] [ "rejects", "public", 16, "monetdb", 0 ] [ "right_shift", "public", 16, "monetdb", 0 ] @@ -5408,8 +5404,6 @@ drop function pcre_replace(string, strin [ "stddev_pop","public", 16, "monetdb", 0 ] [ "stddev_pop","public", 16, "monetdb", 0 ] [ "stddev_pop","public", 16, "monetdb", 0 ] -[ "stddev_pop","public", 16, "monetdb", 0 ] -[ "stddev_samp", "public", 16, "monetdb", 0 ] [ "stddev_samp", "public", 16, "monetdb", 0 ] [ "stddev_samp", "public", 16, "monetdb", 0 ] [ "stddev_samp", "public", 16, "monetdb", 0 ] @@ -5445,8 +5439,6 @@ drop function pcre_replace(string, strin [ "var_pop", "public", 16, "monetdb", 0 ] [ "var_pop", "public", 16, "monetdb", 0 ] [ "var_pop", "public", 16, "monetdb", 0 ] -[ "var_pop", "public", 16, "monetdb", 0 ] -[ "var_samp", "public", 16, "monetdb", 0 ] [ "var_samp", "public", 16, "monetdb", 0 ] [ "var_samp", "public", 16, "monetdb", 0 ] [ "var_samp", "public", 16, "monetdb", 0 ] diff --git a/sql/test/emptydb-upgrade/Tests/check.stable.out b/sql/test/emptydb-upgrade/Tests/check.stable.out --- a/sql/test/emptydb-upgrade/Tests/check.stable.out +++ b/sql/test/emptydb-upgrade/Tests/check.stable.out @@ -5191,7 +5191,6 @@ drop function pcre_replace(string, strin [ "corr", "public", 16, "monetdb", 0 ] [ "corr", "public", 16, "monetdb", 0 ] [ "corr", "public", 16, "monetdb", 0 ] -[ "corr", "public", 16, "monetdb", 0 ] [ "date_to_str", "public", 16, "monetdb", 0 ] [ "degrees", "public", 16, "monetdb", 0 ] [ "env", "public", 16, NULL, 0 ] @@ -5203,7 +5202,6 @@ drop function pcre_replace(string, strin [ "filter","public", 16, "monetdb", 0 ] [ "filter","public", 16, "monetdb", 0 ] [ "filter","public", 16
MonetDB: default - HACK to prevent double optimization of a MAL ...
Changeset: 0ab1bb99d0ea for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ab1bb99d0ea Modified Files: sql/backends/monet5/sql_optimizer.c Branch: default Log Message: HACK to prevent double optimization of a MAL plan. Optimizing a plan twice can result in a race condition where two statements both assign to the same MAL variable, and this variable is used by another statement. If things happen in the wrong order, the MAL variable may not have been properly initialized and the third statement will then fail. In particular, this can happen when the third statement is algebra.projectionpath which is only produced by the first optimization run. diffs (18 lines): diff --git a/sql/backends/monet5/sql_optimizer.c b/sql/backends/monet5/sql_optimizer.c --- a/sql/backends/monet5/sql_optimizer.c +++ b/sql/backends/monet5/sql_optimizer.c @@ -213,6 +213,14 @@ SQLoptimizeQuery(Client c, MalBlkPtr mb) str msg = 0; str pipe; + if (mb->stop > 0 && + mb->stmt[mb->stop-1]->token == REMsymbol && + mb->stmt[mb->stop-1]->argc > 0 && + mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.vtype == TYPE_str && + mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.val.sval && + strncmp(mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.val.sval, "total", 5) == 0) + return MAL_SUCCEED; /* already optimized */ + be = (backend *) c->sqlcontext; assert(be && be->mvc); /* SQL clients should always have their state set */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Approve, especially white space and empyty li...
Changeset: 644f0b977224 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=644f0b977224 Modified Files: sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out Branch: default Log Message: Approve, especially white space and empyty line changes. diffs (164 lines): diff --git a/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out b/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out --- a/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out +++ b/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out @@ -1,36 +1,78 @@ stdout of test 'authorization.SF-1430616` in directory 'sql/test/BugTracker` itself: -# 15:18:11 > -# 15:18:11 > mserver5 "--config=/ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf" --debug=10 --set "monet_mod_path=/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin" --set "gdk_dbfarm=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm" --set "sql_logdir=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/sql_logs" --set mapi_open=true --set xrpc_open=true --set mapi_port=30558 --set xrpc_port=46252 --set monet_prompt= --trace "--dbname=mTests_src_test_BugTracker" --set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over.. -# 15:18:11 > +# 17:04:39 > +# 17:04:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=38700" "--set" "mapi_usock=/var/tmp/mtest-7090/.s.monetdb.38700" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/Monet-devel/var/MonetDB/mTests_sql_test_BugTracker" "--set" "embedded_r=yes" "--set" "embedded_py=true" +# 17:04:39 > -# MonetDB server v5.6.0, based on kernel v1.24.0 -# Serving database 'mTests_src_test_BugTracker' -# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked -# Copyright (c) 1993-2008 CWI, all rights reserved -# Visit http://monetdb.cwi.nl/ for further information -# Listening for connection requests on mapi:monetdb://alf.ins.cwi.nl:30558/ -# MonetDB/SQL module v2.24.0 loaded +# MonetDB 5 server v11.24.0 (hg id: 0ab1bb99d0ea) +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers +# Found 15.589 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2016 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:38700/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-7090/.s.monetdb.38700 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/Python module loaded +# MonetDB/R module loaded Ready. -#function user.main():void; -#clients.quit(); -#end main; +# SQL catalog created, loading sql scripts once +# loading sql script: 09_like.sql +# loading sql script: 10_math.sql +# loading sql script: 11_times.sql +# loading sql script: 12_url.sql +# loading sql script: 13_date.sql +# loading sql script: 14_inet.sql +# loading sql script: 15_querylog.sql +# loading sql script: 16_tracelog.sql +# loading sql script: 17_temporal.sql +# loading sql script: 18_index.sql +# loading sql script: 20_vacuum.sql +# loading sql script: 21_dependency_functions.sql +# loading sql script: 22_clients.sql +# loading sql script: 23_skyserver.sql +# loading sql script: 25_debug.sql +# loading sql script: 26_sysmon.sql +# loading sql script: 27_rejects.sql +# loading sql script: 39_analytics.sql +# loading sql script: 39_analytics_hge.sql +# loading sql script: 40_geom.sql +# loading sql script: 40_json.sql +# loading sql script: 40_json_hge.sql +# loading sql script: 41_md5sum.sql +# loading sql script: 45_uuid.sql +# loading sql script: 46_gsl.sql +# loading sql script: 46_profiler.sql +# loading sql script: 51_sys_schema_extension.sql +# loading sql script: 72_fits.sql +# loading sql script: 74_netcdf.sql +# loading sql script: 75_lidar.sql +# loading sql script: 75_shp.sql +# loading sql script: 75_storagemodel.sql +# loading sql script: 80_statistics.sql +# loading sql script: 80_udf.sql +# loading sql script: 80_udf_hge.sql +# loading sql script: 85_bam.sql +# loading sql script: 90_generator.sql +# loading sql script: 90_generator_hge.sql +# loading sql script: 99_system.sql +# 17:04:39 > +# 17:04:39 > "./authorization.SF-1430616.SQL.sh" "authorization.SF-1430616" +# 17:04:39 > -# 10:24:37 > -# 10:24:37 > Mtimeout -timeout 300 ./authorization.SF-1430616.SQL authorization.SF-1430616 -# 10:24:37 > - -# 10:24:37 > -# 10:24:37 > Mtimeout -timeout 60 java nl.cwi.monetdb.client.JdbcClient -e -h localhost -p 32887 -d mTests_sql_test_BugTracker -f "../../../../../../MonetDB/sql/test/BugTracker/Tests/authorization.SF-1430616.sql" -# 10:24:37 > +# 17:04:39 > +# 1
MonetDB: graph0 - Basic handling of query rewrite phase for the ...
Changeset: 57a754716181 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=57a754716181 Modified Files: sql/backends/monet5/rel_bin.c sql/include/sql_relation.h sql/server/rel_distribute.c sql/server/rel_dump.c sql/server/rel_dump.h sql/server/rel_graph.c sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_select.c Branch: graph0 Log Message: Basic handling of query rewrite phase for the spfw operator diffs (truncated from 582 to 300 lines): 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 @@ -16,6 +16,7 @@ #include "rel_select.h" #include "rel_updates.h" #include "rel_optimizer.h" +#include "rel_dump.h" #include "sql_env.h" #define OUTER_ZERO 64 @@ -4550,6 +4551,15 @@ rel2bin_ddl(mvc *sql, sql_rel *rel, list } static stmt * +rel2bin_spfw(mvc *sql, sql_rel *rel, list *refs) +{ + printf("[Codegen] Input relation: %s\n", rel_to_str(sql, rel)); + + // for the time being, just ignore spfw and generate the code for the upper table + return subrel_bin(sql, rel->l, refs); +} + +static stmt * subrel_bin(mvc *sql, sql_rel *rel, list *refs) { stmt *s = NULL; @@ -4639,8 +4649,8 @@ subrel_bin(mvc *sql, sql_rel *rel, list s = rel2bin_ddl(sql, rel, refs); break; case op_spfw: - // todo - return NULL; + s = rel2bin_spfw(sql, rel, refs); + break; } if (s && rel_is_ref(rel)) { list_append(refs, rel); diff --git a/sql/include/sql_relation.h b/sql/include/sql_relation.h --- a/sql/include/sql_relation.h +++ b/sql/include/sql_relation.h @@ -135,7 +135,7 @@ typedef struct expression { #define DDL_ALTER_TABLE_DEL_TABLE 64 #define DDL_ALTER_TABLE_SET_ACCESS 65 -#define MAXOPS 21 +#define MAXOPS 22 typedef enum operator_type { op_basetable = 0, @@ -221,6 +221,8 @@ typedef enum operator_type { (op == op_insert || op == op_update || op == op_delete) #define is_sample(op) \ (op == op_sample) +#define is_spfw(op) \ + (op == op_spfw) /* NO NIL semantics of aggr operations */ #define need_no_nil(e) \ diff --git a/sql/server/rel_distribute.c b/sql/server/rel_distribute.c --- a/sql/server/rel_distribute.c +++ b/sql/server/rel_distribute.c @@ -43,6 +43,7 @@ has_remote_or_replica( sql_rel *rel ) case op_union: case op_inter: case op_except: +case op_spfw: if (has_remote_or_replica( rel->l ) || has_remote_or_replica( rel->r )) return 1; @@ -65,8 +66,6 @@ has_remote_or_replica( sql_rel *rel ) if (rel->r && has_remote_or_replica( rel->r )) return 1; break; -case op_spfw: -break; // TODO, just allow to compile ftb } return 0; } @@ -157,6 +156,7 @@ replica(mvc *sql, sql_rel *rel, char *ur case op_union: case op_inter: case op_except: +case op_spfw: rel->l = replica(sql, rel->l, uri); rel->r = replica(sql, rel->r, uri); break; @@ -177,8 +177,6 @@ replica(mvc *sql, sql_rel *rel, char *ur case op_delete: rel->r = replica(sql, rel->r, uri); break; -case op_spfw: -break; // TODO, just allow to compile ftb } return rel; } @@ -301,7 +299,8 @@ rel_remote_func(mvc *sql, sql_rel *rel) case op_union: case op_inter: - case op_except: + case op_except: +case op_spfw: rel->l = rel_remote_func(sql, rel->l); rel->r = rel_remote_func(sql, rel->r); break; @@ -322,8 +321,6 @@ rel_remote_func(mvc *sql, sql_rel *rel) case op_delete: rel->r = rel_remote_func(sql, rel->r); break; -case op_spfw: -break; // TODO, just allow to compile ftb } if (find_prop(rel->p, PROP_REMOTE) != NULL) { list *exps = rel_projections(sql, rel, NULL, 1, 1); diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -1343,3 +1343,20 @@ rel_read(mvc *sql, char *r, int *pos, li return rel; } +// copied and pasted from codegen +str +rel_to_str(mvc *sql, sql_rel *rel) +{ + buffer *b; + stream *s = buffer_wastream(b = buffer_create(1024), "rel_dump"); + list *refs = sa_list(sql->sa); + char *res = NULL; + + rel_print_refs(sql, s, rel, 0, refs, 0); + rel_print_(sql, s, rel, 0, refs, 0); + mnstr_printf(s, "\n"); + res = buffer_get_buf(b); + buffer_destroy(b); + mnstr_destroy(s); + return res; +} diff --git a/sql/server/rel_dump.h b/sql/server/rel_dump.h --- a/sql/server/
MonetDB: graph0 - MIL Codegen - WIP
Changeset: 129094d42aa3 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=129094d42aa3 Modified Files: monetdb5/optimizer/opt_prelude.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/server/rel_dump.c sql/server/rel_dump.h sql/server/rel_optimizer.c sql/server/rel_rel.c Branch: graph0 Log Message: MIL Codegen - WIP diffs (truncated from 336 to 300 lines): diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c --- a/monetdb5/optimizer/opt_prelude.c +++ b/monetdb5/optimizer/opt_prelude.c @@ -94,6 +94,8 @@ str getRef; str getTraceRef; str generatorRef; str grabRef; +str graphRef; +str graph_makeRef; str groupRef; str subgroupRef; str subgroupdoneRef; @@ -326,6 +328,8 @@ void optimizerInit(void) getTraceRef = putName("getTrace"); generatorRef = putName("generator"); grabRef = putName("grab"); + graphRef = putName("graph"); + graph_makeRef = putName("gmake"); groupRef = putName("group"); subgroupRef = putName("subgroup"); subgroupdoneRef= putName("subgroupdone"); 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 @@ -4553,10 +4553,81 @@ rel2bin_ddl(mvc *sql, sql_rel *rel, list static stmt * rel2bin_spfw(mvc *sql, sql_rel *rel, list *refs) { - printf("[Codegen] Input relation: %s\n", rel_to_str(sql, rel)); - - // for the time being, just ignore spfw and generate the code for the upper table - return subrel_bin(sql, rel->l, refs); + stmt *edges = NULL, *spfw = NULL, *graph = NULL; + stmt *left = NULL, right = NULL; + stmt *c = NULL, *g = NULL, *groups = NULL, *smpl = NULL; + stmt *D = NULL; + stmt *p0 = NULL, *p1 = NULL; + list *l = NULL; + stmt *e_from = NULL, *e_to = NULL, *q_from = NULL, *q_to = NULL; + node *n = NULL; + + // materialize the input relations + left = subrel_bin(sql->sa, rel->l, refs); + if(!left) return NULL; + (void) right; + edges = subrel_bin(sql->sa, rel->r, refs); + if(!edges) return NULL; + + // refer to the columns + assert(rel->exps->cnt == 4 && "Expected four columns as input (ftb)"); // TODO weights missing + n = rel->exps->h; + q_from = exp_bin(sql->sa, n->data, left, NULL, NULL, NULL, NULL, NULL); + n = n->next; + q_to = exp_bin(sql->sa, n->data, left, NULL, NULL, NULL, NULL, NULL); + n = n->next; + e_from = exp_bin(sql->sa, n->data, edges, NULL, NULL, NULL, NULL, NULL); + n = n->next; + e_to = exp_bin(sql->sa, n->data, edges, NULL, NULL, NULL, NULL, NULL); + + // create the graph + // this is, like, super fun! + l = sa_list(sql->sa); + list_append(l, e_from); + list_append(l, e_to); + c = stmt_concat(sql->sa, l); + g = stmt_group(sql->sa, c, NULL, NULL, NULL); + groups = stmt_result(sql->sa, g, 0); + smpl = stmt_result(sql->sa, g, 1); + e_from = stmt_mkpartition(sql->sa, groups, 0, 2); + e_to = stmt_mkpartition(sql->sa, groups, 1, 2); + graph = stmt_mkgraph(sql->sa, e_from, e_to); + + // map the values in qfrom, qto into vertex IDs + D = stmt_project(sql->sa, smpl, c); // domain + + // make the operator + spfw = stmt_spfw(sql->sa, left, graph); + + + +// spfw->op4.lval = sa_list(sql->sa); +// for(node* n = rel->exps->h; n; n = n->next){ +// list_append(spfw->op4.lval, exp_bin(sql, n->data, left, edges, NULL, NULL, NULL, NULL)); +// } +// +// // input columns (for debug reasons) +// do { // damn c +// int i = 0; +// for(node* n = left->op4.lval->h; n; n = n->next, i++){ +// stmt* s = n->data; +// printf("[%d] %s %s, with f: %s %s, type: %d, tbl: %p\n", i, s->tname, s->cname, table_name(sql->sa, s), column_name(sql->sa, s), s->type, s->op4.tval); +// } +// } while(0); +// +// // apply the filter +// r = stmt_result(sql->sa, spfw, 0); +// l = sa_list(sql->sa); +// for(node *n = left->op4.lval->h; n; n = n->next) { +// stmt *col = n->data; +// +// if (col->nrcols == 0) /* constant */ +// col = stmt_const(sql->sa, r, col); +// else +// col = stmt_project(sql->sa, r, col); +// list_append(l, col); +// } +// return stmt_list(sql->sa, l); } static stmt * diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -2771,6 +2771,37 @@ static int if (q == NULL) return -1;
MonetDB: leftmart - A bitvector-based sort function designed for...
Changeset: 53c1c6dd7704 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53c1c6dd7704 Modified Files: gdk/gdk_select.c Branch: leftmart Log Message: A bitvector-based sort function designed for unsorted cand lists. Unsorted cand lists are produced during an ordered index selection or a hash index selection. Instead of trying to sort this list of candidates with the usual n*log(n) GDKqsort method, we instead set the bits of a bitvector that correspond to the positions of candidates in the original BAT. We then sequentially materialize the bitvector to a cand list that it is ordered by construction, resulting in a 2*n "sort" method. diffs (83 lines): diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -149,6 +149,56 @@ doubleslice(BAT *b, BUN l1, BUN h1, BUN return virtualize(bn); } +static BAT * +sort_cand(BAT *b, BUN cnt) +{ + BAT *bn; + const oid *restrict o; + oid *restrict p; + unsigned char *bitvector; + BUN i,sz_b; + +#define remainder8(X) ((X) & 7) +#define quotient8(X)((X) >> 3) + + assert(b->ttype=TYPE_oid); + /* input must be a potential candidate list or NULL */ + assert(b == NULL || + (((b->ttype == TYPE_void && b->tseqbase != oid_nil) || +b->ttype == TYPE_oid) && +b->tkey)); + + sz_b = BATcount(b); + bitvector = (unsigned char *) GDKzalloc(cnt/8+1); + if (bitvector == NULL) { + GDKerror("#BATbloom: memory allocation error"); + return GDK_FAIL; + } + + o = (oid *) Tloc(b,0); + for (i=0; i < sz_b; i++) { + bitvector[quotient8(o[i])] |= (1trevsorted = bn->batCount <= 1; + bn->tkey = 1; + bn->tseqbase = (bn->tdense = bn->batCount <= 1) != 0 ? 0 : oid_nil; + bn->tnil = 0; + bn->tnonil = 1; + return virtualize(bn); +} + #define HASHloop_bound(bi, h, hb, v, lo, hi) \ for (hb = HASHget(h, HASHprobe((h), v));\ hb != HASHnil(h); \ @@ -1678,16 +1728,18 @@ BATselect(BAT *b, BAT *s, const void *tl rs++; } BATsetcount(bn, cnt); + bn->tkey = 1; + bn->tnil = 0; + bn->tnonil = 1; } /* output must be sorted */ + /* GDKqsort((oid *) Tloc(bn, 0), NULL, NULL, (size_t) bn->batCount, sizeof(oid), 0, TYPE_oid); bn->tsorted = 1; bn->trevsorted = bn->batCount <= 1; - bn->tkey = 1; - bn->tseqbase = (bn->tdense = bn->batCount <= 1) != 0 ? 0 : oid_nil; - bn->tnil = 0; - bn->tnonil = 1; + bn->tseqbase = (bn->tdense = bn->batCount <= 1) != 0 ? 0 : oid_nil;*/ + sort_cand(bn,BATcount(b)); } else { /* match: [low..high) */ if (s) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2016 - fix compilation on osx 10.12
Changeset: c299b5dca70d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c299b5dca70d Modified Files: configure.ag Branch: Jun2016 Log Message: fix compilation on osx 10.12 diffs (12 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -3116,7 +3116,7 @@ AC_DEFINE([__hidden], [/* empty */], dnl checks for library functions case $host in - *-darwin1[[012345]]*) + *-darwin1[[0123456]]*) # OSX 10.6 (Snow Leopard) and up somehow makes configure believe # that fdatasync exists, in reality however, it does not on this # platform. ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Jun2016 branch.
Changeset: 64bf074b6f46 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64bf074b6f46 Modified Files: configure.ag sql/test/emptydb-upgrade-chain/Tests/check.stable.out sql/test/emptydb-upgrade/Tests/check.stable.out sql/test/emptydb/Tests/All sql/test/emptydb/Tests/check.stable.out Branch: default Log Message: Merge with Jun2016 branch. diffs (12 lines): diff --git a/sql/test/emptydb/Tests/All b/sql/test/emptydb/Tests/All --- a/sql/test/emptydb/Tests/All +++ b/sql/test/emptydb/Tests/All @@ -1,5 +1,5 @@ HAVE_GEOM?load -RELEASERUN&!HAVE_HGE&!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!BITS32?package -RELEASERUN&HAVE_HGE&!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!BITS32?package-hge +RELEASERUN&!HAVE_HGE&!HAVE_LIDAR&!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!BITS32?package +RELEASERUN&HAVE_HGE&!HAVE_LIDAR&!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!BITS32?package-hge HAVE_GEOM?dump -!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&HAVE_PCRE&!HAVE_SAMTOOLS&!BITS32?check +!HAVE_LIDAR&!HAVE_NETCDF&!HAVE_FITS&HAVE_GEOM&!HAVE_GSL&HAVE_PCRE&!HAVE_SAMTOOLS&!BITS32?check ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2016 - fixes for both bug 4058 and bug 4064
Changeset: cb072f9b954e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb072f9b954e Modified Files: clients/mapilib/mapi.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_select.c sql/test/BugTracker-2016/Tests/concat_2_integers.Bug-4058.stable.out Branch: Jun2016 Log Message: fixes for both bug 4058 and bug 4064 In both cases the same expression (pointer) was used, which isn't correct. Because with rewrites both uses change. They are now correctly referencing a single projection column diffs (135 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -2175,6 +2175,8 @@ mapi_destroy(Mapi mid) free(mid->password); if (mid->language) free(mid->language); + if (mid->motd) + free(mid->motd); if (mid->database) free(mid->database); diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -72,6 +72,7 @@ exp_print(mvc *sql, stream *fout, sql_ex (void)sql; if (!e) return; + //mnstr_printf(fout, " %p ", e); switch(e->type) { case e_psm: { if (e->flag & PSM_SET) { @@ -319,6 +320,8 @@ rel_print_(mvc *sql, stream *fout, sql_ mnstr_printf(fout, "\n%cREF %d (%d)", decorate?'=':' ', nr, cnt); } + + //mnstr_printf(fout, " %p ", rel); switch (rel->op) { case op_basetable: { sql_table *t = rel->l; diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5331,6 +5331,8 @@ exps_used(list *l) static void rel_used(sql_rel *rel) { + if (!rel) + return; if (is_join(rel->op) || is_set(rel->op) || is_semi(rel->op)) { if (rel->l) rel_used(rel->l); @@ -5340,7 +5342,7 @@ rel_used(sql_rel *rel) rel_used(rel->l); rel = rel->l; } - if (rel->exps) { + if (rel && rel->exps) { exps_used(rel->exps); if (rel->r && (rel->op == op_project || rel->op == op_groupby)) exps_used(rel->r); 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 @@ -2111,6 +2111,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel, list *vals = NULL, *ll = sa_list(sql->sa); int correlated = 0; int l_is_value = 1, r_is_rel = 0; + list *pexps = NULL; /* complex case */ if (dl->h->type == type_list) { /* (a,b..) in (.. ) */ @@ -2140,12 +2141,18 @@ rel_logical_exp(mvc *sql, sql_rel *rel, /* first remove the NULLs */ if (sc->token == SQL_NOT_IN && l->card != CARD_ATOM && has_nil(l)) { + sql_exp *ol; + + rel = rel_project(sql->sa, rel, rel_projections(sql, rel, NULL, 1, 1)); + pexps = rel_projections(sql, rel, NULL, 1, 1); + l = exp_label(sql->sa, l, ++sql->label); + append(rel->exps, l); + ol = l; + l = exp_column(sql->sa, exp_relname(ol), exp_name(ol), exp_subtype(ol), ol->card, has_nil(ol), is_intern(ol)); 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)) - left = rel = rel_select(sql->sa, rel, e); - else - rel_select_add_exp(sql->sa, rel, e); + left = rel = rel_select(sql->sa, rel, e); + l = exp_column(sql->sa, exp_relname(ol), exp_name(ol), exp_subtype(ol), ol->card, has_nil(ol), is_intern(ol)); } append(ll, l); @@ -2191,7 +2198,10 @@ rel_logical_exp(mvc *sql, sql_rel *rel, list_append(nvals, r); } e = exp_in(sql->sa, l, nvals, sc->token==SQL_NOT_IN?cmp_notin:cmp_in); - return rel_select(sql->sa, rel, e); + rel = rel_select(sql->sa, rel, e); + if (pexps) + rel = rel_project(sql->sa, rel, pexps); + return rel; } else { /* complex case */