MonetDB: default - merged with oscar

2020-07-24 Thread Niels Nes
Changeset: d28853482462 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d28853482462
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: default
Log Message:

merged with oscar


diffs (38 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
@@ -775,13 +775,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l
assert(!e->r);
if (exps) {
int nrcols = 0;
-   int push_cond_exec = 0;
+   int push_cond_exec = 0, coalesce = 0;
stmt *ncond = NULL, *ocond = cond;
 
if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
+   if (strcmp(sql_func_mod(f->func), "") == 0 && 
strcmp(sql_func_imp(f->func), "") == 0 && strcmp(f->func->base.name, 
"coalesce") == 0)
+   coalesce = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
for (en = exps->h; en; en = en->next) {
@@ -809,6 +811,17 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
if (push_cands && es->nrcols)
nrcands++;
+   if (coalesce && en->next) {
+   sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "isnull", tail_type(es), NULL, F_FUNC);
+   ncond = stmt_unop(be, es, a);
+   if (ocond) {
+   sql_subtype *bt = 
sql_bind_localtype("bit");
+   sql_subfunc *a = 
sql_bind_func(sql->sa, sql->session->schema, "and", bt, bt, F_FUNC);
+   cond = stmt_binop(be, ocond, 
ncond, a);
+   } else {
+   cond = ncond;
+   }
+   }
if (push_cond_exec && ncond) { /* handled then 
part */
sql_subtype *bt = 
sql_bind_localtype("bit");
sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "not", bt, NULL, F_FUNC);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: oscar - merged with jun

2020-07-24 Thread Niels Nes
Changeset: 9087c8729f4c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9087c8729f4c
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: oscar
Log Message:

merged with jun


diffs (38 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
@@ -689,13 +689,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l
assert(!e->r);
if (exps) {
int nrcols = 0;
-   int push_cond_exec = 0;
+   int push_cond_exec = 0, coalesce = 0;
stmt *ncond = NULL, *ocond = cond;
 
if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
+   if (strcmp(sql_func_mod(f->func), "") == 0 && 
strcmp(sql_func_imp(f->func), "") == 0 && strcmp(f->func->base.name, 
"coalesce") == 0)
+   coalesce = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
for (en = exps->h; en; en = en->next) {
@@ -723,6 +725,17 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
if (push_cands && es->nrcols)
nrcands++;
+   if (coalesce && en->next) {
+   sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "isnull", tail_type(es), NULL, F_FUNC);
+   ncond = stmt_unop(be, es, a);
+   if (ocond) {
+   sql_subtype *bt = 
sql_bind_localtype("bit");
+   sql_subfunc *a = 
sql_bind_func(sql->sa, sql->session->schema, "and", bt, bt, F_FUNC);
+   cond = stmt_binop(be, ocond, 
ncond, a);
+   } else {
+   cond = ncond;
+   }
+   }
if (push_cond_exec && ncond) { /* handled then 
part */
sql_subtype *bt = 
sql_bind_localtype("bit");
sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "not", bt, NULL, F_FUNC);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - fix coalesce conditional execution

2020-07-24 Thread Niels Nes
Changeset: 0b05f86f46f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0b05f86f46f9
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: Jun2020
Log Message:

fix coalesce conditional execution


diffs (38 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
@@ -689,13 +689,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l
assert(!e->r);
if (exps) {
int nrcols = 0;
-   int push_cond_exec = 0;
+   int push_cond_exec = 0, coalesce = 0;
stmt *ncond = NULL, *ocond = cond;
 
if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
+   if (strcmp(sql_func_mod(f->func), "") == 0 && 
strcmp(sql_func_imp(f->func), "") == 0 && strcmp(f->func->base.name, 
"coalesce") == 0)
+   coalesce = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
for (en = exps->h; en; en = en->next) {
@@ -723,6 +725,17 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
if (push_cands && es->nrcols)
nrcands++;
+   if (coalesce && en->next) {
+   sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "isnull", tail_type(es), NULL, F_FUNC);
+   ncond = stmt_unop(be, es, a);
+   if (ocond) {
+   sql_subtype *bt = 
sql_bind_localtype("bit");
+   sql_subfunc *a = 
sql_bind_func(sql->sa, sql->session->schema, "and", bt, bt, F_FUNC);
+   cond = stmt_binop(be, ocond, 
ncond, a);
+   } else {
+   cond = ncond;
+   }
+   }
if (push_cond_exec && ncond) { /* handled then 
part */
sql_subtype *bt = 
sql_bind_localtype("bit");
sql_subfunc *a = sql_bind_func(sql->sa, 
sql->session->schema, "not", bt, NULL, F_FUNC);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - approved output

2020-07-24 Thread Niels Nes
Changeset: dd1e43650882 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd1e43650882
Modified Files:
clients/Tests/exports.stable.out
Branch: default
Log Message:

approved output


diffs (11 lines):

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
@@ -1373,7 +1373,6 @@ str diffcandRef;
 str differenceRef;
 str disconnectRef;
 str divRef;
-void dropQRYqueue(void);
 str drop_constraintRef;
 str drop_functionRef;
 str drop_indexRef;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - fixed merge problem

2020-07-24 Thread Niels Nes
Changeset: 3a5a8fe16a1c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a5a8fe16a1c
Modified Files:
sql/backends/monet5/sql_statement.c
Branch: default
Log Message:

fixed merge problem


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3157,7 +3157,7 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
//coalesce(e1,e2) -> ifthenelse(isnil(e1),e2,e1)
if (strcmp(f->func->base.name, "coalesce") == 0) {
str mod = (!nrcols)?calcRef:batcalcRef;
-   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnotnil");
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
q = pushArgument(mb, q, e1->nr);
int nr = getDestVar(q);
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - merged

2020-07-24 Thread Niels Nes
Changeset: 658640ab17ec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=658640ab17ec
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/server/sql_atom.h
sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: default
Log Message:

merged


diffs (252 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
@@ -780,7 +780,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
-if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
+   if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
@@ -856,7 +856,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
list_append(l, ocond);
}
/* single value conditional execution done below */
-   if (ocond && !push_cond_exec && !nrcols && 
strcmp(sql_func_mod(f->func), "calc") == 0) {
+   if (ocond && !ocond->nrcols && !push_cond_exec && 
!nrcols && strcmp(sql_func_mod(f->func), "calc") == 0) {
sql_subtype *bt = sql_bind_localtype("bit");
sql_subfunc *isnull = 
sql_bind_func(be->mvc->sa, NULL, "isnull", bt, NULL, F_FUNC);
sql_subfunc *or = sql_bind_func(be->mvc->sa, 
NULL, "or", bt, bt, F_FUNC);
diff --git a/sql/backends/monet5/sql_round_impl.h 
b/sql/backends/monet5/sql_round_impl.h
--- a/sql/backends/monet5/sql_round_impl.h
+++ b/sql/backends/monet5/sql_round_impl.h
@@ -297,6 +297,8 @@ str_2dec(TYPE *res, const str *val, cons
if (scale < *sc) {
/* the current scale is too small, increase it by adding 0's */
int dff = *sc - scale;  /* CANNOT be 0! */
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
 
value *= scales[dff];
scale += dff;
@@ -305,6 +307,10 @@ str_2dec(TYPE *res, const str *val, cons
/* the current scale is too big, decrease it by correctly 
rounding */
/* we should round properly, and check for overflow (res >= 
10^digits+scale) */
int dff = scale - *sc;  /* CANNOT be 0 */
+
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
+
BIG rnd = scales[dff] >> 1;
 
if (value > 0)
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3154,7 +3154,7 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
 
nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
/* nrcols */
-   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   //coalesce(e1,e2) -> ifthenelse(isnil(e1),e2,e1)
if (strcmp(f->func->base.name, "coalesce") == 0) {
str mod = (!nrcols)?calcRef:batcalcRef;
q = newStmt(mb, e1->nrcols?mod:calcRef, "isnotnil");
@@ -3163,8 +3163,8 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
 
q = newStmt(mb, mod, "ifthenelse");
q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e2->nr);
q = pushArgument(mb, q, e1->nr);
-   q = pushArgument(mb, q, e2->nr);
}
//nullif(e1,e2) -> ifthenelse(e1==e2),NULL,e1)
if (strcmp(f->func->base.name, "nullif") == 0) {
diff --git a/sql/server/sql_atom.h b/sql/server/sql_atom.h
--- a/sql/server/sql_atom.h
+++ b/sql/server/sql_atom.h
@@ -69,9 +69,11 @@ extern int atom_is_false(atom *a);
 extern int atom_is_zero(atom *a);
 
 #ifdef HAVE_HGE
-extern hge scales[39];
+#define MAX_SCALE 39
+extern hge scales[MAX_SCALE];
 #else
-extern lng scales[19];
+#define MAX_SCALE 19
+extern lng scales[MAX_SCALE];
 #endif
 
 extern atom *atom_zero_value(sql_allocator *sa, sql_subtype* tpe);
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.err 
b/sql/test/SQLancer/Tests/sqlancer03.stable.err
--- a/sql/test/SQLancer/Tests/sqlancer03.stable.err
+++ 

MonetDB: oscar - merged

2020-07-24 Thread Niels Nes
Changeset: aee50b6e9ef0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aee50b6e9ef0
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_round_impl.h
sql/backends/monet5/sql_statement.c
sql/server/sql_atom.h
sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: oscar
Log Message:

merged


diffs (257 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
@@ -694,7 +694,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
-if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
+   if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
@@ -770,7 +770,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
list_append(l, ocond);
}
/* single value conditional execution done below */
-   if (ocond && !push_cond_exec && !nrcols && 
strcmp(sql_func_mod(f->func), "calc") == 0) {
+   if (ocond && !ocond->nrcols && !push_cond_exec && 
!nrcols && strcmp(sql_func_mod(f->func), "calc") == 0) {
sql_subtype *bt = sql_bind_localtype("bit");
sql_subfunc *isnull = 
sql_bind_func(be->mvc->sa, NULL, "isnull", bt, NULL, F_FUNC);
sql_subfunc *or = sql_bind_func(be->mvc->sa, 
NULL, "or", bt, bt, F_FUNC);
diff --git a/sql/backends/monet5/sql_round_impl.h 
b/sql/backends/monet5/sql_round_impl.h
--- a/sql/backends/monet5/sql_round_impl.h
+++ b/sql/backends/monet5/sql_round_impl.h
@@ -297,6 +297,8 @@ str_2dec(TYPE *res, const str *val, cons
if (scale < *sc) {
/* the current scale is too small, increase it by adding 0's */
int dff = *sc - scale;  /* CANNOT be 0! */
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
 
value *= scales[dff];
scale += dff;
@@ -305,6 +307,10 @@ str_2dec(TYPE *res, const str *val, cons
/* the current scale is too big, decrease it by correctly 
rounding */
/* we should round properly, and check for overflow (res >= 
10^digits+scale) */
int dff = scale - *sc;  /* CANNOT be 0 */
+
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
+
BIG rnd = scales[dff] >> 1;
 
if (value > 0)
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3122,21 +3122,17 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
 
nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
/* nrcols */
-   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   //coalesce(e1,e2) -> ifthenelse(isnil(e1),e2,e1)
if (strcmp(f->func->base.name, "coalesce") == 0) {
str mod = (!nrcols)?calcRef:batcalcRef;
q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
q = pushArgument(mb, q, e1->nr);
int nr = getDestVar(q);
 
-   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
-   q = pushArgument(mb, q, nr);
-   nr = getDestVar(q);
-
q = newStmt(mb, mod, "ifthenelse");
q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e2->nr);
q = pushArgument(mb, q, e1->nr);
-   q = pushArgument(mb, q, e2->nr);
}
//nullif(e1,e2) -> ifthenelse(e1==e2),NULL,e1)
if (strcmp(f->func->base.name, "nullif") == 0) {
diff --git a/sql/server/sql_atom.h b/sql/server/sql_atom.h
--- a/sql/server/sql_atom.h
+++ b/sql/server/sql_atom.h
@@ -71,9 +71,11 @@ extern int atom_is_false(atom *a);
 extern int atom_is_zero(atom *a);
 
 #ifdef HAVE_HGE
-extern hge scales[39];
+#define MAX_SCALE 39
+extern hge scales[MAX_SCALE];
 #else
-extern lng scales[19];
+#define MAX_SCALE 19
+extern lng scales

MonetDB: Jun2020 - simplified coalesce maping (coalesce(e1,e2) -...

2020-07-24 Thread Niels Nes
Changeset: 3c66999c81a8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c66999c81a8
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_round_impl.h
sql/backends/monet5/sql_statement.c
sql/server/sql_atom.h
sql/test/SQLancer/Tests/sqlancer03.stable.err
sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: Jun2020
Log Message:

simplified coalesce maping (coalesce(e1,e2) -> ifthenelse(isnil(e1)),e2,e1)
fixed issue with conditional execution were the input condition is a bat
but the current value is a single value.


diffs (260 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
@@ -692,9 +692,9 @@ exp_bin(backend *be, sql_exp *e, stmt *l
int push_cond_exec = 0;
stmt *ncond = NULL, *ocond = cond;
 
-if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
+   if (sel && strcmp(sql_func_mod(f->func), "calc") == 0 
&& strcmp(sql_func_imp(f->func), "ifthenelse") != 0)
push_cands = 1;
-if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
+   if (strcmp(sql_func_mod(f->func), "calc") == 0 && 
strcmp(sql_func_imp(f->func), "ifthenelse") == 0)
push_cond_exec = 1;
 
assert(list_length(exps) == list_length(f->func->ops) 
|| f->func->type == F_ANALYTIC || f->func->type == F_LOADER || f->func->vararg 
|| f->func->varres);
@@ -770,7 +770,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
list_append(l, ocond);
}
/* single value conditional execution done below */
-   if (ocond && !push_cond_exec && !nrcols && 
strcmp(sql_func_mod(f->func), "calc") == 0) {
+   if (ocond && !ocond->nrcols && !push_cond_exec && 
!nrcols && strcmp(sql_func_mod(f->func), "calc") == 0) {
sql_subtype *bt = sql_bind_localtype("bit");
sql_subfunc *isnull = 
sql_bind_func(be->mvc->sa, NULL, "isnull", bt, NULL, F_FUNC);
sql_subfunc *or = sql_bind_func(be->mvc->sa, 
NULL, "or", bt, bt, F_FUNC);
diff --git a/sql/backends/monet5/sql_round_impl.h 
b/sql/backends/monet5/sql_round_impl.h
--- a/sql/backends/monet5/sql_round_impl.h
+++ b/sql/backends/monet5/sql_round_impl.h
@@ -296,6 +296,8 @@ str_2dec(TYPE *res, const str *val, cons
if (scale < *sc) {
/* the current scale is too small, increase it by adding 0's */
int dff = *sc - scale;  /* CANNOT be 0! */
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
 
value *= scales[dff];
scale += dff;
@@ -304,6 +306,10 @@ str_2dec(TYPE *res, const str *val, cons
/* the current scale is too big, decrease it by correctly 
rounding */
/* we should round properly, and check for overflow (res >= 
10^digits+scale) */
int dff = scale - *sc;  /* CANNOT be 0 */
+
+   if (dff >= MAX_SCALE)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
+
BIG rnd = scales[dff] >> 1;
 
if (value > 0)
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3079,21 +3079,17 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
 
nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
/* nrcols */
-   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   //coalesce(e1,e2) -> ifthenelse(isnil(e1),e2,e1)
if (strcmp(f->func->base.name, "coalesce") == 0) {
str mod = (!nrcols)?calcRef:batcalcRef;
q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
q = pushArgument(mb, q, e1->nr);
int nr = getDestVar(q);
 
-   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
-   q = pushArgument(mb, q, nr);
-   nr = getDestVar(q);
-
q = newStmt(mb, mod, "ifthenelse");
q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e2->nr);
q = pushArgument(mb, q, e1->nr);
-   q = pushArgument(mb, q, e2->nr);
}
//nu

MonetDB: default - Generate less backend code

2020-07-24 Thread Pedro Ferreira
Changeset: 10101c778be3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10101c778be3
Modified Files:
sql/backends/monet5/sql_statement.c
Branch: default
Log Message:

Generate less backend code


diffs (19 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3157,14 +3157,10 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
//coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
if (strcmp(f->func->base.name, "coalesce") == 0) {
str mod = (!nrcols)?calcRef:batcalcRef;
-   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnotnil");
q = pushArgument(mb, q, e1->nr);
int nr = getDestVar(q);
 
-   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
-   q = pushArgument(mb, q, nr);
-   nr = getDestVar(q);
-
q = newStmt(mb, mod, "ifthenelse");
q = pushArgument(mb, q, nr);
q = pushArgument(mb, q, e1->nr);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: typing - Approved output

2020-07-24 Thread Pedro Ferreira
Changeset: d60e8e1ab622 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d60e8e1ab622
Modified Files:
sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out
Branch: typing
Log Message:

Approved output


diffs (15 lines):

diff --git a/sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out 
b/sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out
--- a/sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out
+++ b/sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.stable.out
@@ -8,9 +8,9 @@ stdout of test 'date-arithmetic.Bug-6415
 #select cast('2017-10-10' as date) - cast('2017-10-01' as date), date 
'2017-10-10' - date '2017-10-01';
 % .%2, .%3 # table_name
 % %2,  %3 # name
-% int, int # type
+% day_interval,day_interval # type
 % 5,   5 # length
-[ 9,   9   ]
+[ 0.009,   0.009   ]
 #select cast('2017-10-01' as date) + interval '9' day, date '2017-10-01' + 
interval '9' day;
 % .%2, .%3 # table_name
 % %2,  %3 # name
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merged with oscar

2020-07-24 Thread Pedro Ferreira
Changeset: 12987b3f64fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=12987b3f64fe
Modified Files:
gdk/gdk_utils.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_select.c

sql/test/BugDay_2005-11-09_2.9.3/Tests/sql_server_crash.SF-1080024.stable.out

sql/test/BugTracker-2016/Tests/column_alias_in_where_clause.Bug-3947.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in.Bug-6560.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
sql/test/SQLancer/Tests/sqlancer03.sql
sql/test/SQLancer/Tests/sqlancer03.stable.out
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/miscellaneous/Tests/simple_plans.stable.out
sql/test/miscellaneous/Tests/simple_plans.stable.out.single
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Merged with oscar


diffs (truncated from 1318 to 300 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3145,77 +3145,120 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
}
}
 
-   if (backend_create_subfunc(be, f, ops->op4.lval) < 0)
-   return NULL;
-   mod = sql_func_mod(f->func);
-   fimp = sql_func_imp(f->func);
-   if (o && o->nrcols > 0 && f->func->type != F_LOADER && f->func->type != 
F_PROC) {
-   sql_subtype *res = f->res->h->data;
-   fimp = convertMultiplexFcn(fimp);
-   q = NULL;
-   if (strcmp(fimp, "rotate_xor_hash") == 0 &&
-   strcmp(mod, calcRef) == 0 &&
-   (q = newStmt(mb, mkeyRef, bulk_rotate_xor_hashRef)) == NULL)
-   return NULL;
-   if (!q) {
-   if (f->func->type == F_UNION)
-   q = newStmt(mb, batmalRef, multiplexRef);
-   else
-   q = newStmt(mb, malRef, multiplexRef);
-   if (q == NULL)
-   return NULL;
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
-   q = pushStr(mb, q, mod);
-   q = pushStr(mb, q, fimp);
-   } else {
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
+   /* handle coalesce and nullif */
+   if (list_length(ops->op4.lval) == 2 &&
+   f->func->mod && strcmp(f->func->mod, "") == 0 && f->func->imp 
&& strcmp(f->func->imp, "") == 0) {
+   stmt *e1 = ops->op4.lval->h->data;
+   stmt *e2 = ops->op4.lval->h->next->data;
+   int nrcols = 0;
+
+   nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
+   /* nrcols */
+   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   if (strcmp(f->func->base.name, "coalesce") == 0) {
+   str mod = (!nrcols)?calcRef:batcalcRef;
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
+   q = pushArgument(mb, q, e1->nr);
+   int nr = getDestVar(q);
+
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
+   q = pushArgument(mb, q, nr);
+   nr = getDestVar(q);
+
+   q = newStmt(mb, mod, "ifthenelse");
+   q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e1->nr);
+   q = pushArgument(mb, q, e2->nr);
}
-   } else {
-   fimp = convertOperator(fimp);
-   q = newStmt(mb, mod, fimp);
-
-   if (f->res && list_length(f->res)) {
-   sql_subtype *res = f->res->h->data;
-
-   setVarType(mb, getArg(q, 0), res->type->localtype);
-   setVarUDFtype(mb, getArg(q, 0));
+   //nullif(e1,e2) -> ifthenelse(e1==e2),NULL,e1)
+   if (strcmp(f->func->base.name, "nullif") == 0) {
+   str mod = (!nrcols)?calcRef:batcalcRef;
+   sql_subtype *t = tail_type(e1);
+   int tt = t->type->localtype;

MonetDB: default - Added more tests for the circular sys.queue()...

2020-07-24 Thread Ying Zhang
Changeset: 6b0edb15628f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b0edb15628f
Added Files:
sql/test/sysmon/Tests/All
sql/test/sysmon/Tests/SingleServer
sql/test/sysmon/Tests/sys_queue_expand.sql
sql/test/sysmon/Tests/sys_queue_expand.stable.err
sql/test/sysmon/Tests/sys_queue_expand.stable.out
sql/test/sysmon/Tests/sys_queue_rotate.sql
sql/test/sysmon/Tests/sys_queue_rotate.stable.err
sql/test/sysmon/Tests/sys_queue_rotate.stable.out
sql/test/sysmon/Tests/sysqueue.sql
sql/test/sysmon/Tests/sysqueue.stable.err
sql/test/sysmon/Tests/sysqueue.stable.out
Removed Files:
sql/test/Tests/sysqueue.sql
sql/test/Tests/sysqueue.stable.err
sql/test/Tests/sysqueue.stable.out
Modified Files:
sql/test/Tests/All
Branch: default
Log Message:

Added more tests for the circular sys.queue(): test both the rotation and 
expansion of the circle


diffs (truncated from 475 to 300 lines):

diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -122,8 +122,6 @@ unicode
 
 window_functions
 
-sysqueue
-
 HAVE_PYMONETDB?hot_snapshot
 HAVE_PYMONETDB&HAVE_LIBZ?hot_snapshot_gz
 HAVE_PYMONETDB&HAVE_LIBBZ2?hot_snapshot_bz2
diff --git a/sql/test/sysmon/Tests/All b/sql/test/sysmon/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/sysmon/Tests/All
@@ -0,0 +1,3 @@
+sysqueue
+sys_queue_rotate
+sys_queue_expand
diff --git a/sql/test/sysmon/Tests/SingleServer 
b/sql/test/sysmon/Tests/SingleServer
new file mode 100644
--- /dev/null
+++ b/sql/test/sysmon/Tests/SingleServer
@@ -0,0 +1,1 @@
+--set max_clients=4
diff --git a/sql/test/sysmon/Tests/sys_queue_expand.sql 
b/sql/test/sysmon/Tests/sys_queue_expand.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/sysmon/Tests/sys_queue_expand.sql
@@ -0,0 +1,27 @@
+-- Use prepared statements to force sys.queue() to expand its query circle.
+-- This test relies on the little error that once a prepared statement is
+--   executed, the "prepare ..." query is not removed from sys.queue()
+prepare select 0;
+prepare select 1;
+prepare select 2;
+prepare select 3;
+prepare select 4;
+prepare select 5;
+prepare select 6;
+prepare select 7;
+select username, status, query from sys.queue();
+exec 0();
+select 0, username, status, query from sys.queue();
+exec 1();
+select 1, username, status, query from sys.queue();
+exec 2();
+select 2, username, status, query from sys.queue();
+exec 3();
+select 3, username, status, query from sys.queue();
+exec 4();
+select 4, username, status, query from sys.queue();
+exec 5();
+exec 6();
+exec 7();
+select 7, username, status, query from sys.queue();
+select 8, username, status, query from sys.queue();
diff --git a/sql/test/sysmon/Tests/sys_queue_expand.stable.err 
b/sql/test/sysmon/Tests/sys_queue_expand.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/sysmon/Tests/sys_queue_expand.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'sys_queue_expand` in directory 'sql/test/sysmon` itself:
+
+
+# 18:07:00 >  
+# 18:07:00 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-31724" "--port=38231"
+# 18:07:00 >  
+
+
+# 18:07:00 >  
+# 18:07:00 >  "Done."
+# 18:07:00 >  
+
diff --git a/sql/test/sysmon/Tests/sys_queue_expand.stable.out 
b/sql/test/sysmon/Tests/sys_queue_expand.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/sysmon/Tests/sys_queue_expand.stable.out
@@ -0,0 +1,212 @@
+stdout of test 'sys_queue_expand` in directory 'sql/test/sysmon` itself:
+
+
+# 18:07:00 >  
+# 18:07:00 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-31724" "--port=38231"
+# 18:07:00 >  
+
+#prepare select 0;
+#prepare select 0;
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, int,int,str,str,str # type
+% 7,   1,  1,  0,  2,  2 # length
+[ "tinyint",   8,  0,  "", "%2",   "%2"]
+#prepare select 1;
+#prepare select 1;
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, int,int,str,str,str # type
+% 7,   1,  1,  0,  2,  2 # length
+[ "tinyint",   1,  0,  "", "%2",   "%2"]
+#prepare select 2;
+#prepare select 2;
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, int,int,str,str,str # type
+% 7,   1,  1,  0,  2,  2 # length
+[ "tinyint",   2,  0,  "", "%2",   "%2"]
+#prepare select 3;
+#prepare select 3;
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.

MonetDB: oscar - Mergws with Jun2020

2020-07-24 Thread Pedro Ferreira
Changeset: 6dd1a04a34ce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6dd1a04a34ce
Modified Files:
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c

sql/test/BugTracker-2016/Tests/column_alias_in_where_clause.Bug-3947.stable.out
sql/test/SQLancer/Tests/sqlancer03.stable.out
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/miscellaneous/Tests/simple_plans.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: oscar
Log Message:

Mergws with Jun2020


diffs (truncated from 1386 to 300 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3113,77 +3113,120 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
}
}
 
-   if (backend_create_subfunc(be, f, ops->op4.lval) < 0)
-   return NULL;
-   mod = sql_func_mod(f->func);
-   fimp = sql_func_imp(f->func);
-   if (o && o->nrcols > 0 && f->func->type != F_LOADER && f->func->type != 
F_PROC) {
-   sql_subtype *res = f->res->h->data;
-   fimp = convertMultiplexFcn(fimp);
-   q = NULL;
-   if (strcmp(fimp, "rotate_xor_hash") == 0 &&
-   strcmp(mod, calcRef) == 0 &&
-   (q = newStmt(mb, mkeyRef, bulk_rotate_xor_hashRef)) == NULL)
-   return NULL;
-   if (!q) {
-   if (f->func->type == F_UNION)
-   q = newStmt(mb, batmalRef, multiplexRef);
-   else
-   q = newStmt(mb, malRef, multiplexRef);
-   if (q == NULL)
-   return NULL;
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
-   q = pushStr(mb, q, mod);
-   q = pushStr(mb, q, fimp);
-   } else {
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
+   /* handle coalesce and nullif */
+   if (list_length(ops->op4.lval) == 2 &&
+   f->func->mod && strcmp(f->func->mod, "") == 0 && f->func->imp 
&& strcmp(f->func->imp, "") == 0) {
+   stmt *e1 = ops->op4.lval->h->data;
+   stmt *e2 = ops->op4.lval->h->next->data;
+   int nrcols = 0;
+
+   nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
+   /* nrcols */
+   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   if (strcmp(f->func->base.name, "coalesce") == 0) {
+   str mod = (!nrcols)?calcRef:batcalcRef;
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
+   q = pushArgument(mb, q, e1->nr);
+   int nr = getDestVar(q);
+
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
+   q = pushArgument(mb, q, nr);
+   nr = getDestVar(q);
+
+   q = newStmt(mb, mod, "ifthenelse");
+   q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e1->nr);
+   q = pushArgument(mb, q, e2->nr);
}
-   } else {
-   fimp = convertOperator(fimp);
-   q = newStmt(mb, mod, fimp);
-
-   if (f->res && list_length(f->res)) {
-   sql_subtype *res = f->res->h->data;
-
-   setVarType(mb, getArg(q, 0), res->type->localtype);
-   setVarUDFtype(mb, getArg(q, 0));
+   //nullif(e1,e2) -> ifthenelse(e1==e2),NULL,e1)
+   if (strcmp(f->func->base.name, "nullif") == 0) {
+   str mod = (!nrcols)?calcRef:batcalcRef;
+   sql_subtype *t = tail_type(e1);
+   int tt = t->type->localtype;
+   q = newStmt(mb, mod, "==");
+   q = pushArgument(mb, q, e1->nr);
+   q = pushArgument(mb, q, e2->nr);
+   int nr = getDestVar(q);
+
+   q = newStmt(mb, mod, "ifthenelse");
+   q = pushArgument(mb, q, nr);
+   q = pushNil(mb, q, tt);
+   q = pushArgument(mb, q, e1->nr);
}
}
-   if (LANG_EXT(f-

MonetDB: Jun2020 - SQLancer SIGFPE (division by 0)

2020-07-24 Thread Pedro Ferreira
Changeset: f6e4c7abe85b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f6e4c7abe85b
Modified Files:
sql/test/SQLancer/Tests/sqlancer03.sql
Branch: Jun2020
Log Message:

SQLancer SIGFPE (division by 0)


diffs (44 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -306,6 +306,40 @@ case least(time '19:32:57', time '16:10:
 then sql_min(0.7, 0.03) else 0.3 end), coalesce (case - (t0.c0) when 
cast(v0.c2 as real) then abs(0.4) else 0.5 end, cast(t0.c0 as decimal)));
 ROLLBACK;
 
+START TRANSACTION; --SIGFPE
+CREATE TABLE "sys"."t0" (
+   "c0" INTERVAL MONTH NOT NULL,
+   "c1" DOUBLENOT NULL,
+   "c2" INTERVAL SECOND,
+   CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),
+   CONSTRAINT "t0_c0_unique" UNIQUE ("c0"),
+   CONSTRAINT "t0_c2_unique" UNIQUE ("c2"),
+   CONSTRAINT "t0_c1_c2_c0_unique" UNIQUE ("c1", "c2", "c0")
+);
+COPY 19 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+99360484   0.8104160489147377  NULL
+434886876  2003187499  NULL
+1868593144 0.605787503265435   -721601140.000
+1061127048 888903964   1369533413.000
+-320985624 0.7758661909853402  0.423
+-559098799 0.589701133253508   40364999.000
+1065193340 0.41440171821837046 1426163499.000
+1712034073 0.17915355536697286 -514338316.000
+1526621371 0.5435870488621911  -3797659.000
+130081317  0.4014279036721254  NULL
+2048481116 0.2107093605121693  1704117927.000
+-20673683910.5763887172257189  -452165183.000
+0  0.9286759330434932  NULL
+1021996113 0.737198399943565   NULL
+-713573774 0.3021457500334628  NULL
+-1680724988280992707   NULL
+1411861402 83084647NULL
+-1710710010-90593292   -1255979722.000
+1844355385 0.6101178479960011  1733503642.000
+
+select cast(group_concat(all r'0.5787210717348131') as decimal) from t0 group 
by - (abs(- (- (1061572565, least(t0.c0, least(cast(cast(0.09300166 as int) 
as interval month), t0.c0));
+ROLLBACK;
+
 START TRANSACTION; -- Bug 6924
 CREATE TABLE "sys"."t0" ("a" INTEGER, "b" INTEGER NOT NULL, CONSTRAINT 
"t0_a_b_unique" UNIQUE ("a","b"));
 --This copy into must succeed 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - small fix for ping/pong between too optimizers

2020-07-24 Thread Niels Nes
Changeset: fbaca56f1bc0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fbaca56f1bc0
Modified Files:
sql/server/rel_optimizer.c
Branch: Jun2020
Log Message:

small fix for ping/pong between too optimizers


diffs (12 lines):

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
@@ -5651,7 +5651,7 @@ rel_push_project_down(visitor *v, sql_re
 
if (rel_is_ref(l))
return rel;
-   if (is_basetable(l->op)) {
+   if (is_base(l->op)) {
if (list_check_prop_all(rel->exps, 
(prop_check_func)&exp_is_useless_rename)) {
/* TODO reduce list (those in the project + 
internal) */
rel->l = NULL;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - Fix for SQLancer assertion error, check for o...

2020-07-24 Thread Pedro Ferreira
Changeset: aa184c4c8c65 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aa184c4c8c65
Modified Files:
sql/server/sql_datetime.c
sql/test/SQLancer/Tests/sqlancer03.stable.err
sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: Jun2020
Log Message:

Fix for SQLancer assertion error, check for overflow while converting a string 
to an interval type


diffs (156 lines):

diff --git a/sql/server/sql_datetime.c b/sql/server/sql_datetime.c
--- a/sql/server/sql_datetime.c
+++ b/sql/server/sql_datetime.c
@@ -55,7 +55,6 @@ qualifier2multiplier( int sk )
/* fall through */
case imonth:
break;
-
case iday:
mul *= 24;
/* fall through */
@@ -76,11 +75,9 @@ qualifier2multiplier( int sk )
 static int
 parse_interval_(mvc *sql, lng sign, char *str, int sk, int ek, int sp, int ep, 
lng *i)
 {
-   char *n = NULL;
-   lng val = 0;
-   char sep = ':';
+   char *n = NULL, sep = ':';
+   lng val = 0, mul;
int type;
-   lng mul;
 
if (*str == '-') {
sign *= -1;
@@ -96,7 +93,6 @@ parse_interval_(mvc *sql, lng sign, char
sep = '-';
type = 0;
break;
-
case iday:
mul *= 24;
sep = ' ';
@@ -110,7 +106,6 @@ parse_interval_(mvc *sql, lng sign, char
case isec:
type = 1;
break;
-
default:
if (sql)
snprintf(sql->errstr, ERRSIZE, _("Internal error: 
parse_interval: bad value for sk (%d)\n"), sk);
@@ -177,14 +172,14 @@ parse_interval_(mvc *sql, lng sign, char
}
 }
 
+#define MABS(a) (((a) < 0) ? -(a) : (a))
+
 int
 parse_interval(mvc *sql, lng sign, char *str, int sk, int ek, int sp, int ep, 
lng *i)
 {
-   char *n = NULL;
-   lng val = 0;
-   char sep = ':';
+   char *n = NULL, sep = ':';
+   lng val = 0, mul, msec = 0;
int type;
-   lng mul;
 
if (*str == '-') {
sign *= -1;
@@ -200,7 +195,6 @@ parse_interval(mvc *sql, lng sign, char 
sep = '-';
type = 0;
break;
-
case iday:
mul *= 24;
sep = ' ';
@@ -214,7 +208,6 @@ parse_interval(mvc *sql, lng sign, char 
case isec:
type = 1;
break;
-
default:
if (sql)
snprintf(sql->errstr, ERRSIZE, _("Internal error: 
parse_interval: bad value for sk (%d)\n"), sk);
@@ -225,7 +218,6 @@ parse_interval(mvc *sql, lng sign, char 
if (!n)
return -1;
if (sk == isec) {
-   lng msec = 0;
if (n && n[0] == '.') {
char *nn;
msec = strtol(n+1, &nn, 10);
@@ -238,14 +230,36 @@ parse_interval(mvc *sql, lng sign, char 
n = nn;
}
}
-   if (val > GDK_lng_max / 1000 ||
-   (val == GDK_lng_max / 1000 && msec > GDK_lng_max % 1000)) {
+   }
+   switch (sk) {
+   case iyear:
+   case imonth:
+   if (val > (lng) GDK_int_max / MABS(mul)) {
+   if (sql)
+   snprintf(sql->errstr, ERRSIZE, _("Overflow\n"));
+   return -1;
+   }
+   break;
+   case iday:
+   case ihour:
+   case imin:
+   if (val > GDK_lng_max / MABS(mul)) {
+   if (sql)
+   snprintf(sql->errstr, ERRSIZE, _("Overflow\n"));
+   return -1;
+   }
+   break;
+   case isec:
+   if (val > GDK_lng_max / 1000 / MABS(mul) || (val == GDK_lng_max 
/ 1000 / MABS(mul) && msec > GDK_lng_max % 1000)) {
if (sql)
snprintf(sql->errstr, ERRSIZE, _("Overflow\n"));
return -1;
}
val *= 1000;
val += msec;
+   break;
+   default:
+   assert(0);
}
val *= mul;
*i += val;
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.err 
b/sql/test/SQLancer/Tests/sqlancer03.stable.err
--- a/sql/test/SQLancer/Tests/sqlancer03.stable.err
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.err
@@ -5,6 +5,10 @@ stderr of test 'sqlancer03` in directory
 # 17:14:16 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-439482" "--port=37916"
 # 17:14:16 >  
 
+MAPI  = (monetdb) /var/tmp/mtest-279965/.s.monetdb.34039
+QUERY = select all sum(all cast("concat"(cast("month"(t1.c0) as string), 
r'1313451898') as interval month)) from t1;
+ERROR = !Wrong format (11313451898)
+CODE  = 42000
 
 # 17:14:16 >  
 # 17:14:16 >  "Done."
diff --git a/sql/test/SQLancer/Tests/sqlancer

MonetDB: Jun2020 - merged

2020-07-24 Thread Niels Nes
Changeset: f010115b80a1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f010115b80a1
Branch: Jun2020
Log Message:

merged


diffs (36 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -280,6 +280,32 @@ COPY 4 RECORDS INTO "sys"."t1" FROM stdi
 select all sum(all cast("concat"(cast("month"(t1.c0) as string), 
r'1313451898') as interval month)) from t1;
 ROLLBACK;
 
+START TRANSACTION; -- Unknown barrier type error
+CREATE TABLE "sys"."t0" ("c0" INTEGER);
+COPY 13 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+-952561247
+668236378
+-2045848771
+-1790523044
+-1543588024
+-1750414901
+1790114978
+-274432932
+874627516
+-452950065
+303960197
+1
+20
+
+create view v0(c0, c1, c2, c3) as (
+   select distinct cast(case time '03:52:21' when time '05:04:36' then 
r'0.2' end as date), 
+   coalesce (t0.c0, length(coalesce (r't%QB', replace(r' ,yO_5G刵i稶bDßᶏ''', 
r'0.8', r'-1e500', interval '1' month, timestamp '1970-01-16 13:47:20' from 
t0) with check option;
+select v0.c0 from v0 join t0 on (0.3) not in 
+(least(cast(t0.c0 as decimal), 
+case least(time '19:32:57', time '16:10:04') when coalesce (time '22:25:53', 
time '00:14:31', time '18:12:09', time '01:59:38') 
+then sql_min(0.7, 0.03) else 0.3 end), coalesce (case - (t0.c0) when 
cast(v0.c2 as real) then abs(0.4) else 0.5 end, cast(t0.c0 as decimal)));
+ROLLBACK;
+
 START TRANSACTION; -- Bug 6924
 CREATE TABLE "sys"."t0" ("a" INTEGER, "b" INTEGER NOT NULL, CONSTRAINT 
"t0_a_b_unique" UNIQUE ("a","b"));
 --This copy into must succeed 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - improved dce optimizer in case of projects wi...

2020-07-24 Thread Niels Nes
Changeset: ff7ffe8c240c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ff7ffe8c240c
Modified Files:
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_rel.c

sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out

sql/test/BugTracker-2016/Tests/column_alias_in_where_clause.Bug-3947.stable.out

sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
sql/test/mergetables/Tests/sqlsmith-exists2.stable.out
sql/test/miscellaneous/Tests/simple_plans.stable.out
Branch: Jun2020
Log Message:

improved dce optimizer in case of projects with self referencing.
improved push project up optimizer, ie project_unsafe now checks for self 
references
make sure we don't rewrite 2 select were the later has a function (ie is more 
expensive when pushed down anyway, but also fixes issues with division by zero)


diffs (263 lines):

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
@@ -252,7 +252,7 @@ exp_compare_func(mvc *sql, sql_exp *le, 
 {
sql_subfunc *cmp_func = sql_bind_func(sql->sa, NULL, compareop, 
exp_subtype(le), exp_subtype(le), F_FUNC);
sql_exp *e;
- 
+
assert(cmp_func);
e = exp_binop(sql->sa, le, re, cmp_func);
if (e) {
@@ -1794,6 +1794,20 @@ exps_have_rel_exp( list *exps)
return 0;
 }
 
+int
+exps_have_func(list *exps)
+{
+   if (list_empty(exps))
+   return 0;
+   for(node *n=exps->h; n; n=n->next) {
+   sql_exp *e = n->data;
+
+   if (exp_has_func(e))
+   return 1;
+   }
+   return 0;
+}
+
 static sql_rel *
 exps_rel_get_rel(sql_allocator *sa, list *exps )
 {
diff --git a/sql/server/rel_exp.h b/sql/server/rel_exp.h
--- a/sql/server/rel_exp.h
+++ b/sql/server/rel_exp.h
@@ -151,6 +151,7 @@ extern int exp_is_null(mvc *sql, sql_exp
 extern int exp_is_rel(sql_exp *e);
 extern int exp_has_rel(sql_exp *e);
 extern int exps_have_rel_exp(list *exps);
+extern int exps_have_func(list *exps);
 extern sql_rel *exp_rel_get_rel(sql_allocator *sa, sql_exp *e);
 extern sql_exp *exp_rel_update_exp(mvc *sql, sql_exp *e);
 extern sql_exp *exp_rel_label(mvc *sql, sql_exp *e);
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
@@ -2968,20 +2968,6 @@ rel_merge_projects(visitor *v, sql_rel *
all = 0;
break;
}
-   /*
-   if (ne && ne->type == e_column) {
-   sql_exp *nne = NULL;
-
-   if (ne->l)
-   nne = exps_bind_column2(rel->exps, 
ne->l, ne->r);
-   if (!nne && !ne->l)
-   nne = exps_bind_column(rel->exps, 
ne->r, NULL, 1);
-   if (nne && ne != nne && nne != e) {
-   all = 0;
-   break;
-   }
-   }
-   */
if (ne) {
if (exp_name(e))
exp_prop_alias(v->sql->sa, ne, e);
@@ -4622,7 +4608,7 @@ rel_push_select_down(visitor *v, sql_rel
 
/* merge 2 selects */
r = rel->l;
-   if (is_select(rel->op) && r && r->exps && is_select(r->op) && 
!(rel_is_ref(r))) {
+   if (is_select(rel->op) && r && r->exps && is_select(r->op) && 
!(rel_is_ref(r)) && !exps_have_func(rel->exps)) {
(void)list_merge(r->exps, rel->exps, (fdup)NULL);
rel->l = NULL;
rel_destroy(rel);
@@ -6820,7 +6806,7 @@ exp_mark_used(sql_rel *subrel, sql_exp *
break;
}
if (ne && e != ne) {
-   if (!local_proj || (has_label(ne) || (ne->alias.rname && 
ne->alias.rname[0] == '%')))
+   if (!local_proj || (has_label(ne) || (ne->alias.rname && 
ne->alias.rname[0] == '%')) || (subrel->l && !rel_find_exp(subrel->l, e)))
ne->used = 1;
return ne->used;
}
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -38,11 +38,14 @@ project_unsafe(sql_rel *rel, int allow_i
if (!sub || (sub && sub->op == op_ddl))
return 1;
for(n = rel->exps->h; n; n = n->next) {
-   sql_exp *e = n->data;
+   sql_exp *e = n->data, *ne;
 
/* aggr func in project ! */
if (exp_unsafe(e, allow_identity))
return 1;
+   ne = rel_find_exp(rel, e);
+   if (ne && ne != e) /* no self referencing *

MonetDB: hammertime - Close hammertime

2020-07-24 Thread Aris Koning
Changeset: f58f6b62b3e2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f58f6b62b3e2
Branch: hammertime
Log Message:

Close hammertime

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


MonetDB: Jun2020 - SQLancer query giving "Unknown barrier type" ...

2020-07-24 Thread Pedro Ferreira
Changeset: e9a4ab1e07de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9a4ab1e07de
Modified Files:
sql/test/SQLancer/Tests/sqlancer03.sql
Branch: Jun2020
Log Message:

SQLancer query giving "Unknown barrier type" MAL error


diffs (36 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -280,6 +280,32 @@ COPY 4 RECORDS INTO "sys"."t1" FROM stdi
 select all sum(all cast("concat"(cast("month"(t1.c0) as string), 
r'1313451898') as interval month)) from t1;
 ROLLBACK;
 
+START TRANSACTION; -- Unknown barrier type error
+CREATE TABLE "sys"."t0" ("c0" INTEGER);
+COPY 13 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+-952561247
+668236378
+-2045848771
+-1790523044
+-1543588024
+-1750414901
+1790114978
+-274432932
+874627516
+-452950065
+303960197
+1
+20
+
+create view v0(c0, c1, c2, c3) as (
+   select distinct cast(case time '03:52:21' when time '05:04:36' then 
r'0.2' end as date), 
+   coalesce (t0.c0, length(coalesce (r't%QB', replace(r' ,yO_5G刵i稶bDßᶏ''', 
r'0.8', r'-1e500', interval '1' month, timestamp '1970-01-16 13:47:20' from 
t0) with check option;
+select v0.c0 from v0 join t0 on (0.3) not in 
+(least(cast(t0.c0 as decimal), 
+case least(time '19:32:57', time '16:10:04') when coalesce (time '22:25:53', 
time '00:14:31', time '18:12:09', time '01:59:38') 
+then sql_min(0.7, 0.03) else 0.3 end), coalesce (case - (t0.c0) when 
cast(v0.c2 as real) then abs(0.4) else 0.5 end, cast(t0.c0 as decimal)));
+ROLLBACK;
+
 START TRANSACTION; -- Bug 6924
 CREATE TABLE "sys"."t0" ("a" INTEGER, "b" INTEGER NOT NULL, CONSTRAINT 
"t0_a_b_unique" UNIQUE ("a","b"));
 --This copy into must succeed 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: userstats - minor clean up after having merged with def...

2020-07-24 Thread Ying Zhang
Changeset: adedc92eef14 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=adedc92eef14
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: userstats
Log Message:

minor clean up after having merged with default


diffs (48 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -104,6 +104,9 @@ updateUserStats(Client cntxt, MalBlkPtr 
}
 }
 
+/*
+ * Free up the whole USRstats before mserver5 exits.
+ */
 static void
 dropUSRstats(void)
 {
@@ -114,11 +117,10 @@ dropUSRstats(void)
GDKfree(USRstats[i].username);
if( USRstats[i].maxquery)
GDKfree(USRstats[i].maxquery);
-   clearUSRstats(i); // FIXME: not needed since it's freed below
+   clearUSRstats(i);
}
GDKfree(USRstats);
USRstats = NULL;
-   // FIXME: shouldn't reset usrstatscnt?
MT_lock_unset(&mal_delayLock);
 }
 
@@ -208,15 +210,14 @@ runtimeProfileInit(Client cntxt, MalBlkP
 
MT_lock_set(&mal_delayLock);
 
-   // FIXME: is this the correct init function to initiate this?
-   if(USRstats == NULL){ // FIXME: isn't USRstats always NULL here?
+   if(USRstats == NULL){
usrstatscnt = MAL_MAXCLIENTS;
USRstats = (UserStats) GDKzalloc( sizeof (struct USERSTAT) * 
usrstatscnt);
-   }
-   if(USRstats == NULL) {
-   addMalException(mb,"runtimeProfileInit" MAL_MALLOC_FAIL);
-   MT_lock_unset(&mal_delayLock);
-   return;
+   if(USRstats == NULL) {
+   addMalException(mb,"runtimeProfileInit" 
MAL_MALLOC_FAIL);
+   MT_lock_unset(&mal_delayLock);
+   return;
+   }
}
 
tmp = QRYqueue;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: typing - Added missing unary sql_neg function on interv...

2020-07-24 Thread Pedro Ferreira
Changeset: fdb3da3ac987 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fdb3da3ac987
Modified Files:
sql/common/sql_types.c
sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err
sql/test/miscellaneous/Tests/simple_selects.stable.out
sql/test/pg_regress/Tests/date.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: typing
Log Message:

Added missing unary sql_neg function on intervals and approved output


diffs (truncated from 1173 to 300 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1595,6 +1595,7 @@ sqltypeinit( sql_allocator *sa)
for (t = dates; *t != TME; t++) {
sql_create_func(sa, "sql_sub", "calc", "-", FALSE, FALSE, 
SCALE_FIX, 0, *t, 2, *t, *t);
sql_create_func(sa, "sql_add", "calc", "+", FALSE, FALSE, 
SCALE_FIX, 0, *t, 2, *t, *t);
+   sql_create_func(sa, "sql_neg", "calc", "-", TRUE, FALSE, INOUT, 
0, *t, 1, *t);
}
 
/* allow smaller types for arguments of mul/div */
@@ -1643,16 +1644,13 @@ sqltypeinit( sql_allocator *sa)
/* scale fixing for all numbers */
sql_create_func(sa, "scale_up", "calc", "*", FALSE, FALSE, 
SCALE_NONE, 0, *t, 2, *t, lt->type);
sql_create_func(sa, "scale_down", "sql", "dec_round", FALSE, 
FALSE, SCALE_NONE, 0, *t, 2, *t, lt->type);
-
/* numeric functions on INTERVALS */
-   if (t < dates) {
-   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, 
FALSE, SCALE_MUL, 0, MONINT, 2, MONINT, *t);
-   sql_create_func(sa, "sql_div", "calc", "/", FALSE, 
FALSE, SCALE_DIV, 0, MONINT, 2, MONINT, *t);
-   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, 
FALSE, SCALE_MUL, 0, DAYINT, 2, DAYINT, *t);
-   sql_create_func(sa, "sql_div", "calc", "/", FALSE, 
FALSE, SCALE_DIV, 0, DAYINT, 2, DAYINT, *t);
-   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, 
FALSE, SCALE_MUL, 0, SECINT, 2, SECINT, *t);
-   sql_create_func(sa, "sql_div", "calc", "/", FALSE, 
FALSE, SCALE_DIV, 0, SECINT, 2, SECINT, *t);
-   }
+   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, FALSE, 
SCALE_MUL, 0, MONINT, 2, MONINT, *t);
+   sql_create_func(sa, "sql_div", "calc", "/", FALSE, FALSE, 
SCALE_DIV, 0, MONINT, 2, MONINT, *t);
+   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, FALSE, 
SCALE_MUL, 0, DAYINT, 2, DAYINT, *t);
+   sql_create_func(sa, "sql_div", "calc", "/", FALSE, FALSE, 
SCALE_DIV, 0, DAYINT, 2, DAYINT, *t);
+   sql_create_func(sa, "sql_mul", "calc", "*", FALSE, FALSE, 
SCALE_MUL, 0, SECINT, 2, SECINT, *t);
+   sql_create_func(sa, "sql_div", "calc", "/", FALSE, FALSE, 
SCALE_DIV, 0, SECINT, 2, SECINT, *t);
}
 
for (t = decimals, t++; t != floats; t++) {
diff --git 
a/sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err 
b/sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err
--- a/sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err
+++ b/sql/test/bugs/Tests/interval_convert_bugs-sf-1274077-1274085.stable.err
@@ -20,7 +20,7 @@ ERROR = !types tinyint(1,0) and month_in
 CODE  = 42000
 MAPI  = (monetdb) /var/tmp/mtest-524170/.s.monetdb.38467
 QUERY = select cast( 1 as interval day ); --error
-ERROR = !types tinyint(1,0) and sec_interval(4,0) are not equal
+ERROR = !types tinyint(1,0) and day_interval(4,0) are not equal
 CODE  = 42000
 
 # 14:19:19 >  
diff --git a/sql/test/miscellaneous/Tests/simple_selects.stable.out 
b/sql/test/miscellaneous/Tests/simple_selects.stable.out
--- a/sql/test/miscellaneous/Tests/simple_selects.stable.out
+++ b/sql/test/miscellaneous/Tests/simple_selects.stable.out
@@ -146,8 +146,8 @@ stdout of test 'simple_selects` in direc
 #select -NULL;
 % .%2 # table_name
 % %2 # name
-% sec_interval # type
-% 5 # length
+% double # type
+% 24 # length
 [ NULL ]
 #create table x (x interval second, y interval month);
 #insert into x values (1, 1);
diff --git a/sql/test/pg_regress/Tests/date.stable.out 
b/sql/test/pg_regress/Tests/date.stable.out
--- a/sql/test/pg_regress/Tests/date.stable.out
+++ b/sql/test/pg_regress/Tests/date.stable.out
@@ -547,44 +547,44 @@ stdout of test 'date` in directory 'sql/
 #SELECT f1, sql_sub(f1, cast('2001-12-12' as date)) FROM DATE_TBL;
 % sys.date_tbl,sys.%1 # table_name
 % f1,  %1 # name
-% date,int # type
-% 10,  6 # length
-[ 1957-04-09,  -16318  ]
-[ 1957-06-13,  -16253  ]
-[ 1996-02-28,  -2114   ]
-[ 1996-02-29,  -2113   ]
-[ 1996-03-01,  -2112   ]
-[ 1996-03-02,  -2111   ]
-[ 1997-02-28,  -1748   ]
-[ 1997-03-01,  -1747   ]
-[ 1997-03-02,  -1746   ]
-[ 2000-04-01,

MonetDB: Jun2020 - Don't add more complexity to the codebase. SQ...

2020-07-24 Thread Pedro Ferreira
Changeset: 6a07b2137d71 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6a07b2137d71
Modified Files:
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/server/rel_optimizer.c
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: Jun2020
Log Message:

Don't add more complexity to the codebase. SQL functions without a backend 
implementation use the empty module and implementation names


diffs (164 lines):

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
@@ -1005,16 +1005,9 @@ monet5_resolve_function(ptr M, sql_func 
int clientID = *(int*) M;
str mname = getName(f->mod), fname = getName(f->imp);
 
-   /* sql.internal doesn't exist */
-   if (!fname && mname == sqlRef && f->imp && strcmp(f->imp, "internal") 
== 0)
-   return 1;
-
if (!mname || !fname)
return 0;
 
-   /* sql.internal doesn't exist */
-   if (strcmp(mname, "sql") == 0 && strcmp(fname,"internal") == 0)
-   return 1;
/* Some SQL functions MAL mapping such as count(*) aggregate, the 
number of arguments don't match */
if (mname == calcRef && fname == getName("="))
return 1;
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3072,7 +3072,7 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
 
/* handle coalesce and nullif */
if (list_length(ops->op4.lval) == 2 &&
-   f->func->mod && strcmp(f->func->mod, "sql") == 0 && 
f->func->imp && strcmp(f->func->imp, "internal") == 0) {
+   f->func->mod && strcmp(f->func->mod, "") == 0 && f->func->imp 
&& strcmp(f->func->imp, "") == 0) {
stmt *e1 = ops->op4.lval->h->data;
stmt *e2 = ops->op4.lval->h->next->data;
int nrcols = 0;
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1314,8 +1314,9 @@ sqltypeinit( sql_allocator *sa)
sql_create_func(sa, "least", "calc", "min_no_nil", FALSE, SCALE_FIX, 0, 
ANY, 2, ANY, ANY);
sql_create_func(sa, "greatest", "calc", "max_no_nil", FALSE, SCALE_FIX, 
0, ANY, 2, ANY, ANY);
sql_create_func(sa, "ifthenelse", "calc", "ifthenelse", FALSE, 
SCALE_FIX, 0, ANY, 3, BIT, ANY, ANY);
-   sql_create_func(sa, "nullif", "sql", "internal", FALSE, SCALE_FIX, 0, 
ANY, 2, ANY, ANY);
-   sql_create_func(sa, "coalesce", "sql", "internal", FALSE, SCALE_FIX, 0, 
ANY, 2, ANY, ANY);
+   /* nullif and coalesce don't have a backend implementation */
+   sql_create_func(sa, "nullif", "", "", FALSE, SCALE_FIX, 0, ANY, 2, ANY, 
ANY);
+   sql_create_func(sa, "coalesce", "", "", FALSE, SCALE_FIX, 0, ANY, 2, 
ANY, ANY);
 
/* sum for numerical and decimals */
sql_create_aggr(sa, "sum", "aggr", "sum", LargestINT, 1, BTE);
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
@@ -3069,7 +3069,7 @@ exp_simplify_math( mvc *sql, sql_exp *e,
 * value */
 
/* for both nullif and coalesce don't rewrite the NULL 
handling */
-   if (f && f->func && f->func->imp && 
strcmp(f->func->imp, "internal") == 0)
+   if (f && f->func && f->func->imp && 
strcmp(f->func->imp, "") == 0)
return e;
 
if (exp_is_atom(le) && exp_is_null(sql, le)) {
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -2378,7 +2378,7 @@ drop function pcre_replace(string, strin
 [ "sys.functions", "sys",  "charindex","SYSTEM",   "locate",   
"str",  "Internal C",   "Scalar function",  false,  false,  false,  
"res_0","int",  32, 0,  "out",  "arg_1","varchar",  
0,  0,  "in",   "arg_2","varchar",  0,  0,  "in",   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NUL

MonetDB: userstats - merged with default

2020-07-24 Thread Ying Zhang
Changeset: 851d30f9dd52 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=851d30f9dd52
Modified Files:
monetdb5/mal/mal_runtime.c
monetdb5/modules/mal/sysmon.c
Branch: userstats
Log Message:

merged with default


diffs (24 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -221,7 +221,7 @@ runtimeProfileInit(Client cntxt, MalBlkP
 
tmp = QRYqueue;
if ( QRYqueue == NULL) {
-   QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= 8)); /* for testing */
+   QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= MAL_MAXCLIENTS));
 
if ( QRYqueue == NULL){
addMalException(mb,"runtimeProfileInit" 
MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c
--- a/monetdb5/modules/mal/sysmon.c
+++ b/monetdb5/modules/mal/sysmon.c
@@ -147,7 +147,7 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, 
 
(void) cntxt;
(void) mb;
-   sz = MAL_MAXCLIENTS;// reserve space for all possible clients.
+   sz = qsize; // reserve space for all tuples in QRYqueue
tag = COLnew(0, TYPE_lng, sz, TRANSIENT);
sessionid = COLnew(0, TYPE_int, sz, TRANSIENT);
user = COLnew(0, TYPE_str, sz, TRANSIENT);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - New sqlsmith crash

2020-07-24 Thread Pedro Ferreira
Changeset: 1d0a3989d894 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d0a3989d894
Modified Files:
sql/test/mergetables/Tests/sqlsmith-exists2.sql
Branch: Jun2020
Log Message:

New sqlsmith crash


diffs (55 lines):

diff --git a/sql/test/mergetables/Tests/sqlsmith-exists2.sql 
b/sql/test/mergetables/Tests/sqlsmith-exists2.sql
--- a/sql/test/mergetables/Tests/sqlsmith-exists2.sql
+++ b/sql/test/mergetables/Tests/sqlsmith-exists2.sql
@@ -559,4 +559,51 @@ SELECT 1 FROM myitem WHERE i_current_pri
 
 SELECT 1 FROM tab0 WHERE col0 BETWEEN 64 AND 64 + 10 AND col0 BETWEEN 64 + 1 
AND 64 + 15;
 
+select 
+ subq_0.c6 as c0, 
+ subq_0.c5 as c1, 
+ 38 as c2 from 
+ (select 
+ case when ref_0.i is not null then ref_0.i else ref_0.i end
+ as c0, 
+ ref_0.i as c1, 
+ ref_0.i as c2, 
+ ref_0.i as c3, 
+ ref_0.i as c4, 
+ ref_0.i as c5, 
+ ref_0.i as c6, 
+ ref_0.i as c7, 
+ ref_0.i as c8, 
+ case when ref_0.i is not null then ref_0.i else ref_0.i end
+ as c9
+ from 
+ integers as ref_0
+ where (exists (
+ select 
+ ref_1.col4 as c0, 
+ 28 as c1, 
+ ref_1.col2 as c2, 
+ ref_1.col3 as c3, 
+ 71 as c4
+ from 
+ tbl_productsales as ref_1
+ where false)) 
+ or ((ref_0.i is null) 
+ or ((ref_0.i is not null) 
+ or (exists (
+ select 
+ ref_2.col1 as c0
+ from 
+ tbl_productsales as ref_2
+ where (((false) 
+ and (true)) 
+ and ((ref_2.col3 is null) 
+ and ((false) 
+ and (true 
+ and (ref_0.i is not null)
+ limit 77) as subq_0 where case when (subq_0.c5 is null) 
+ or (subq_0.c9 is not null) then subq_0.c2 else subq_0.c2 end
+ is null limit 71;
+ -- NULL NULL 38
+
 ROLLBACK;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Don't use MAL_MAXCLIENTS to initialise the re...

2020-07-24 Thread Ying Zhang
Changeset: 24ed58127581 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=24ed58127581
Modified Files:
monetdb5/modules/mal/sysmon.c
Branch: default
Log Message:

Don't use MAL_MAXCLIENTS to initialise the result size of sys.queue(), since 
one client can have multiple queries in the QRYqueue.  Use 'qsize' instead, 
which is surely big enough.


diffs (12 lines):

diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c
--- a/monetdb5/modules/mal/sysmon.c
+++ b/monetdb5/modules/mal/sysmon.c
@@ -37,7 +37,7 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, 
 
(void) cntxt;
(void) mb;
-   sz = MAL_MAXCLIENTS;// reserve space for all possible clients.
+   sz = qsize; // reserve space for all tuples in QRYqueue
tag = COLnew(0, TYPE_lng, sz, TRANSIENT);
sessionid = COLnew(0, TYPE_int, sz, TRANSIENT);
user = COLnew(0, TYPE_str, sz, TRANSIENT);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Use the proper value to initialise QRYqueue.

2020-07-24 Thread Ying Zhang
Changeset: 7ea42f1617a3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ea42f1617a3
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

Use the proper value to initialise QRYqueue.

For testing, use the mserver5 option '--set max_clients=N' to lowser this 
initial size of QRYqueue.


diffs (12 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -116,7 +116,7 @@ runtimeProfileInit(Client cntxt, MalBlkP
 
MT_lock_set(&mal_delayLock);
if ( QRYqueue == NULL) {
-   QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= 8)); /* for testing */
+   QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= MAL_MAXCLIENTS));
 
if ( QRYqueue == NULL){
addMalException(mb,"runtimeProfileInit" 
MAL_MALLOC_FAIL);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: userstats - merged with default

2020-07-24 Thread Ying Zhang
Changeset: 9a6829da3e43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a6829da3e43
Removed Files:
debian/monetdb5-server-hugeint.install
debian/monetdb5-sql-hugeint.install
monetdb5/modules/kernel/00_aggr_hge.mal.sh
monetdb5/modules/kernel/aggr.mal.sh
monetdb5/modules/mal/00_batcalc_hge.mal.sh
monetdb5/modules/mal/00_calc_hge.mal.sh
monetdb5/modules/mal/01_batcalc.mal.sh
monetdb5/modules/mal/01_calc.mal.sh
monetdb5/modules/mal/batmtime.mal.sh
sql/backends/monet5/sql_decimal.mal.sh
sql/backends/monet5/sql_decimal_hge.mal.sh
sql/backends/monet5/sql_rank.mal.sh
sql/backends/monet5/sql_rank_hge.mal.sh
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_runtime.h
sql/backends/monet5/sql_upgrades.c
Branch: userstats
Log Message:

merged with default


diffs (truncated from 10802 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -777,3 +777,6 @@ 28480e096722b7f76ab021c0d16c68c6949f41b4
 80bd3e89c48032840f493a63d6c4c12ee6273b3d Jun2020_release
 1e3bd8cd485a0880a7557aa5307e986a210a1e00 Jun2020_9
 1e3bd8cd485a0880a7557aa5307e986a210a1e00 Jun2020_SP1_release
+bb157905ecb86908dcfb112d102a8c6152557b5d Jun2020_11
+1e3bd8cd485a0880a7557aa5307e986a210a1e00 Jun2020_SP1_release
+bb157905ecb86908dcfb112d102a8c6152557b5d Jun2020_SP1_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -7,7 +7,7 @@
 # The --with OPTION and --without OPTION arguments can be passed on
 # the commandline of both rpmbuild and mock.
 
-# On 64 bit architectures we build "hugeint" packages.
+# On 64 bit architectures compile with 128 bit integer support.
 %if "%{?_lib}" == "lib64"
 %bcond_without hugeint
 %endif
@@ -379,9 +379,6 @@ extensions for %{name}-SQL-server5.
 
 %files geom-MonetDB5
 %defattr(-,root,root)
-%{_libdir}/monetdb5/autoload/*_geom.mal
-%{_libdir}/monetdb5/createdb/*_geom.sql
-%{_libdir}/monetdb5/geom.mal
 %{_libdir}/monetdb5/lib_geom.so
 %endif
 
@@ -406,8 +403,7 @@ install it.
 
 %files R
 %defattr(-,root,root)
-%{_libdir}/monetdb5/rapi.*
-%{_libdir}/monetdb5/autoload/*_rapi.mal
+%{_libdir}/monetdb5/rapi.R
 %{_libdir}/monetdb5/lib_rapi.so
 %endif
 
@@ -432,8 +428,6 @@ install it.
 
 %files python3
 %defattr(-,root,root)
-%{_libdir}/monetdb5/pyapi3.*
-%{_libdir}/monetdb5/autoload/*_pyapi3.mal
 %{_libdir}/monetdb5/lib_pyapi3.so
 %endif
 
@@ -454,9 +448,6 @@ format.
 
 %files cfitsio
 %defattr(-,root,root)
-%{_libdir}/monetdb5/fits.mal
-%{_libdir}/monetdb5/autoload/*_fits.mal
-%{_libdir}/monetdb5/createdb/*_fits.sql
 %{_libdir}/monetdb5/lib_fits.so
 %endif
 
@@ -465,10 +456,12 @@ Summary: MonetDB - Monet Database Manage
 Group: Applications/Databases
 Requires(pre): shadow-utils
 Requires: %{name}-client%{?_isa} = %{version}-%{release}
+Obsoletes: MonetDB5-server-hugeint < 11.38.0
+%if %{with hugeint}
+Provides: MonetDB5-server-hugeint%{?_isa} = %{version}-%{release}
+%endif
 %if (0%{?fedora} >= 22)
 Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-%if %{with hugeint}
-Recommends: MonetDB5-server-hugeint%{?_isa} = %{version}-%{release}
 %endif
 Suggests: %{name}-client%{?_isa} = %{version}-%{release}
 %endif
@@ -521,37 +514,7 @@ exit 0
 %exclude %{_bindir}/stethoscope
 %{_libdir}/libmonetdb5.so.*
 %dir %{_libdir}/monetdb5
-%dir %{_libdir}/monetdb5/autoload
-%if %{with fits}
-%exclude %{_libdir}/monetdb5/fits.mal
-%exclude %{_libdir}/monetdb5/autoload/*_fits.mal
-%endif
-%if %{with geos}
-%exclude %{_libdir}/monetdb5/geom.mal
-%endif
-%if %{with py3integration}
-%exclude %{_libdir}/monetdb5/pyapi3.mal
-%endif
-%if %{with rintegration}
-%exclude %{_libdir}/monetdb5/rapi.mal
-%endif
-%exclude %{_libdir}/monetdb5/sql*.mal
-%if %{with hugeint}
-%exclude %{_libdir}/monetdb5/*_hge.mal
-%exclude %{_libdir}/monetdb5/autoload/*_hge.mal
-%endif
-%{_libdir}/monetdb5/*.mal
-%if %{with geos}
-%exclude %{_libdir}/monetdb5/autoload/*_geom.mal
-%endif
-%if %{with py3integration}
-%exclude %{_libdir}/monetdb5/autoload/*_pyapi3.mal
-%endif
-%if %{with rintegration}
-%exclude %{_libdir}/monetdb5/autoload/*_rapi.mal
-%endif
-%exclude %{_libdir}/monetdb5/autoload/??_sql*.mal
-%{_libdir}/monetdb5/autoload/*.mal
+%{_libdir}/monetdb5/microbenchmark.mal
 %{_libdir}/monetdb5/lib_capi.so
 %{_libdir}/monetdb5/lib_generator.so
 %{_libdir}/monetdb5/lib_udf.so
@@ -560,28 +523,6 @@ exit 0
 %docdir %{_datadir}/doc/MonetDB
 %{_datadir}/doc/MonetDB/*
 
-%if %{with hugeint}
-%package -n MonetDB5-server-hugeint
-Summary: MonetDB - 128-bit integer support for MonetDB5-server
-Group: Applications/Databases
-Requires: MonetDB5-server%{?_isa}
-
-%description -n MonetDB5-server-hugeint
-MonetDB is a database management system that is developed from a
-main-memory perspective with use of a fully decomposed storage model,
-automatic index management, extensibility of data types and search
-accelerators.  It also 

MonetDB: default - Remove superfluous checks for NULL pointers, ...

2020-07-24 Thread Ying Zhang
Changeset: 2aa7d4920db5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2aa7d4920db5
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

Remove superfluous checks for NULL pointers, GDKfree is already NULL pointer 
resistant


diffs (47 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -87,8 +87,7 @@ advanceQRYqueue(void)
return;
}
GDKfree(s);
-   if(QRYqueue[qhead].username)
-   GDKfree(QRYqueue[qhead].username);
+   GDKfree(QRYqueue[qhead].username);
clearQRYqueue(qhead);
}
 }
@@ -99,10 +98,8 @@ dropQRYqueue(void)
size_t i;
MT_lock_set(&mal_delayLock);
for(i = 0; i < qsize; i++){
-   if( QRYqueue[i].query)
-   GDKfree(QRYqueue[i].query);
-   if(QRYqueue[i].username)
-   GDKfree(QRYqueue[i].username);
+   GDKfree(QRYqueue[i].query);
+   GDKfree(QRYqueue[i].username);
clearQRYqueue(i);
}
GDKfree(QRYqueue);
@@ -165,10 +162,9 @@ runtimeProfileInit(Client cntxt, MalBlkP
QRYqueue[qhead].start = time(0);
q = isaSQLquery(mb);
QRYqueue[qhead].query = q? GDKstrdup(q):0;
-   if(QRYqueue[qhead].username)
-   GDKfree(QRYqueue[qhead].username);
+   GDKfree(QRYqueue[qhead].username);
if (!GDKembedded())
-   AUTHgetUsername(&QRYqueue[qhead].username, cntxt);
+   QRYqueue[qhead].username = GDKstrdup(cntxt->username);
QRYqueue[qhead].idx = cntxt->idx;
QRYqueue[qhead].memory = (int) (stk->memory / LL_CONSTANT(1048576)); /* 
Convert to MB */
QRYqueue[qhead].workers = (int) stk->workers;
@@ -189,7 +185,6 @@ runtimeProfileFinish(Client cntxt, MalBl
size_t i;
 
(void) cntxt;
-   (void) mb;
 
MT_lock_set(&mal_delayLock);
i=qtail;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - merged

2020-07-24 Thread Niels Nes
Changeset: 34395ce0699d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=34395ce0699d
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: unlock
Log Message:

merged


diffs (79 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -98,7 +98,6 @@ void mal_reset(void)
 {
GDKprepareExit();
MCstopClients(0);
-   dropQRYqueue();
setHeartbeat(-1);
stopProfiler(0);
AUTHreset();
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -30,17 +30,6 @@ QueryQueue QRYqueue = NULL;
 size_t qsize = 0, qhead = 0, qtail = 0;
 static oid qtag= 1;// A unique query identifier
 
-void
-mal_runtime_reset(void)
-{
-   GDKfree(QRYqueue);
-   QRYqueue = NULL;
-   qsize = 0;
-   qtag= 1;
-   qhead = 0;
-   qtail = 0;
-}
-
 static str
 isaSQLquery(MalBlkPtr mb){
int i;
@@ -93,7 +82,7 @@ advanceQRYqueue(void)
if( s){
/* don;t wipe them when they are still running, prepared, or 
paused */
/* The upper layer has assured there is at least one slot 
available */
-   if(QRYqueue[qhead].status == 0 || (QRYqueue[qhead].status[0] != 
'r' && QRYqueue[qhead].status[0] != 'p')){
+   if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 
'r' || QRYqueue[qhead].status[0] == 'p')){
advanceQRYqueue();
return;
}
@@ -104,7 +93,7 @@ advanceQRYqueue(void)
}
 }
 
-void
+static void
 dropQRYqueue(void)
 {
size_t i;
@@ -229,6 +218,17 @@ runtimeProfileFinish(Client cntxt, MalBl
MT_lock_unset(&mal_delayLock);
 }
 
+/* Used by mal_reset to do the grand final clean up of this area before 
MonetDB exits */
+void
+mal_runtime_reset(void)
+{
+   dropQRYqueue();
+   qsize = 0;
+   qtag= 1;
+   qhead = 0;
+   qtail = 0;
+}
+
 /*
  * Each MAL instruction is executed by a single thread, which means we can
  * keep a simple working set around to make Stethscope attachement easy.
diff --git a/monetdb5/mal/mal_runtime.h b/monetdb5/mal/mal_runtime.h
--- a/monetdb5/mal/mal_runtime.h
+++ b/monetdb5/mal/mal_runtime.h
@@ -53,7 +53,6 @@ mal_export void runtimeProfileInit(Clien
 mal_export void runtimeProfileFinish(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk);
 mal_export void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, RuntimeProfile prof);
 mal_export void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, RuntimeProfile prof);
-mal_export void dropQRYqueue(void);
 mal_export lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
 mal_export lng getBatSpace(BAT *b);
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - SQLancer assertion error

2020-07-24 Thread Pedro Ferreira
Changeset: c887e200a75c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c887e200a75c
Modified Files:
sql/test/SQLancer/Tests/sqlancer03.sql
Branch: Jun2020
Log Message:

SQLancer assertion error


diffs (21 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -269,6 +269,17 @@ select all t1.c0 from t1 right outer joi
 cast(abs(0.160418955416609) as string), cast(coalesce (greatest(interval 
'-1022285655' second, interval '-1047501443' second), interval '641174375' 
second, sql_max(interval '-1539884267' second, interval '-685917930' second)) 
as string)))not ilike(t0.c0));
 ROLLBACK;
 
+START TRANSACTION;
+CREATE TABLE "sys"."t1" ("c0" TIMESTAMP);
+COPY 4 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+"1970-01-14 14:26:27.00"
+"1970-01-18 02:50:56.00"
+"1970-01-06 21:36:37.00"
+"1970-01-14 01:01:12.00"
+
+select all sum(all cast("concat"(cast("month"(t1.c0) as string), 
r'1313451898') as interval month)) from t1;
+ROLLBACK;
+
 START TRANSACTION; -- Bug 6924
 CREATE TABLE "sys"."t0" ("a" INTEGER, "b" INTEGER NOT NULL, CONSTRAINT 
"t0_a_b_unique" UNIQUE ("a","b"));
 --This copy into must succeed 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - When we can't expand the currenct QRYqueue, d...

2020-07-24 Thread Ying Zhang
Changeset: f2076b3dad89 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2076b3dad89
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

When we can't expand the currenct QRYqueue, don't overwrite it.


diffs (46 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -115,18 +115,17 @@ runtimeProfileInit(Client cntxt, MalBlkP
 {
size_t i, paused = 0;
str q;
-   QueryQueue tmp;
+   QueryQueue tmp = NULL;
 
MT_lock_set(&mal_delayLock);
-   tmp = QRYqueue;
-   if ( QRYqueue == NULL)
+   if ( QRYqueue == NULL) {
QRYqueue = (QueryQueue) GDKzalloc( sizeof (struct QRYQUEUE) * 
(qsize= 8)); /* for testing */
 
-   if ( QRYqueue == NULL){
-   addMalException(mb,"runtimeProfileInit" MAL_MALLOC_FAIL);
-   GDKfree(tmp);
-   MT_lock_unset(&mal_delayLock);
-   return;
+   if ( QRYqueue == NULL){
+   addMalException(mb,"runtimeProfileInit" 
MAL_MALLOC_FAIL);
+   MT_lock_unset(&mal_delayLock);
+   return;
+   }
}
// check for recursive call, which does not change the number of workers
i=qtail;
@@ -146,13 +145,13 @@ runtimeProfileInit(Client cntxt, MalBlkP
assert(qhead < qsize);
if( (int) (qsize - paused) < MAL_MAXCLIENTS){
qsize += MAL_MAXCLIENTS;
-   QRYqueue = (QueryQueue) GDKrealloc( QRYqueue, sizeof (struct 
QRYQUEUE) * qsize);
-   if ( QRYqueue == NULL){
+   tmp = (QueryQueue) GDKrealloc( QRYqueue, sizeof (struct 
QRYQUEUE) * qsize);
+   if ( tmp == NULL){
addMalException(mb,"runtimeProfileInit" 
MAL_MALLOC_FAIL);
-   GDKfree(tmp);
MT_lock_unset(&mal_delayLock);
return;
}
+   QRYqueue = tmp;
for(i = qsize - MAL_MAXCLIENTS; i < qsize; i++)
clearQRYqueue(i);
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - No hugeint in the output

2020-07-24 Thread Pedro Ferreira
Changeset: 8a6ff73009f1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8a6ff73009f1
Modified Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.sql

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.sql

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
Branch: Jun2020
Log Message:

No hugeint in the output


diffs (71 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.sql
@@ -1,3 +1,3 @@
-SELECT + NULLIF ( + 67, + + NULLIF ( + + 46, 66 - CASE WHEN 51 IN ( + 91 ) 
THEN + SUM ( CAST ( NULL AS INTEGER ) )
+SELECT CAST(+ NULLIF ( + 67, + + NULLIF ( + + 46, 66 - CASE WHEN 51 IN ( + 91 
) THEN + SUM ( CAST ( NULL AS INTEGER ) )
 + - 92 ELSE - ( - 47 ) END ) ) / - CAST ( NULL AS INTEGER ) + + NULLIF ( - 
COALESCE ( CAST ( - 35 AS INTEGER ), + 6,
-CAST ( COUNT ( ALL 28 ) AS INT) ), 75 + 14 );
+CAST ( COUNT ( ALL 28 ) AS INT) ), 75 + 14 ) AS BIGINT);
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out
@@ -25,10 +25,10 @@ stdout of test 'sqlitelogictest-complex-
 
 #SELECT + NULLIF ( + 67, + + NULLIF ( + + 46, 66 - CASE WHEN 51 IN ( + 91 ) 
THEN + SUM ( CAST ( NULL AS INTEGER ) )
 #+ - 92 ELSE - ( - 47 ) END ) ) / - CAST ( NULL AS INTEGER ) + + NULLIF ( - 
COALESCE ( CAST ( - 35 AS INTEGER ), + 6,
-#CAST ( COUNT ( ALL 28 ) AS INT) ), 75 + 14 );
-% .%15 # table_name
-% %15 # name
-% hugeint # type
+#CAST ( COUNT ( ALL 28 ) AS INT) ), 75 + 14 ) AS BIGINT);
+% .%11 # table_name
+% %11 # name
+% bigint # type
 % 1 # length
 [ NULL ]
 
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.sql 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.sql
--- a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.sql
+++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.sql
@@ -1,3 +1,3 @@
-SELECT ALL + 60 * - NULLIF ( - CAST ( NULL AS INTEGER ), 51 * 70 * 62 / + 52 * 
+ 58 / 90 - CAST ( + 44 AS INTEGER ) ) AS col2, 35;
+SELECT ALL CAST(+ 60 * - NULLIF ( - CAST ( NULL AS INTEGER ), 51 * 70 * 62 / + 
52 * + 58 / 90 - CAST ( + 44 AS INTEGER ) ) AS BIGINT) AS col2, 35;
 SELECT ALL CAST( 11 * COUNT ( * ) * + 2 * 6 AS BIGINT);
 SELECT ALL - 9 * NULLIF ( + 30, + 64 ) * + 46 * 1;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
@@ -5,28 +5,10 @@ stdout of test 'sqlitelogictest-select-e
 # 12:42:15 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=38685" "--set" 
"mapi_usock=/var/tmp/mtest-28541/.s.monetdb.38685" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-old/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2018"
 "--set" "embedded_c=true"
 # 12:42:15 >  
 
-# MonetDB 5 server v11.29.4
-# This is an unreleased version
-# Serving database 'mTests_sql_test_BugTracker-2018', using 8 threads
-# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
-# Found 15.386 GiB available main-memory.
-# Copyright (c) 1993 - July 2008 CWI.
-# Copyright (c) August 2008 - 2018 MonetDB B.V., all rights reserved
-# Visit https://www.monetdb.org/ for further information
-# Listening for connection requests on mapi:monetdb://xps13:38685/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-28541/.s.monetdb.38685
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-
-
-# 12:42:15 >  
-# 12:42:15 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-28541" "--port=38685"
-# 12:42:15 >  
-
-#SELECT ALL + 60 * - NULLIF ( - CAST ( NULL AS INTEGER ), 51 * 70 * 62 / + 52 
* + 58 / 90 - CAST ( + 44 AS INTEGER ) ) AS col2, 35;
-% .,   .%4 # table_name
-% col2,%4 # name
-% hugeint, tinyint # type
+#SELECT ALL CAST(+ 60 * - NULLIF ( - CAST ( NULL AS INTEGER ), 51 * 70 * 62 / 
+ 

MonetDB: Jun2020 - moved coalesce and nullif into 'virtual' func...

2020-07-24 Thread Niels Nes
Changeset: 7298a3b335b8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7298a3b335b8
Modified Files:
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/server/rel_optimizer.c
sql/server/rel_select.c

sql/test/BugDay_2005-11-09_2.9.3/Tests/sql_server_crash.SF-1080024.stable.out

sql/test/BugTracker-2012/Tests/case_evaluated_too_early.Bug-3186.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-nullif-coalesce.Bug-6565.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-errors.Bug-6600.stable.out
sql/test/SQLancer/Tests/sqlancer03.stable.out
sql/test/Tests/coalesce.stable.out
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: Jun2020
Log Message:

moved coalesce and nullif into 'virtual' functions. They are now rewritten into
binary statements (mal) during code generation. Solves crash of sqlancer.


diffs (truncated from 907 to 300 lines):

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
@@ -1005,9 +1005,16 @@ monet5_resolve_function(ptr M, sql_func 
int clientID = *(int*) M;
str mname = getName(f->mod), fname = getName(f->imp);
 
+   /* sql.internal doesn't exist */
+   if (!fname && mname == sqlRef && f->imp && strcmp(f->imp, "internal") 
== 0)
+   return 1;
+
if (!mname || !fname)
return 0;
 
+   /* sql.internal doesn't exist */
+   if (strcmp(mname, "sql") == 0 && strcmp(fname,"internal") == 0)
+   return 1;
/* Some SQL functions MAL mapping such as count(*) aggregate, the 
number of arguments don't match */
if (mname == calcRef && fname == getName("="))
return 1;
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3070,77 +3070,120 @@ stmt_Nop(backend *be, stmt *ops, sql_sub
}
}
 
-   if (backend_create_subfunc(be, f, ops->op4.lval) < 0)
-   return NULL;
-   mod = sql_func_mod(f->func);
-   fimp = sql_func_imp(f->func);
-   if (o && o->nrcols > 0 && f->func->type != F_LOADER && f->func->type != 
F_PROC) {
-   sql_subtype *res = f->res->h->data;
-   fimp = convertMultiplexFcn(fimp);
-   q = NULL;
-   if (strcmp(fimp, "rotate_xor_hash") == 0 &&
-   strcmp(mod, calcRef) == 0 &&
-   (q = newStmt(mb, mkeyRef, bulk_rotate_xor_hashRef)) == NULL)
-   return NULL;
-   if (!q) {
-   if (f->func->type == F_UNION)
-   q = newStmt(mb, batmalRef, multiplexRef);
-   else
-   q = newStmt(mb, malRef, multiplexRef);
-   if (q == NULL)
-   return NULL;
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
-   q = pushStr(mb, q, mod);
-   q = pushStr(mb, q, fimp);
-   } else {
-   setVarType(mb, getArg(q, 0), 
newBatType(res->type->localtype));
-   setVarUDFtype(mb, getArg(q, 0));
+   /* handle coalesce and nullif */
+   if (list_length(ops->op4.lval) == 2 &&
+   f->func->mod && strcmp(f->func->mod, "sql") == 0 && 
f->func->imp && strcmp(f->func->imp, "internal") == 0) {
+   stmt *e1 = ops->op4.lval->h->data;
+   stmt *e2 = ops->op4.lval->h->next->data;
+   int nrcols = 0;
+
+   nrcols = e1->nrcols>e2->nrcols ? e1->nrcols:e2->nrcols;
+   /* nrcols */
+   //coalesce(e1,e2) -> ifthenelse(not(isnil(e1)),e1,e2)
+   if (strcmp(f->func->base.name, "coalesce") == 0) {
+   str mod = (!nrcols)?calcRef:batcalcRef;
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "isnil");
+   q = pushArgument(mb, q, e1->nr);
+   int nr = getDestVar(q);
+
+   q = newStmt(mb, e1->nrcols?mod:calcRef, "not");
+   q = pushArgument(mb, q, nr);
+   nr = getDestVar(q);
+
+   q = newStmt(mb, mod, "ifthenelse");
+   q = pushArgument(mb, q, nr);
+   q = pushArgument(mb, q, e1->nr);
+   q = pus

MonetDB: default - Don't expose dropQRYqueue, but embed it in ma...

2020-07-24 Thread Ying Zhang
Changeset: 4dc78c54d28f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4dc78c54d28f
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_runtime.h
Branch: default
Log Message:

Don't expose dropQRYqueue, but embed it in mal_runtime_reset, which does the 
grand final clean up of mal_runtime


diffs (70 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -98,7 +98,6 @@ void mal_reset(void)
 {
GDKprepareExit();
MCstopClients(0);
-   dropQRYqueue();
setHeartbeat(-1);
stopProfiler(0);
AUTHreset();
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -30,17 +30,6 @@ QueryQueue QRYqueue = NULL;
 size_t qsize = 0, qhead = 0, qtail = 0;
 static oid qtag= 1;// A unique query identifier
 
-void
-mal_runtime_reset(void)
-{
-   GDKfree(QRYqueue);
-   QRYqueue = NULL;
-   qsize = 0;
-   qtag= 1;
-   qhead = 0;
-   qtail = 0;
-}
-
 static str
 isaSQLquery(MalBlkPtr mb){
int i;
@@ -104,7 +93,7 @@ advanceQRYqueue(void)
}
 }
 
-void
+static void
 dropQRYqueue(void)
 {
size_t i;
@@ -229,6 +218,17 @@ runtimeProfileFinish(Client cntxt, MalBl
MT_lock_unset(&mal_delayLock);
 }
 
+/* Used by mal_reset to do the grand final clean up of this area before 
MonetDB exits */
+void
+mal_runtime_reset(void)
+{
+   dropQRYqueue();
+   qsize = 0;
+   qtag= 1;
+   qhead = 0;
+   qtail = 0;
+}
+
 /*
  * Each MAL instruction is executed by a single thread, which means we can
  * keep a simple working set around to make Stethscope attachement easy.
diff --git a/monetdb5/mal/mal_runtime.h b/monetdb5/mal/mal_runtime.h
--- a/monetdb5/mal/mal_runtime.h
+++ b/monetdb5/mal/mal_runtime.h
@@ -53,7 +53,6 @@ mal_export void runtimeProfileInit(Clien
 mal_export void runtimeProfileFinish(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk);
 mal_export void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, RuntimeProfile prof);
 mal_export void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, RuntimeProfile prof);
-mal_export void dropQRYqueue(void);
 mal_export lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
 mal_export lng getBatSpace(BAT *b);
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Fix for fix (changeset: e081dda6aea5), apolog...

2020-07-24 Thread Ying Zhang
Changeset: 54ef266d940e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54ef266d940e
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

Fix for fix (changeset: e081dda6aea5), apologies.


diffs (12 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -93,7 +93,7 @@ advanceQRYqueue(void)
if( s){
/* don;t wipe them when they are still running, prepared, or 
paused */
/* The upper layer has assured there is at least one slot 
available */
-   if(QRYqueue[qhead].status != 0 || (QRYqueue[qhead].status[0] == 
'r' && QRYqueue[qhead].status[0] == 'p')){
+   if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 
'r' || QRYqueue[qhead].status[0] == 'p')){
advanceQRYqueue();
return;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - merged

2020-07-24 Thread Niels Nes
Changeset: c696d4be3c03 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c696d4be3c03
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: unlock
Log Message:

merged


diffs (truncated from 2261 to 300 lines):

diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -1677,25 +1677,19 @@ GDKanalyticalavg(BAT *r, BAT *b, BAT *s,
 #ifdef TRUNCATE_NUMBERS
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do {
-   if (rem > 0 && avg < 0) { \
+   if (rem > 0 && avg < 0) \
avg++; \
-   rem -= ncnt; \
-   }
} while(0)
 #else
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do { \
if (rem > 0) { \
if (avg < 0) { \
-   if (2*rem > ncnt) { \
+   if (2*rem > ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} else { \
-   if (2*rem >= ncnt) { \
+   if (2*rem >= ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} \
} \
} while(0)
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1160,6 +1160,11 @@ SQLparser(Client c)
 
if (msg != MAL_SUCCEED) {
str other = c->curprg->def->errors;
+   /* In debugging mode you may want to 
assess what went wrong in the optimizers*/
+#ifndef NDEBUG
+   if( m->emod & mod_debug)
+   runMALDebugger(c, 
c->curprg->def);
+#endif
c->curprg->def->errors = 0;
MSresetInstructions(c->curprg->def, 
oldstop);
freeVariables(c, c->curprg->def, NULL, 
oldvtop);
diff --git a/sql/benchmarks/tpcds/Tests/47.stable.out 
b/sql/benchmarks/tpcds/Tests/47.stable.out
--- a/sql/benchmarks/tpcds/Tests/47.stable.out
+++ b/sql/benchmarks/tpcds/Tests/47.stable.out
@@ -37,112 +37,112 @@ stdout of test '47` in directory 'sql/be
 #  s_company_name,
 % sys.v2,  sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, 
sys.v2 # table_name
 % i_category,  i_brand,s_store_name,   s_company_name, d_year, d_moy,  
avg_monthly_sales,  sum_sales,  psum,   nsum # name
-% char,char,   varchar,varchar,int,int,double, 
decimal,decimal,decimal # type
-% 50,  50, 5,  7,  4,  1,  24, 20, 20, 20 # 
length
-[ "Men",   "importoimporto #1","ese",  "Unknown",  1999,   3,  
5492.817525,2070.65,3307.78,2784.11 ]
-[ "Music", "exportischolar #1","eing", "Unknown",  1999,   2,  
5134.238322,1740.21,4401.89,2721.61 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   4,  
5463.700806,2091.07,3391.39,3095.31 ]
-[ "Music", "edu packscholar #1",   "ought","Unknown",  1999,   
7,  5552.305013,2226.34,4081.99,7573.33 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   2,  
5463.700806,2268.27,4139.47,3391.39 ]
-[ "Men",   "edu packimporto #1",   "ought","Unknown",  1999,   
7,  5176.257426,1993.73,3542.54,5764.35 ]
-[ "Children",  "exportiexporti #1","ese",  "Unknown",  1999,   3,  
5185.898254,2019.69,3479.21,2982.05 ]
-[ "Shoes", "amalgedu pack #1", "ation","Unknown",  1999,   
6,  5152.095886,2077.67,3123.43,2368.73 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   3,  
5501.180766,2453.88,2683.70,2615.32 ]
-[ "Children",  "exportiexporti #1","ation","Unknown",  1999,   
4,  5238.357524,2232.03,3221.70,3649.52 ]
-[ "Shoes", "importoedu pack #1",   "eing", "Unknown",  1999,   5,  
4698.612447,1703.27,2687.15,2757.83 ]
-[ "Music", "exportischolar #1","bar",  "Unknown",  1999,   7,  
5318.146708,2346.06,3483.88,7658.62 ]
-[ "Music", "edu packscholar #1",   "ation","Unknown",  1999,   
2,  5622.227458,2657.68,4207.03,3543.

MonetDB: default - Fix the advancement of QRYqueue to find the n...

2020-07-24 Thread Ying Zhang
Changeset: e081dda6aea5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e081dda6aea5
Modified Files:
monetdb5/mal/mal_runtime.c
Branch: default
Log Message:

Fix the advancement of QRYqueue to find the next usable slot: if this slot does 
contain a query, and the query is running, pauzed or prepared, then search 
further.

The correct conditions are exactly the opposite as the corrected code.


diffs (12 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -93,7 +93,7 @@ advanceQRYqueue(void)
if( s){
/* don;t wipe them when they are still running, prepared, or 
paused */
/* The upper layer has assured there is at least one slot 
available */
-   if(QRYqueue[qhead].status == 0 || (QRYqueue[qhead].status[0] != 
'r' && QRYqueue[qhead].status[0] != 'p')){
+   if(QRYqueue[qhead].status != 0 || (QRYqueue[qhead].status[0] == 
'r' && QRYqueue[qhead].status[0] == 'p')){
advanceQRYqueue();
return;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: typing - Merged with default

2020-07-24 Thread Pedro Ferreira
Changeset: c946327214dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c946327214dc
Branch: typing
Log Message:

Merged with default


diffs (truncated from 2261 to 300 lines):

diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -1677,25 +1677,19 @@ GDKanalyticalavg(BAT *r, BAT *b, BAT *s,
 #ifdef TRUNCATE_NUMBERS
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do {
-   if (rem > 0 && avg < 0) { \
+   if (rem > 0 && avg < 0) \
avg++; \
-   rem -= ncnt; \
-   }
} while(0)
 #else
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do { \
if (rem > 0) { \
if (avg < 0) { \
-   if (2*rem > ncnt) { \
+   if (2*rem > ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} else { \
-   if (2*rem >= ncnt) { \
+   if (2*rem >= ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} \
} \
} while(0)
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1157,6 +1157,11 @@ SQLparser(Client c)
 
if (msg != MAL_SUCCEED) {
str other = c->curprg->def->errors;
+   /* In debugging mode you may want to 
assess what went wrong in the optimizers*/
+#ifndef NDEBUG
+   if( m->emod & mod_debug)
+   runMALDebugger(c, 
c->curprg->def);
+#endif
c->curprg->def->errors = 0;
MSresetInstructions(c->curprg->def, 
oldstop);
freeVariables(c, c->curprg->def, NULL, 
oldvtop);
diff --git a/sql/benchmarks/tpcds/Tests/47.stable.out 
b/sql/benchmarks/tpcds/Tests/47.stable.out
--- a/sql/benchmarks/tpcds/Tests/47.stable.out
+++ b/sql/benchmarks/tpcds/Tests/47.stable.out
@@ -37,112 +37,112 @@ stdout of test '47` in directory 'sql/be
 #  s_company_name,
 % sys.v2,  sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, 
sys.v2 # table_name
 % i_category,  i_brand,s_store_name,   s_company_name, d_year, d_moy,  
avg_monthly_sales,  sum_sales,  psum,   nsum # name
-% char,char,   varchar,varchar,int,int,double, 
decimal,decimal,decimal # type
-% 50,  50, 5,  7,  4,  1,  24, 20, 20, 20 # 
length
-[ "Men",   "importoimporto #1","ese",  "Unknown",  1999,   3,  
5492.817525,2070.65,3307.78,2784.11 ]
-[ "Music", "exportischolar #1","eing", "Unknown",  1999,   2,  
5134.238322,1740.21,4401.89,2721.61 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   4,  
5463.700806,2091.07,3391.39,3095.31 ]
-[ "Music", "edu packscholar #1",   "ought","Unknown",  1999,   
7,  5552.305013,2226.34,4081.99,7573.33 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   2,  
5463.700806,2268.27,4139.47,3391.39 ]
-[ "Men",   "edu packimporto #1",   "ought","Unknown",  1999,   
7,  5176.257426,1993.73,3542.54,5764.35 ]
-[ "Children",  "exportiexporti #1","ese",  "Unknown",  1999,   3,  
5185.898254,2019.69,3479.21,2982.05 ]
-[ "Shoes", "amalgedu pack #1", "ation","Unknown",  1999,   
6,  5152.095886,2077.67,3123.43,2368.73 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   3,  
5501.180766,2453.88,2683.70,2615.32 ]
-[ "Children",  "exportiexporti #1","ation","Unknown",  1999,   
4,  5238.357524,2232.03,3221.70,3649.52 ]
-[ "Shoes", "importoedu pack #1",   "eing", "Unknown",  1999,   5,  
4698.612447,1703.27,2687.15,2757.83 ]
-[ "Music", "exportischolar #1","bar",  "Unknown",  1999,   7,  
5318.146708,2346.06,3483.88,7658.62 ]
-[ "Music", "edu packscholar #1",   "ation","Unknown",  1999,   
2,  5622.227458,2657.68,4207.03,3543.82 ]
-[ "Children",  "exportiexporti #1","

MonetDB: oscar - Backported memory leak fix from default into oscar

2020-07-24 Thread Pedro Ferreira
Changeset: 71f2b3388e08 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71f2b3388e08
Modified Files:
gdk/gdk_utils.c
Branch: oscar
Log Message:

Backported memory leak fix from default into oscar


diffs (22 lines):

diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1089,6 +1089,10 @@ GDKreset(int status)
}
if (!skip)
GDKunlockHome(farmid);
+   if (BBPfarms[farmid].dirname) {
+   
GDKfree((char*)BBPfarms[farmid].dirname);
+   BBPfarms[farmid].dirname = NULL;
+   }
}
}
 
@@ -1249,7 +1253,6 @@ GDKunlockHome(int farmid)
BBPfarms[farmid].lock_file = NULL;
GDKfree(gdklockpath);
}
-   BBPfarms[farmid].dirname = NULL;
 }
 
 /*
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Approved output

2020-07-24 Thread Pedro Ferreira
Changeset: 15194bc241d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=15194bc241d8
Modified Files:
sql/benchmarks/tpcds/Tests/58.stable.out
sql/benchmarks/tpcds/Tests/58.stable.out.int128
Branch: default
Log Message:

Approved output


diffs (32 lines):

diff --git a/sql/benchmarks/tpcds/Tests/58.stable.out 
b/sql/benchmarks/tpcds/Tests/58.stable.out
--- a/sql/benchmarks/tpcds/Tests/58.stable.out
+++ b/sql/benchmarks/tpcds/Tests/58.stable.out
@@ -46,9 +46,9 @@ stdout of test '58` in directory 'sql/be
 % item_id, ss_item_rev,ss_dev, cs_item_rev,cs_dev, ws_item_rev,
ws_dev, average # name
 % char,decimal,decimal,decimal,decimal,
decimal,decimal,decimal # type
 % 16,  20, 20, 20, 20, 20, 20, 20 # length
-[ "CNGB",  1900.15,100.300,1950.92,
103.000,1829.52,96.600, 1893.530]
-[ "IDOA",  6605.22,104.100,6078.33,95.800, 
6338.25,99.900, 6340.600]
-[ "JMFC",  3608.52,103.000,3590.47,
102.500,3305.82,94.400, 3501.603]
+[ "CNGB",  1900.15,100.300,1950.92,
103.000,1829.52,96.600, 1893.53 ]
+[ "IDOA",  6605.22,104.100,6078.33,95.800, 
6338.25,99.900, 6340.60 ]
+[ "JMFC",  3608.52,103.000,3590.47,
102.500,3305.82,94.400, 3501.60 ]
 
 # 18:32:30 >  
 # 18:32:30 >  "Done."
diff --git a/sql/benchmarks/tpcds/Tests/58.stable.out.int128 
b/sql/benchmarks/tpcds/Tests/58.stable.out.int128
--- a/sql/benchmarks/tpcds/Tests/58.stable.out.int128
+++ b/sql/benchmarks/tpcds/Tests/58.stable.out.int128
@@ -46,9 +46,9 @@ stdout of test '58` in directory 'sql/be
 % item_id, ss_item_rev,ss_dev, cs_item_rev,cs_dev, ws_item_rev,
ws_dev, average # name
 % char,decimal,decimal,decimal,decimal,
decimal,decimal,decimal # type
 % 16,  40, 40, 40, 40, 40, 40, 40 # length
-[ "CNGB",  1900.15,100.300,1950.92,
103.000,1829.52,96.600, 1893.530]
-[ "IDOA",  6605.22,104.100,6078.33,95.800, 
6338.25,99.900, 6340.600]
-[ "JMFC",  3608.52,103.000,3590.47,
102.500,3305.82,94.400, 3501.603]
+[ "CNGB",  1900.15,100.300,1950.92,
103.000,1829.52,96.600, 1893.53 ]
+[ "IDOA",  6605.22,104.100,6078.33,95.800, 
6338.25,99.900, 6340.60 ]
+[ "JMFC",  3608.52,103.000,3590.47,
102.500,3305.82,94.400, 3501.60 ]
 
 # 18:32:30 >  
 # 18:32:30 >  "Done."
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merged with oscar

2020-07-24 Thread Pedro Ferreira
Changeset: af8c3691379c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af8c3691379c
Branch: default
Log Message:

Merged with oscar


diffs (truncated from 2214 to 300 lines):

diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -1677,25 +1677,19 @@ GDKanalyticalavg(BAT *r, BAT *b, BAT *s,
 #ifdef TRUNCATE_NUMBERS
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do {
-   if (rem > 0 && avg < 0) { \
+   if (rem > 0 && avg < 0) \
avg++; \
-   rem -= ncnt; \
-   }
} while(0)
 #else
 #define ANALYTICAL_AVERAGE_INT_CALC_FINALIZE(avg, rem, ncnt) \
do { \
if (rem > 0) { \
if (avg < 0) { \
-   if (2*rem > ncnt) { \
+   if (2*rem > ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} else { \
-   if (2*rem >= ncnt) { \
+   if (2*rem >= ncnt) \
avg++; \
-   rem -= ncnt; \
-   } \
} \
} \
} while(0)
diff --git a/sql/benchmarks/tpcds/Tests/47.stable.out 
b/sql/benchmarks/tpcds/Tests/47.stable.out
--- a/sql/benchmarks/tpcds/Tests/47.stable.out
+++ b/sql/benchmarks/tpcds/Tests/47.stable.out
@@ -37,112 +37,112 @@ stdout of test '47` in directory 'sql/be
 #  s_company_name,
 % sys.v2,  sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, 
sys.v2 # table_name
 % i_category,  i_brand,s_store_name,   s_company_name, d_year, d_moy,  
avg_monthly_sales,  sum_sales,  psum,   nsum # name
-% char,char,   varchar,varchar,int,int,double, 
decimal,decimal,decimal # type
-% 50,  50, 5,  7,  4,  1,  24, 20, 20, 20 # 
length
-[ "Men",   "importoimporto #1","ese",  "Unknown",  1999,   3,  
5492.817525,2070.65,3307.78,2784.11 ]
-[ "Music", "exportischolar #1","eing", "Unknown",  1999,   2,  
5134.238322,1740.21,4401.89,2721.61 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   4,  
5463.700806,2091.07,3391.39,3095.31 ]
-[ "Music", "edu packscholar #1",   "ought","Unknown",  1999,   
7,  5552.305013,2226.34,4081.99,7573.33 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   2,  
5463.700806,2268.27,4139.47,3391.39 ]
-[ "Men",   "edu packimporto #1",   "ought","Unknown",  1999,   
7,  5176.257426,1993.73,3542.54,5764.35 ]
-[ "Children",  "exportiexporti #1","ese",  "Unknown",  1999,   3,  
5185.898254,2019.69,3479.21,2982.05 ]
-[ "Shoes", "amalgedu pack #1", "ation","Unknown",  1999,   
6,  5152.095886,2077.67,3123.43,2368.73 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   3,  
5501.180766,2453.88,2683.70,2615.32 ]
-[ "Children",  "exportiexporti #1","ation","Unknown",  1999,   
4,  5238.357524,2232.03,3221.70,3649.52 ]
-[ "Shoes", "importoedu pack #1",   "eing", "Unknown",  1999,   5,  
4698.612447,1703.27,2687.15,2757.83 ]
-[ "Music", "exportischolar #1","bar",  "Unknown",  1999,   7,  
5318.146708,2346.06,3483.88,7658.62 ]
-[ "Music", "edu packscholar #1",   "ation","Unknown",  1999,   
2,  5622.227458,2657.68,4207.03,3543.82 ]
-[ "Children",  "exportiexporti #1","bar",  "Unknown",  1999,   7,  
5280.662557,2324.79,3003.61,5961.39 ]
-[ "Children",  "importoexporti #1","eing", "Unknown",  1999,   2,  
4650.438314,1734.45,2341.19,2720.78 ]
-[ "Shoes", "importoedu pack #1",   "ought","Unknown",  1999,   
4,  4537.635834,1623.33,2928.34,1905.23 ]
-[ "Women", "edu packamalg #1", "ation","Unknown",  1999,   
4,  4507.417511,1596.92,2865.38,2665.75 ]
-[ "Men",   "importoimporto #1","ought","Unknown",  1999,   
6,  5045.758321,2152.15,2834.94,2667.92 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   4,  
5501.180766,2615.32,2453.88,2874.96 ]
-[ "Shoes", "exportiedu pack #1",   "bar",  "Unknown",  1999, 

MonetDB: oscar - Approved output of new avg window function

2020-07-24 Thread Pedro Ferreira
Changeset: fd4d5e1e37b5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fd4d5e1e37b5
Modified Files:
sql/benchmarks/tpcds/Tests/47.stable.out
sql/benchmarks/tpcds/Tests/47.stable.out.int128
sql/benchmarks/tpcds/Tests/53.stable.out
sql/benchmarks/tpcds/Tests/53.stable.out.int128
sql/benchmarks/tpcds/Tests/57.stable.out
sql/benchmarks/tpcds/Tests/57.stable.out.int128
sql/benchmarks/tpcds/Tests/63.stable.out
sql/benchmarks/tpcds/Tests/63.stable.out.int128
sql/benchmarks/tpcds/Tests/89.stable.out
sql/benchmarks/tpcds/Tests/89.stable.out.int128
Branch: oscar
Log Message:

Approved output of new avg window function


diffs (truncated from 2182 to 300 lines):

diff --git a/sql/benchmarks/tpcds/Tests/47.stable.out 
b/sql/benchmarks/tpcds/Tests/47.stable.out
--- a/sql/benchmarks/tpcds/Tests/47.stable.out
+++ b/sql/benchmarks/tpcds/Tests/47.stable.out
@@ -37,112 +37,112 @@ stdout of test '47` in directory 'sql/be
 #  s_company_name,
 % sys.v2,  sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, sys.v2, 
sys.v2 # table_name
 % i_category,  i_brand,s_store_name,   s_company_name, d_year, d_moy,  
avg_monthly_sales,  sum_sales,  psum,   nsum # name
-% char,char,   varchar,varchar,int,int,double, 
decimal,decimal,decimal # type
-% 50,  50, 5,  7,  4,  1,  24, 20, 20, 20 # 
length
-[ "Men",   "importoimporto #1","ese",  "Unknown",  1999,   3,  
5492.817525,2070.65,3307.78,2784.11 ]
-[ "Music", "exportischolar #1","eing", "Unknown",  1999,   2,  
5134.238322,1740.21,4401.89,2721.61 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   4,  
5463.700806,2091.07,3391.39,3095.31 ]
-[ "Music", "edu packscholar #1",   "ought","Unknown",  1999,   
7,  5552.305013,2226.34,4081.99,7573.33 ]
-[ "Music", "edu packscholar #1",   "ese",  "Unknown",  1999,   2,  
5463.700806,2268.27,4139.47,3391.39 ]
-[ "Men",   "edu packimporto #1",   "ought","Unknown",  1999,   
7,  5176.257426,1993.73,3542.54,5764.35 ]
-[ "Children",  "exportiexporti #1","ese",  "Unknown",  1999,   3,  
5185.898254,2019.69,3479.21,2982.05 ]
-[ "Shoes", "amalgedu pack #1", "ation","Unknown",  1999,   
6,  5152.095886,2077.67,3123.43,2368.73 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   3,  
5501.180766,2453.88,2683.70,2615.32 ]
-[ "Children",  "exportiexporti #1","ation","Unknown",  1999,   
4,  5238.357524,2232.03,3221.70,3649.52 ]
-[ "Shoes", "importoedu pack #1",   "eing", "Unknown",  1999,   5,  
4698.612447,1703.27,2687.15,2757.83 ]
-[ "Music", "exportischolar #1","bar",  "Unknown",  1999,   7,  
5318.146708,2346.06,3483.88,7658.62 ]
-[ "Music", "edu packscholar #1",   "ation","Unknown",  1999,   
2,  5622.227458,2657.68,4207.03,3543.82 ]
-[ "Children",  "exportiexporti #1","bar",  "Unknown",  1999,   7,  
5280.662557,2324.79,3003.61,5961.39 ]
-[ "Children",  "importoexporti #1","eing", "Unknown",  1999,   2,  
4650.438314,1734.45,2341.19,2720.78 ]
-[ "Shoes", "importoedu pack #1",   "ought","Unknown",  1999,   
4,  4537.635834,1623.33,2928.34,1905.23 ]
-[ "Women", "edu packamalg #1", "ation","Unknown",  1999,   
4,  4507.417511,1596.92,2865.38,2665.75 ]
-[ "Men",   "importoimporto #1","ought","Unknown",  1999,   
6,  5045.758321,2152.15,2834.94,2667.92 ]
-[ "Men",   "edu packimporto #1",   "eing", "Unknown",  1999,   4,  
5501.180766,2615.32,2453.88,2874.96 ]
-[ "Shoes", "exportiedu pack #1",   "bar",  "Unknown",  1999,   3,  
5296.089091,2410.44,2685.85,3821.39 ]
-[ "Men",   "importoimporto #1","able", "Unknown",  1999,   2,  
5194.818359,2333.43,2765.75,2674.91 ]
-[ "Music", "amalgscholar #1",  "ought","Unknown",  1999,   
2,  4565.600047,1727.16,3895.09,2606.58 ]
-[ "Music", "edu packscholar #1",   "eing", "Unknown",  1999,   5,  
5539.30835, 2704.16,3862.34,3960.90 ]
-[ "Shoes", "importoedu pack #1",   "ation","Unknown",  1999,   
4,  4690.577484,1855.85,3524.69,3050.34 ]
-[ "Men",   "edu packimporto #1"