MonetDB: sq2 - and make it compile.

2019-10-29 Thread Niels Nes
Changeset: 3ad85df70bfb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ad85df70bfb
Modified Files:
sql/server/rel_select.c
Branch: sq2
Log Message:

and make it compile.


diffs (35 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
@@ -3807,7 +3807,6 @@ rel_binop(sql_query *query, sql_rel **re
mvc *sql = query->sql;
dnode *dl = se->data.lval->h;
sql_exp *l, *r;
-   sql_rel *orel = *rel, *left;
char *fname = qname_fname(dl->data.lval);
char *sname = qname_schema(dl->data.lval);
sql_schema *s = sql->session->schema;
@@ -3822,7 +3821,6 @@ rel_binop(sql_query *query, sql_rel **re
return NULL;
 
l = rel_value_exp(query, rel, dl->next->data.sym, f, iek);
-   left = *rel;
r = rel_value_exp(query, rel, dl->next->next->data.sym, f, iek);
if (l && *rel && exp_card(l) > CARD_AGGR && rel_find_groupby(*rel)) {
if (l && exp_relname(l) && exp_name(l))
@@ -3831,7 +3829,6 @@ rel_binop(sql_query *query, sql_rel **re
}
 
if (!l || !r) {
-   *rel = orel;
sf = find_func(sql, s, fname, 2, F_AGGR, NULL);
}
if (!sf && (!l || !r) && *rel && (*rel)->card == CARD_AGGR) {
@@ -5506,7 +5503,6 @@ rel_value_exp2(sql_query *query, sql_rel
 
if (e->l && e->r)
ne = 
rel_bind_column2(sql, r, e->l, e->r, 0);
-   }
if (ne) {
e = ne;
r = r->l;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sq2 - removed unused code

2019-10-29 Thread Niels Nes
Changeset: 1ac2ec8544b3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ac2ec8544b3
Modified Files:
sql/server/rel_select.c
Branch: sq2
Log Message:

removed unused code


diffs (131 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
@@ -1719,67 +1719,6 @@ compare_aggr_op( char *compare, int quan
 }
 
 static sql_rel *
-rel_compare_selects(sql_query *query, sql_rel *rel, symbol *lo, symbol *ro, 
char *compare_op, 
-   int f, exp_kind k, int quantifier, int need_not)
-{
-   mvc *sql = query->sql;
-   sql_exp *rs = NULL, *ls = NULL;
-   exp_kind ek = {type_value, card_column, FALSE};
-   sql_rel *l, *r;
-   int ldependent = 0, rdependent = 0;
-   
-   assert(is_sql_where(f)); /* for now just where part */
-   l = rel_subquery(query, NULL, lo, ek);
-   if (!l && sql->session->status != -ERR_AMBIGUOUS) {
-   /* reset error */
-   sql->session->status = 0;
-   sql->errstr[0] = 0;
-   query_push_outer(query, rel, f);
-   l = rel_subquery(query, NULL, lo, ek);
-   if (l)
-   set_subquery(l);
-   rel = query_pop_outer(query);
-   ldependent = 1;
-   }
-   r = rel_subquery(query, NULL, ro, ek);
-   if (!r && sql->session->status != -ERR_AMBIGUOUS) {
-   /* reset error */
-   sql->session->status = 0;
-   sql->errstr[0] = 0;
-   query_push_outer(query, rel, f);
-   r = rel_subquery(query, NULL, ro, ek);
-   if (r)
-   set_subquery(r);
-   rel = query_pop_outer(query);
-   rdependent = 1;
-   }
-   if (!l || !r)
-   return NULL;
-   ls = rel_lastexp(sql, l);
-   rs = rel_lastexp(sql, r);
-   if (rel) {
-   r = rel_crossproduct(sql->sa, l, r, op_join);
-   set_subquery(r);
-   if (rel && is_left(rel->op)) {
-   r = rel->r = rel_crossproduct(sql->sa, rel->r, r, 
/*(!quantifier)?op_semi:*/op_join);
-   if (rdependent)
-   set_dependent(r);
-   } else if (rel && is_right(rel->op)) {
-   l = rel->l = rel_crossproduct(sql->sa, rel->l, r, 
(!quantifier)?op_semi:op_join);
-   if (ldependent)
-   set_dependent(l);
-   } else {
-   rel = rel_crossproduct(sql->sa, rel, r, 
(!quantifier)?op_semi:op_join);
-   }
-   } else {
-   rel = rel_crossproduct(sql->sa, l, r, 
(!quantifier)?op_semi:op_join);
-   }
-   if (rel && ldependent && rdependent)
-   set_dependent(rel);
-   return rel_compare_exp(query, rel, ls, rs, compare_op, NULL, k.reduce, 
quantifier, need_not);
-}
-
-static sql_rel *
 rel_compare(sql_query *query, sql_rel *rel, symbol *sc, symbol *lo, symbol 
*ro, symbol *ro2,
char *compare_op, int f, exp_kind k, int quantifier)
 {
@@ -1811,9 +1750,6 @@ rel_compare(sql_query *query, sql_rel *r
compare_op[1] = 0;
}
 
-   if (0 && !ro2 && lo->token == SQL_SELECT && ro->token == SQL_SELECT)
-   return rel_compare_selects(query, rel, lo, ro, compare_op, f, 
k, quantifier, need_not);
-
if (!ro2 && lo->token == SQL_SELECT) { /* swap subquery to the right 
hand side */
symbol *tmp = lo;
 
@@ -2084,9 +2020,6 @@ rel_in_value_exp(sql_query *query, sql_r
l_is_value=0;
}
ek.card = card_set;
-   if (0 && l && is_aggr(l->type) && is_groupby(left->op)) {
-   l = rel_project_add_exp(sql, left, l);
-   }
 
/* For each r in values keep a list of vals/rels, union these groupby 
(in/not in) etc  */
if (n->type == type_list) {
@@ -3890,10 +3823,6 @@ rel_binop(sql_query *query, sql_rel **re
 
l = rel_value_exp(query, rel, dl->next->data.sym, f, iek);
left = *rel;
-   if (0 && l && is_aggr(l->type) && is_groupby(left->op)) {
-   l = rel_project_add_exp(sql, left, l);
-   orel = left;
-   }
r = rel_value_exp(query, rel, dl->next->next->data.sym, f, iek);
if (l && *rel && exp_card(l) > CARD_AGGR && rel_find_groupby(*rel)) {
if (l && exp_relname(l) && exp_name(l))
@@ -5564,18 +5493,7 @@ rel_value_exp2(sql_query *query, sql_rel
exp_setname(sql->sa, ne, 
exp_relname(e), exp_name(e));
e = ne;
} else { 
-#if 0
-   if (is_sql_sel(f) && is_project(p->op) 
&& !is_processed(p)) {
-   if (p->l) {
-   p->l 

MonetDB: sq2 - more cleaning

2019-10-29 Thread Niels Nes
Changeset: dc800e803010 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dc800e803010
Modified Files:
sql/common/sql_list.c
sql/include/sql_list.h
sql/include/sql_relation.h
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_unnest.c
Branch: sq2
Log Message:

more cleaning


diffs (truncated from 930 to 300 lines):

diff --git a/sql/common/sql_list.c b/sql/common/sql_list.c
--- a/sql/common/sql_list.c
+++ b/sql/common/sql_list.c
@@ -740,6 +740,15 @@ list_hash_add(list *l, void *data, fcmp 
return data;
 }
 
+void
+list_hash_clear(list *l)
+{
+   MT_lock_set(>ht_lock);
+l->ht = NULL;
+MT_lock_unset(>ht_lock);
+
+}
+
 #ifdef TEST
 #include 
 
diff --git a/sql/include/sql_list.h b/sql/include/sql_list.h
--- a/sql/include/sql_list.h
+++ b/sql/include/sql_list.h
@@ -95,5 +95,6 @@ extern list *list_merge_destroy(list *l,
 
 extern void list_hash_delete(list *l, void *data, fcmp cmp);
 extern void* list_hash_add(list *l, void *data, fcmp cmp);
+extern void list_hash_clear(list *l);
 
 #endif /* LIST_H */
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
@@ -165,6 +165,8 @@ typedef enum operator_type {
(et == e_func)
 #define is_aggr(et) \
(et == e_aggr)
+#define is_convert(et) \
+   (et == e_convert)
 #define is_map_op(et) \
(et == e_func || et == e_convert)
 #define is_column(et) \
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
@@ -85,7 +85,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
(void)sql;
if (!e)
return;
-   //mnstr_printf(fout, "%p ", e);
+   /*mnstr_printf(fout, "%p ", e);*/
switch(e->type) {
case e_psm: {
if (e->flag & PSM_SET) {
@@ -106,7 +106,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
if (e->f)
exps_print(sql, fout, e->f, depth, refs, alias, 
0);
} else if (e->flag & PSM_REL) {
-   rel_print_(sql, fout, e->l, depth+1, refs, 1);
+   rel_print_(sql, fout, e->l, depth+10, refs, 1);
} else if (e->flag & PSM_EXCEPTION) {
mnstr_printf(fout, "except ");
exp_print(sql, fout, e->l, depth, refs, 0, 0);
@@ -164,8 +164,11 @@ exp_print(mvc *sql, stream *fout, sql_ex
f->func->s?f->func->s->base.name:"sys",
f->func->base.name);
exps_print(sql, fout, e->l, depth, refs, alias, 1);
-   if (e->r)
-   exps_print(sql, fout, e->r, depth, refs, alias, 1);
+   if (e->r) { /* list of optional lists */
+   list *l = e->r;
+   for(node *n = l->h; n; n = n->next) 
+   exps_print(sql, fout, n->data, depth, refs, 
alias, 1);
+   }
}   break;
case e_aggr: {
sql_subaggr *a = e->f;
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -540,17 +540,11 @@ exp_alias_or_copy( mvc *sql, const char 
if (!tname)
tname = old->alias.rname;
 
-   if (!tname && old->type == e_column)
-   tname = old->l;
-
if (!cname && exp_name(old) && exp_name(old)[0] == 'L') {
ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel?orel->card:CARD_ATOM, has_nil(old), is_intern(old));
return exp_propagate(sql->sa, ne, old);
} else if (!cname) {
-   char name[16], *nme;
-   nme = number2name(name, 16, ++sql->label);
-
-   exp_setname(sql->sa, old, nme, nme);
+   exp_label(sql->sa, old, ++sql->label);
ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel?orel->card:CARD_ATOM, has_nil(old), is_intern(old));
return exp_propagate(sql->sa, ne, old);
} else if (cname && !old->alias.name) {
@@ -652,6 +646,11 @@ exp_rel(mvc *sql, sql_rel *rel)
*/
e->l = rel;
e->flag = PSM_REL;
+   assert(rel);
+   if (is_project(rel->op)) {
+   sql_exp *last = rel->exps->t->data;
+   e->tpe = *exp_subtype(last);
+   }
return e;
 }
 
@@ -804,6 +803,10 @@ exp_subtype( sql_exp *e )
}
case e_cmp:
/* return bit */
+   case e_psm:
+   if (e->tpe.type)
+   return >tpe;
+   /* fall through */
default:
return NULL;
}
@@ -825,8 +828,6 @@ exp_relname( 

MonetDB: compactprofiler - Revert keeping the uuid in the client...

2019-10-29 Thread Martin Kersten
Changeset: 18e5cfdcb9cf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=18e5cfdcb9cf
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_profiler.c
Branch: compactprofiler
Log Message:

Revert keeping the uuid in the client record.


diffs (55 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -213,7 +213,6 @@ MCinitClientRecord(Client c, oid user, b
 
c->user = user;
c->username = 0;
-   c->uuid = NULL;
c->scenario = NULL;
c->oldscenario = NULL;
c->srcFile = NULL;
@@ -432,8 +431,6 @@ MCfreeClient(Client c)
GDKfree(c->username);
c->username = 0;
}
-   GDKfree(c->uuid);
-   c->uuid = NULL;
c->mythread = 0;
if (c->glb) {
freeStack(c->glb);
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -47,7 +47,6 @@ typedef struct CLIENT {
int idx;/* entry in mal_clients */
oid user;   /* user id in the auth administration */
str username;   /* for event processor */
-   str uuid;   /* unique session marker */
/*
 * The actions for a client is separated into several stages:
 * parsing, strategic optimization, tactical optimization, and
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -174,15 +174,11 @@ renderProfilerEvent(Client cntxt, MalBlk
 if (!GDKinmemory()) {
 char *uuid;
str c;
-   if( cntxt->uuid)
-   logadd("\"session\":\"%s\","PRETTIFY, 
cntxt->uuid);
-   else{
-   if ((c = msab_getUUID()) == NULL) {
-   logadd("\"session\":\"%s\","PRETTIFY, uuid);
-   cntxt->uuid = uuid;
-   } else
-   free(c);
-   }
+   if ((c = msab_getUUID()) == NULL) {
+   logadd("\"session\":\"%s\","PRETTIFY, uuid);
+   free(uuid);
+   } else
+   free(c);
 }
logadd("\"state\":\"%s\","PRETTIFY, start?"start":"done");
logadd("\"usec\":"LLFMT","PRETTIFY, pci->ticks);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: grouping-analytics - Merge with default

2019-10-29 Thread Pedro Ferreira
Changeset: 2ae0e44bf9bd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ae0e44bf9bd
Added Files:
sql/test/miscellaneous/Tests/select_groupby.sql
sql/test/miscellaneous/Tests/select_groupby.stable.err
sql/test/miscellaneous/Tests/select_groupby.stable.out
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
clients/mapiclient/dump.c
clients/mapiclient/msqldump.c
gdk/gdk_analytic_bounds.c
geom/monetdb5/geom.c
geom/monetdb5/geom_upgrade.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_builder.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_runtime.c
monetdb5/modules/mal/Tests/inspect05.stable.out.int128
monetdb5/modules/mal/Tests/mat.malC
monetdb5/modules/mal/Tests/mat.stable.out
monetdb5/modules/mal/manual.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/mat.mal
monetdb5/modules/mal/tokenizer.c
sql/backends/monet5/UDF/udf/Tests/udf-fuse.stable.out
sql/backends/monet5/UDF/udf/Tests/udf-reverse.stable.out
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_upgrades.h
sql/backends/monet5/vaults/fits/fits.c
sql/backends/monet5/vaults/shp/shp.c
sql/scripts/26_sysmon.sql
sql/scripts/99_system.sql
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_updates.c
sql/test/BugConstraints/Tests/check_constraint.SF-1714829.stable.err

sql/test/BugDay_2005-12-19_2.9.3/Tests/default_next_value_for_non_ex_seq.SF.1246631.stable.err

sql/test/BugTracker-2009/Tests/segfault_when_quitting_debugger.SF-2538837.stable.out

sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out

sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.out
sql/test/BugTracker-2014/Tests/manifold.Bug-3556.stable.out
sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.stable.out

sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-view.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-view.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out
sql/test/Tests/comment-dump.stable.out
sql/test/Triggers/Tests/trigger_owner.stable.err
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128

sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/miscellaneous/Tests/All
sql/test/pg_regress/Tests/alter_table.stable.err
sql/test/pg_regress/Tests/alter_table.stable.out
sql/test/remote/Tests/partition_elim.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out

MonetDB: grouping-analytics - New keywords added

2019-10-29 Thread Pedro Ferreira
Changeset: ba0dc001d223 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba0dc001d223
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/scripts/51_sys_schema_extension.sql
Branch: grouping-analytics
Log Message:

New keywords added


diffs (48 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -2381,6 +2381,9 @@ sql_update_default(Client c, mvc *sql, c
"update sys._tables set system = true where schema_id = 
(select id from sys.schemas where name = 'sys')"
" and name = 'queue';\n");
 
+   pos += snprintf(buf + pos, bufsize - pos,
+   "insert into sys.keywords values ('CUBE'), 
('GROUPING'), ('ROLLUP'), ('SETS');\n");
+
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
diff --git a/sql/scripts/51_sys_schema_extension.sql 
b/sql/scripts/51_sys_schema_extension.sql
--- a/sql/scripts/51_sys_schema_extension.sql
+++ b/sql/scripts/51_sys_schema_extension.sql
@@ -52,6 +52,7 @@ INSERT INTO sys.keywords (keyword) VALUE
   ('CORRESPONDING'),
   ('CREATE'),
   ('CROSS'),
+  ('CUBE'),
   ('CURRENT'),
   ('CURRENT_DATE'),
   ('CURRENT_ROLE'),
@@ -94,6 +95,7 @@ INSERT INTO sys.keywords (keyword) VALUE
   ('GLOBAL'),
   ('GRANT'),
   ('GROUP'),
+  ('GROUPING'),
   ('HAVING'),
   ('HOUR'),
   ('HUGEINT'),
@@ -170,6 +172,7 @@ INSERT INTO sys.keywords (keyword) VALUE
   ('REVOKE'),
   ('RIGHT'),
   ('ROLLBACK'),
+  ('ROLLUP'),
   ('ROWS'),
   ('SAMPLE'),
   ('SAVEPOINT'),
@@ -180,6 +183,7 @@ INSERT INTO sys.keywords (keyword) VALUE
   ('SERIALIZABLE'),
   ('SESSION_USER'),
   ('SET'),
+  ('SETS'),
   ('SIMPLE'),
   ('SMALLINT'),
   ('SOME'),
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: compactprofiler - Keep the uuid around

2019-10-29 Thread Martin Kersten
Changeset: 8ffb3eb0d665 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ffb3eb0d665
Modified Files:
monetdb5/mal/mal_profiler.c
Branch: compactprofiler
Log Message:

Keep the uuid around


diffs (26 lines):

diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -171,9 +171,19 @@ renderProfilerEvent(Client cntxt, MalBlk
logadd("\"tag\":"OIDFMT","PRETTIFY, stk?stk->tag:0);
logadd("\"module\":\"%s\","PRETTIFY, pci->modname ? pci->modname : "" );
logadd("\"instruction\":\"%s\","PRETTIFY, pci->fcnname ? pci->fcnname : 
"");
-   if( cntxt->uuid == 0)
-   cntxt->uuid = msab_getUUID(>uuid);
-   logadd("\"session\":\"%s\","PRETTIFY, cntxt->uuid);
+if (!GDKinmemory()) {
+char *uuid;
+   str c;
+   if( cntxt->uuid)
+   logadd("\"session\":\"%s\","PRETTIFY, 
cntxt->uuid);
+   else{
+   if ((c = msab_getUUID()) == NULL) {
+   logadd("\"session\":\"%s\","PRETTIFY, uuid);
+   cntxt->uuid = uuid;
+   } else
+   free(c);
+   }
+}
logadd("\"state\":\"%s\","PRETTIFY, start?"start":"done");
logadd("\"usec\":"LLFMT","PRETTIFY, pci->ticks);

___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Nov2019

2019-10-29 Thread Pedro Ferreira
Changeset: eac848448663 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eac848448663
Added Files:
sql/test/miscellaneous/Tests/select_groupby.sql
sql/test/miscellaneous/Tests/select_groupby.stable.err
sql/test/miscellaneous/Tests/select_groupby.stable.out
Modified Files:
clients/mapiclient/dump.c
clients/mapiclient/msqldump.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_updates.c

sql/test/BugDay_2005-12-19_2.9.3/Tests/default_next_value_for_non_ex_seq.SF.1246631.stable.err
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.out
sql/test/Tests/comment-dump.stable.out
sql/test/miscellaneous/Tests/All
Branch: default
Log Message:

Merge with Nov2019


diffs (truncated from 796 to 300 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -2575,8 +2575,7 @@ dump_database(Mapi mid, stream *toConsol
goto bailout;
 
/* start a transaction for the dump */
-   if (!describe)
-   mnstr_printf(toConsole, "%s;\n", start_trx);
+   mnstr_printf(toConsole, "%s;\n", start_trx);
 
if ((hdl = mapi_query(mid, start_trx)) == NULL || mapi_error(mid))
goto bailout;
@@ -3095,8 +3094,7 @@ dump_database(Mapi mid, stream *toConsol
mapi_close_handle(hdl);
 
/* finally commit the whole transaction */
-   if (!describe)
-   mnstr_printf(toConsole, "COMMIT;\n");
+   mnstr_printf(toConsole, "COMMIT;\n");
if (sname)
free(sname);
if (query)
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -226,11 +226,15 @@ main(int argc, char **argv)
dump_version(mid, out, "-- server:");
mnstr_printf(out, "-- %s\n", buf);
}
-   if (functions)
+   if (functions) {
+   mnstr_printf(out, "START TRANSACTION;\n");
c = dump_functions(mid, out, true, NULL, NULL, NULL);
-   else if (table)
+   mnstr_printf(out, "COMMIT;\n");
+   } else if (table) {
+   mnstr_printf(out, "START TRANSACTION;\n");
c = dump_table(mid, NULL, table, out, describe, true, 
useinserts, false);
-   else
+   mnstr_printf(out, "COMMIT;\n");
+   } else
c = dump_database(mid, out, describe, useinserts);
mnstr_flush(out);
 
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
@@ -645,7 +645,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (cond_execution) {
/* var_x = nil; */
-   nme = number2name(name, 16, ++sql->label);
+   nme = number2name(name, sizeof(name), ++sql->label);
(void)stmt_var(be, nme, exp_subtype(e), 1, 2);
/* if_barrier ... */
cond_execution = stmt_cond(be, cond_execution, NULL, 0, 
0);
@@ -1674,7 +1674,7 @@ rel2bin_table(backend *be, sql_rel *rel,
char name[16], *nme;
sql_rel *fr;
 
-   nme = number2name(name, 16, ++sql->remote);
+   nme = number2name(name, sizeof(name), ++sql->remote);
 
l = rel2bin_args(be, rel->l, sa_list(sql->sa));
if(!l)
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
@@ -311,18 +311,18 @@ create_table_or_view(mvc *sql, char* sna
list *id_l;
 
sql->sa = sa_create();
-   if(!sql->sa) {
+   if (!sql->sa) {
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
buf = sa_alloc(sql->sa, strlen(c->def) + 8);
-   if(!buf) {
+   if (!buf) {
sa_destroy(sql->sa);
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
typestr = subtype2string2(>type);
-   if(!typestr) {
+   if (!typestr) {
sa_destroy(sql->sa);
sql->sa = osa;
throw(SQL, 

MonetDB: Nov2019 - Merge with Apr2019

2019-10-29 Thread Pedro Ferreira
Changeset: af7bfd5c27da for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af7bfd5c27da
Added Files:
sql/test/miscellaneous/Tests/select_groupby.sql
sql/test/miscellaneous/Tests/select_groupby.stable.err
sql/test/miscellaneous/Tests/select_groupby.stable.out
Modified Files:
sql/test/miscellaneous/Tests/All
Branch: Nov2019
Log Message:

Merge with Apr2019


diffs (truncated from 417 to 300 lines):

diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All
--- a/sql/test/miscellaneous/Tests/All
+++ b/sql/test/miscellaneous/Tests/All
@@ -10,3 +10,4 @@ with_update_stmts
 groupby_error
 alter_table_add_column
 view-mul-digits
+select_groupby
diff --git a/sql/test/miscellaneous/Tests/select_groupby.sql 
b/sql/test/miscellaneous/Tests/select_groupby.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/miscellaneous/Tests/select_groupby.sql
@@ -0,0 +1,111 @@
+start transaction;
+create schema "myschema";
+create sequence "myschema"."myseq";
+create table myschema.mytable
+(
+   "first" char(100),
+   "second" double,
+   "third" double,
+   "fourth" clob,
+   "fifth" clob,
+   "sixth" double,
+   "seventh" clob,
+   "eighth" date,
+   "ninth" double,
+   "tenth" double,
+   "eleventh" char(100),
+   "tweelfth" char(4),
+   "thirteenth" char(50),
+   "fourteenth" char(50),
+   "fifteenth" clob,
+   "sixteenth" char(100),
+   "seventeenth" char(100),
+   "eighteenth" char(30),
+   "nineteenth" double,
+   "twentieth" char(100),
+   "twentieth-first" clob,
+   "twentieth-second" double,
+   "twentieth-third" double,
+   "twentieth-fourth" double,
+   "twentieth-fifth" double,
+   "twentieth-sixth" double,
+   "twentieth-seventh" char(100),
+   "twentieth-eighth" char(100),
+   "twentieth-ninth" char(100),
+   "thirtieth" char(14),
+   "thirtieth-first" bigint,
+   "thirtieth-second" bigint,
+   "thirtieth-third" bigint,
+   "thirtieth-fourth" bigint,
+   "thirtieth-fifth" bigint,
+   "thirtieth-sixth" bigint,
+   "thirtieth-seventh" bigint,
+   "thirtieth-eighth" bigint,
+   "thirtieth-ninth" bigint,
+   "fortieth" bigint,
+   "fortieth-first" tinyint,
+   "fortieth-second" blob,
+   "fortieth-third" int default next value for "myschema"."myseq"
+);
+INSERT INTO myschema.mytable ("first", "second", "third", "fourth", "fifth", 
"sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "tweelfth", 
"thirteenth", "fourteenth", "fifteenth", "sixteenth", 
+ "seventeenth", 
"eighteenth", "nineteenth", "twentieth", "twentieth-first", "twentieth-second", 
"twentieth-third", "twentieth-fourth", "twentieth-fifth", "twentieth-sixth", 
+ "twentieth-seventh", 
"twentieth-eighth", "twentieth-ninth", "thirtieth", "thirtieth-first", 
"thirtieth-second", "thirtieth-third", "thirtieth-fourth", "thirtieth-fifth", 
+ "thirtieth-sixth", 
"thirtieth-seventh", "thirtieth-eighth", "thirtieth-ninth", "fortieth", 
"fortieth-first", "fortieth-second", "fortieth-third") 
+ VALUES ('1234 / 0', 
1234, 1, 'have', 'a', 850.85, 'very', '2019-03-18', 2, 16, 'nice', 'CC', 'DD', 
'Day', 'somewhere', 'you', 'will', '3840', 
+ 455, '11790 - 
Something', 'Paper', 850.83, 344, 0, 506.83, 59.5689, 'Good', 'Food', 'hello', 
'001234/00', 301215, 303378, 300346, 
+ 303378, 
300346, 32, 300015, 31, null, 300073, 0, null, 1);
+SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+exec ** ();
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" 

MonetDB: default - Accept output

2019-10-29 Thread Martin Kersten
Changeset: 72d6976ab495 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=72d6976ab495
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_builder.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
sql/backends/monet5/sql_statement.c
sql/test/BugTracker-2014/Tests/manifold.Bug-3556.stable.out
sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.stable.out
Branch: default
Log Message:

Accept output


diffs (truncated from 372 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
@@ -660,7 +660,7 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1]):void ",   
"OIDXcreate;",  "Introduces the OID index arrangement of ordered values"
]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
pieces:int):void ",   "OIDXcreate;",  "Introduces the OID index arrangement 
of ordered values"]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
l:bat[:any_1]...):void ", "OIDXmerge;",   "Consolidates the OID index 
arrangement"]
-[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the MAT (of values) into a BAT"]
+[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the values into a BAT. Avoiding a clash 
with mat.pack() in mergetable" ]
 [ "bat",   "partition","pattern bat.partition(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ", "CMDBATpartition2;","Create the n-th 
slice over the BAT broken into several pieces."]
 [ "bat",   "partition","pattern 
bat.partition(b:bat[:any_1]):bat[:any_1]... ", "CMDBATpartition;", "Create 
a serie of slices over the BAT argument. The BUNs are distributed evenly."  
]
 [ "bat",   "replace",  "command bat.replace(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ",  "BKCbat_inplace;",  
"Perform replace for all BUNs of the second BAT into the first."]
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
@@ -766,7 +766,7 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1]):void ",   
"OIDXcreate;",  "Introduces the OID index arrangement of ordered values"
]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
pieces:int):void ",   "OIDXcreate;",  "Introduces the OID index arrangement 
of ordered values"]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
l:bat[:any_1]...):void ", "OIDXmerge;",   "Consolidates the OID index 
arrangement"]
-[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the MAT (of values) into a BAT"]
+[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the values into a BAT. Avoiding a clash 
with mat.pack() in mergetable" ]
 [ "bat",   "partition","pattern bat.partition(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ", "CMDBATpartition2;","Create the n-th 
slice over the BAT broken into several pieces."]
 [ "bat",   "partition","pattern 
bat.partition(b:bat[:any_1]):bat[:any_1]... ", "CMDBATpartition;", "Create 
a serie of slices over the BAT argument. The BUNs are distributed evenly."  
]
 [ "bat",   "replace",  "command bat.replace(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ",  "BKCbat_inplace;",  
"Perform replace for all BUNs of the second BAT into the first."]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2418,6 +2418,7 @@ InstrPtr newFcnCall(MalBlkPtr mb, char *
 Symbol newFunction(str mod, str nme, int kind);
 MalStkPtr newGlobalStack(int size);
 InstrPtr newInstruction(MalBlkPtr mb, str modnme, str fcnnme);
+InstrPtr newInstructionArgs(MalBlkPtr mb, str modnme, str fcnnme, int args);
 MalBlkPtr newMalBlk(int elements);
 int newMalBlkStmt(MalBlkPtr mb, int elements);
 Plant newPlant(MalBlkPtr mb);
@@ -2425,6 +2426,7 @@ InstrPtr newRaiseStmt(MalBlkPtr mb, str 
 str newRef;
 InstrPtr newReturnStmt(MalBlkPtr mb);
 InstrPtr newStmt(MalBlkPtr mb, const char *module, const char *name);
+InstrPtr newStmtArgs(MalBlkPtr mb, const char *module, const char *name, int 
args);
 

MonetDB: compactprofiler - The compact profiler only emits a JSO...

2019-10-29 Thread Martin Kersten
Changeset: 5dc7d673789a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5dc7d673789a
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_profiler.c
Branch: compactprofiler
Log Message:

The compact profiler only emits a JSON structure with all the components
The final rendering into a statement and dependencies are left to the frontend.
This way we reduce the profiling cost at the server side.


diffs (271 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -213,6 +213,7 @@ MCinitClientRecord(Client c, oid user, b
 
c->user = user;
c->username = 0;
+   c->uuid = NULL;
c->scenario = NULL;
c->oldscenario = NULL;
c->srcFile = NULL;
@@ -431,6 +432,8 @@ MCfreeClient(Client c)
GDKfree(c->username);
c->username = 0;
}
+   GDKfree(c->uuid);
+   c->uuid = NULL;
c->mythread = 0;
if (c->glb) {
freeStack(c->glb);
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -47,6 +47,7 @@ typedef struct CLIENT {
int idx;/* entry in mal_clients */
oid user;   /* user id in the auth administration */
str username;   /* for event processor */
+   str uuid;   /* unique session marker */
/*
 * The actions for a client is separated into several stages:
 * parsing, strategic optimization, tactical optimization, and
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -126,11 +126,6 @@ EXAMPLE:
 "state":"start",
 "usec":0,
 "rss":215,
-"size":0,
-"oublock":8,
-"stmt":"X_41=0@0:void := querylog.define(\"select count(*) from 
tables;\":str,\"default_pipe\":str,30:int);",
-"short":"define( \"select count(*) from tables;\",\"default_pipe\",30 )",
-"prereq":[]
 }
 */
 static void
@@ -138,9 +133,8 @@ renderProfilerEvent(Client cntxt, MalBlk
 {
char logbuffer[LOGLEN], *logbase;
size_t loglen;
-   str stmt, c;
+   lng usec;
str stmtq;
-   lng usec;
uint64_t microseconds;
 
/* ignore generation of events for instructions that are called too 
often
@@ -159,7 +153,7 @@ renderProfilerEvent(Client cntxt, MalBlk
if( malprofileruser!= MAL_ADMIN && malprofileruser != cntxt->user)
return;
 
-   usec= GDKusec();
+   usec= pci->clock;
microseconds = (uint64_t)usec - ((uint64_t)startup_time.tv_sec*100 
- (uint64_t)startup_time.tv_usec);
/* make profile event tuple  */
lognew();
@@ -168,143 +162,21 @@ renderProfilerEvent(Client cntxt, MalBlk
 * function call to mercurial_revision().
 */
logadd("\"version\":\""VERSION" (hg id: %s)\","PRETTIFY, 
mercurial_revision());
-   logadd("\"source\":\"trace\","PRETTIFY);
-
logadd("\"user_id\":"OIDFMT","PRETTIFY, cntxt->user);
logadd("\"clk\":"LLFMT","PRETTIFY, usec);
logadd("\"ctime\":%"PRIu64","PRETTIFY, microseconds);
logadd("\"thread\":%d,"PRETTIFY, THRgettid());
-
logadd("\"function\":\"%s.%s\","PRETTIFY, getModuleId(getInstrPtr(mb, 
0)), getFunctionId(getInstrPtr(mb, 0)));
logadd("\"pc\":%d,"PRETTIFY, mb?getPC(mb,pci):0);
logadd("\"tag\":"OIDFMT","PRETTIFY, stk?stk->tag:0);
logadd("\"module\":\"%s\","PRETTIFY, pci->modname ? pci->modname : "" );
-   if (pci->modname && strcmp(pci->modname, "user") == 0) {
-   oid caller_tag = 0;
-   if(stk && stk->up) {
-   caller_tag = stk->up->tag;
-   }
-   logadd("\"caller\":"OIDFMT","PRETTIFY, caller_tag);
-   }
logadd("\"instruction\":\"%s\","PRETTIFY, pci->fcnname ? pci->fcnname : 
"");
-   if (!GDKinmemory()) {
-   char *uuid;
-   if ((c = msab_getUUID()) == NULL) {
-   logadd("\"session\":\"%s\","PRETTIFY, uuid);
-   free(uuid);
-   } else
-   free(c);
-   }
-
-   if( start){
-   logadd("\"state\":\"start\","PRETTIFY);
-   // determine the Estimated Time of Completion
-   if ( pci->calls){
-   logadd("\"usec\":"LLFMT","PRETTIFY, 
pci->totticks/pci->calls);
-   } else{
-   logadd("\"usec\":"LLFMT","PRETTIFY, pci->ticks);
-   }
-   } else {
-   logadd("\"state\":\"done\","PRETTIFY);
-   logadd("\"usec\":"LLFMT","PRETTIFY, pci->ticks);
-   }
-   logadd("\"rss\":%zu,"PRETTIFY, MT_getrss()/1024/1024);
-   logadd("\"size\":"LLFMT ","PRETTIFY, pci? pci->wbytes/1024/1024:0); 
// result size
-
-#ifdef NUMAprofiling
- 

MonetDB: Apr2019 - Extended test case

2019-10-29 Thread Pedro Ferreira
Changeset: fdffb7386868 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fdffb7386868
Modified Files:
sql/test/miscellaneous/Tests/select_groupby.sql
sql/test/miscellaneous/Tests/select_groupby.stable.out
Branch: Apr2019
Log Message:

Extended test case


diffs (202 lines):

diff --git a/sql/test/miscellaneous/Tests/select_groupby.sql 
b/sql/test/miscellaneous/Tests/select_groupby.sql
--- a/sql/test/miscellaneous/Tests/select_groupby.sql
+++ b/sql/test/miscellaneous/Tests/select_groupby.sql
@@ -61,4 +61,51 @@ mytable."twentieth-third", mytable."twen
 FROM myschema.mytable
 WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
 GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+exec ** ();
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = ? AND "eleventh" = ? AND (EXTRACT(YEAR FROM mytable."eighth") 
* cast(? as bigint) + EXTRACT(MONTH FROM mytable."eighth")) / cast(? as bigint) 
= cast(? as bigint))
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT ?;
+exec ** ('a', 'b', 923, 51, 942, 544);
+
+TRUNCATE myschema.mytable;
+
+SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+exec ** ();
+
+PREPARE SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = ? AND "eleventh" = ? AND (EXTRACT(YEAR FROM mytable."eighth") 
* cast(? as bigint) + EXTRACT(MONTH FROM mytable."eighth")) / cast(? as bigint) 
= cast(? as bigint))
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT ?;
+exec ** ('a', 'b', 923, 51, 942, 544);
+
 rollback;
diff --git a/sql/test/miscellaneous/Tests/select_groupby.stable.out 
b/sql/test/miscellaneous/Tests/select_groupby.stable.out
--- a/sql/test/miscellaneous/Tests/select_groupby.stable.out
+++ b/sql/test/miscellaneous/Tests/select_groupby.stable.out
@@ -107,6 +107,143 @@ Ready.
 % first-projection,twentieth,  twentieth-seventh,  
twentieth-third,twentieth-second # name
 % date,char,   char,   double, double # type
 % 10,  100,100,24, 24 # length
+#PREPARE SELECT
+#mytable."eighth" AS "first-projection",
+#mytable."twentieth", mytable."twentieth-seventh",
+#mytable."twentieth-third", mytable."twentieth-second"
+#FROM myschema.mytable
+#WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+#GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+#PREPARE SELECT
+#mytable."eighth" AS "first-projection",
+#mytable."twentieth", mytable."twentieth-seventh",
+#mytable."twentieth-third", mytable."twentieth-second"
+#FROM myschema.mytable
+#WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+#GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, 

MonetDB: default - More output approved

2019-10-29 Thread Martin Kersten
Changeset: 400f5df6a6b0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=400f5df6a6b0
Modified Files:
monetdb5/modules/mal/Tests/inspect05.stable.out.int128

sql/test/BugTracker-2009/Tests/segfault_when_quitting_debugger.SF-2538837.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out
Branch: default
Log Message:

More output approved


diffs (truncated from 302 to 300 lines):

diff --git a/monetdb5/modules/mal/Tests/inspect05.stable.out.int128 
b/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
--- a/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
+++ b/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
@@ -81,25 +81,26 @@ stdout of test 'inspect05` in directory 
 [ 50@0,"orderidx", "pattern",  "bat",  "(bv:bat[:any_1], 
l:bat[:any_1]...):void ", "OIDXmerge;"]
 [ 51@0,"orderidx", "pattern",  "bat",  "(bv:bat[:any_1], 
pieces:int):void ",   "OIDXcreate;"   ]
 [ 52@0,"orderidx", "pattern",  "bat",  "(bv:bat[:any_1]):void 
",   "OIDXcreate;"   ]
-[ 53@0,"partition","pattern",  "bat",  "(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ",  "CMDBATpartition2;" ]
-[ 54@0,"partition","pattern",  "bat",  
"(b:bat[:any_1]):bat[:any_1]... ",  "CMDBATpartition;"  ]
-[ 55@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
del:bat[:oid]):bat[:oid] ","BKCreuseBATmap;"   ]
-[ 56@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
del:bat[:oid]):bat[:any_1] ",  "BKCreuseBAT;"  ]
-[ 57@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1], force:bit):bat[:any_1] ",  
"BKCbat_inplace_force;" ]
-[ 58@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ", "BKCbat_inplace;"   ]
-[ 59@0,"reuse","command",  "bat",  "(b:bat[:any_1], h:oid, 
t:any_1, force:bit):bat[:any_1] ",  "BKCbun_inplace_force;" ]
-[ 60@0,"reuseMap", "command",  "bat",  "(b:bat[:any_1], h:oid, 
t:any_1):bat[:any_1] ", "BKCbun_inplace;"   ]
-[ 61@0,"save", "pattern",  "bat",  "(val:any_1):bat[:any_1] ", 
"CMDBATsingle;" ]
-[ 62@0,"save", "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCsetImprints;"   ]
-[ 63@0,"setAccess","command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCsetHash;"   ]
-[ 64@0,"setColumn","command",  "bat",  "(nme:str):bit ",   
"BKCsave;"  ]
-[ 65@0,"setHash",  "command",  "bat",  "(nme:bat[:any_1]):void 
",  "BKCsave2;" ]
-[ 66@0,"setImprints",  "command",  "bat",  "(b:bat[:any_1]):void 
","BKCsetPersistent;" ]
-[ 67@0,"setKey",   "command",  "bat",  "(b:bat[:any_1]):void 
","BKCsetTransient;"  ]
-[ 68@0,"setName",  "command",  "bat",  "(b:bat[:any_1], 
t:str):void ", "BKCsetColumn;" ]
-[ 69@0,"setPersistent","command",  "bat",  
"(b:bat[:any_1], s:str):void ", "BKCsetName;"   ]
-[ 70@0,"setTransient", "command",  "bat",  "(b:bat[:any_1], 
mode:str):bat[:any_1] ",   "BKCsetAccess;" ]
-[ 71@0,"single",   "command",  "bat",  "(b:bat[:any_1], 
mode:bit):bat[:any_1] ",   "BKCsetkey;"]
+[ 53@0,"pack", "pattern",  "bat",  "(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;"]
+[ 54@0,"partition","pattern",  "bat",  "(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ",  "CMDBATpartition2;" ]
+[ 55@0,"partition","pattern",  "bat",  
"(b:bat[:any_1]):bat[:any_1]... ",  "CMDBATpartition;"  ]
+[ 56@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
del:bat[:oid]):bat[:oid] ","BKCreuseBATmap;"   ]
+[ 57@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
del:bat[:oid]):bat[:any_1] ",  "BKCreuseBAT;"  ]
+[ 58@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1], force:bit):bat[:any_1] ",  
"BKCbat_inplace_force;" ]
+[ 59@0,"replace",  "command",  "bat",  "(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ", "BKCbat_inplace;"   ]
+[ 60@0,"reuse","command",  "bat",  "(b:bat[:any_1], h:oid, 
t:any_1, force:bit):bat[:any_1] ",  "BKCbun_inplace_force;" ]
+[ 61@0,"reuseMap", "command",  "bat",  "(b:bat[:any_1], h:oid, 
t:any_1):bat[:any_1] ", "BKCbun_inplace;"   ]
+[ 62@0,"save", "pattern",  "bat",  "(val:any_1):bat[:any_1] ", 
"CMDBATsingle;" ]
+[ 63@0,"save", "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCsetImprints;"   ]
+[ 64@0,

MonetDB: Apr2019 - Added test for rel_push_project_up issue that...

2019-10-29 Thread Pedro Ferreira
Changeset: 29ab9d529082 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=29ab9d529082
Added Files:
sql/test/miscellaneous/Tests/select_groupby.sql
sql/test/miscellaneous/Tests/select_groupby.stable.err
sql/test/miscellaneous/Tests/select_groupby.stable.out
Modified Files:
sql/test/miscellaneous/Tests/All
Branch: Apr2019
Log Message:

Added test for rel_push_project_up issue that has been fixed


diffs (235 lines):

diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All
--- a/sql/test/miscellaneous/Tests/All
+++ b/sql/test/miscellaneous/Tests/All
@@ -7,3 +7,4 @@ groupby_expressions
 with_update_stmts
 groupby_error
 alter_table_add_column
+select_groupby
diff --git a/sql/test/miscellaneous/Tests/select_groupby.sql 
b/sql/test/miscellaneous/Tests/select_groupby.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/miscellaneous/Tests/select_groupby.sql
@@ -0,0 +1,64 @@
+start transaction;
+create schema "myschema";
+create sequence "myschema"."myseq";
+create table myschema.mytable
+(
+   "first" char(100),
+   "second" double,
+   "third" double,
+   "fourth" clob,
+   "fifth" clob,
+   "sixth" double,
+   "seventh" clob,
+   "eighth" date,
+   "ninth" double,
+   "tenth" double,
+   "eleventh" char(100),
+   "tweelfth" char(4),
+   "thirteenth" char(50),
+   "fourteenth" char(50),
+   "fifteenth" clob,
+   "sixteenth" char(100),
+   "seventeenth" char(100),
+   "eighteenth" char(30),
+   "nineteenth" double,
+   "twentieth" char(100),
+   "twentieth-first" clob,
+   "twentieth-second" double,
+   "twentieth-third" double,
+   "twentieth-fourth" double,
+   "twentieth-fifth" double,
+   "twentieth-sixth" double,
+   "twentieth-seventh" char(100),
+   "twentieth-eighth" char(100),
+   "twentieth-ninth" char(100),
+   "thirtieth" char(14),
+   "thirtieth-first" bigint,
+   "thirtieth-second" bigint,
+   "thirtieth-third" bigint,
+   "thirtieth-fourth" bigint,
+   "thirtieth-fifth" bigint,
+   "thirtieth-sixth" bigint,
+   "thirtieth-seventh" bigint,
+   "thirtieth-eighth" bigint,
+   "thirtieth-ninth" bigint,
+   "fortieth" bigint,
+   "fortieth-first" tinyint,
+   "fortieth-second" blob,
+   "fortieth-third" int default next value for "myschema"."myseq"
+);
+INSERT INTO myschema.mytable ("first", "second", "third", "fourth", "fifth", 
"sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "tweelfth", 
"thirteenth", "fourteenth", "fifteenth", "sixteenth", 
+ "seventeenth", 
"eighteenth", "nineteenth", "twentieth", "twentieth-first", "twentieth-second", 
"twentieth-third", "twentieth-fourth", "twentieth-fifth", "twentieth-sixth", 
+ "twentieth-seventh", 
"twentieth-eighth", "twentieth-ninth", "thirtieth", "thirtieth-first", 
"thirtieth-second", "thirtieth-third", "thirtieth-fourth", "thirtieth-fifth", 
+ "thirtieth-sixth", 
"thirtieth-seventh", "thirtieth-eighth", "thirtieth-ninth", "fortieth", 
"fortieth-first", "fortieth-second", "fortieth-third") 
+ VALUES ('1234 / 0', 
1234, 1, 'have', 'a', 850.85, 'very', '2019-03-18', 2, 16, 'nice', 'CC', 'DD', 
'Day', 'somewhere', 'you', 'will', '3840', 
+ 455, '11790 - 
Something', 'Paper', 850.83, 344, 0, 506.83, 59.5689, 'Good', 'Food', 'hello', 
'001234/00', 301215, 303378, 300346, 
+ 303378, 
300346, 32, 300015, 31, null, 300073, 0, null, 1);
+SELECT
+mytable."eighth" AS "first-projection",
+mytable."twentieth", mytable."twentieth-seventh",
+mytable."twentieth-third", mytable."twentieth-second"
+FROM myschema.mytable
+WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM 
mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = 
'2014.030')
+GROUP BY "first-projection", "twentieth", "twentieth-seventh", 
"twentieth-third", "twentieth-second" LIMIT 1001;
+rollback;
diff --git a/sql/test/miscellaneous/Tests/select_groupby.stable.err 
b/sql/test/miscellaneous/Tests/select_groupby.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/miscellaneous/Tests/select_groupby.stable.err
@@ -0,0 +1,33 @@
+stderr of test 'select_groupby` in directory 'sql/test/miscellaneous` itself:
+
+
+# 13:54:02 >  
+# 13:54:02 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=35668" "--set" 
"mapi_usock=/var/tmp/mtest-18773/.s.monetdb.35668" "--set" "monet_prompt=" 
"--forcemito" 

MonetDB: default - Reduce the SQL header to just 5 BATs. Still u...

2019-10-29 Thread Martin Kersten
Changeset: d50298371bb0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d50298371bb0
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
monetdb5/modules/mal/mat.mal
sql/backends/monet5/UDF/udf/Tests/udf-fuse.stable.out
sql/backends/monet5/UDF/udf/Tests/udf-reverse.stable.out
sql/backends/monet5/sql_statement.c

sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out

sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out

sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-view.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-view.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out
sql/test/remote/Tests/partition_elim.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Reduce the SQL header to just 5 BATs. Still upgrade on the pre-allocation
of the corresponding argument list is needed to avoid repetitive calls to 
malloc.


diffs (truncated from 1851 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
@@ -660,6 +660,7 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1]):void ",   
"OIDXcreate;",  "Introduces the OID index arrangement of ordered values"
]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
pieces:int):void ",   "OIDXcreate;",  "Introduces the OID index arrangement 
of ordered values"]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
l:bat[:any_1]...):void ", "OIDXmerge;",   "Consolidates the OID index 
arrangement"]
+[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the MAT (of values) into a BAT"]
 [ "bat",   "partition","pattern bat.partition(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ", "CMDBATpartition2;","Create the n-th 
slice over the BAT broken into several pieces."]
 [ "bat",   "partition","pattern 
bat.partition(b:bat[:any_1]):bat[:any_1]... ", "CMDBATpartition;", "Create 
a serie of slices over the BAT argument. The BUNs are distributed evenly."  
]
 [ "bat",   "replace",  "command bat.replace(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ",  "BKCbat_inplace;",  
"Perform replace for all BUNs of the second BAT into the first."]
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
@@ -766,6 +766,7 @@ stdout of test 'MAL-signatures` in direc
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1]):void ",   
"OIDXcreate;",  "Introduces the OID index arrangement of ordered values"
]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
pieces:int):void ",   "OIDXcreate;",  "Introduces the OID index arrangement 
of ordered values"]
 [ "bat",   "orderidx", "pattern bat.orderidx(bv:bat[:any_1], 
l:bat[:any_1]...):void ", "OIDXmerge;",   "Consolidates the OID index 
arrangement"]
+[ "bat",   "pack", "pattern bat.pack(X_0:any_2...):bat[:any_2] ",  
"MATpackValues;",   "Materialize the MAT (of values) into a BAT"]
 [ "bat",   "partition","pattern bat.partition(b:bat[:any_1], 
pieces:int, n:int):bat[:any_1] ", "CMDBATpartition2;","Create the n-th 
slice over the BAT broken into several pieces."]
 [ "bat",   "partition","pattern 
bat.partition(b:bat[:any_1]):bat[:any_1]... ", "CMDBATpartition;", "Create 
a serie of slices over the BAT argument. The BUNs are distributed evenly."  
]
 [ "bat",   "replace",  "command bat.replace(b:bat[:any_1], 
rid:bat[:oid], val:bat[:any_1]):bat[:any_1] ",  "BKCbat_inplace;",  
"Perform replace for all BUNs of the second BAT into the first."]
diff --git a/monetdb5/modules/mal/mat.mal b/monetdb5/modules/mal/mat.mal
--- a/monetdb5/modules/mal/mat.mal
+++ b/monetdb5/modules/mal/mat.mal
@@ -11,6 +11,10 @@ address MATpack
 comment "Define a Merge Association Table (MAT). Fall back to the pack 
operation
 when this is called ";
 
+pattern 

MonetDB: mosaic - Update TODO's.

2019-10-29 Thread Aris Koning
Changeset: 3817007ac9b0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3817007ac9b0
Modified Files:
monetdb5/modules/mosaic/TODO_MOSAIC.txt
Branch: mosaic
Log Message:

Update TODO's.


diffs (25 lines):

diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt 
b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
--- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt
+++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
@@ -1,21 +1,15 @@
 technical depth
-Check if compressors are always called in tests. Use MOSdestroy trick for that.
-Make dictionary variable-sized so it can always compress. We are going to use 
vheap for this.
-dictionary encoding should use the ordered property of its dictionary in the 
algebraic operators
 Test null semantics
 mosaic.select (c,nil:any_1, nil:any_1,true,true,(true|false)) is not working 
correctly: should result in c == nil or c!=nil(anti).
 Use bit vectors more aggressively in mosaic_delta --- then resolve test 
mosaic_delta_timestamp --- and possibly other compression techniques as well.
-Somehow force mosaic to only use specified compressions even if inefficient. 
This poses a design problem for dictionary compression though.
 Be sure alignment is correct. Use asserts for this.
 Check MOSanalysis and its test.
 Fix/check/test MOSlayout.
 Add test for float/double
 delta compression: check if the hardcoded compression expression are correct. 
See also (2)
 Add asserts on type degeneration for bit => bte daytime => lng timestmap => 
lng date => int.
-Fix the task-factor array.
 See if we can re-introduce landmark stuff somehow.
 benchmark
-Do estimation before mosaic heap creation.That saves a potential heap extend.
 
 code issues
 Update copyright.
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Remove old factor and range arrays.

2019-10-29 Thread Aris Koning
Changeset: 3f101e5a2157 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3f101e5a2157
Modified Files:
monetdb5/modules/mosaic/mosaic.h
monetdb5/modules/mosaic/mosaic_delta.c
monetdb5/modules/mosaic/mosaic_hdr.c
monetdb5/modules/mosaic/mosaic_linear.c
monetdb5/modules/mosaic/mosaic_prefix.c
monetdb5/modules/mosaic/mosaic_runlength.c
Branch: mosaic
Log Message:

Remove old factor and range arrays.


diffs (134 lines):

diff --git a/monetdb5/modules/mosaic/mosaic.h b/monetdb5/modules/mosaic/mosaic.h
--- a/monetdb5/modules/mosaic/mosaic.h
+++ b/monetdb5/modules/mosaic/mosaic.h
@@ -131,10 +131,6 @@ typedef struct MOSTASK{
int type;   // one of the permissible compression types
int filter[MOSAIC_METHODS];// algorithmic (de)compression mix
 
-   /* collect the range being applied for the last compression call */
-   BUN range[MOSAIC_METHODS]; // end of compression range
-   float factor[MOSAIC_METHODS];// compression factor of last range. // 
TODO: This doesn't seem to be used. It also has some design flaws to it. Like 
what is its value if there are two blocks of the same compression type.
-
MosaicHdr hdr;  // header block with index/synopsis information
MosaicBlk blk;  // current block header in scan
GlobalVarInfo* var_info;
diff --git a/monetdb5/modules/mosaic/mosaic_delta.c 
b/monetdb5/modules/mosaic/mosaic_delta.c
--- a/monetdb5/modules/mosaic/mosaic_delta.c
+++ b/monetdb5/modules/mosaic/mosaic_delta.c
@@ -115,7 +115,6 @@ MOSskip_delta(MOStask task)
 str
 MOSestimate_delta(MOStask task, MosaicEstimation* current, const 
MosaicEstimation* previous)
 {  unsigned int i = 0;
-   flt factor = 1.0;
(void) previous;
 
switch(ATOMbasetype(task->type)){
@@ -128,8 +127,6 @@ MOSestimate_delta(MOStask task, MosaicEs
case TYPE_hge: Estimate_delta(hge,  (delta < -127 || delta 
>127)); break;
#endif
}
-   task->factor[MOSAIC_DELTA] = factor;
-   task->range[MOSAIC_DELTA] = task->start + i;
return MAL_SUCCEED;
 }
 
diff --git a/monetdb5/modules/mosaic/mosaic_hdr.c 
b/monetdb5/modules/mosaic/mosaic_hdr.c
--- a/monetdb5/modules/mosaic/mosaic_hdr.c
+++ b/monetdb5/modules/mosaic/mosaic_hdr.c
@@ -39,8 +39,6 @@ MOSinitHeader(MOStask task)
int i;
for(i=0; i < MOSAIC_METHODS; i++){
hdr->elms[i] = hdr->blks[i] = METHOD_NOT_AVAILABLE;
-   task->range[i]=0;
-   task->factor[i]=0.0;
}
hdr->ratio = 0;
hdr->version = MOSAIC_VERSION;
diff --git a/monetdb5/modules/mosaic/mosaic_linear.c 
b/monetdb5/modules/mosaic/mosaic_linear.c
--- a/monetdb5/modules/mosaic/mosaic_linear.c
+++ b/monetdb5/modules/mosaic/mosaic_linear.c
@@ -131,7 +131,6 @@ MOSskip_linear(MOStask task)
 str
 MOSestimate_linear(MOStask task, MosaicEstimation* current, const 
MosaicEstimation* previous)
 {  unsigned int i = -1;
-   flt factor = 0.0;
(void) previous;
 
switch(ATOMbasetype(task->type)){
@@ -146,8 +145,6 @@ MOSestimate_linear(MOStask task, MosaicE
case TYPE_hge: Estimate(hge); break;
 #endif
}
-   task->factor[MOSAIC_LINEAR] = factor;
-   task->range[MOSAIC_LINEAR] = task->start + i;
return MAL_SUCCEED;
 }
 
diff --git a/monetdb5/modules/mosaic/mosaic_prefix.c 
b/monetdb5/modules/mosaic/mosaic_prefix.c
--- a/monetdb5/modules/mosaic/mosaic_prefix.c
+++ b/monetdb5/modules/mosaic/mosaic_prefix.c
@@ -284,7 +284,6 @@ MOSestimate_prefix(MOStask task, MosaicE
 {  
(void) previous;
unsigned int i = 0;
-   flt factor = 0.0;
int prefixbits = 0,size;
BUN bits,store;
BUN limit = task->stop - task->start > MOSAICMAXCNT? MOSAICMAXCNT: 
task->stop - task->start;
@@ -315,7 +314,6 @@ MOSestimate_prefix(MOStask task, MosaicE
 
current->uncompressed_size += (BUN) (i * sizeof(bte));
current->compressed_size += store;
-   factor = ( (flt)i * sizeof(bte))/ store;
}
break;
case 2:
@@ -339,7 +337,6 @@ MOSestimate_prefix(MOStask task, MosaicE
 
current->uncompressed_size += (BUN) (i * sizeof(sht));
current->compressed_size += store;
-   factor = ( (flt)i * sizeof(sht))/ store;
}
break;
case 4:
@@ -364,7 +361,6 @@ MOSestimate_prefix(MOStask task, MosaicE
 
current->uncompressed_size += (BUN) (i * sizeof(int));
current->compressed_size += store;
-   factor = ( (flt)i * sizeof(int))/ store;
}
break;
case 8:
@@ -387,12 +383,9 @@ MOSestimate_prefix(MOStask task, MosaicE
 
current->uncompressed_size += (BUN) (i * sizeof(lng));

MonetDB: mosaic - Remove old in header capped dictionary.

2019-10-29 Thread Aris Koning
Changeset: 93928713b58e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=93928713b58e
Modified Files:
monetdb5/modules/mosaic/mosaic.h
monetdb5/modules/mosaic/mosaic_capped.c
Branch: mosaic
Log Message:

Remove old in header capped dictionary.


diffs (55 lines):

diff --git a/monetdb5/modules/mosaic/mosaic.h b/monetdb5/modules/mosaic/mosaic.h
--- a/monetdb5/modules/mosaic/mosaic.h
+++ b/monetdb5/modules/mosaic/mosaic.h
@@ -69,19 +69,6 @@ typedef struct MOSAICHEADER{
// both dictionary and framebased compression require a global 
dictionary of frequent values
// Their size is purposely topped 
bte mask, bits, framebits;  // global compression type properties
-   int dictsize;   // used by capped compression, it is a small 
table
-   union{
-   bte valbte[256];
-   sht valsht[256];
-   int valint[256];
-   lng vallng[256];
-   oid valoid[256];
-   flt valflt[256];
-   dbl valdbl[256];
-#ifdef HAVE_HGE
-   hge valhge[256];
-#endif
-   }dict;
lng dictfreq[256];// keep track on their use
// collect compression statistics for the particular task
// A value of METHOD_NOT_AVAILABLE in blks or elms indicates that the 
corresponding method wasn't considered as candidate.
diff --git a/monetdb5/modules/mosaic/mosaic_capped.c 
b/monetdb5/modules/mosaic/mosaic_capped.c
--- a/monetdb5/modules/mosaic/mosaic_capped.c
+++ b/monetdb5/modules/mosaic/mosaic_capped.c
@@ -137,22 +137,24 @@ void
 MOSlayout_capped_hdr(MOStask task, BAT *btech, BAT *bcount, BAT *binput, BAT 
*boutput, BAT *bproperties)
 {
lng zero=0;
-   int i;
+   unsigned int i;
char buf[BUFSIZ];
char bufv[BUFSIZ];
+   (void) boutput;
 
-   for(i=0; i< task->hdr->dictsize; i++){
+   BUN dictsize = GetCount(task->capped_info);
+
+   for(i=0; i< dictsize; i++){
snprintf(buf, BUFSIZ,"capped[%d]",i);
if( BUNappend(btech, buf, false) != GDK_SUCCEED ||
BUNappend(bcount, , false) != GDK_SUCCEED ||
BUNappend(binput, , false) != GDK_SUCCEED ||
-   BUNappend(boutput, >hdr->dictfreq[i], false) != 
GDK_SUCCEED ||
+   // BUNappend(boutput, MOSgetDictFreq(dict_hdr, i), 
false) != GDK_SUCCEED ||
BUNappend(bproperties, bufv, false) != GDK_SUCCEED)
return;
}
 }
 
-
 void
 MOSlayout_capped(MOStask task, BAT *btech, BAT *bcount, BAT *binput, BAT 
*boutput, BAT *bproperties)
 {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Un-expand macro's.

2019-10-29 Thread Aris Koning
Changeset: 04bfc2f94a9c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=04bfc2f94a9c
Modified Files:
monetdb5/modules/mosaic/mosaic_capped.c
monetdb5/modules/mosaic/mosaic_var.c
Branch: mosaic
Log Message:

Un-expand macro's.


diffs (83 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_capped.c 
b/monetdb5/modules/mosaic/mosaic_capped.c
--- a/monetdb5/modules/mosaic/mosaic_capped.c
+++ b/monetdb5/modules/mosaic/mosaic_capped.c
@@ -110,17 +110,7 @@ DictionaryClass(TPE, GlobalCappedInfo, G
 
 DerivedDictionaryClass(bte)
 DerivedDictionaryClass(sht)
-PresentInTempDictFuncDef(int)static inline BUN _findValue_int(int* dict, BUN 
dict_count, int val) { int m, f= 0, l = dict_count; while( l-f > 0 ) { m = f + 
(l-f)/2; if ( val < dict[m]) l=m-1; else f= m; if ( val > dict[m]) f=m+1; else 
l= m; } return f;}static inline int _getValue_int(GlobalCappedInfo* info, BUN 
key) { return GetValue(info, key, int);}static str estimateDict_int(BUN* 
nr_compressed, BUN* delta_count, BUN limit, GlobalCappedInfo* info, int* val) { 
size_t buffer_size = 256; int* dict = (int*) GetBase(info, int); BUN dict_cnt = 
GetCount(info); int* delta = dict + dict_cnt; *delta_count = 0; 
for((*nr_compressed) = 0; (*nr_compressed)< limit; (*nr_compressed)++, val++) { 
BUN pos = _findValue_int(dict, dict_cnt, *val); if (pos == dict_cnt || 
_getValue_int(info, pos) != *val) { ; if (PresentInTempDict(info, *val, int)) { 
BUN key = _findValue_int(delta, (*delta_count), *val); if (key < *delta_count 
&& delta[key] == *val) { continue; } if (dict_cnt + *delta_count + 1 == GetCap
 (info)) { if( !Extend(info, dict_cnt + *delta_count + (buffer_size <<=1)) ) 
throw(MAL, "mosaic.var", MAL_MALLOC_FAIL); dict = GetBase(info, int); delta = 
dict + dict_cnt; } int w = *val; for( ; key< *delta_count; key++) { if 
(delta[key] > w){ int v = delta[key]; delta[key] = w; w = v; } } delta[key] = 
w; (*delta_count)++; } else break; } } GetDeltaCount(info) = (*delta_count); 
BUN new_count = dict_cnt + GetDeltaCount(info); GetBitsExtended(info) = 
calculateBits(new_count); return MAL_SUCCEED;}static void 
_mergeDeltaIntoDictionary_int(GlobalCappedInfo* info) { int* delta = (int*) 
GetBase(info, int) + GetCount(info); if (GetCount(info) == 0) { ++delta; 
GetCount(info)++; GetDeltaCount(info)--; } BUN limit = GetDeltaCount(info); for 
(BUN i = 0; i < limit; i++) { BUN key = _findValue_int(GetBase(info, int), 
GetCount(info), delta[i]); if (key < GetCount(info) && GetValue(info, key, int) 
== delta[i]) { continue; } int w = delta[i]; for( ; key< GetCount(info); key++) 
{ if (GetValue(info, ke
 y, int) > w){ int v =GetValue(info, key, int); GetValue(info, key, int)= w; w 
= v; } } GetCount(info)++; GetValue(info, key, int)= w; } GetBits(info) = 
GetBitsExtended(info);}
-static void _compress_dictionary_int(int* dict, BUN dict_size, BUN* i, int* 
val, BUN limit, BitVector base, bte bits) {
-   for((*i) = 0; (*i) < limit; (*i)++, val++) {
-   BUN key = _findValue_int(dict, dict_size, *val);
-   assert(key < dict_size);
-   setBitVector(base, (*i), bits, (unsigned int) key);
-   }
-}
-static void _decompress_dictionary_int(int* dict, bte bits, BitVector base, 
BUN limit, int** dest) { for(BUN i = 0; i < limit; i++){ size_t key = 
getBitVector(base,i,(int) bits); (*dest)[i] = dict[key]; } *dest += limit;}
-
-
+DerivedDictionaryClass(int)
 DerivedDictionaryClass(oid)
 DerivedDictionaryClass(lng)
 DerivedDictionaryClass(flt)
diff --git a/monetdb5/modules/mosaic/mosaic_var.c 
b/monetdb5/modules/mosaic/mosaic_var.c
--- a/monetdb5/modules/mosaic/mosaic_var.c
+++ b/monetdb5/modules/mosaic/mosaic_var.c
@@ -89,56 +89,7 @@ typedef struct _GlobalVarInfo {
 
 DerivedDictionaryClass(bte)
 DerivedDictionaryClass(sht)
-static inline BUN _findValue_int(int* dict, BUN dict_count, int val) { int m, 
f= 0, l = dict_count; while( l-f > 0 ) { m = f + (l-f)/2; if ( val < dict[m]) 
l=m-1; else f= m; if ( val > dict[m]) f=m+1; else l= m; } return f;}
-static inline int _getValue_int(GlobalVarInfo* info, BUN key) { return 
GetValue(info, key, int);}
-static str estimateDict_int(BUN* nr_compressed, BUN* delta_count, BUN limit, 
GlobalVarInfo* info, int* val) {
-   size_t buffer_size = 256;
-   int* dict = (int*) GetBase(info, int);
-   BUN dict_cnt = GetCount(info);
-   int* delta = dict + dict_cnt;
-   *delta_count = 0;
-   for((*nr_compressed) = 0; (*nr_compressed)< limit; (*nr_compressed)++, 
val++) {
-   BUN pos = _findValue_int(dict, dict_cnt, *val);
-   if (pos == dict_cnt || _getValue_int(info, pos) != *val) {
-   if (InsertCondition(info, *val, int)) {
-   BUN key = _findValue_int(delta, 
(*delta_count), *val);
-   if (key < *delta_count && delta[key] == 
*val) { continue; }
-   if (dict_cnt + *delta_count + 1 == 

MonetDB: Nov2019 - Don't do exp_name == 'L', to test for labels,...

2019-10-29 Thread Pedro Ferreira
Changeset: e16fec7772f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e16fec7772f5
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_updates.c
Branch: Nov2019
Log Message:

Don't do exp_name == 'L', to test for labels, has it can give false positives. 
Also use sizeof to determine the size of the buffer for cleaner code


diffs (166 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
@@ -645,7 +645,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (cond_execution) {
/* var_x = nil; */
-   nme = number2name(name, 16, ++sql->label);
+   nme = number2name(name, sizeof(name), ++sql->label);
(void)stmt_var(be, nme, exp_subtype(e), 1, 2);
/* if_barrier ... */
cond_execution = stmt_cond(be, cond_execution, NULL, 0, 
0);
@@ -1674,7 +1674,7 @@ rel2bin_table(backend *be, sql_rel *rel,
char name[16], *nme;
sql_rel *fr;
 
-   nme = number2name(name, 16, ++sql->remote);
+   nme = number2name(name, sizeof(name), ++sql->remote);
 
l = rel2bin_args(be, rel->l, sa_list(sql->sa));
if(!l)
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -516,7 +516,7 @@ exp_alias(sql_allocator *sa, const char 
 }
 
 sql_exp *
-exp_alias_or_copy( mvc *sql, const char *tname, const char *cname, sql_rel 
*orel, sql_exp *old)
+exp_alias_or_copy(mvc *sql, const char *tname, const char *cname, sql_rel 
*orel, sql_exp *old)
 {
sql_exp *ne = NULL;
 
@@ -526,12 +526,12 @@ exp_alias_or_copy( mvc *sql, const char 
if (!tname && old->type == e_column)
tname = old->l;
 
-   if (!cname && exp_name(old) && exp_name(old)[0] == 'L') {
+   if (!cname && exp_name(old) && has_label(old)) {
ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel?orel->card:CARD_ATOM, has_nil(old), is_intern(old));
return exp_propagate(sql->sa, ne, old);
} else if (!cname) {
char name[16], *nme;
-   nme = number2name(name, 16, ++sql->label);
+   nme = number2name(name, sizeof(name), ++sql->label);
 
exp_setname(sql->sa, old, nme, nme);
ne = exp_column(sql->sa, exp_relname(old), exp_name(old), 
exp_subtype(old), orel?orel->card:CARD_ATOM, has_nil(old), is_intern(old));
@@ -701,7 +701,7 @@ exp_setrelname(sql_allocator *sa, sql_ex
 {
char name[16], *nme;
 
-   nme = number2name(name, 16, nr);
+   nme = number2name(name, sizeof(name), nr);
e->alias.label = 0;
e->alias.rname = sa_strdup(sa, nme);
 }
@@ -711,7 +711,7 @@ make_label(sql_allocator *sa, int nr)
 {
char name[16], *nme;
 
-   nme = number2name(name, 16, nr);
+   nme = number2name(name, sizeof(name), nr);
return sa_strdup(sa, nme);
 }
 
@@ -1880,7 +1880,7 @@ is_identity( sql_exp *e, sql_rel *r)
sql_exp *re = NULL;
if (e->l)
re = exps_bind_column2(r->exps, e->l, e->r);
-   if (!re && ((char*)e->r)[0] == 'L')
+   if (!re && has_label(e))
re = exps_bind_column(r->exps, e->r, NULL);
if (re)
return is_identity(re, r->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
@@ -8330,13 +8330,13 @@ rel_dicttable(mvc *sql, sql_column *c, c
 
ie = exp_indexcol(sql, e, tname, c->base.name, de, 1);
 nr = ++sql->label;
-   nme = sa_strdup(sql->sa, number2name(name, 16, nr));
+   nme = sa_strdup(sql->sa, number2name(name, sizeof(name), nr));
exp_setname(sql->sa, ie, nme, nme);
append(rel->exps, ie);
 
ie = exp_stringscol(sql, e, tname, c->base.name);
 nr = ++sql->label;
-   nme = sa_strdup(sql->sa, number2name(name, 16, nr));
+   nme = sa_strdup(sql->sa, number2name(name, sizeof(name), nr));
exp_setname(sql->sa, ie, nme, nme);
append(rel->exps, ie);
e->p = prop_create(sql->sa, PROP_HASHCOL, e->p);
@@ -8369,7 +8369,7 @@ rel_add_dicts(int *changes, mvc *sql, sq
char name[16], *nme;
sql_rel *vt = rel_dicttable(sql, c, 
rname, de);
 
-   nme = sa_strdup(sql->sa, 
number2name(name, 16, nr));
+   nme = 

MonetDB: Nov2019 - Don't stack error codes

2019-10-29 Thread Pedro Ferreira
Changeset: 136f90bd2787 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=136f90bd2787
Modified Files:
sql/backends/monet5/sql.c

sql/test/BugDay_2005-12-19_2.9.3/Tests/default_next_value_for_non_ex_seq.SF.1246631.stable.err
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.out
Branch: Nov2019
Log Message:

Don't stack error codes


diffs (149 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
@@ -310,18 +310,18 @@ create_table_or_view(mvc *sql, char* sna
list *id_l;
 
sql->sa = sa_create();
-   if(!sql->sa) {
+   if (!sql->sa) {
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
buf = sa_alloc(sql->sa, strlen(c->def) + 8);
-   if(!buf) {
+   if (!buf) {
sa_destroy(sql->sa);
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
typestr = subtype2string2(>type);
-   if(!typestr) {
+   if (!typestr) {
sa_destroy(sql->sa);
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
@@ -331,11 +331,14 @@ create_table_or_view(mvc *sql, char* sna
r = rel_parse(sql, s, buf, m_deps);
if (!r || !is_project(r->op) || !r->exps || 
list_length(r->exps) != 1 ||
rel_check_type(sql, >type, r, 
r->exps->h->data, type_equal) == NULL) {
-   if(r)
+   if (r)
rel_destroy(r);
sa_destroy(sql->sa);
sql->sa = osa;
-   throw(SQL, "sql.catalog", SQLSTATE(42000) "%s", 
sql->errstr);
+   if (strlen(sql->errstr) > 6 && sql->errstr[5] 
== '!')
+   throw(SQL, "sql.catalog", "%s", 
sql->errstr);
+   else 
+   throw(SQL, "sql.catalog", 
SQLSTATE(42000) "%s", sql->errstr);
}
id_l = rel_dependencies(sql, r);
mvc_create_dependencies(sql, id_l, nt->base.id, 
FUNC_DEPENDENCY);
@@ -352,16 +355,16 @@ create_table_or_view(mvc *sql, char* sna
sql->sa = osa;
throw(SQL, "sql.catalog", SQLSTATE(42000) "CREATE 
TABLE: %s_%s_%s conflicts", s->base.name, t->base.name, c->base.name);
}
-   if(isPartitionedByColumnTable(t) && c->base.id == 
t->part.pcol->base.id)
+   if (isPartitionedByColumnTable(t) && c->base.id == 
t->part.pcol->base.id)
nt->part.pcol = copied;
}
-   if(isPartitionedByExpressionTable(t)) {
+   if (isPartitionedByExpressionTable(t)) {
char *err = NULL;
 
nt->part.pexp->exp = sa_strdup(sql->session->tr->sa, 
t->part.pexp->exp);
 
sql->sa = sa_create();
-   if(!sql->sa) {
+   if (!sql->sa) {
sql->sa = osa;
throw(SQL, "sql.catalog",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
@@ -369,16 +372,16 @@ create_table_or_view(mvc *sql, char* sna
err = bootstrap_partition_expression(sql, sql->session->tr->sa, 
nt, 1);
sa_destroy(sql->sa);
sql->sa = NULL;
-   if(err) {
+   if (err) {
sql->sa = osa;
return err;
}
}
check = sql_trans_set_partition_table(sql->session->tr, nt);
-   if(check == -1) {
+   if (check == -1) {
sql->sa = osa;
throw(SQL, "sql.catalog", SQLSTATE(42000) "CREATE TABLE: %s_%s: 
the partition's expression is too long", s->base.name, t->base.name);
-   } else if(check) {
+   } else if (check) {
sql->sa = osa;
throw(SQL, "sql.catalog", SQLSTATE(42000) "CREATE TABLE: %s_%s: 
an internal error occurred", s->base.name, t->base.name);
}
@@ -403,7 +406,7 @@ create_table_or_view(mvc *sql, char* sna
err = sql_partition_validate_key(sql, nt, k, "CREATE");
sa_destroy(sql->sa);
sql->sa = NULL;
-   if(err) {
+