MonetDB: Oct2020 - merged with jun2020

2021-08-27 Thread Niels Nes
Changeset: a330b422fbe5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a330b422fbe5
Modified Files:
gdk/gdk_logger.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (78 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1496,6 +1496,7 @@ logger_switch_bat(BAT *old, BAT *new, co
if (BBPrename(new->batCacheid, bak) != 0) {
return GDK_FAIL;
}
+   BBPretain(new->batCacheid);
return GDK_SUCCEED;
 }
 
@@ -1554,7 +1555,7 @@ bm_subcommit(logger *lg, BAT *list_bid, 
catalog_bid == list_bid &&
catalog_nme == list_nme &&
lg->catalog_bid == catalog_bid) {
-   BAT *bids, *nmes, *tids, *tpes, *oids;
+   BAT *bids, *nmes, *tids, *tpes, *oids, *dcat;
 
tids = bm_tids(catalog_bid, dcatalog);
if (tids == NULL) {
@@ -1565,13 +1566,15 @@ bm_subcommit(logger *lg, BAT *list_bid, 
nmes = logbat_new(TYPE_str, BATcount(tids), PERSISTENT);
tpes = logbat_new(TYPE_bte, BATcount(tids), PERSISTENT);
oids = logbat_new(TYPE_lng, BATcount(tids), PERSISTENT);
-
-   if (bids == NULL || nmes == NULL || tpes == NULL || oids == 
NULL) {
+   dcat = logbat_new(TYPE_oid, 0, PERSISTENT);
+
+   if (bids == NULL || nmes == NULL || tpes == NULL || oids == 
NULL || dcat == NULL) {
logbat_destroy(tids);
logbat_destroy(bids);
logbat_destroy(nmes);
logbat_destroy(tpes);
logbat_destroy(oids);
+   logbat_destroy(dcat);
GDKfree(n);
return GDK_FAIL;
}
@@ -1585,16 +1588,17 @@ bm_subcommit(logger *lg, BAT *list_bid, 
logbat_destroy(nmes);
logbat_destroy(tpes);
logbat_destroy(oids);
+   logbat_destroy(dcat);
GDKfree(n);
return GDK_FAIL;
}
logbat_destroy(tids);
-   BATclear(dcatalog, true);
 
if (logger_switch_bat(catalog_bid, bids, lg->fn, "catalog_bid") 
!= GDK_SUCCEED ||
logger_switch_bat(catalog_nme, nmes, lg->fn, "catalog_nme") 
!= GDK_SUCCEED ||
logger_switch_bat(catalog_tpe, tpes, lg->fn, "catalog_tpe") 
!= GDK_SUCCEED ||
-   logger_switch_bat(catalog_oid, oids, lg->fn, "catalog_oid") 
!= GDK_SUCCEED) {
+   logger_switch_bat(catalog_oid, oids, lg->fn, "catalog_oid") 
!= GDK_SUCCEED ||
+   logger_switch_bat(dcatalog, dcat, lg->fn, "dcatalog") != 
GDK_SUCCEED) {
logbat_destroy(bids);
logbat_destroy(nmes);
GDKfree(n);
@@ -1604,16 +1608,19 @@ bm_subcommit(logger *lg, BAT *list_bid, 
n[i++] = nmes->batCacheid;
n[i++] = tpes->batCacheid;
n[i++] = oids->batCacheid;
+   n[i++] = dcat->batCacheid;
 
logbat_destroy(lg->catalog_bid);
logbat_destroy(lg->catalog_nme);
logbat_destroy(lg->catalog_tpe);
logbat_destroy(lg->catalog_oid);
+   logbat_destroy(lg->dcatalog);
 
lg->catalog_bid = catalog_bid = bids;
lg->catalog_nme = catalog_nme = nmes;
lg->catalog_tpe = catalog_tpe = tpes;
lg->catalog_oid = catalog_oid = oids;
+   lg->dcatalog = dcatalog = dcat;
}
if (lg->seqs_id && list_nme) {
n[i++] = lg->seqs_id->batCacheid;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2021-06-08 Thread Pedro Ferreira
Changeset: c5127de6b9d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c5127de6b9d6
Modified Files:
sql/server/rel_optimizer.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (44 lines):

diff --git a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql 
b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql
--- a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql
+++ b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql
@@ -54,4 +54,14 @@ select count(*) FROM (
 FROM "myschema"."mymerge" myalias
 GROUP BY field1, field2) AS mycount;
 
+-- These statements are related to the same issue
+create merge table merge_table (mcol1 int, mcol2 int, mcol3 int);
+create table child1 (mcol1 int, mcol2 int, mcol3 int);
+insert into child1 values (1,1,1);
+create table child2 (mcol1 int, mcol2 int, mcol3 int);
+insert into child2 values (2,2,2);
+alter table merge_table add table child1;
+alter table merge_table add table child2;
+select cast(sum(mcol1) as bigint), cast(sum(mcol2) as bigint) from merge_table 
group by mcol1, mcol2, mcol3 order by mcol1 limit 2;
+
 rollback;
diff --git 
a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.out 
b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.out
--- a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.out
+++ b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.out
@@ -80,6 +80,22 @@ stdout of test 'mergetable_rel_push_aggr
 % bigint # type
 % 1 # length
 [ 0]
+#create merge table merge_table (mcol1 int, mcol2 int, mcol3 int);
+#create table child1 (mcol1 int, mcol2 int, mcol3 int);
+#insert into child1 values (1,1,1);
+[ 1]
+#create table child2 (mcol1 int, mcol2 int, mcol3 int);
+#insert into child2 values (2,2,2);
+[ 1]
+#alter table merge_table add table child1;
+#alter table merge_table add table child2;
+#select cast(sum(mcol1) as bigint), cast(sum(mcol2) as bigint) from 
merge_table group by mcol1, mcol2, mcol3 order by mcol1 limit 2;
+% .%2, .%4 # table_name
+% %2,  %4 # name
+% bigint,  bigint # type
+% 1,   1 # length
+[ 1,   1   ]
+[ 2,   2   ]
 #rollback;
 
 # 12:55:05 >  
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged jun2020

2021-05-27 Thread Niels Nes
Changeset: 6e42cf1d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6e42cf1d
Modified Files:
common/utils/mstring.h
gdk/gdk_logger.c
gdk/gdk_project.c
sql/storage/bat/bat_logger.c
sql/storage/store.c
Branch: Oct2020
Log Message:

merged jun2020


diffs (73 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -29,7 +29,10 @@ strcpy_len(char *restrict dst, const cha
if ((dst[i] = src[i]) == 0)
return i;
}
-   dst[n - 1] = 0;
+   /* for correctness, the decrement isn't needed (just assigning 0
+* to dst[n-1] would be sufficient), but to work around a too
+* strict GNU C compiler, we do need it */
+   dst[--n] = 0;
 /* in some versions of GCC (at least gcc (Ubuntu 7.5.0-3ubuntu1~18.04)
  * 7.5.0), the error just can't be turned off when using
  * --enable-strict, so we just use the (more) expensive way of getting the
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2460,7 +2460,9 @@ logger_destroy(logger *lg)
BUN p, q;
BAT *b = lg->catalog_bid;
 
-   if (logger_cleanup(lg) != GDK_SUCCEED)
+   if (lg->changes &&
+   (logger_restart(lg) != GDK_SUCCEED ||
+logger_cleanup(lg) != GDK_SUCCEED))
TRC_CRITICAL(GDK, "logger_cleanup failed\n");
 
/* free resources */
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -1073,15 +1073,9 @@ bl_destroy(void)
 {
logger *l = bat_logger;
 
+   logger_destroy(l);
+
bat_logger = NULL;
-   if (l) {
-   close_stream(l->log);
-   GDKfree(l->fn);
-   GDKfree(l->dir);
-   GDKfree(l->local_dir);
-   GDKfree(l->buf);
-   GDKfree(l);
-   }
 }
 
 static int
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2310,6 +2310,7 @@ flusher_should_run(void)
 void
 store_exit(void)
 {
+   int debug = store_debug&128;
MT_lock_set(_lock);
 
TRC_DEBUG(SQL_STORE, "Store locked\n");
@@ -2320,6 +2321,11 @@ store_exit(void)
MT_sleep_ms(100);
MT_lock_set(_lock);
}
+   while (debug && ATOMIC_GET(_nr_active)) { /* wait for all to 
finish */
+   MT_lock_unset(_lock);
+   MT_sleep_ms(100);
+   MT_lock_set(_lock);
+   }
 
if (gtrans) {
MT_lock_unset(_lock);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2021-04-23 Thread Niels Nes
Changeset: 77a9ad16c479 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/77a9ad16c479
Branch: Oct2020
Log Message:

merged


diffs (56 lines):

diff --git a/NT/ChangeLog.Oct2020 b/NT/ChangeLog.Oct2020
new file mode 100644
--- /dev/null
+++ b/NT/ChangeLog.Oct2020
@@ -0,0 +1,6 @@
+# ChangeLog file for NT
+# This file is updated with Maddlog
+
+* Fri Apr 23 2021 Sjoerd Mullender 
+- Added the monetdbe library to the Windows installer.
+
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -143,6 +143,7 @@ def main():
r'bin\bat.dll',
r'bin\mapi.dll',
r'bin\monetdb5.dll',
+   r'bin\monetdbe.dll',
r'bin\monetdbsql.dll',
r'bin\stream.dll',
vcpkg.format(r'bin\iconv-2.dll'),
@@ -198,6 +199,7 @@ def main():
   [r'lib\bat.lib',
r'lib\mapi.lib',
r'lib\monetdb5.lib',
+   r'lib\monetdbe.lib',
r'lib\monetdbsql.lib',
r'lib\stream.lib',
vcpkg.format(r'lib\iconv.lib'),
diff --git a/tools/mserver/monet_version.c.in b/tools/mserver/monet_version.c.in
--- a/tools/mserver/monet_version.c.in
+++ b/tools/mserver/monet_version.c.in
@@ -77,10 +77,19 @@ monet_version(void)
GDKnr_threads, GDKnr_threads != 1 ? "s" : ""); */
printf("Libraries:\n");
 #ifdef HAVE_LIBPCRE
+   /* PCRE_PRERELEASE may be defined as an empty value.  In order
+* to get the proper amount of white space between various
+* parts of the version string on different compilers (none
+* between minor and prerelease, a single one between that
+* combination and the date), we need to resort to some
+* run-time trickery since we can't do it with the
+* preprocessor */
print_libversion("libpcre",
-pcre_version(),
-XSTRING(PCRE_MAJOR.PCRE_MINOR) 
XSTRING(PCRE_PRERELEASE)
-" " XSTRING(PCRE_DATE));
+pcre_version(),
+XSTRING(Z PCRE_PRERELEASE)[1] == 0
+? XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE)
+: XSTRING(PCRE_MAJOR.PCRE_MINOR)
+  XSTRING(PCRE_PRERELEASE PCRE_DATE));
 #endif
 #ifdef HAVE_OPENSSL
print_libversion("openssl",
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2021-04-22 Thread Niels Nes
Changeset: 2d42d6d8b007 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2d42d6d8b007
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Oct2020
Log Message:

merged


diffs (29 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2392,6 +2392,7 @@ tr_update_delta( sql_trans *tr, sql_delt
 
/* for cleared tables the bid is reset */
if (cbat->bid == 0) {
+   assert(cbat->cleared);
cbat->bid = obat->bid;
if (cbat->bid)
temp_dup(cbat->bid);
@@ -2424,11 +2425,13 @@ tr_update_delta( sql_trans *tr, sql_delt
cbat->cached = NULL;
if (!obat->bid) {
cur = temp_descriptor(obat->ibid);
-   obat->bid = obat->ibid;
-   obat->cnt = obat->ibase = BATcount(cur);
-   obat->ibid = e_bat(cur->ttype);
+   if (BATcount(cur) > SNAPSHOT_MINSIZE) {
+   obat->bid = obat->ibid;
+   obat->cnt = obat->ibase = BATcount(cur);
+   obat->ibid = e_bat(cur->ttype);
+   obat->cleared = 0;
+   }
bat_destroy(cur);
-   obat->cleared = 0;
}
return ok;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged with jun2020

2021-04-22 Thread Niels Nes
Changeset: 0dfe4bf93c22 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0dfe4bf93c22
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (35 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2373,6 +2373,7 @@ tr_handle_snapshot( sql_trans *tr, sql_d
bat->bid = bat->ibid;
bat->cnt = bat->ibase = BATcount(ins);
bat->ibid = e_bat(ins->ttype);
+   bat->cleared = 0;
BATmsync(ins);
}
bat_destroy(ins);
@@ -2409,7 +2410,7 @@ tr_update_delta( sql_trans *tr, sql_delt
if(!cur)
return LOG_ERR;
}
-   if (!savepoint && !obat->bid && tr != gtrans) {
+   if (!savepoint && (!obat->bid || !cbat->bid) && tr != gtrans) {
if (obat->next)
destroy_bat(obat->next);
destroy_delta(obat);
@@ -2421,6 +2422,14 @@ tr_update_delta( sql_trans *tr, sql_delt
cbat->cleared = 0;
cbat->name = NULL;
cbat->cached = NULL;
+   if (!obat->bid) {
+   cur = temp_descriptor(obat->ibid);
+   obat->bid = obat->ibid;
+   obat->cnt = obat->ibase = BATcount(cur);
+   obat->ibid = e_bat(cur->ttype);
+   bat_destroy(cur);
+   obat->cleared = 0;
+   }
return ok;
}
ins = temp_descriptor(cbat->ibid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2021-03-18 Thread Niels Nes
Changeset: ad8288f5ec33 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ad8288f5ec33
Branch: Oct2020
Log Message:

merged


diffs (truncated from 1157 to 300 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -1746,9 +1746,6 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
lwidth = l->twidth;
rwidth = r->twidth;
 
-   /* basic properties will be adjusted if necessary later on,
-* they were initially set by joininitresults() */
-
if (not_in && rci->ncand > 0 && !r->tnonil &&
((BATtvoid(l) && l->tseqbase == oid_nil) ||
 (BATtvoid(r) && r->tseqbase == oid_nil) ||
@@ -1781,14 +1778,23 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
BAT *r2 = r2p ? *r2p : NULL;
 
if (l->tsorted || l->trevsorted) {
-   /* determine opportunistic scan window for l */
-   for (nl = lci->ncand, lscan = 4; nl > 0; lscan++)
-   nl >>= 1;
equal_order = (l->tsorted && r->tsorted) ||
(l->trevsorted && r->trevsorted &&
 !BATtvoid(l) && !BATtvoid(r));
lordering = l->tsorted && (r->tsorted || !equal_order) ? 1 : -1;
rordering = equal_order ? lordering : -lordering;
+   if (!l->tnonil && !nil_matches && !nil_on_miss) {
+   nl = binsearch(NULL, 0, l->ttype, lvals, lvars, lwidth, 
0, BATcount(l), nil, lordering, 1);
+   nl = canditer_search(lci, nl + l->hseqbase, true);
+   if (l->tsorted) {
+   canditer_setidx(lci, nl);
+   } else if (l->trevsorted) {
+   lci->ncand = nl;
+   }
+   }
+   /* determine opportunistic scan window for l */
+   for (nl = lci->ncand, lscan = 4; nl > 0; lscan++)
+   nl >>= 1;
} else {
/* if l not sorted, we will always use binary search
 * on r */
@@ -2246,7 +2252,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
/* keyness or r2 can only be assured
 * as long as matched values are
 * ordered */
-   int ord = rordering * cmp(prev, v);
+   int ord = rordering * cmp(prev, v ? v : nil);
if (ord < 0) {
/* previous value in l was
 * less than current */
@@ -2270,7 +2276,7 @@ mergejoin(BAT **r1p, BAT **r2p, BAT *l, 
}
}
}
-   prev = v;
+   prev = v ? v : nil;
}
if (BATcount(r1) > 0) {
/* a new, higher value will be inserted into
@@ -3522,7 +3528,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
lcnt = canditer_init(, l, sl);
rcnt = canditer_init(, r, sr);
 
-   if (lcnt == 0 || (!only_misses && !nil_on_miss && rcnt == 0)) {
+   if (lcnt == 0 || rcnt == 0) {
TRC_DEBUG(ALGO, "%s(l=" ALGOBATFMT ","
  "r=" ALGOBATFMT ",sl=" ALGOOPTBATFMT ","
  "sr=" ALGOOPTBATFMT ",nil_matches=%d,"
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -640,6 +640,7 @@ str runMALsequence(Client cntxt, MalBlkP
if (pci->fcn == NULL) {
ret = createException(MAL,"mal.interpreter", 
"address of pattern %s.%s missing", pci->modname, pci->fcnname);
} else {
+   TRC_DEBUG(ALGO, "calling %s.%s\n", pci->modname 
? pci->modname : "", pci->fcnname ? pci->fcnname : "");
ret = (*pci->fcn)(cntxt, mb, stk, pci);
 #ifndef NDEBUG
if (ret == MAL_SUCCEED) {
@@ -667,6 +668,7 @@ str runMALsequence(Client cntxt, MalBlkP
}
break;
case CMDcall:
+   TRC_DEBUG(ALGO, "calling %s.%s\n", pci->modname ? 
pci->modname : "", pci->fcnname ? pci->fcnname : "");
ret = malCommandCall(stk, pci);
 #ifndef NDEBUG
if (ret == MAL_SUCCEED) {
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,6 +1,6 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run 

MonetDB: Oct2020 - merged

2021-03-13 Thread Niels Nes
Changeset: ea27ecfb1883 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ea27ecfb1883
Modified Files:
sql/server/rel_optimizer.c
Branch: Oct2020
Log Message:

merged


diffs (234 lines):

diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -686,13 +686,15 @@ BAThashsync(void *arg)
c = hash_##TYPE(h, v + o - b->hseqbase);\
hget = HASHget(h, c);   \
h->nheads += hget == hnil;  \
-   for (hb = hget; \
-hb != hnil;\
-hb = HASHgetlink(h, hb)) { \
-   if (EQ##TYPE(v[o - b->hseqbase], v[hb])) \
-   break;  \
+   if (!hascand) { \
+   for (hb = hget; \
+hb != hnil;\
+hb = HASHgetlink(h, hb)) { \
+   if (EQ##TYPE(v[o - b->hseqbase], 
v[hb])) \
+   break;  \
+   }   \
+   h->nunique += hb == hnil;   \
}   \
-   h->nunique += hb == hnil;   \
HASHputlink(h, p, hget);\
HASHput(h, c, p);   \
o = canditer_next(ci);  \
@@ -923,13 +925,15 @@ BAThash_impl(BAT *restrict b, struct can
c = hash_any(h, v);
hget = HASHget(h, c);
h->nheads += hget == hnil;
-   for (hb = hget;
-hb != hnil;
-hb = HASHgetlink(h, hb)) {
-   if (ATOMcmp(h->type, v, BUNtail(bi, hb)) == 0)
-   break;
+   if (!hascand) {
+   for (hb = hget;
+hb != hnil;
+hb = HASHgetlink(h, hb)) {
+   if (ATOMcmp(h->type, v, BUNtail(bi, 
hb)) == 0)
+   break;
+   }
+   h->nunique += hb == hnil;
}
-   h->nunique += hb == hnil;
HASHputlink(h, p, hget);
HASHput(h, c, p);
o = canditer_next(ci);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -491,7 +491,7 @@ MT_init(void)
/* assume "max" if not a number */
fclose(f);
}
-   /* soft limit */
+   /* soft high limit */
strcpy(pth + l, "memory.high");
f = fopen(pth, "r");
if (f != NULL) {
@@ -502,6 +502,17 @@ MT_init(void)
/* assume "max" if not a number */
fclose(f);
}
+   /* soft low limit */
+   strcpy(pth + l, "memory.low");
+   f = fopen(pth, "r");
+   if (f != NULL) {
+   if (fscanf(f, "%" SCNu64, ) == 1 && 
mem > 0 && mem < (uint64_t) _MT_pagesize * _MT_npages) {
+   _MT_npages = (size_t) (mem / 
_MT_pagesize);
+   }
+   success = true;
+   /* assume "max" if not a number */
+   fclose(f);
+   }
/* limit of memory+swap usage
 * we use this as maximum virtual memory size */
strcpy(pth + l, "memory.swap.max");
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5546,8 +5546,7 @@ rel_select_exp(sql_query *query, sql_rel
 */
pexps = list_merge(pexps, te, (fdup)NULL);
}
-   if (rel && 

MonetDB: Oct2020 - merged

2021-03-13 Thread Niels Nes
Changeset: 4615c8d963c7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4615c8d963c7
Removed Files:
sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
Modified Files:
gdk/gdk_bbp.c
sql/jdbc/tests/Tests/All
sql/jdbc/tests/Tests/JDBC_API_Tester.stable.err
sql/jdbc/tests/Tests/JDBC_API_Tester.stable.out
sql/server/rel_optimizer.c

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-prologue.stable.out
Branch: Oct2020
Log Message:

merged


diffs (truncated from 351 to 300 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2447,7 +2447,7 @@ decref(bat i, bool logical, bool release
 * if they have been made cold or are not dirty */
if (BBP_refs(i) > 0 ||
(BBP_lrefs(i) > 0 &&
-(b == NULL || BATdirtydata(b) || !(BBP_status(i) & BBPPERSISTENT) 
|| GDKinmemory( {
+(b == NULL || BATdirty(b) || !(BBP_status(i) & BBPPERSISTENT) || 
GDKinmemory( {
/* bat cannot be swapped out */
} else if (b ? b->batSharecnt == 0 : (BBP_status(i) & BBPTMP)) {
/* bat will be unloaded now. set the UNLOADING bit
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,7 +1,6 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
-HAVE_JDBCCLIENT_JAR?Test_JdbcClient
-HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run everytime, 
only before a new release)
 # next test should be done AFTER all the other tests have completed
+HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 HAVE_JDBCCLIENT_JAR?ValidateSystemCatalogTables
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
deleted file mode 100755
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
+++ /dev/null
@@ -1,11 +0,0 @@
-@echo off
-
-echo user=monetdb> .monetdb
-echo password=monetdb>>.monetdb
-
-prompt # $t $g  
-echo on
-
-call java org.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d %TSTDB% -e 
-f "%TSTSRCBASE%\%TSTDIR%\Tests\bogus-auto-generated-keys.sql"
-
-@del .monetdb
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
deleted file mode 100755
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-cat << EOF > .monetdb
-user=monetdb
-password=monetdb
-EOF
-
-Mlog -x "java org.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} 
-e -f \"$TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql\""
-
-rm -f .monetdb
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.sql 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.sql
deleted file mode 100644
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-START TRANSACTION;
--- generate a simple table with an auto-generated key (id)
-CREATE TABLE gen_keys (
-   "id" serial,
-   "x" varchar(12)
-);
-
--- perform an update, useless, but illustrates the bug, this time no
--- generated key is reported, which is correct
-UPDATE gen_keys SET "x" = 'bla' WHERE "id" = 12;
-
--- insert some value, should get a generated key
-INSERT INTO gen_keys ("x") VALUES ('boe');
-
--- update again, we expect NO generated key, but we DO get one
-UPDATE gen_keys SET "x" = 'bla' WHERE "id" = 1;
-UPDATE gen_keys SET "x" = 'bla' WHERE "id" = 12;
-
--- ok, cleanup a bit
-DROP TABLE gen_keys;
-ROLLBACK;
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.err 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.err
deleted file mode 100644
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.err
+++ /dev/null
@@ -1,17 +0,0 @@
-stderr of test 'bogus-auto-generated-keys` in directory 'sql/jdbc/tests` 
itself:
-
-
-# 19:33:44 >  
-# 19:33:44 >  "./bogus-auto-generated-keys.SQL.sh" "bogus-auto-generated-keys"
-# 19:33:44 >  
-
-
-# 19:33:44 >  
-# 19:33:44 >  java nl.cwi.monetdb.client.JdbcClient -h monetdb-nuc2 -p 30491 
-d mTests_sql_jdbc_tests -e -f 
"/home/dinther/dev/dev/MonetDB/sql/jdbc/tests/Tests/bogus-auto-generated-keys.sql"
-# 19:33:44 >  
-
-
-# 19:33:44 >  
-# 19:33:44 >  "Done."
-# 19:33:44 >  
-
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.out 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.out
deleted file mode 100644
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.out
+++ /dev/null
@@ -1,46 +0,0 @@
-stdout of test 'bogus-auto-generated-keys` in directory 'sql/jdbc/tests` 
itself:
-
-
-# 19:33:44 >  
-# 19:33:44 >  

MonetDB: Oct2020 - Merged with Jun2020

2021-03-11 Thread Pedro Ferreira
Changeset: 394c65c8f553 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=394c65c8f553
Modified Files:
sql/server/rel_optimizer.c

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-prologue.stable.out
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (197 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
@@ -1676,13 +1676,32 @@ rel_push_count_down(visitor *v, sql_rel 
return rel;
 }
 
+static bool
+check_projection_on_foreignside(sql_rel *r, list *pexps, int fk_left) 
+{
+   /* projection columns from the foreign side */
+   if (list_empty(pexps))
+   return true;
+   for (node *n = pexps->h; n; n = n->next) {
+   sql_exp *pe = n->data;
+
+   if (pe && is_atom(pe->type))
+   continue;
+   if (pe && !is_alias(pe->type))
+   return false;
+   /* check for columns from the pk side, then keep the join with 
the pk */
+   if ((fk_left && rel_find_exp(r->r, pe)) || (!fk_left && 
rel_find_exp(r->l, pe)))
+   return false;
+   }
+   return true;
+}
+
 static sql_rel *
-rel_simplify_project_fk_join(mvc *sql, sql_rel *r, list *pexps, int *changes)
+rel_simplify_project_fk_join(mvc *sql, sql_rel *r, list *pexps, list 
*orderexps, int *changes)
 {
sql_rel *rl = r->l;
sql_rel *rr = r->r;
sql_exp *je, *le, *nje, *re;
-   node *n;
int fk_left = 1;
 
/* check for foreign key join */
@@ -1713,22 +1732,11 @@ rel_simplify_project_fk_join(mvc *sql, s
 #endif
/* primary side must be a full table */
if ((fk_left && (!is_left(r->op) && !is_full(r->op)) && 
!is_basetable(rr->op)) ||
-   (!fk_left && (!is_right(r->op) && !is_full(r->op)) && 
!is_basetable(rl->op)))
+   (!fk_left && (!is_right(r->op) && !is_full(r->op)) && 
!is_basetable(rl->op)))
return r;
 
-   /* projection columns from the foreign side */
-   for (n = pexps->h; n; n = n->next) {
-   sql_exp *pe = n->data;
-
-   if (pe && is_atom(pe->type))
-   continue;
-   if (pe && !is_alias(pe->type))
-   return r;
-   /* check for columns from the pk side, then keep the join with 
the pk */
-   if ((fk_left && rel_find_exp(r->r, pe)) ||
-   (!fk_left && rel_find_exp(r->l, pe)))
-   return r;
-   }
+   if (!check_projection_on_foreignside(r, pexps, fk_left) || 
!check_projection_on_foreignside(r, orderexps, fk_left))
+   return r;
 
/* rewrite, ie remove pkey side if possible */
le = (sql_exp*)je->l, re = (sql_exp*)je->l;
@@ -1751,7 +1759,7 @@ rel_simplify_project_fk_join(mvc *sql, s
 }
 
 static sql_rel *
-rel_simplify_count_fk_join(mvc *sql, sql_rel *r, list *gexps, int *changes)
+rel_simplify_count_fk_join(mvc *sql, sql_rel *r, list *gexps, list *gcols, int 
*changes)
 {
sql_rel *rl = r->l;
sql_rel *rr = r->r;
@@ -1779,18 +1787,21 @@ rel_simplify_count_fk_join(mvc *sql, sql
 
/* primary side must be a full table */
if ((fk_left && (!is_left(r->op) && !is_full(r->op)) && 
!is_basetable(rr->op)) ||
-   (!fk_left && (!is_right(r->op) && !is_full(r->op)) && 
!is_basetable(rl->op)))
+   (!fk_left && (!is_right(r->op) && !is_full(r->op)) && 
!is_basetable(rl->op)))
return r;
 
if (fk_left && is_join(rl->op) && !rel_is_ref(rl)) {
-   rl = rel_simplify_count_fk_join(sql, rl, gexps, changes);
+   rl = rel_simplify_count_fk_join(sql, rl, gexps, gcols, changes);
r->l = rl;
}
if (!fk_left && is_join(rr->op) && !rel_is_ref(rr)) {
-   rr = rel_simplify_count_fk_join(sql, rr, gexps, changes);
+   rr = rel_simplify_count_fk_join(sql, rr, gexps, gcols, changes);
r->r = rr;
}
 
+   if (!check_projection_on_foreignside(r, gcols, fk_left))
+   return r;
+
/* rewrite, ie remove pkey side if possible */
le = (sql_exp*)je->l, re = (sql_exp*)je->l;
 
@@ -1813,7 +1824,7 @@ rel_simplify_count_fk_join(mvc *sql, sql
 
 /*
  * Handle (left/right/outer/natural) join fk-pk rewrites
- *   1 group by ( fk-pk-join () ) [ count(*) ] -> groub py ( fk )
+ *   1 group by ( fk-pk-join () ) [ count(*) ] -> group by ( fk )
  *   2 project ( fk-pk-join () ) [ fk-column ] -> project (fk table)[ 
fk-column ]
  *   3 project ( fk1-pk1-join( fk2-pk2-join()) [ fk-column, pk1 column ] -> 
project (fk1-pk1-join)[ fk-column, pk1 column ]
  */
@@ -1822,13 +1833,13 @@ rel_simplify_fk_joins(visitor *v, sql_re
 {
sql_rel *r = NULL;
 
-   if (rel->op == op_project)
+   if (is_simple_project(rel->op))

MonetDB: Oct2020 - merged with jun2020

2021-03-06 Thread Niels Nes
Changeset: d199beeb9b99 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d199beeb9b99
Modified Files:
sql/benchmarks/tpcds/Tests/40.stable.out
sql/benchmarks/tpcds/Tests/40.stable.out.int128
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/check_MaxStrLength_violations.stable.out
Branch: Oct2020
Log Message:

merged with jun2020


diffs (80 lines):

diff --git a/sql/benchmarks/tpcds/Tests/40.stable.out 
b/sql/benchmarks/tpcds/Tests/40.stable.out
--- a/sql/benchmarks/tpcds/Tests/40.stable.out
+++ b/sql/benchmarks/tpcds/Tests/40.stable.out
@@ -35,7 +35,7 @@ stdout of test '40` in directory 'sql/be
 #   END) AS sales_after
 #FROM catalog_sales
 #LEFT OUTER JOIN catalog_returns ON (cs_order_number = cr_order_number
-% sys.warehouse,   .item,  .,  . # table_name
+% sys.warehouse,   sys.item,   .,  . # table_name
 % w_state, i_item_id,  sales_before,   sales_after # name
 % char,char,   decimal,decimal # type
 % 2,   16, 20, 20 # length
diff --git a/sql/benchmarks/tpcds/Tests/40.stable.out.int128 
b/sql/benchmarks/tpcds/Tests/40.stable.out.int128
--- a/sql/benchmarks/tpcds/Tests/40.stable.out.int128
+++ b/sql/benchmarks/tpcds/Tests/40.stable.out.int128
@@ -35,7 +35,7 @@ stdout of test '40` in directory 'sql/be
 #   END) AS sales_after
 #FROM catalog_sales
 #LEFT OUTER JOIN catalog_returns ON (cs_order_number = cr_order_number
-% sys.warehouse,   .item,  .,  . # table_name
+% sys.warehouse,   sys.item,   .,  . # table_name
 % w_state, i_item_id,  sales_before,   sales_after # name
 % char,char,   decimal,decimal # type
 % 2,   16, 40, 40 # length
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
@@ -663,7 +663,6 @@ order_join_expressions(mvc *sql, list *d
node *n = NULL;
int i, *keys, cnt = list_length(dje);
void **data;
-   int debug = mvc_debug_on(sql, 16);
 
if (cnt == 0)
return res;
@@ -681,9 +680,9 @@ order_join_expressions(mvc *sql, list *d
sql_rel *r = find_rel(rels, e->r);
 
if (l && is_select(l->op) && l->exps)
-   keys[i] += list_length(l->exps)*10 + 
exps_count(l->exps)*debug;
+   keys[i] += list_length(l->exps)*10 + 
exps_count(l->exps);
if (r && is_select(r->op) && r->exps)
-   keys[i] += list_length(r->exps)*10 + 
exps_count(r->exps)*debug;
+   keys[i] += list_length(r->exps)*10 + 
exps_count(r->exps);
}
data[i] = n->data;
}
@@ -939,6 +938,8 @@ order_joins(visitor *v, list *rels, list
while(list_length(exps) && fnd) {
fnd = 0;
/* find the first expression which could be added */
+   if (list_length(sdje) > 1)
+   sdje = order_join_expressions(v->sql, sdje, rels);
for(djn = sdje->h; djn && !fnd && rels->h; djn = 
(!fnd)?djn->next:NULL) {
node *ln, *rn, *en;
 
diff --git a/sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.stable.out 
b/sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.stable.out
--- a/sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.stable.out
+++ b/sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.stable.out
@@ -31,7 +31,7 @@ stdout of test 'fk-smaller-pk.Bug-3983` 
 #CREATE TABLE parent2(a int, b int, PRIMARY KEY(a,b));
 #CREATE TABLE child1(x int, y int, FOREIGN KEY(x,y) REFERENCES parent2);
 #SELECT table_name, column_name, key_name, key_col_nr, key_type, depend_type 
FROM dependency_columns_on_keys WHERE table_name LIKE 'parent%' AND key_name 
LIKE 'parent%';
-% .dependency_columns_on_keys, .dependency_columns_on_keys,
.dependency_columns_on_keys,.dependency_columns_on_keys,
.dependency_columns_on_keys,.dependency_columns_on_keys # table_name
+% .dependency_columns_on_keys, .dependency_columns_on_keys,
sys.dependency_columns_on_keys, .dependency_columns_on_keys,
sys.dependency_columns_on_keys, .dependency_columns_on_keys # table_name
 % table_name,  column_name,key_name,   key_col_nr, key_type,   
depend_type # name
 % varchar, varchar,varchar,int,smallint,   
smallint # type
 % 7,   1,  16, 1,  1,  1 # length
diff --git a/sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out 
b/sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out
--- a/sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out
+++ 

MonetDB: Oct2020 - Merged with Jun2020

2021-03-03 Thread Pedro Ferreira
Changeset: f9823b730e7d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9823b730e7d
Modified Files:
sql/benchmarks/tpcds/Tests/40.stable.out
sql/benchmarks/tpcds/Tests/40.stable.out.int128
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (24 lines):

diff --git a/sql/benchmarks/tpcds/Tests/40.stable.out 
b/sql/benchmarks/tpcds/Tests/40.stable.out
--- a/sql/benchmarks/tpcds/Tests/40.stable.out
+++ b/sql/benchmarks/tpcds/Tests/40.stable.out
@@ -35,7 +35,7 @@ stdout of test '40` in directory 'sql/be
 #   END) AS sales_after
 #FROM catalog_sales
 #LEFT OUTER JOIN catalog_returns ON (cs_order_number = cr_order_number
-% sys.warehouse,   sys.item,   .,  . # table_name
+% sys.warehouse,   .item,  .,  . # table_name
 % w_state, i_item_id,  sales_before,   sales_after # name
 % char,char,   decimal,decimal # type
 % 2,   16, 20, 20 # length
diff --git a/sql/benchmarks/tpcds/Tests/40.stable.out.int128 
b/sql/benchmarks/tpcds/Tests/40.stable.out.int128
--- a/sql/benchmarks/tpcds/Tests/40.stable.out.int128
+++ b/sql/benchmarks/tpcds/Tests/40.stable.out.int128
@@ -35,7 +35,7 @@ stdout of test '40` in directory 'sql/be
 #   END) AS sales_after
 #FROM catalog_sales
 #LEFT OUTER JOIN catalog_returns ON (cs_order_number = cr_order_number
-% sys.warehouse,   sys.item,   .,  . # table_name
+% sys.warehouse,   .item,  .,  . # table_name
 % w_state, i_item_id,  sales_before,   sales_after # name
 % char,char,   decimal,decimal # type
 % 2,   16, 40, 40 # length
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2021-03-03 Thread Pedro Ferreira
Changeset: 5389bf9e901d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5389bf9e901d
Modified Files:
gdk/gdk_logger.c
gdk/gdk_string.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c

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

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

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

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-2join-view.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-prologue.stable.out
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (truncated from 725 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2898,7 +2898,7 @@ log_delta(logger *lg, BAT *uid, BAT *uva
fprintf(stderr, "#Logged %s " LLFMT " inserts\n", name, 
l.nr);
}
if (ok != GDK_SUCCEED)
-   TRC_CRITICAL(GDK, "write failed\n");
+   TRC_CRITICAL(GDK, "write failed for %s\n", name);
return ok;
 }
 
@@ -2946,7 +2946,7 @@ log_bat(logger *lg, BAT *b, const char *
}
 
if (ok != GDK_SUCCEED)
-   TRC_CRITICAL(GDK, "write failed\n");
+   TRC_CRITICAL(GDK, "write failed for %s\n", name);
return ok;
 }
 
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -176,6 +176,46 @@ strLocate(Heap *h, const char *v)
return 0;
 }
 
+static inline gdk_return
+checkUTF8(const char *v)
+{
+   if (v[0] != '\200' || v[1] != '\0') {
+   /* check that string is correctly encoded UTF-8; there
+* was no need to do this earlier: if the string was
+* found above, it must have gone through here in the
+* past */
+   int nutf8 = 0;
+   int m = 0;
+   for (size_t i = 0; v[i]; i++) {
+   if (nutf8 > 0) {
+   if ((v[i] & 0xC0) != 0x80 ||
+   (m != 0 && (v[i] & m) == 0))
+   goto badutf8;
+   m = 0;
+   nutf8--;
+   } else if ((v[i] & 0xE0) == 0xC0) {
+   nutf8 = 1;
+   if ((v[i] & 0x1E) == 0)
+   goto badutf8;
+   } else if ((v[i] & 0xF0) == 0xE0) {
+   nutf8 = 2;
+   if ((v[i] & 0x0F) == 0)
+   m = 0x20;
+   } else if ((v[i] & 0xF8) == 0xF0) {
+   nutf8 = 3;
+   if ((v[i] & 0x07) == 0)
+   m = 0x30;
+   } else if ((v[i] & 0x80) != 0) {
+   goto badutf8;
+   }
+   }
+   }
+   return GDK_SUCCEED;
+
+  badutf8:
+   return GDK_FAIL;
+}
+
 var_t
 strPut(Heap *h, var_t *dst, const char *v)
 {
@@ -219,39 +259,9 @@ strPut(Heap *h, var_t *dst, const char *
}
/* the string was not found in the heap, we need to enter it */
 
-   if (v[0] != '\200' || v[1] != '\0') {
-   /* check that string is correctly encoded UTF-8; there
-* was no need to do this earlier: if the string was
-* found above, it must have gone through here in the
-* past */
-   int nutf8 = 0;
-   int m = 0;
-   for (size_t i = 0; v[i]; i++) {
-   if (nutf8 > 0) {
-   if ((v[i] & 0xC0) != 0x80 ||
-   (m != 0 && (v[i] & m) == 0)) {
- badutf8:
-   GDKerror("incorrectly encoded UTF-8");
-   return 0;
-   }
-   m = 0;
-   nutf8--;
-   } else if ((v[i] & 0xE0) == 0xC0) {
-   nutf8 = 1;
-   if ((v[i] & 0x1E) == 0)
-   goto badutf8;
-   } else if ((v[i] & 0xF0) == 0xE0) {
-   nutf8 = 2;
-   if ((v[i] & 0x0F) == 0)
-   m = 0x20;
-   } else if ((v[i] & 0xF8) == 0xF0) {
-   nutf8 = 3;
-   if ((v[i] & 0x07) == 0)
- 

MonetDB: Oct2020 - merged

2021-03-02 Thread Niels Nes
Changeset: cf94931eaa10 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf94931eaa10
Branch: Oct2020
Log Message:

merged


diffs (21 lines):

diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -822,13 +822,15 @@ SQLinsert_val(READERtask *task, int col,
fmt->c->tnonil = false;
} else {
if (task->escape) {
-   char *data = GDKmalloc(strlen(s) + 1);
+   size_t slen = strlen(s) + 1;
+   char *data = slen <= sizeof(buf) ? buf : 
GDKmalloc(strlen(s) + 1);
if (data == NULL ||
GDKstrFromStr((unsigned char *) data, (unsigned 
char *) s, strlen(s)) < 0)
adt = NULL;
else
adt = fmt->frstr(fmt, fmt->adt, data);
-   GDKfree(data);
+   if (data != buf)
+   GDKfree(data);
} else
adt = fmt->frstr(fmt, fmt->adt, s);
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2021-02-25 Thread Niels Nes
Changeset: ced8b287140b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ced8b287140b
Branch: Oct2020
Log Message:

merged


diffs (164 lines):

diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -398,14 +398,10 @@ char *
case SQL_NOP: {
dnode *lst = se->data.lval->h, *ops = 
lst->next->next->data.lval->h, *aux;
const char *op = symbol_escape_ident(sql->ta, 
qname_schema_object(lst->data.lval)),
-  *sname = qname_schema(lst->data.lval);
+  *sname = symbol_escape_ident(sql->ta, 
qname_schema(lst->data.lval));
int i = 0, nargs = 0;
char** inputs = NULL, *res;
-   size_t inputs_length = 0;
-
-   if (!sname)
-   sname = sql->session->schema->base.name;
-   sname = symbol_escape_ident(sql->ta, sname);
+   size_t inputs_length = 0, extra = sname ? strlen(sname) + 3 : 0;
 
for (aux = ops; aux; aux = aux->next)
nargs++;
@@ -420,8 +416,11 @@ char *
i++;
}
 
-   if ((res = SA_NEW_ARRAY(sql->ta, char, strlen(sname) + 
strlen(op) + inputs_length + 6 + (nargs - 1 /* commas */) + 2))) {
-   char *concat = stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(res, 
"\""), sname), "\".\""), op), "\"(");
+   if ((res = SA_NEW_ARRAY(sql->ta, char, extra + strlen(op) + 
inputs_length + 3 + (nargs - 1 /* commas */) + 2))) {
+   char *concat = res;
+   if (sname)
+   concat = stpcpy(stpcpy(stpcpy(res, "\""), 
sname), "\".");
+   concat = stpcpy(stpcpy(stpcpy(concat, "\""), op), 
"\"(");
i = 0;
for (aux = ops; aux; aux = aux->next) {
concat = stpcpy(concat, inputs[i]);
@@ -432,55 +431,56 @@ char *
concat = stpcpy(concat, ")");
}
return res;
-   } break;
+   }
case SQL_BINOP: {
dnode *lst = se->data.lval->h;
const char *op = symbol_escape_ident(sql->ta, 
qname_schema_object(lst->data.lval)),
-  *sname = qname_schema(lst->data.lval);
+  *sname = symbol_escape_ident(sql->ta, 
qname_schema(lst->data.lval));
char *l = NULL, *r = NULL, *res;
-
-   if (!sname)
-   sname = sql->session->schema->base.name;
-   sname = symbol_escape_ident(sql->ta, sname);
+   size_t extra = sname ? strlen(sname) + 3 : 0;
 
if (!(l = _symbol2string(sql, lst->next->next->data.sym, 
expression, err)) || !(r = _symbol2string(sql, lst->next->next->next->data.sym, 
expression, err)))
return NULL;
 
-   if ((res = SA_NEW_ARRAY(sql->ta, char, strlen(sname) + 
strlen(op) + strlen(l) + strlen(r) + 9)))
-   
stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(res, "\""), 
sname), "\".\""), op), "\"("), l), ","), r), ")");
-
+   if ((res = SA_NEW_ARRAY(sql->ta, char, extra + strlen(op) + 
strlen(l) + strlen(r) + 6))) {
+   char *concat = res;
+   if (sname)
+   concat = stpcpy(stpcpy(stpcpy(res, "\""), 
sname), "\".");
+   
stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(concat, "\""), op), "\"("), 
l), ","), r), ")");
+   }
return res;
-   } break;
+   }
case SQL_OP: {
dnode *lst = se->data.lval->h;
const char *op = symbol_escape_ident(sql->ta, 
qname_schema_object(lst->data.lval)),
-  *sname = qname_schema(lst->data.lval);
+  *sname = symbol_escape_ident(sql->ta, 
qname_schema(lst->data.lval));
char *res;
+   size_t extra = sname ? strlen(sname) + 3 : 0;
 
-   if (!sname)
-   sname = sql->session->schema->base.name;
-   sname = symbol_escape_ident(sql->ta, sname);
-
-   if ((res = SA_NEW_ARRAY(sql->ta, char, strlen(sname) + 
strlen(op) + 8)))
-   stpcpy(stpcpy(stpcpy(stpcpy(stpcpy(res, "\""), sname), 
"\".\""), op), "\"()");
-
+   if ((res = SA_NEW_ARRAY(sql->ta, char, extra + strlen(op) + 
5))) {
+   char *concat = res;
+   if (sname)
+   concat = stpcpy(stpcpy(stpcpy(res, "\""), 
sname), "\".");
+   stpcpy(stpcpy(stpcpy(concat, "\""), op), "\"()");
+   }
return res;
-   } break;
+   }
case 

MonetDB: Oct2020 - merged with Jun2020

2021-02-25 Thread Niels Nes
Changeset: 122d6d24c632 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=122d6d24c632
Modified Files:
sql/server/rel_optimizer.c
Branch: Oct2020
Log Message:

merged with Jun2020


diffs (68 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
@@ -438,6 +438,12 @@ exp_count(int *cnt, sql_exp *e)
case cmp_lt:
case cmp_lte:
*cnt += 6;
+   if (e->l) {
+   sql_exp *l = e->l;
+   sql_subtype *t = exp_subtype(l);
+   if (EC_TEMP(t->type->eclass)) /* give 
preference too temporal ranges */
+   *cnt += 200;
+   }
if (e->f){ /* range */
*cnt += 6;
return 12;
@@ -5270,6 +5276,43 @@ rel_push_join_down_union(visitor *v, sql
return rel;
 }
 
+static sql_rel *
+rel_push_join_down_outer(visitor *v, sql_rel *rel)
+{
+   if (is_join(rel->op) && !is_outerjoin(rel->op) && !is_single(rel) && 
!list_empty(rel->exps) && !rel_is_ref(rel)) {
+   sql_rel *l = rel->l, *r = rel->r;
+
+   if (is_left(r->op) && (is_select(l->op) || (is_join(l->op) && 
!is_outerjoin(l->op))) && !rel_is_ref(l) &&
+   !rel_is_ref(r)) {
+   sql_rel *rl = r->l;
+   sql_rel *rr = r->r;
+   if (rel_is_ref(rl) || rel_is_ref(rr))
+   return rel;
+   /* join exps should only include l and r.l */
+   list *njexps = sa_list(v->sql->sa);
+   for(node *n = rel->exps->h; n; n = n->next) {
+   sql_exp *je = n->data;
+
+   assert(je->type == e_cmp);
+   if (je->f)
+   return rel;
+   if ((rel_find_exp(l, je->l) && rel_find_exp(rl, 
je->r)) || (rel_find_exp(l, je->r) && rel_find_exp(rl, je->l))) {
+   list_append(njexps, je);
+   } else {
+   return rel;
+   }
+   }
+   sql_rel *nl = rel_crossproduct(v->sql->sa, rel_dup(l), 
rl, rel->op);
+   r->l = nl;
+   nl->exps = njexps;
+   rel_dup(r);
+   rel_destroy(rel);
+   rel = r;
+   }
+   }
+   return rel;
+}
+
 static int
 rel_is_empty( sql_rel *rel )
 {
@@ -9724,6 +9767,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int
 
rel = rel_visitor_topdown(, rel, _out2inner);
rel = rel_visitor_bottomup(, rel, _join2semijoin);
+   rel = rel_visitor_bottomup(, rel, _push_join_down_outer);
if (!gp.cnt[op_update])
rel = rel_join_order(, rel);
rel = rel_visitor_bottomup(, rel, _push_join_down_union);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2021-02-22 Thread Niels Nes
Changeset: 1217affb9d64 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1217affb9d64
Branch: Oct2020
Log Message:

merged


diffs (truncated from 2476 to 300 lines):

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 11.39.12
+current_version = 11.39.14
 commit = False
 tag = False
 
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -796,3 +796,5 @@ 929f5e280bc1532a2bfaab127ca7915dc3b69a33
 742b7847cfdcea39a6c19ab29eb35471d46bb2bb Oct2020_11
 929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_SP2_release
 742b7847cfdcea39a6c19ab29eb35471d46bb2bb Oct2020_SP2_release
+17d27ad30941c81e4bc700300912e84e9b9a8c37 Oct2020_13
+17d27ad30941c81e4bc700300912e84e9b9a8c37 Oct2020_SP3_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1,5 +1,5 @@
 %global name MonetDB
-%global version 11.39.12
+%global version 11.39.14
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP2/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP3/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -845,6 +845,10 @@ else
 fi
 
 %changelog
+* Thu Feb 11 2021 Sjoerd Mullender  - 11.39.13-20210211
+- Rebuilt.
+- GH#7049: Implement DISTINCT for GROUP_CONCAT
+
 * Mon Jan 18 2021 Sjoerd Mullender  - 11.39.11-20210118
 - Rebuilt.
 - GH#3772: Any user can grant a role.
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -969,6 +969,34 @@ dump_column_definition(Mapi mid, stream 
mnstr_printf(toConsole, "\t");
space = dquoted_print(toConsole, c_name, " ");
mnstr_printf(toConsole, "%*s", CAP(slen - space), "");
+   if (s != NULL && t != NULL &&
+   strcmp(c_type, "char") == 0 && strcmp(c_type_digits, 
"0") == 0) {
+   /* if the number of characters is not specified (due to 
a bug),
+* calculate a size */
+   char *c = descape(c_name);
+   if (c != NULL) {
+   size_t qlen = strlen(c) + strlen(s) + strlen(t) 
+ 64;
+   char *q = malloc(qlen);
+   if (q != NULL) {
+   snprintf(q, qlen, "SELECT 
max(length(\"%s\")) FROM \"%s\".\"%s\"", c, s, t);
+   MapiHdl h = mapi_query(mid, q);
+   if (h != NULL) {
+   if (mapi_fetch_row(h) != 0) {
+   const char *d = 
mapi_fetch_field(h, 0);
+   free(c_type_digits);
+   /* if NULL, i.e. no 
non-NULL values, fill in 1 */
+   c_type_digits = 
strdup(d ? d : "1");
+   fprintf(stderr, 
"Warning: fixing size of CHAR column for %s of table %s.%s\n", c_name, schema, 
tname);
+   }
+   mapi_close_handle(h);
+   }
+   free(q);
+   }
+   free(c);
+   }
+   if (c_type_digits == NULL)
+   goto bailout;
+   }
space = dump_type(mid, toConsole, c_type, c_type_digits, 
c_type_scale, hashge);
if (strcmp(c_null, "false") == 0) {
mnstr_printf(toConsole, "%*s NOT NULL",
diff --git a/clients/mapilib/mapi.rc b/clients/mapilib/mapi.rc
--- a/clients/mapilib/mapi.rc
+++ b/clients/mapilib/mapi.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,39,12)
-  PRODUCTVERSION version(11,39,12)
+  FILEVERSION version(11,39,14)
+  PRODUCTVERSION version(11,39,14)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB B.V.\0"
   VALUE "FileDescription", "MonetDB Application Interface DLL\0"
-  VALUE "FileVersion", sversion(11,39,12)
+  VALUE "FileVersion", sversion(11,39,14)
 

MonetDB: Oct2020 - merged

2021-02-06 Thread Niels Nes
Changeset: ba279291a60d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba279291a60d
Branch: Oct2020
Log Message:

merged


diffs (truncated from 317 to 300 lines):

diff --git a/sql/benchmarks/tpcds/Tests/09.stable.out 
b/sql/benchmarks/tpcds/Tests/09.stable.out
--- a/sql/benchmarks/tpcds/Tests/09.stable.out
+++ b/sql/benchmarks/tpcds/Tests/09.stable.out
@@ -42,7 +42,7 @@ stdout of test '09` in directory 'sql/be
 % .,   .,  .,  .,  . # table_name
 % bucket1, bucket2,bucket3,bucket4,bucket5 # name
 % decimal, decimal,decimal,decimal,decimal # type
-% 20,  20, 20, 20, 20 # length
+% 11,  11, 11, 11, 11 # length
 [ 39.65,   115.90, 191.63, 267.19, 341.99  ]
 
 # 11:36:53 >  
diff --git a/sql/benchmarks/tpcds/Tests/09.stable.out.int128 
b/sql/benchmarks/tpcds/Tests/09.stable.out.int128
deleted file mode 100644
--- a/sql/benchmarks/tpcds/Tests/09.stable.out.int128
+++ /dev/null
@@ -1,54 +0,0 @@
-stdout of test '09` in directory 'sql/benchmarks/tpcds` itself:
-
-
-# 18:29:57 >  
-# 18:29:57 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30709" "--set" 
"mapi_usock=/var/tmp/mtest-16393/.s.monetdb.30709" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/ufs/sjoerd/@Monet-devel/var/MonetDB/mTests_sql_benchmarks_tpcds" 
"--set" "embedded_c=true"
-# 18:29:57 >  
-
-# MonetDB 5 server v11.32.0 (hg id: edafb9f9a3c6+79d16e518d38+)
-# This is an unreleased version
-# Serving database 'mTests_sql_benchmarks_tpcds', using 8 threads
-# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
-# Found 62.694 GiB available main-memory.
-# Copyright (c) 1993 - July 2008 CWI.
-# Copyright (c) August 2008 - 2020 MonetDB B.V., all rights reserved
-# Visit https://www.monetdb.org/ for further information
-# Listening for connection requests on 
mapi:monetdb://methuselah.da.cwi.nl:30709/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-16393/.s.monetdb.30709
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-
-
-# 18:29:57 >  
-# 18:29:57 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-16393" "--port=30709"
-# 18:29:57 >  
-
-#SELECT CASE
-#   WHEN
-#  (SELECT count(*)
-#   FROM store_sales
-#   WHERE ss_quantity BETWEEN 1 AND 20) > 74129 THEN
-#  (SELECT avg(ss_ext_discount_amt)
-#   FROM store_sales
-#   WHERE ss_quantity BETWEEN 1 AND 20)
-#   ELSE
-#  (SELECT avg(ss_net_paid)
-#   FROM store_sales
-#   WHERE ss_quantity BETWEEN 1 AND 20)
-#   END bucket1,
-#   CASE
-#   WHEN
-#  (SELECT count(*)
-% .,   .,  .,  .,  . # table_name
-% bucket1, bucket2,bucket3,bucket4,bucket5 # name
-% decimal, decimal,decimal,decimal,decimal # type
-% 40,  40, 40, 40, 40 # length
-[ 39.65,   115.90, 191.63, 267.19, 341.99  ]
-
-# 11:36:53 >  
-# 11:36:53 >  "Done."
-# 11:36:53 >  
-
-# 18:29:57 >  
-# 18:29:57 >  "Done."
-# 18:29:57 >  
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
@@ -462,8 +462,10 @@ static sql_subfunc *
scale = member->scale;
}
/* same type as the input */
-   if (r->type->eclass == EC_ANY && member)
+   if (r->type->eclass == EC_ANY && member) {
r = member;
+   digits = member->digits;
+   }
if (!EC_SCALE(r->type->eclass))
scale = 0;
res = sql_create_subtype(sa, r->type, digits, scale);
@@ -569,7 +571,7 @@ sql_dup_subfunc(sql_allocator *sa, sql_f
} else if (r->scale)
scale = r->scale;
}
-   if (member && f->fix_scale == INOUT)
+   if (member && (f->fix_scale == INOUT || 
r->type->eclass == EC_ANY))
digits = member->digits;
if (IS_ANALYTIC(f) && mscale)
scale = mscale;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -3270,6 +3270,8 @@ rewrite_values(visitor *v, sql_rel *rel)
if (rel_is_ref(rel)) { /* need extra project */
rel->l = rel_project(v->sql->sa, rel->l, rel->exps);
rel->exps = rel_projections(v->sql, rel->l, NULL, 1, 1);
+   ((sql_rel*)rel->l)->r = rel->r; /* propagate order by exps */
+   rel->r = NULL;
 

MonetDB: Oct2020 - merged

2021-02-04 Thread Niels Nes
Changeset: 5295c7d58eb9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5295c7d58eb9
Branch: Oct2020
Log Message:

merged


diffs (truncated from 354 to 300 lines):

diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c
--- a/sql/backends/monet5/sql_cat.c
+++ b/sql/backends/monet5/sql_cat.c
@@ -789,12 +789,13 @@ create_func(mvc *sql, char *sname, char 
 
FUNC_TYPE_STR(f->type)
 
-   (void) fname;
(void) fn;
if (sname && !(s = mvc_bind_schema(sql, sname)))
throw(SQL,"sql.create_func", SQLSTATE(3F000) "CREATE %s: no 
such schema '%s'", F, sname);
if (!mvc_schema_privs(sql, s))
throw(SQL,"sql.create_func", SQLSTATE(42000) "CREATE %s: access 
denied for %s to schema '%s'", F, sqlvar_get_string(find_global_var(sql, 
mvc_bind_schema(sql, "sys"), "current_user")), s->base.name);
+   if (strlen(fname) >= IDLENGTH)
+   throw(SQL,"sql.create_func", SQLSTATE(42000) "CREATE %s: name 
'%s' too large for the backend", F, fname);
nf = mvc_create_func(sql, NULL, s, f->base.name, f->ops, f->res, 
f->type, f->lang, f->mod, f->imp, f->query, f->varres, f->vararg, f->system);
assert(nf);
switch (nf->lang) {
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
@@ -143,6 +143,14 @@ static int
int res = 0;
str msg = MAL_SUCCEED;
 
+   if (strlen(mod) >= IDLENGTH) {
+   (void) sql_error(m, 02, SQLSTATE(42000) "Module name '%s' too 
large for the backend", mod);
+   return -1;
+   }
+   if (strlen(name) >= IDLENGTH) {
+   (void) sql_error(m, 02, SQLSTATE(42000) "Function name '%s' too 
large for the backend", name);
+   return -1;
+   }
backup = c->curprg;
curPrg = c->curprg = newFunction(putName(mod), putName(name), 
FUNCTIONsymbol);
if( curPrg == NULL) {
@@ -184,7 +192,10 @@ static int
sql_error(m, 001, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
return -1;
}
-   varid = newVariable(curBlk, buf, strlen(buf), type);
+   if ((varid = newVariable(curBlk, buf, strlen(buf), 
type)) < 0) {
+   sql_error(m, 003, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
+   return -1;
+   }
curInstr = pushArgument(curBlk, curInstr, varid);
setVarType(curBlk, varid, type);
setVarUDFtype(curBlk, varid);
@@ -213,7 +224,10 @@ static int
sql_error(m, 001, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
return -1;
}
-   varid = newVariable(curBlk, (char *)buf, strlen(buf), 
type);
+   if ((varid = newVariable(curBlk, (char *)buf, 
strlen(buf), type)) < 0) {
+   sql_error(m, 003, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
+   return -1;
+   }
curInstr = pushArgument(curBlk, curInstr, varid);
setVarType(curBlk, varid, type);
setVarUDFtype(curBlk, varid);
@@ -311,6 +325,14 @@ static int
sql_error(m, 003, SQLSTATE(42000) "Missing property on the 
input relation");
return -1;
}
+   if (strlen(mod) >= IDLENGTH) {
+   sql_error(m, 003, SQLSTATE(42000) "Module name '%s' too large 
for the backend", mod);
+   return -1;
+   }
+   if (strlen(name) >= IDLENGTH) {
+   sql_error(m, 003, SQLSTATE(42000) "Function name '%s' too large 
for the backend", name);
+   return -1;
+   }
 
lname = GDKstrdup(name);
if (lname == NULL) {
@@ -373,7 +395,11 @@ static int
return -1;
}
stpcpy(stpcpy(buf, "A"), nme);
-   varid = newVariable(curBlk, buf,strlen(buf), type);
+   if ((varid = newVariable(curBlk, buf,strlen(buf), 
type)) < 0) {
+   GDKfree(lname);
+   sql_error(m, 003, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
+   return -1;
+   }
curInstr = pushArgument(curBlk, curInstr, varid);
setVarType(curBlk, varid, type);
setVarUDFtype(curBlk, varid);
@@ -789,10 +815,12 @@ backend_dumpproc(backend *be, Client c, 
int argc = 0, res, added_to_cache = 0;
 
backup 

MonetDB: Oct2020 - merged

2021-02-04 Thread Niels Nes
Changeset: fc934fa3e3af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc934fa3e3af
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: Oct2020
Log Message:

merged


diffs (12 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
@@ -2737,7 +2737,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
 
-   if (l_is_base && nme[0] == '%' && strcmp(nme, TID) == 0)
+   if (semijoin_only && l_is_base && nme[0] == '%' && strcmp(nme, 
TID) == 0)
s = join;
else
s = stmt_project(be, join, column(be, c));
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2021-02-02 Thread Pedro Ferreira
Changeset: 0a258a97c2c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0a258a97c2c0
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (40 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
@@ -2524,13 +2524,16 @@ rel2bin_semijoin(backend *be, sql_rel *r
list *l, *sexps = NULL;
node *en = NULL, *n;
stmt *left = NULL, *right = NULL, *join = NULL, *jl, *jr, *c, *lcand = 
NULL;
-   int semijoin_only = 0;
+   int semijoin_only = 0, l_is_base = 0;
 
if (rel->op == op_anti && !list_empty(rel->exps) && 
list_length(rel->exps) == 1 && ((sql_exp*)rel->exps->h->data)->flag == 
mark_notin)
return rel2bin_antijoin(be, rel, refs);
 
-   if (rel->l) /* first construct the left sub relation */
-   left = subrel_bin(be, rel->l, refs);
+   if (rel->l) { /* first construct the left sub relation */
+   sql_rel *l = rel->l;
+   l_is_base = is_basetable(l->op);
+   left = subrel_bin(be, l, refs);
+   }
if (rel->r) /* first construct the right sub relation */
right = subrel_bin(be, rel->r, refs);
if (!left || !right)
@@ -2730,10 +2733,14 @@ rel2bin_semijoin(backend *be, sql_rel *r
 
/* project all the left columns */
for( n = left->op4.lval->h; n; n = n->next ) {
-   stmt *c = n->data;
+   stmt *c = n->data, *s;
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
-   stmt *s = stmt_project(be, join, column(be, c));
+
+   if (l_is_base && nme[0] == '%' && strcmp(nme, TID) == 0)
+   s = join;
+   else
+   s = stmt_project(be, join, column(be, c));
 
s = stmt_alias(be, s, rnme, nme);
list_append(l, s);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2021-02-01 Thread Pedro Ferreira
Changeset: 122c2c36b794 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=122c2c36b794
Modified Files:
monetdb5/optimizer/opt_pushselect.c
sql/backends/monet5/UDF/udf/Tests/udf-fuse.stable.out
sql/backends/monet5/UDF/udf/Tests/udf-reverse.stable.out
sql/backends/monet5/rel_bin.c

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

sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out
sql/test/BugTracker-2014/Tests/manifold.Bug-3556.stable.out
sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out

sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out

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

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

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

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

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

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out
sql/test/mergetables/Tests/mergequery.stable.out
sql/test/miscellaneous/Tests/simple_plans.stable.out
sql/test/remote/Tests/partition_elim.stable.out
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (253 lines):

diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -132,6 +132,8 @@ no_updates(InstrPtr *old, int *vars, int
return 1;
 }
 
+#define isIntersect(p) (getModuleId(p) == algebraRef && getFunctionId(p) == 
intersectRef)
+
 str
 OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
@@ -169,7 +171,7 @@ OPTpushselectImplementation(Client cntxt
}
 
if (getModuleId(p) == algebraRef &&
-   (getFunctionId(p) == intersectRef ||
+   ((!no_mito && getFunctionId(p) == intersectRef) ||
 getFunctionId(p) == differenceRef)) {
GDKfree(vars);
goto wrapup;
@@ -181,6 +183,9 @@ OPTpushselectImplementation(Client cntxt
if (isLikeOp(p))
nr_likes++;
 
+   if (no_mito && isIntersect(p))
+   push_down_delta++;
+
if ((getModuleId(p) == sqlRef && getFunctionId(p) == deltaRef) 
||
(no_mito && getModuleId(p) == matRef && 
getFunctionId(p) == packRef && p->argc == (p->retc+2)))
push_down_delta++;
@@ -804,6 +809,74 @@ OPTpushselectImplementation(Client cntxt
oclean[i] = 1;
actions++;
}
+   } else if (isIntersect(p) && p->retc == 1 && lastbat == 4) {
+   /* c = delta(b, uid, uvl, ins)
+* s = intersect(l, r, li, ..)
+*
+* nc = intersect(b, r, li..)
+* ni = intersect(ins, r, li..)
+* nu = intersect(uvl, r, ..)
+* s = subdelta(nc, uid, nu, ni);
+*/
+   int var = getArg(p, 1);
+   InstrPtr q = old[vars[var]];
+
+   if (q && q->token == ASSIGNsymbol) {
+   var = getArg(q, 1);
+   q = old[vars[var]];
+   }
+   if (q && getModuleId(q) == sqlRef && getFunctionId(q) 
== deltaRef) {
+   InstrPtr r = copyInstruction(p);
+   InstrPtr s = copyInstruction(p);
+   InstrPtr t = copyInstruction(p);
+   InstrPtr u = copyInstruction(q);
+
+   if( r == NULL || s == NULL || t== NULL ||u == 
NULL){
+   freeInstruction(r);
+   freeInstruction(s);
+   freeInstruction(t);
+   freeInstruction(u);
+   GDKfree(vars);
+   GDKfree(nvars);
+   GDKfree(slices);
+   GDKfree(rslices);
+   GDKfree(oclean);
+

MonetDB: Oct2020 - merged

2021-01-29 Thread Niels Nes
Changeset: 38e6e0bc6d0c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38e6e0bc6d0c
Branch: Oct2020
Log Message:

merged


diffs (truncated from 4902 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9411,19 +9411,19 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog","comment_on",   "pattern sqlcatalog.comment_on(X_1:int, 
X_2:str):void ","SQLcomment_on;",   ""  ]
 [ "sqlcatalog","create_function",  "pattern 
sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ",  
"SQLcreate_function;",  ""  ]
 [ "sqlcatalog","create_role",  "pattern 
sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ",  
"SQLcreate_role;",  ""  ]
-[ "sqlcatalog","create_schema","pattern 
sqlcatalog.create_schema(X_1:str, X_2:str, X_3:int, X_4:int):void ",   
"SQLcreate_schema;",""  ]
+[ "sqlcatalog","create_schema","pattern 
sqlcatalog.create_schema(X_1:str, X_2:str, X_3:int):void ",
"SQLcreate_schema;",""  ]
 [ "sqlcatalog","create_seq",   "pattern sqlcatalog.create_seq(X_1:str, 
X_2:str, X_3:ptr, X_4:int):void ",  "SQLcreate_seq;",   ""  ]
 [ "sqlcatalog","create_table", "pattern 
sqlcatalog.create_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ",
"SQLcreate_table;", ""  ]
 [ "sqlcatalog","create_trigger",   "pattern 
sqlcatalog.create_trigger(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, 
X_7:str, X_8:str, X_9:str, X_10:str):void ",   "SQLcreate_trigger;",   ""  ]
 [ "sqlcatalog","create_type",  "pattern 
sqlcatalog.create_type(X_1:str, X_2:str, X_3:str):void ",  
"SQLcreate_type;",  ""  ]
 [ "sqlcatalog","create_user",  "pattern 
sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ",
"SQLcreate_user;",  ""  ]
 [ "sqlcatalog","create_view",  "pattern 
sqlcatalog.create_view(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", 
"SQLcreate_view;",  ""  ]
-[ "sqlcatalog","drop_constraint",  "pattern 
sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:int, X_4:int):void ", 
"SQLdrop_constraint;",  ""  ]
+[ "sqlcatalog","drop_constraint",  "pattern 
sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int):void ", 
   "SQLdrop_constraint;",  ""  ]
 [ "sqlcatalog","drop_function","pattern 
sqlcatalog.drop_function(X_1:str, X_2:str, X_3:int, X_4:int, X_5:int):void ",  
"SQLdrop_function;",""  ]
 [ "sqlcatalog","drop_index",   "pattern sqlcatalog.drop_index(X_1:str, 
X_2:str, X_3:int):void ",   "SQLdrop_index;",   ""  ]
 [ "sqlcatalog","drop_role","pattern sqlcatalog.drop_role(X_1:str, 
X_2:int):void ", "SQLdrop_role;",""  ]
 [ "sqlcatalog","drop_role","pattern sqlcatalog.drop_role(X_1:str, 
X_2:str, X_3:int):void ","SQLdrop_role;",""  ]
-[ "sqlcatalog","drop_schema",  "pattern 
sqlcatalog.drop_schema(X_1:str, X_2:str, X_3:int, X_4:int):void ", 
"SQLdrop_schema;",  ""  ]
+[ "sqlcatalog","drop_schema",  "pattern 
sqlcatalog.drop_schema(X_1:str, X_2:int, X_3:int):void ",  
"SQLdrop_schema;",  ""  ]
 [ "sqlcatalog","drop_seq", "pattern sqlcatalog.drop_seq(X_1:str, 
X_2:str, X_3:int):void ", "SQLdrop_seq;", ""  ]
 [ "sqlcatalog","drop_table",   "pattern sqlcatalog.drop_table(X_1:str, 
X_2:str, X_3:int, X_4:int):void ",  "SQLdrop_table;",   ""  ]
 [ "sqlcatalog","drop_trigger", "pattern 
sqlcatalog.drop_trigger(X_1:str, X_2:str, X_3:int):void ", 
"SQLdrop_trigger;", ""  ]
@@ -9591,7 +9591,7 @@ stdout of test 'MAL-signatures` in direc
 [ "wlc",   "commit",   "pattern wlc.commit():void ",   
"WLCcommitCmd;",""  ]
 [ "wlc",   "create_function",  "pattern wlc.create_function(X_1:str, 
X_2:str):void ",  "WLCgeneric;",  ""  ]
 [ "wlc",   "create_role",  "pattern wlc.create_role(X_1:str, X_2:str, 
X_3:int):void ", "WLCgeneric;",  ""  ]
-[ "wlc",   "create_schema","pattern wlc.create_schema(X_1:str, 
X_2:str, X_3:int, X_4:int):void ",  "WLCgeneric;",  ""  ]
+[ "wlc",   "create_schema","pattern wlc.create_schema(X_1:str, 
X_2:str, X_3:int):void ",   "WLCgeneric;",  ""  ]
 [ "wlc",   "create_seq",   "pattern wlc.create_seq(X_1:str, X_2:str, 
X_3:int):void ",  "WLCgeneric;",  ""  ]
 [ "wlc",   "create_table", "pattern wlc.create_table(X_1:str, X_2:str, 
X_3:int):void ","WLCgeneric;",  ""  ]
 [ "wlc",   "create_trigger",   "pattern wlc.create_trigger(X_1:str, 
X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, X_7:str, X_8:str, X_9:str, 
X_10:str):void ",  "WLCgeneric;",  ""   

MonetDB: Oct2020 - Merged with Jun2020

2021-01-20 Thread Pedro Ferreira
Changeset: 4270fafb7ecd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4270fafb7ecd
Modified Files:
sql/server/rel_dump.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/server/rel_unnest.c
sql/server/rel_updates.c

sql/test/BugDay_2005-10-06_2.9.3/Tests/parser_crashes_server.SF-921996.stable.err
sql/test/miscellaneous/Tests/simple_selects.sql
sql/test/miscellaneous/Tests/simple_selects.stable.err
sql/test/subquery/Tests/subquery5.stable.out
Branch: Oct2020
Log Message:

Merged with Jun2020

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


MonetDB: Oct2020 - Merged with Jun2020

2021-01-15 Thread Pedro Ferreira
Changeset: 1bd4fdb7b2d7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1bd4fdb7b2d7
Modified Files:
monetdb5/optimizer/opt_emptybind.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (53 lines):

diff --git a/monetdb5/optimizer/opt_emptybind.c 
b/monetdb5/optimizer/opt_emptybind.c
--- a/monetdb5/optimizer/opt_emptybind.c
+++ b/monetdb5/optimizer/opt_emptybind.c
@@ -35,21 +35,6 @@
}  } while (0)
 
 
-static int
-withoutMitosis(MalBlkPtr mb)
-{
-   InstrPtr p;
-
-   for(int i = mb->stop-1; i>=0; i--) {
-   p = mb->stmt[i];
-   if (p->token == ENDsymbol)
-   break;
-   if (getFunctionId(p) == mitosisRef)
-   return (p->token == REMsymbol);
-}
-   return 0;
-}
-
 str
 OPTemptybindImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
 {
@@ -62,7 +47,6 @@ OPTemptybindImplementation(Client cntxt,
str sch,tbl;
int etop= 0, esize= 256;
str msg = MAL_SUCCEED;
-   int no_mitosis = withoutMitosis(mb);
 
(void) stk;
(void) cntxt;
@@ -211,19 +195,6 @@ OPTemptybindImplementation(Client cntxt,
continue;
}
}
-   // delta operations without updates can be replaced by an pack 
of base and inserts
-   if (getModuleId(p)== sqlRef && getFunctionId(p) == deltaRef  && 
p->argc == 5){
-   if (no_mitosis && empty[getArg(p,2)] && 
empty[getArg(p,3)]){
-   actions++;
-   clrFunction(p);
-   setModuleId(p,matRef);
-   setFunctionId(p,packRef);
-   p->argc = 3;
-   getArg(p, 2) = getArg(p, 4);
-   p->typechk= TYPE_UNKNOWN;
-   }
-   continue;
-   }
 
if (getModuleId(p)== sqlRef && getFunctionId(p) == 
projectdeltaRef) {
if( empty[getArg(p,3)] && empty[getArg(p,4)] ){
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged

2020-12-30 Thread Ying Zhang
Changeset: e5f4cff884b8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e5f4cff884b8
Modified Files:
clients/mapiclient/mhelp.c
Branch: Oct2020
Log Message:

Merged

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


MonetDB: Oct2020 - merged from Jun2020

2020-12-30 Thread Ying Zhang
Changeset: 4b01d8a3677f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b01d8a3677f
Modified Files:
clients/mapiclient/mhelp.c
Branch: Oct2020
Log Message:

merged from Jun2020


diffs (39 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -54,7 +54,7 @@ SQLhelp sqlhelp1[] = {
 "",
 "ALTER SCHEMA [ IF EXISTS ] ident RENAME TO ident",
 "ident",
-"See also 
https://www.monetdb.org/Documentation/SQLreference/TableDefinitions/AlterStatement"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/DataDefinition/SchemaDefinitions"},
{"ALTER SEQUENCE",
 "",
 "ALTER SEQUENCE qname [ AS seq_int_datatype] [ RESTART [WITH intval]] 
[INCREMENT BY intval]\n"
@@ -190,7 +190,7 @@ SQLhelp sqlhelp1[] = {
 "",
 "CREATE REPLICA TABLE [ IF NOT EXISTS ] qname table_source",
 NULL,
-"See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/TransactionReplication"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/TableDefinitions"},
{"CREATE ROLE",
 "Create a new role. You can grant privileges to a role and next\n"
 "grant a role (or multiple roles) to specific users",
@@ -250,7 +250,7 @@ SQLhelp sqlhelp1[] = {
 "RETURNS function_return_data_type\n"
 "EXTERNAL NAME ident ',' ident",
 "qname,param,function_return_data_type,ident",
-"See also 
https://www.monetdb.org/Documentation/SQLreference/ProgrammingSQL/Functions"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/DataManipulation/WindowFunctions"},
{"CURRENT_DATE",
 "Pseudo column or function to get the current date",
 "CURRENT_DATE [ '(' ')' ]",
@@ -295,7 +295,7 @@ SQLhelp sqlhelp1[] = {
 "Debug a SQL statement using MAL debugger",
 "DEBUG statement",
 NULL,
-
"https://www.monetdb.org/Documentation/SQLreference/RuntimeFeatures/Debug"},
+"See also 
https://www.monetdb.org/Documentation/SQLreference/RuntimeFeatures/Debug"},
{"DECLARE",
 "Define a local variable",
 "DECLARE ident_list data_type",
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020, not changing any code.

2020-12-18 Thread Sjoerd Mullender
Changeset: c50eb74a9bab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c50eb74a9bab
Modified Files:
gdk/gdk_private.h
Branch: Oct2020
Log Message:

Merged with Jun2020, not changing any code.
The problem with the Intel compiler that was fixed in the Jun2020
branch only occurred there.

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


MonetDB: Oct2020 - Merged with Jun2020

2020-12-16 Thread Pedro Ferreira
Changeset: fe9fe36d3530 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe9fe36d3530
Modified Files:
gdk/gdk_project.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (20 lines):

diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -305,7 +305,7 @@ project_str(BAT *restrict l, struct cand
var_t v;
 
if ((bn = COLnew(l->hseqbase, TYPE_str, ci ? ci->ncand : BATcount(l),
-TRANSIENT)) != NULL)
+TRANSIENT)) == NULL)
return NULL;
 
v = (var_t) r1->tvheap->free;
@@ -329,6 +329,7 @@ project_str(BAT *restrict l, struct cand
memset(bn->tvheap->base + r1->tvheap->free, 0, h1off - 
r1->tvheap->free);
 #endif
memcpy(bn->tvheap->base + h1off, r2->tvheap->base, 
r2->tvheap->free);
+   bn->tvheap->free = h1off + r2->tvheap->free;
}
 
if (v >= ((var_t) 1 << (8 * bn->twidth)) &&
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-12-16 Thread Niels Nes
Changeset: e6eb722152e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e6eb722152e3
Branch: Oct2020
Log Message:

merged


diffs (154 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -141,7 +141,7 @@ VIEWcreate(oid seq, BAT *b)
GDKfree(bn);
return NULL;
}
-   TRC_DEBUG(ALGO, "VIEWcreate(" ALGOBATFMT ")=" ALGOBATFMT "\n",
+   TRC_DEBUG(ALGO, ALGOBATFMT " -> " ALGOBATFMT "\n",
  ALGOBATPAR(b), ALGOBATPAR(bn));
return bn;
 }
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -842,7 +842,7 @@ COLcopy(BAT *b, int tt, bool writable, r
}
if (!writable)
bn->batRestricted = BAT_READ;
-   TRC_DEBUG(ALGO, "COLcopy(" ALGOBATFMT ")=" ALGOBATFMT "\n",
+   TRC_DEBUG(ALGO, ALGOBATFMT " -> " ALGOBATFMT "\n",
  ALGOBATPAR(b), ALGOBATPAR(bn));
return bn;
   bunins_failed:
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1767,11 +1767,11 @@ BATsort(BAT **sorted, BAT **order, BAT *
}
*groups = gn;
}
-   TRC_DEBUG(ALGO, "BATsort(b=" ALGOBATFMT ",o="
+   TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",o="
  ALGOOPTBATFMT ",g=" ALGOOPTBATFMT
  ",reverse=%d,nilslast=%d,stable=%d) = ("
  ALGOOPTBATFMT "," ALGOOPTBATFMT ","
- ALGOOPTBATFMT ") -- trivial (" LLFMT
+ ALGOOPTBATFMT " -- trivial (" LLFMT
  " usec)\n",
  ALGOBATPAR(b), ALGOOPTBATPAR(o),
  ALGOOPTBATPAR(g), reverse, nilslast, stable,
@@ -1854,11 +1854,11 @@ BATsort(BAT **sorted, BAT **order, BAT *
BBPunfix(on->batCacheid);
on = NULL;
}
-   TRC_DEBUG(ALGO, "BATsort(b=" ALGOBATFMT ",o="
+   TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",o="
  ALGOOPTBATFMT ",g=" ALGOOPTBATFMT
  ",reverse=%d,nilslast=%d,stable=%d) = ("
  ALGOOPTBATFMT "," ALGOOPTBATFMT ","
- ALGOOPTBATFMT ") -- orderidx (" LLFMT
+ ALGOOPTBATFMT " -- orderidx (" LLFMT
  " usec)\n",
  ALGOBATPAR(b), ALGOOPTBATPAR(o),
  ALGOOPTBATPAR(g), reverse, nilslast, stable,
@@ -1956,12 +1956,12 @@ BATsort(BAT **sorted, BAT **order, BAT *
goto error;
*groups = gn;
}
-   TRC_DEBUG(ALGO, "BATsort(b=" ALGOBATFMT
+   TRC_DEBUG(ALGO, "b=" ALGOBATFMT
  ",o=" ALGOOPTBATFMT ",g=" ALGOBATFMT
  ",reverse=%d,nilslast=%d,stable=%d"
  ") = (" ALGOOPTBATFMT ","
  ALGOOPTBATFMT "," ALGOOPTBATFMT
- ") -- key group (" LLFMT " usec)\n",
+ " -- key group (" LLFMT " usec)\n",
  ALGOBATPAR(b), ALGOOPTBATPAR(o),
  ALGOBATPAR(g), reverse, nilslast,
  stable, ALGOOPTBATPAR(bn),
@@ -2078,10 +2078,10 @@ BATsort(BAT **sorted, BAT **order, BAT *
bn = NULL;
}
 
-   TRC_DEBUG(ALGO, "BATsort(b=" ALGOBATFMT ",o=" ALGOOPTBATFMT
+   TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",o=" ALGOOPTBATFMT
  ",g=" ALGOOPTBATFMT ",reverse=%d,nilslast=%d,"
  "stable=%d) = (" ALGOOPTBATFMT "," ALGOOPTBATFMT ","
- ALGOOPTBATFMT ") -- %ssort (" LLFMT " usec)\n",
+ ALGOOPTBATFMT " -- %ssort (" LLFMT " usec)\n",
  ALGOBATPAR(b), ALGOOPTBATPAR(o), ALGOOPTBATPAR(g),
  reverse, nilslast, stable, ALGOOPTBATPAR(bn),
  ALGOOPTBATPAR(gn), ALGOOPTBATPAR(on),
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -265,8 +265,8 @@ BAT *virtualize(BAT *bn)
BATcount(b),\
b->hseqbase,\
ATOMname(b->ttype), \
-   !b->batTransient ? "P" : isVIEW(b) ? "V" : "T", \
-   BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" :"", \
+   !b->batTransient ? "P" : b->theap.parentid ? "V" : b->tvheap && 
b->tvheap->parentid != b->batCacheid ? "v" : "T", \
+   BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : 
ATOMstorage(b->ttype) == TYPE_str && 

MonetDB: Oct2020 - merged with jun2020

2020-12-12 Thread Niels Nes
Changeset: 4325bd87fe76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4325bd87fe76
Modified Files:
sql/storage/sql_catalog.c
sql/storage/store.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (31 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2365,6 +2365,11 @@ cleanup_table(sql_table *t)
for (int i = 0; ischemas.set->h; m; m = 
m->next) {
sql_schema * schema = m->data;
+
+   if (schema->tables.dset) {
+   list_destroy(schema->tables.dset);
+   schema->tables.dset = NULL;
+   }
node *o = find_sql_table_node(schema, 
t->base.id);
if (o) {
list_remove_node(schema->tables.set, o);
@@ -4127,6 +4132,7 @@ rollforward_changeset_updates(sql_trans 
list_destroy(fs->dset);
fs->dset = NULL;
}
+   /*
if (!apply && ts->dset) {
for (n = ts->dset->h; ok == LOG_OK && n; n = n->next) {
sql_base *tb = n->data;
@@ -4135,6 +4141,7 @@ rollforward_changeset_updates(sql_trans 
ok = rollforward_deletes(tr, tb, mode);
}
}
+   */
if (apply && ts->dset && !cf) {
list_destroy(ts->dset);
ts->dset = NULL;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2020-12-10 Thread Pedro Ferreira
Changeset: bb0575cfe1f2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bb0575cfe1f2
Modified Files:
gdk/gdk.h
gdk/gdk_batop.c
gdk/gdk_join.c
gdk/gdk_project.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (truncated from 360 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2023,6 +2023,7 @@ enum prop_t {
GDK_MAX_VALUE,  /* largest non-nil value in BAT */
GDK_HASH_BUCKETS,   /* last used hash bucket size */
GDK_NUNIQUE,/* number of unique values */
+   GDK_UNIQUE_ESTIMATE,/* estimate of number of distinct values */
 };
 
 /*
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1073,6 +1073,7 @@ BUNappend(BAT *b, const void *t, bool fo
IMPSdestroy(b); /* no support for inserts in imprints yet */
OIDXdestroy(b);
BATrmprop(b, GDK_NUNIQUE);
+   BATrmprop(b, GDK_UNIQUE_ESTIMATE);
 #if 0  /* enable if we have more properties than just min/max */
PROPrec *prop;
do {
@@ -1159,6 +1160,7 @@ BUNdelete(BAT *b, oid o)
OIDXdestroy(b);
HASHdestroy(b);
BATrmprop(b, GDK_NUNIQUE);
+   BATrmprop(b, GDK_UNIQUE_ESTIMATE);
 #if 0  /* enable if we have more properties than just min/max */
do {
for (prop = b->tprops; prop; prop = prop->next)
@@ -1248,6 +1250,7 @@ BUNinplace(BAT *b, BUN p, const void *t,
}
}
BATrmprop(b, GDK_NUNIQUE);
+   BATrmprop(b, GDK_UNIQUE_ESTIMATE);
 #if 0  /* enable if we have more properties than just min/max */
do {
for (prop = b->tprops; prop; prop = prop->next)
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -573,6 +573,7 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
}
}
BATrmprop(b, GDK_NUNIQUE);
+   BATrmprop(b, GDK_UNIQUE_ESTIMATE);
 #if 0  /* enable if we have more properties than just min/max */
do {
for (prop = b->tprops; prop; prop = prop->next)
@@ -890,6 +891,7 @@ BATreplace(BAT *b, BAT *p, BAT *n, bool 
OIDXdestroy(b);
IMPSdestroy(b);
BATrmprop(b, GDK_NUNIQUE);
+   BATrmprop(b, GDK_UNIQUE_ESTIMATE);
 
b->tsorted = b->trevsorted = false;
b->tnosorted = b->tnorevsorted = 0;
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3041,12 +3041,19 @@ guess_uniques(BAT *b, struct canditer *c
if (b->tkey)
return (double) ci->ncand;
 
-   if (ci->s) {
+   if (ci->s == NULL ||
+   (ci->tpe == cand_dense && ci->ncand == BATcount(b))) {
+   PROPrec *p = BATgetprop(b, GDK_UNIQUE_ESTIMATE);
+   if (p) {
+   TRC_DEBUG(ALGO, "b=" ALGOBATFMT " use cached value\n",
+ ALGOBATPAR(b));
+   return p->v.val.dval;
+   }
+   s1 = BATsample(b, 1000);
+   } else {
BAT *s2 = BATsample(ci->s, 1000);
s1 = BATproject(s2, ci->s);
BBPreclaim(s2);
-   } else {
-   s1 = BATsample(b, 1000);
}
BUN n2 = BATcount(s1);
BUN n1 = n2 / 2;
@@ -3056,7 +3063,12 @@ guess_uniques(BAT *b, struct canditer *c
double A = (double) (cnt2 - cnt1) / (n2 - n1);
double B = cnt1 - n1 * A;
 
-   return A * ci->ncand + B;
+   B += A * ci->ncand;
+   if (ci->s == NULL ||
+   (ci->tpe == cand_dense && ci->ncand == BATcount(b))) {
+   BATsetprop(b, GDK_UNIQUE_ESTIMATE, TYPE_dbl, );
+   }
+   return B;
 }
 
 #define MASK_EQ1
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -290,6 +290,211 @@ project_any(BAT *restrict bn, BAT *restr
return GDK_SUCCEED;
 }
 
+static BAT *
+project_str(BAT *restrict l, struct canditer *restrict ci,
+   BAT *restrict r1, BAT *restrict r2, lng t0)
+{
+   BAT *bn;
+   BUN lo, hi;
+   oid r1seq, r1end;
+   oid r2seq, r2end;
+   BUN h1off;
+   BAT *r;
+   BUN off;
+   oid seq;
+   var_t v;
+
+   if ((bn = COLnew(l->hseqbase, TYPE_str, ci ? ci->ncand : BATcount(l),
+TRANSIENT)) != NULL)
+   return NULL;
+
+   v = (var_t) r1->tvheap->free;
+   if (r1->tvheap == r2->tvheap) {
+   h1off = 0;
+   BBPshare(bn->tvheap->parentid);
+   HEAPfree(bn->tvheap, true);
+   GDKfree(bn->tvheap);
+   bn->tvheap = r1->tvheap;
+   } else {
+   v = (v + GDK_VARALIGN - 1) & ~(GDK_VARALIGN - 1);
+   h1off = (BUN) v;
+   v += ((var_t) r2->tvheap->free + GDK_VARALIGN - 1) & 

MonetDB: Oct2020 - merged

2020-12-10 Thread Niels Nes
Changeset: d8fcc010263f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d8fcc010263f
Branch: Oct2020
Log Message:

merged


diffs (32 lines):

diff --git a/sql/test/miscellaneous/Tests/simple_selects.sql 
b/sql/test/miscellaneous/Tests/simple_selects.sql
--- a/sql/test/miscellaneous/Tests/simple_selects.sql
+++ b/sql/test/miscellaneous/Tests/simple_selects.sql
@@ -201,6 +201,12 @@ rollback;
 select * from (select 1 as c0, 2 as c0) as sub;
-- 1 2
 
+select *,* from (select 1 as c0, 2 as c0) as sub;
+   --  1 2 1 2
+
+select * from (select 1 as c0, max(k) as c0 from (select 2, 3) tst(k, name) 
group by name) as sub;
+   -- 1 2
+
 select cast(interval '3' second as clob);
-- 3.000
 
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
@@ -386,6 +386,12 @@ stdout of test 'simple_selects` in direc
 % tinyint, tinyint # type
 % 1,   1 # length
 [ 1,   2   ]
+#select * from (select 1 as c0, max(k) as c0 from (select 2, 3) tst(k, name) 
group by name) as sub;
+% .sub,.sub # table_name
+% c0,  c0 # name
+% tinyint, tinyint # type
+% 1,   1 # length
+[ 1,   2   ]
 #select cast(interval '3' second as clob);
 % .%1 # table_name
 % %1 # name
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-12-09 Thread Niels Nes
Changeset: da8a53851f30 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da8a53851f30
Modified Files:
sql/storage/sql_catalog.c
Branch: Oct2020
Log Message:

merged

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


MonetDB: Oct2020 - merged

2020-12-09 Thread Niels Nes
Changeset: 7ad5ffe26663 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ad5ffe26663
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_subquery.c
Branch: Oct2020
Log Message:

merged


diffs (11 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -541,7 +541,6 @@ mvc_bind(mvc *m, const char *sname, cons
return NULL;
 
b = store_funcs.bind_col(tr, c, access);
-   assert(b);
return b;
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-12-09 Thread Niels Nes
Changeset: f8e4a7e23e4b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8e4a7e23e4b
Branch: Oct2020
Log Message:

merged


diffs (167 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
@@ -1682,46 +1682,20 @@ rel_find_exp_and_corresponding_rel(sql_r
case op_right:
case op_full:
case op_join:
+   case op_semi:
+   case op_anti:
ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, 
under_join);
-   if (!ne)
+   if (!ne && is_join(rel->op))
ne = rel_find_exp_and_corresponding_rel(rel->r, 
e, res, under_join);
if (ne && under_join)
*under_join = true;
break;
case op_table:
-   if (rel->exps && e->type == e_column && e->l && 
exps_bind_column2(rel->exps, e->l, e->r, NULL))
-   ne = e;
-   if (ne && res)
-   *res = rel;
-   break;
-   case op_union:
-   case op_except:
-   case op_inter:
-   {
-   if (rel->l)
-   ne = rel_find_exp_and_corresponding_rel(rel->l, 
e, res, under_join);
-   else if (rel->exps && e->l) {
-   ne = exps_bind_column2(rel->exps, e->l, e->r, 
NULL);
-   if (ne && res)
-   *res = rel;
-   } else if (rel->exps) {
-   ne = exps_bind_column(rel->exps, e->r, NULL, 
NULL, 1);
-   if (ne && res)
-   *res = rel;
-   }
-   }
-   break;
case op_basetable:
-   if (rel->exps && e->type == e_column && e->l)
-   ne = exps_bind_column2(rel->exps, e->l, e->r, 
NULL);
-   if (ne && res)
-   *res = rel;
break;
default:
if (!is_project(rel->op) && rel->l)
ne = rel_find_exp_and_corresponding_rel(rel->l, 
e, res, under_join);
-   if (ne && (rel->op == op_semi || rel->op == op_anti) && 
under_join)
-   *under_join = true;
}
}
return ne;
diff --git a/sql/test/BugTracker-2020/Tests/All 
b/sql/test/BugTracker-2020/Tests/All
--- a/sql/test/BugTracker-2020/Tests/All
+++ b/sql/test/BugTracker-2020/Tests/All
@@ -33,3 +33,4 @@ drop-stream-table.Bug-7005
 deallocate-id.Bug-7010
 values-groupby.Bug-7013
 txtsim-parallel.Bug-7016
+release_old_savepoint.Bug-7020
diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql 
b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql
@@ -0,0 +1,18 @@
+start transaction;
+
+create table savepointtest (id int, primary key(id));
+savepoint name1;
+
+insert into savepointtest values(1), (2), (3);
+select * from savepointtest;
+savepoint name2;
+
+insert into savepointtest values(4), (5), (6);
+insert into savepointtest values(7), (8), (9);
+select * from savepointtest;
+savepoint name3;
+
+release savepoint name1;
+select * from savepointtest;
+commit;
+
diff --git 
a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err 
b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'release_old_savepoint.Bug-7020` in directory 
'sql/test/BugTracker-2020` itself:
+
+
+# 09:05:47 >  
+# 09:05:47 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-141551" "--port=39186"
+# 09:05:47 >  
+
+
+# 09:05:47 >  
+# 09:05:47 >  "Done."
+# 09:05:47 >  
+
diff --git 
a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out 
b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out
@@ -0,0 +1,61 @@
+stdout of test 'release_old_savepoint.Bug-7020` in directory 
'sql/test/BugTracker-2020` itself:
+
+
+# 09:05:47 >  
+# 09:05:47 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-141551" "--port=39186"
+# 09:05:47 >  
+
+#start transaction;
+#create table savepointtest (id int, primary key(id));
+#savepoint name1;
+#insert into savepointtest values(1), (2), (3);
+[ 3]

MonetDB: Oct2020 - Merged with Jun2020

2020-12-04 Thread Pedro Ferreira
Changeset: d80919e1bc62 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d80919e1bc62
Modified Files:
sql/server/rel_propagate.c
sql/storage/sql_catalog.c
sql/test/merge-partitions/Tests/All
sql/test/merge-partitions/Tests/mergepart01.stable.err
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (truncated from 488 to 300 lines):

diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c
--- a/sql/server/rel_propagate.c
+++ b/sql/server/rel_propagate.c
@@ -160,7 +160,7 @@ generate_partition_limits(sql_query *que
 }
 
 static sql_rel*
-create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges)
+create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges, bool 
max_equal_min)
 {
mvc *sql = query->sql;
sql_rel *anti_rel;
@@ -184,14 +184,18 @@ create_range_partition_anti_rel(sql_quer
if (!(e1 = exp_check_type(sql, , NULL, e1, 
type_equal)))
return NULL;
 
-   e2 = exp_copy(sql, pmax);
-   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
-   return NULL;
+   if (max_equal_min) {
+   anti_exp = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_notequal);
+   } else {
+   e2 = exp_copy(sql, pmax);
+   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
+   return NULL;
 
-   range1 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e1, 3);
-   range2 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e2, 1);
-   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
-   
list_append(new_exp_list(sql->sa), range2), 0);
+   range1 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_lt);
+   range2 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e2, cmp_gte);
+   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
+   
list_append(new_exp_list(sql->sa), range2), 0);
+   }
}
if (!with_nills) {
anti_nils = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
@@ -277,17 +281,19 @@ propagate_validation_to_upper_tables(sql
int (*atomcmp)(const void *, const void *) = 
ATOMcompare(tpe);
const void *nil = ATOMnilptr(tpe);
sql_exp *e1 = NULL, *e2 = NULL;
-   bool found_all = false;
+   bool found_all = false, max_equal_min = false;
 
if (atomcmp(spt->part.range.minvalue, nil) != 0 
&& atomcmp(spt->part.range.maxvalue, nil) != 0) {
+   max_equal_min = 
ATOMcmp(spt->tpe.type->localtype, spt->part.range.maxvalue, 
spt->part.range.minvalue) == 0;
e1 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.minvalue));
-   e2 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.maxvalue));
+   if (!max_equal_min)
+   e2 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.maxvalue));
} else {
assert(spt->with_nills);
found_all = is_bit_nil(spt->with_nills);
}
if (!found_all || !spt->with_nills)
-   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false));
+   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false, max_equal_min));
} else if (isListPartitionTable(it->t)) {
list *exps = new_exp_list(sql->sa);
for (node *n = spt->part.values->h ; n ; n = 
n->next) {
@@ -357,7 +363,12 @@ rel_alter_table_add_partition_range(sql_
rel_psm->nrcols = 0;
 
if (!is_bit_nil(with_nills)) {
-   res = 

MonetDB: Oct2020 - Merged with Jun2020

2020-12-04 Thread Pedro Ferreira
Changeset: 253ebf64f0f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=253ebf64f0f3
Modified Files:
sql/storage/sql_catalog.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (269 lines):

diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -453,44 +453,54 @@ sql_range_part_validate_and_insert(void 
sql_part* pt = (sql_part*) v1, *newp = (sql_part*) v2;
int res1, res2, tpe = pt->tpe.type->localtype;
const void *nil = ATOMnilptr(tpe);
-   bool pt_down_all = false, pt_upper_all = false;
+   bool pt_down_all = false, pt_upper_all = false, newp_down_all = false, 
newp_upper_all = false;
 
if (pt == newp) /* same pointer, skip (used in updates) */
return NULL;
 
assert(tpe == newp->tpe.type->localtype);
-   if (is_bit_nil(pt->with_nills)) //if one partition holds all including 
nills, then conflicts
+   if (is_bit_nil(pt->with_nills) || is_bit_nil(newp->with_nills)) /* if 
one partition holds all including nills, then conflicts */
return pt;
-   if (newp->with_nills && pt->with_nills) //only one partition at most 
has null values
+   if (newp->with_nills && pt->with_nills) /* only one partition at most 
has null values */
return pt;
 
pt_down_all = !ATOMcmp(tpe, nil, pt->part.range.minvalue);
pt_upper_all = !ATOMcmp(tpe, nil, pt->part.range.maxvalue);
+   newp_down_all = !ATOMcmp(tpe, nil, newp->part.range.minvalue);
+   newp_upper_all = !ATOMcmp(tpe, nil, newp->part.range.maxvalue);
 
-   if (pt_down_all || pt_upper_all) {
-   if (pt_down_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_upper_all)  /* holds all range, conflicts if 
newp holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.minvalue) || 
ATOMcmp(tpe, pt->part.range.maxvalue, newp->part.range.minvalue) > 0)
-   return pt;
-   }
-   if (pt_upper_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_down_all) /* holds all range, conflicts if newp 
holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.maxvalue) || 
ATOMcmp(tpe, newp->part.range.maxvalue, pt->part.range.minvalue) > 0)
-   return pt;
-   }
+   /* if one partition just holds NULL values, then there's no conflict */
+   if ((newp_down_all && newp_upper_all && newp->with_nills) || 
(pt_down_all && pt_upper_all && pt->with_nills))
+   return NULL;
+/* holds all range, will always conflict */
+   if ((pt_down_all && pt_upper_all && !pt->with_nills) || (newp_down_all 
&& newp_upper_all && !newp->with_nills))
+   return pt;
+
+   if (pt_down_all) { /* from range min value until a value */
+   if (newp_down_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (pt_upper_all) { /* from value until range max value */
+   if (newp_upper_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_down_all) { /* from range min value until a value */
+   if (pt_down_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_upper_all) { /* from value until range max value */
+   if (pt_upper_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
return NULL;
}
 
/* Fallback into normal cases */
res1 = ATOMcmp(tpe, pt->part.range.minvalue, newp->part.range.maxvalue);
res2 = ATOMcmp(tpe, newp->part.range.minvalue, pt->part.range.maxvalue);
-   if (res1 < 0 && res2 < 0) //overlap: x1 < y2 && y1 < x2
+   if (res1 < 0 && res2 < 0) /* overlap: x1 < y2 && y1 < x2 */
return pt;
return NULL;
 }
diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ b/sql/test/merge-partitions/Tests/mergepart30.sql
@@ -42,7 +42,7 @@ ALTER TABLE table1 ADD TABLE another2 AS
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FOR NULL VALUES;
 
 TRUNCATE table1;
-INSERT 

MonetDB: Oct2020 - merged with jun2020

2020-12-04 Thread Niels Nes
Changeset: d6019bf23807 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d6019bf23807
Modified Files:
sql/backends/monet5/sql.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (141 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -541,6 +541,7 @@ mvc_bind(mvc *m, const char *sname, cons
return NULL;
 
b = store_funcs.bind_col(tr, c, access);
+   assert(b);
return b;
 }
 
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2688,8 +2688,9 @@ static int
 update_table(sql_trans *tr, sql_table *ft, sql_table *tt)
 {
sql_trans *oldest = oldest_active_transaction();
+   sql_table *ot = NULL;
int ok = LOG_OK;
-   node *n, *m;
+   node *n, *m, *o = NULL;
 
if (ATOMIC_GET(_nr_active) == 1 || ft->base.allocated) {
if (ATOMIC_GET(_nr_active) > 1 && ft->data) { /* move 
delta */
@@ -2706,12 +2707,16 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find table t->base.stime */
+ot = tr_find_table(oldest, tt);
+   if (b && ot && b->wtime < ot->base.stime) {
+   while (b && b->wtime >= ot->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_dbat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < ot->base.stime) {
+   delayed_destroy_dbat(b->next);
+   b->next = NULL;
+   }
}
} else if (tt->data && ft->base.allocated) {
if (tr_update_dbat(tr, tt->data, ft->data) != LOG_OK)
@@ -2733,7 +2738,9 @@ update_table(sql_trans *tr, sql_table *f
ft->data = NULL;
}
}
-   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next) {
+   if (ot)
+   o = ot->columns.set->h;
+   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_column *cc = n->data; // TODO: either stick to to/from 
terminology or old/current terminology
sql_column *oc = m->data;
 
@@ -2741,6 +2748,7 @@ update_table(sql_trans *tr, sql_table *f
assert(!cc->base.wtime || oc->base.wtime < 
cc->base.wtime || (oc->base.wtime == cc->base.wtime && oc->base.allocated /* 
alter */));
if (ATOMIC_GET(_nr_active) > 1 && cc->data) { /* 
move delta */
sql_delta *b = cc->data;
+   sql_column *oldc = NULL;
 
if (!oc->data)
oc->base.allocated = cc->base.allocated;
@@ -2754,12 +2762,17 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find column c->base.stime */
+if (o)
+   oldc = o->data;
+   if (oldc && b && oldc->base.id == cc->base.id 
&& b->wtime < oldc->base.stime) {
+   while (b && b->wtime >= 
oldc->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_bat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < 
oldc->base.stime) {
+   delayed_destroy_bat(b->next);
+   b->next = NULL;
+   }
}
} else if (oc->data && cc->base.allocated) {
if (tr_update_delta(tr, oc->data, cc->data, 
cc->unique == 1) 

MonetDB: Oct2020 - Merged with Jun2020

2020-12-02 Thread Pedro Ferreira
Changeset: b065c84f78aa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b065c84f78aa
Modified Files:
gdk/gdk_batop.c
Branch: Oct2020
Log Message:

Merged with Jun2020

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


MonetDB: Oct2020 - merged jun

2020-12-02 Thread Niels Nes
Changeset: 543dddb990af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=543dddb990af
Modified Files:
gdk/gdk_logger.c
Branch: Oct2020
Log Message:

merged jun

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


MonetDB: Oct2020 - merged with jun2020 (small changes to keep AB...

2020-12-02 Thread Niels Nes
Changeset: 48ff5d61c03d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=48ff5d61c03d
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_logger.c
gdk/gdk_logger.h
gdk/gdk_logger_internals.h
sql/common/sql_list.c
sql/server/rel_optimizer.c
sql/storage/bat/bat_logger.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: Oct2020
Log Message:

merged with jun2020 (small changes to keep ABI change smaller)


diffs (truncated from 1041 to 300 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
@@ -514,6 +514,7 @@ gdk_return log_bat_clear(logger *lg, con
 gdk_return log_bat_persists(logger *lg, BAT *b, const char *n, char tpe, oid 
id);
 gdk_return log_bat_transient(logger *lg, const char *n, char tpe, oid id);
 gdk_return log_delta(logger *lg, BAT *uid, BAT *uval, const char *n, char tpe, 
oid id);
+lng log_save_id(logger *lg);
 gdk_return log_sequence(logger *lg, int seq, lng id);
 gdk_return log_tend(logger *lg);
 gdk_return log_tstart(logger *lg);
@@ -523,9 +524,8 @@ gdk_return logger_cleanup(logger *lg);
 logger *logger_create(int debug, const char *fn, const char *logdir, int 
version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp);
 gdk_return logger_del_bat(logger *lg, log_bid bid) 
__attribute__((__warn_unused_result__));
 void logger_destroy(logger *lg);
-gdk_return logger_exit(logger *lg);
 log_bid logger_find_bat(logger *lg, const char *name, char tpe, oid id);
-gdk_return logger_restart(logger *lg);
+gdk_return logger_flush(logger *lg, lng save_id);
 int logger_sequence(logger *lg, int seq, lng *id);
 gdk_return logger_upgrade_bat(logger *lg, const char *name, char tpe, oid id) 
__attribute__((__warn_unused_result__));
 void logger_with_ids(logger *lg);
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -160,7 +160,7 @@ typedef enum {LOG_OK, LOG_EOF, LOG_ERR} 
  * indicate that to the function wkbREAD during reading of the log. */
 static bool geomisoldversion;
 
-static gdk_return bm_commit(logger *lg);
+static gdk_return bm_commit(logger *lg, lng save_id);
 static gdk_return tr_grow(trans *tr);
 
 static BUN
@@ -1401,7 +1401,7 @@ logger_readlogs(logger *lg, FILE *fp, ch
 }
 
 static gdk_return
-logger_commit(logger *lg)
+logger_commit(logger *lg, lng save_id)
 {
if (lg->debug & 1)
fprintf(stderr, "#logger_commit\n");
@@ -1416,7 +1416,7 @@ logger_commit(logger *lg)
BATcommit(lg->snapshots_tid);
BATcommit(lg->dsnapshots);
}
-   return bm_commit(lg);
+   return bm_commit(lg, save_id);
 }
 
 static gdk_return
@@ -1721,6 +1721,7 @@ logger_load(int debug, const char *fn, c
lg->snapshots_tid = NULL;
lg->dsnapshots = NULL;
lg->freed = NULL;
+   lg->freed_lid = NULL;
lg->seqs_id = NULL;
lg->seqs_val = NULL;
lg->dseqs = NULL;
@@ -2006,6 +2007,15 @@ logger_load(int debug, const char *fn, c
if (BBPrename(lg->freed->batCacheid, bak) < 0) {
goto error;
}
+   lg->freed_lid = logbat_new(TYPE_lng, 1, TRANSIENT);
+   if (lg->freed_lid == NULL) {
+   GDKerror("Logger_new: failed to create freed_lid bat");
+   goto error;
+   }
+   strconcat_len(bak, sizeof(bak), fn, "_freed_lid", NULL);
+   if (BBPrename(lg->freed_lid->batCacheid, bak) < 0) {
+   goto error;
+   }
snapshots_bid = logger_find_bat(lg, "snapshots_bid", 0, 0);
if (snapshots_bid == 0) {
lg->snapshots_bid = logbat_new(TYPE_int, 1, PERSISTENT);
@@ -2129,7 +2139,7 @@ logger_load(int debug, const char *fn, c
needcommit = true;
}
GDKdebug &= ~CHECKMASK;
-   if (needcommit && bm_commit(lg) != GDK_SUCCEED) {
+   if (needcommit && bm_commit(lg, lg->tid+1) != GDK_SUCCEED) {
GDKerror("Logger_new: commit failed");
goto error;
}
@@ -2303,6 +2313,7 @@ logger_load(int debug, const char *fn, c
logbat_destroy(lg->snapshots_tid);
logbat_destroy(lg->dsnapshots);
logbat_destroy(lg->freed);
+   logbat_destroy(lg->freed_lid);
logbat_destroy(lg->seqs_id);
logbat_destroy(lg->seqs_val);
logbat_destroy(lg->dseqs);
@@ -2392,6 +2403,12 @@ logger_new(int debug, const char *fn, co
return NULL;
 }
 
+static gdk_return
+logger_restart(logger *lg)
+{
+   return logger_flush(lg, lg->tid);
+}
+
 /* Create a new logger */
 logger *
 logger_create(int debug, const char *fn, const char *logdir, int version, 
preversionfix_fptr prefuncp, postversionfix_fptr postfuncp)
@@ -2456,6 +2473,7 @@ logger_destroy(logger *lg)
logbat_destroy(lg->catalog_oid);

MonetDB: Oct2020 - Merged with Jun2020

2020-11-27 Thread Pedro Ferreira
Changeset: 23c8a1a7ff28 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23c8a1a7ff28
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/common/sql_list.c
sql/include/sql_catalog.h
sql/server/rel_optimizer.c
sql/server/rel_propagate.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/rel_updates.c
sql/server/sql_partition.c
sql/storage/sql_catalog.c
sql/storage/store.c
sql/test/merge-partitions/Tests/mergepart01.stable.err
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (truncated from 1833 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -3932,7 +3932,7 @@ rel2bin_insert(backend *be, sql_rel *rel
pin = refs_find_rel(refs, prel);
 
if (constraint && !be->first_statement_generated)
-   sql_insert_check_null(be, (be->cur_append && t->p) ? t->p : t, 
inserts->op4.lval);
+   sql_insert_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ 
t, inserts->op4.lval);
 
l = sa_list(sql->sa);
 
@@ -3944,12 +3944,14 @@ rel2bin_insert(backend *be, sql_rel *rel
}
 
 /* before */
+#if 0
if (be->cur_append && !be->first_statement_generated) {
for(sql_table *up = t->p ; up ; up = up->p) {
if (!sql_insert_triggers(be, up, updates, 0))
return sql_error(sql, 02, SQLSTATE(27000) 
"INSERT INTO: triggers failed for table '%s'", up->base.name);
}
}
+#endif
if (!sql_insert_triggers(be, t, updates, 0))
return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: 
triggers failed for table '%s'", t->base.name);
 
@@ -3986,12 +3988,14 @@ rel2bin_insert(backend *be, sql_rel *rel
if (!insert)
return NULL;
 
+#if 0
if (be->cur_append && !be->first_statement_generated) {
for(sql_table *up = t->p ; up ; up = up->p) {
if (!sql_insert_triggers(be, up, updates, 1))
return sql_error(sql, 02, SQLSTATE(27000) 
"INSERT INTO: triggers failed for table '%s'", up->base.name);
}
}
+#endif
if (!sql_insert_triggers(be, t, updates, 1))
return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: 
triggers failed for table '%s'", t->base.name);
if (ddl) {
@@ -4822,7 +4826,7 @@ sql_update(backend *be, sql_table *t, st
node *n;
 
if (!be->first_statement_generated)
-   sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, 
updates);
+   sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ 
t, updates);
 
/* check keys + get idx */
idx_updates = update_idxs_and_check_keys(be, t, rows, updates, l, NULL);
@@ -4832,12 +4836,14 @@ sql_update(backend *be, sql_table *t, st
}
 
 /* before */
+#if 0
if (be->cur_append && !be->first_statement_generated) {
for(sql_table *up = t->p ; up ; up = up->p) {
if (!sql_update_triggers(be, up, rows, updates, 0))
return sql_error(sql, 02, SQLSTATE(27000) 
"UPDATE: triggers failed for table '%s'", up->base.name);
}
}
+#endif
if (!sql_update_triggers(be, t, rows, updates, 0))
return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers 
failed for table '%s'", t->base.name);
 
@@ -4852,12 +4858,14 @@ sql_update(backend *be, sql_table *t, st
return sql_error(sql, 02, SQLSTATE(42000) "UPDATE: cascade 
failed for table '%s'", t->base.name);
 
 /* after */
+#if 0
if (be->cur_append && !be->first_statement_generated) {
for(sql_table *up = t->p ; up ; up = up->p) {
if (!sql_update_triggers(be, up, rows, updates, 1))
return sql_error(sql, 02, SQLSTATE(27000) 
"UPDATE: triggers failed for table '%s'", up->base.name);
}
}
+#endif
if (!sql_update_triggers(be, t, rows, updates, 1))
return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers 
failed for table '%s'", t->base.name);
 
@@ -4919,7 +4927,7 @@ rel2bin_update(backend *be, sql_rel *rel
updates[c->colnr] = bin_find_column(be, update, ce->l, 
ce->r);
}
if (!be->first_statement_generated)
-   sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, 
updates);
+   sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ 
t, updates);
 
/* check keys + get idx */
updcol = first_updated_col(updates, list_length(t->columns.set));
@@ -4947,12 +4955,14 @@ rel2bin_update(backend *be, sql_rel *rel
  

MonetDB: Oct2020 - Merged with Jun2020

2020-11-20 Thread Pedro Ferreira
Changeset: d4016daeaedd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d4016daeaedd
Modified Files:
sql/storage/store.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (69 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4215,7 +4215,7 @@ rollforward_drop_part(sql_trans *tr, sql
(void) tr;
if (mode == R_APPLY) {
sql_table *mt = p->t;
-   sql_table *pt = find_sql_table(mt->s, p->base.name);
+   sql_table *pt = find_sql_table_id(mt->s, p->base.id);
 
assert(isMergeTable(mt) || isReplicaTable(mt));
if (pt)
@@ -4463,7 +4463,7 @@ rollforward_update_table(sql_trans *tr, 
ft->cleared = 0;
tt->access = ft->access;
if (ft->p) {
-   tt->p = find_sql_table(tt->s, ft->p->base.name);
+   tt->p = find_sql_table_id(tt->s, ft->p->base.id);
assert(isMergeTable(tt->p) || isReplicaTable(tt->p));
} else
tt->p = NULL;
@@ -4765,7 +4765,7 @@ reset_type(sql_trans *tr, sql_type *ft, 
ft->localtype = pft->localtype;
ft->digits = pft->digits;
ft->scale = pft->scale;
-   ft->s = find_sql_schema(tr, pft->s->base.name);
+   ft->s = find_sql_schema_id(tr, pft->s->base.id);
}
return LOG_OK;
 }
@@ -4790,7 +4790,7 @@ reset_func(sql_trans *tr, sql_func *ff, 
ff->fix_scale = pff->fix_scale;
ff->system = pff->system;
ff->semantics = pff->semantics;
-   ff->s = find_sql_schema(tr, pff->s->base.name);
+   ff->s = find_sql_schema_id(tr, pff->s->base.id);
ff->sa = tr->sa;
}
return LOG_OK;
@@ -4847,9 +4847,9 @@ reset_part(sql_trans *tr, sql_part *ft, 
 
if (pft->t) {
sql_table *mt = pft->t;
-   sql_schema *s = find_sql_schema(tr, mt->s->base.name);
+   sql_schema *s = find_sql_schema_id(tr, mt->s->base.id);
if (s) {
-   sql_table *fmt = find_sql_table(s, 
mt->base.name);
+   sql_table *fmt = find_sql_table_id(s, 
mt->base.id);
assert(isMergeTable(fmt) || 
isReplicaTable(fmt));
ft->t = fmt;
}
@@ -4888,7 +4888,7 @@ reset_table(sql_trans *tr, sql_table *ft
ft->cleared = 0;
ft->access = pft->access;
if (pft->p) {
-   ft->p = find_sql_table(ft->s, pft->p->base.name);
+   ft->p = find_sql_table_id(ft->s, pft->p->base.id);
//Check if this assert can be removed definitely.
//the parent (merge or replica table) maybe created 
later!
//assert(isMergeTable(ft->p) || isReplicaTable(ft->p));
@@ -5047,7 +5047,7 @@ sql_trans_validate(sql_trans *tr)
if (isTempSchema(s))
continue;
 
-   os = find_sql_schema(tr->parent, s->base.name);
+   os = find_sql_schema_id(tr->parent, s->base.id);
if (os && (s->base.wtime != 0 || s->base.rtime != 0)) {
if (!validate_tables(s, os))
return false;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2020-11-20 Thread Pedro Ferreira
Changeset: a8117d1b7afa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a8117d1b7afa
Modified Files:
sql/storage/store.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (12 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -6242,7 +6242,7 @@ sql_trans_del_table(sql_trans *tr, sql_t
 {
sql_schema *syss = find_sql_schema(tr, isGlobal(mt)?"sys":"tmp");
sql_table *sysobj = find_sql_table(syss, "objects");
-   node *n = cs_find_name(>members, pt->base.name);
+   node *n = cs_find_id(>members, pt->base.id);
oid obj_oid = table_funcs.column_find_row(tr, find_sql_column(sysobj, 
"nr"), >base.id, NULL), rid;
sql_part *p = (sql_part*) n->data;
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged with jun2020

2020-11-20 Thread Niels Nes
Changeset: 2991a3bac47b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2991a3bac47b
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (23 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -789,7 +789,8 @@ SQLreader(Client c)
/* auto_commit on end of statement */
if (language != 'D' && m->scanner.mode == LINE_N && 
!commit_done) {
msg = SQLautocommit(m);
-   go = msg == MAL_SUCCEED;
+   if (msg)
+   break;
commit_done = true;
}
if (m->session->tr && m->session->tr->active)
@@ -813,7 +814,8 @@ SQLreader(Client c)
   and start a transaction on the start of a 
new statement (s A;B; case) */
if (language != 'D' && !(m->emod & mod_debug) 
&& !commit_done) {
msg = SQLautocommit(m);
-   go = msg == MAL_SUCCEED;
+   if (msg)
+   break;
commit_done = true;
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2020-11-19 Thread Pedro Ferreira
Changeset: 959e94e60f76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=959e94e60f76
Modified Files:
sql/common/sql_list.c
sql/include/sql_catalog.h
sql/server/rel_optimizer.c
sql/server/rel_propagate.c
sql/server/sql_partition.c
sql/storage/sql_catalog.c
sql/storage/store.c

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

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

Merged with Jun2020


diffs (219 lines):

diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -732,7 +732,7 @@ extern sql_idx *sql_trans_find_idx(sql_t
 
 extern sql_column *find_sql_column(sql_table *t, const char *cname);
 
-extern sql_part *find_sql_part(sql_table *t, const char *tname);
+extern sql_part *find_sql_part_id(sql_table *t, sqlid id);
 
 extern sql_table *find_sql_table(sql_schema *s, const char *tname);
 extern sql_table *find_sql_table_id(sql_schema *s, sqlid id);
diff --git a/sql/server/rel_distribute.c b/sql/server/rel_distribute.c
--- a/sql/server/rel_distribute.c
+++ b/sql/server/rel_distribute.c
@@ -81,7 +81,7 @@ static sql_rel *
 rewrite_replica( mvc *sql, sql_rel *rel, sql_table *t, sql_part *pd, int 
remote_prop)
 {
node *n, *m;
-   sql_table *p = find_sql_table(t->s, pd->base.name);
+   sql_table *p = find_sql_table_id(t->s, pd->base.id);
sql_rel *r = rel_basetable(sql, p, t->base.name);
 
for (n = rel->exps->h, m = r->exps->h; n && m; n = n->next, m = 
m->next) {
@@ -197,7 +197,7 @@ replica(mvc *sql, sql_rel *rel, char *ur
/* replace by the replica which matches the uri 
*/
for (n = t->members.set->h; n; n = n->next) {
sql_part *p = n->data;
-   sql_table *pt = find_sql_table(t->s, 
p->base.name);
+   sql_table *pt = find_sql_table_id(t->s, 
p->base.id);
 
if (isRemote(pt) && strcmp(uri, 
pt->query) == 0) {
rel = rewrite_replica(sql, rel, 
t, p, 0);
@@ -210,7 +210,7 @@ replica(mvc *sql, sql_rel *rel, char *ur
sql_part *p;
for (n = t->members.set->h; n; n = 
n->next) {
sql_part *p = n->data;
-   sql_table *pt = 
find_sql_table(t->s, p->base.name);
+   sql_table *pt = 
find_sql_table_id(t->s, p->base.id);
 
if (!isRemote(pt)) {
fnd = 1;
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
@@ -8940,7 +8940,7 @@ rel_merge_table_rewrite(visitor *v, sql_
 
for (node *nt = t->members.set->h; nt; 
nt = nt->next) {
sql_part *pd = nt->data;
-   sql_table *pt = 
find_sql_table(t->s, pd->base.name);
+   sql_table *pt = 
find_sql_table_id(t->s, pd->base.id);
sql_rel *prel = 
rel_basetable(v->sql, pt, tname), *bt = NULL;
int skip = 0;
list *exps = NULL;
diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c
--- a/sql/server/rel_propagate.c
+++ b/sql/server/rel_propagate.c
@@ -268,7 +268,7 @@ propagate_validation_to_upper_tables(sql
 {
mvc *sql = query->sql;
for (sql_table *prev = mt, *it = prev->p ; it && prev ; prev = it, it = 
it->p) {
-   sql_part *spt = find_sql_part(it, prev->base.name);
+   sql_part *spt = find_sql_part_id(it, prev->base.id);
if (spt) {
if (isRangePartitionTable(it)) {
int tpe = spt->tpe.type->localtype;
@@ -581,7 +581,7 @@ rel_generate_subdeletes(mvc *sql, sql_re
 
for (node *n = t->members.set->h; n; n = n->next) {
sql_part *pt = (sql_part *) n->data;
-   sql_table *sub = find_sql_table(t->s, pt->base.name);
+   sql_table *sub = find_sql_table_id(t->s, pt->base.id);
sql_rel *s1, *dup = NULL;
 
if (!update_allowed(sql, sub, sub->base.name, 
is_delete(rel->op) ? "DELETE": "TRUNCATE",
@@ -615,7 +615,7 @@ rel_generate_subupdates(mvc *sql, sql_re
 
for (node *n = t->members.set->h; 

MonetDB: Oct2020-merged-Jun2020 - Fix some test output and use a...

2020-11-17 Thread Aris Koning
Changeset: 43efc5547600 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43efc5547600
Modified Files:
sql/backends/monet5/sql_round_impl.h
sql/server/sql_decimal.c
sql/test/SQLancer/Tests/sqlancer03.stable.err
sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: Oct2020-merged-Jun2020
Log Message:

Fix some test output and use a more convervative digit convention.


diffs (135 lines):

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
@@ -309,15 +309,13 @@ nil_2dec(TYPE *res, const void *val, con
 static inline str
 str_2dec_body(TYPE *res, const str val, const int d, const int sc)
 {
-   char *s;
+   char *s = val;
int digits;
int scale;
BIG value;
 
if (d < 0 || d >= (int) (sizeof(scales) / sizeof(scales[0])))
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", val, d, sc);
-
-   s = val;
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
 
int has_errors;
value = 0;
@@ -326,7 +324,7 @@ str_2dec_body(TYPE *res, const str val, 
 
value = decimal_from_str(s, , , _errors);
if (has_errors)
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", val, d, sc);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
 
// handle situations where the de facto scale is different from the 
formal scale.
if (scale < sc) {
diff --git a/sql/server/sql_decimal.c b/sql/server/sql_decimal.c
--- a/sql/server/sql_decimal.c
+++ b/sql/server/sql_decimal.c
@@ -60,12 +60,7 @@ fractional_sep_first_opp:
// skip leading zeros in preceding digits, e.g. '0004563.1234' 
=> '4563.1234'
dec++;
if (*dec == '.') {
-   if (dec[1] == 0) { // special case: '(0...0)0.'. We 
give this expression precision (1,0).
-   _digits = 1;
-   dec++;
-   goto end_state;
-   }
-
+   _digits = 1; // case: 0.xyz the zero. the single 
preceding zero counts for one digit by convention.
goto fractional_sep_first_opp;
}
}
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
@@ -11,7 +11,7 @@ ERROR = !Wrong format (11313451898)
 CODE  = 42000
 MAPI  = (monetdb) /var/tmp/mtest-71583/.s.monetdb.38304
 QUERY = select cast(group_concat(all r'0.5787210717348131') as decimal) from 
t0 group by - (abs(- (- (1061572565, least(t0.c0, least(cast(0.09300166 as 
int), t0.c0));
-ERROR = !Rounding of decimal 
(0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131)
 doesn't fit format (18.3)
+ERROR = !Decimal 
(0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131,0.5787210717348131)
 doesn't have format (18.3)
 CODE  = 42000
 MAPI  = (monetdb) /var/tmp/mtest-608035/.s.monetdb.30116
 QUERY = SELECT ALL least(MIN(ALL CAST('0.3' AS TIME)), COALESCE 
(CAST("second"(TIMESTAMP '1970-01-19 08:50:25') AS TIME), CAST(TIME '13:00:42' 
AS TIME))), t0.c0 FROM t0
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out 
b/sql/test/SQLancer/Tests/sqlancer03.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer03.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out
@@ -43,8 +43,8 @@ stdout of test 'sqlancer03` in directory
 #CREATE TABLE "sys"."t0" ("c0" BOOLEAN NOT NULL,"c1" BIGINT,CONSTRAINT 
"t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0"));
 #create view v0(c0, c1, c2) as (select all 2.020551048E9, 0.16688174, 
0.373226221729 from t0 where t0.c0) with check option;
 #SELECT sql_min(sql_max(NULL, ''), '') FROM v0 LEFT OUTER JOIN t0 ON true;
-% .%12 # table_name
-% %12 # name
+% .%1 # table_name
+% %1 # name
 % char # type
 % 0 # length
 #SELECT sql_min(sql_max(NULL, ''), '');
@@ -55,8 +55,8 @@ stdout of test 'sqlancer03` in directory
 [ NULL ]
 #SELECT ALL length(upper(MIN(ALL CAST(((trim(CAST(r'' AS STRING(659)), 
CAST(r'o3%+i]抔DCöf▟nßOpNbybಜ7' AS STRING)))||(sql_min(sql_max(NULL, r''), 
splitpart(r'x', r',7+.', t0.c1 AS STRING(151), 0.4179268710155164 
 #FROM v0 LEFT OUTER JOIN t0 ON NOT (t0.c0) WHERE t0.c0 

MonetDB: Oct2020-merged-Jun2020 - Approve test due to corrected ...

2020-11-17 Thread Aris Koning
Changeset: da4c2f4c61bb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da4c2f4c61bb
Modified Files:
sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.stable.out
Branch: Oct2020-merged-Jun2020
Log Message:

Approve test due to corrected decimal string length.


diffs (12 lines):

diff --git 
a/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.stable.out 
b/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.stable.out
--- a/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.stable.out
+++ b/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.stable.out
@@ -37,7 +37,7 @@ stdout of test 'prepare_decimal_bug.SF-2
 % sys.test2831994, sys.test2831994,sys.test2831994 # table_name
 % id,  value,  value2 # name
 % bigint,  decimal,decimal # type
-% 1,   7,  7 # length
+% 1,   8,  8 # length
 #drop table test2831994;
 
 # 19:40:00 >  
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020-merged-Jun2020 - Merge with Oct2020.

2020-11-17 Thread Aris Koning
Changeset: 39963bbe1a36 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=39963bbe1a36
Branch: Oct2020-merged-Jun2020
Log Message:

Merge with Oct2020.


diffs (232 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -6523,6 +6523,7 @@ stdout of test 'MAL-signatures` in direc
 [ "batudf","fuse", "command batudf.fuse(X_1:bat[:int], 
X_2:bat[:int]):bat[:lng] ", "UDFBATfuse;",  ""  ]
 [ "batudf","fuse", "command batudf.fuse(X_1:bat[:sht], 
X_2:bat[:sht]):bat[:int] ", "UDFBATfuse;",  ""  ]
 [ "batudf","reverse",  "command 
batudf.reverse(X_1:bat[:str]):bat[:str] ", "UDFBATreverse;",   ""  ]
+[ "batuuid",   "new",  "unsafe command batuuid.new(X_1:bat[:int]):bat[:uuid] 
","UUIDgenerateUuidInt_bulk;",""  ]
 [ "batxml","attribute","command batxml.attribute(X_1:str, 
X_2:bat[:str]):bat[:xml] ",  "BATXMLattribute;", ""  ]
 [ "batxml","comment",  "command 
batxml.comment(X_1:bat[:str]):bat[:xml] ", "BATXMLcomment;",   ""  ]
 [ "batxml","concat",   "command batxml.concat(X_1:bat[:xml], 
X_2:bat[:xml]):bat[:xml] ",   "BATXMLconcat;",""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -9124,6 +9124,7 @@ stdout of test 'MAL-signatures` in direc
 [ "batudf","fuse", "command batudf.fuse(X_1:bat[:lng], 
X_2:bat[:lng]):bat[:hge] ", "UDFBATfuse;",  ""  ]
 [ "batudf","fuse", "command batudf.fuse(X_1:bat[:sht], 
X_2:bat[:sht]):bat[:int] ", "UDFBATfuse;",  ""  ]
 [ "batudf","reverse",  "command 
batudf.reverse(X_1:bat[:str]):bat[:str] ", "UDFBATreverse;",   ""  ]
+[ "batuuid",   "new",  "unsafe command batuuid.new(X_1:bat[:int]):bat[:uuid] 
","UUIDgenerateUuidInt_bulk;",""  ]
 [ "batxml","attribute","command batxml.attribute(X_1:str, 
X_2:bat[:str]):bat[:xml] ",  "BATXMLattribute;", ""  ]
 [ "batxml","comment",  "command 
batxml.comment(X_1:bat[:str]):bat[:xml] ", "BATXMLcomment;",   ""  ]
 [ "batxml","concat",   "command batxml.concat(X_1:bat[:xml], 
X_2:bat[:xml]):bat[:xml] ",   "BATXMLconcat;",""  ]
diff --git a/clients/mapiclient/ReadlineTools.c 
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -312,7 +312,7 @@ invoke_editor(int cnt, int key) {
char editor_command[BUFFER_SIZE];
char *read_buff = NULL;
char *editor = NULL;
-   FILE *fp;
+   FILE *fp = NULL;
size_t content_len;
size_t read_bytes, idx;
 #ifdef WIN32
diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c
--- a/monetdb5/modules/atoms/uuid.c
+++ b/monetdb5/modules/atoms/uuid.c
@@ -189,22 +189,9 @@ UUIDcompare(const void *L, const void *R
 #endif
 }
 
-static str
-#ifdef HAVE_HGE
-UUIDgenerateUuid(uuid *retval)
-#else
-UUIDgenerateUuid(uuid **retval)
-#endif
+static inline void
+UUIDgenerateUuid_internal(uuid *u)
 {
-   uuid *u;
-
-#ifdef HAVE_HGE
-   u = retval;
-#else
-   if (*retval == NULL && (*retval = GDKmalloc(UUID_SIZE)) == NULL)
-   throw(MAL, "uuid.new", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-   u = *retval;
-#endif
 #ifdef HAVE_UUID
uuid_generate(u->u);
 #else
@@ -226,6 +213,25 @@ UUIDgenerateUuid(uuid **retval)
/* make sure this is version 4 (random UUID) */
u->u[6] = (u->u[6] & 0x0F) | 0x40;
 #endif
+}
+
+static str
+#ifdef HAVE_HGE
+UUIDgenerateUuid(uuid *retval)
+#else
+UUIDgenerateUuid(uuid **retval)
+#endif
+{
+   uuid *u;
+
+#ifdef HAVE_HGE
+   u = retval;
+#else
+   if (*retval == NULL && (*retval = GDKmalloc(UUID_SIZE)) == NULL)
+   throw(MAL, "uuid.new", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   u = *retval;
+#endif
+   UUIDgenerateUuid_internal(u);
return MAL_SUCCEED;
 }
 
@@ -241,6 +247,42 @@ UUIDgenerateUuidInt(uuid **retval, int *
 }
 
 static str
+UUIDgenerateUuidInt_bulk(bat *ret, const bat *bid)
+{
+   BAT *b = NULL, *bn = NULL;
+   BUN n = 0;
+   str msg = MAL_SUCCEED;
+   uuid *restrict bnt = NULL;
+
+   if ((b = BATdescriptor(*bid)) == NULL)  {
+   msg = createException(MAL, "uuid.generateuuidint_bulk", 
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
+   goto bailout;
+   }
+   n = BATcount(b);
+   if ((bn = COLnew(b->hseqbase, TYPE_uuid, n, TRANSIENT)) == NULL) {
+   msg = createException(MAL, "uuid.generateuuidint_bulk", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   goto bailout;
+   }
+   bnt = Tloc(bn, 0);
+   for (BUN i = 0 ; i < n ; i++)
+   

MonetDB: Oct2020-merged-Jun2020 - Fix some compilation issue's a...

2020-11-17 Thread Aris Koning
Changeset: a97854b56227 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a97854b56227
Modified Files:
sql/backends/monet5/sql_round_impl.h
sql/server/sql_parser.y
Branch: Oct2020-merged-Jun2020
Log Message:

Fix some compilation issue's and small differences.


diffs (110 lines):

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
@@ -314,10 +314,10 @@ str_2dec_body(TYPE *res, const str val, 
int scale;
BIG value;
 
-   if (*d < 0 || *d >= (int) (sizeof(scales) / sizeof(scales[0])))
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
+   if (d < 0 || d >= (int) (sizeof(scales) / sizeof(scales[0])))
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", val, d, sc);
 
-   s = *val;
+   s = val;
 
int has_errors;
value = 0;
@@ -326,25 +326,25 @@ str_2dec_body(TYPE *res, const str val, 
 
value = decimal_from_str(s, , , _errors);
if (has_errors)
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", val, d, sc);
 
// handle situations where the de facto scale is different from the 
formal scale.
-   if (scale < *sc) {
+   if (scale < sc) {
/* the current scale is too small, increase it by adding 0's */
-   int dff = *sc - scale;  /* CANNOT be 0! */
+   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);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", s, d, sc);
 
value *= scales[dff];
scale += dff;
digits += dff;
-   } else if (scale > *sc) {
+   } else if (scale > sc) {
/* 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 */
+   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);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", s, d, sc);
 
BIG rnd = scales[dff] >> 1;
 
@@ -355,13 +355,11 @@ str_2dec_body(TYPE *res, const str val, 
value /= scales[dff];
scale -= dff;
digits -= dff;
-   if (value >= scales[*d] || value <= -scales[*d]) {
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
-   }
+   if (value >= scales[d] || value <= -scales[d])
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", s, d, sc);
}
-   if (value <= -scales[*d] || value >= scales[*d]) {
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
-   }
+   if (value <= -scales[d] || value >= scales[d])
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
*res = (TYPE) value;
return MAL_SUCCEED;
 }
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -4719,30 +4719,27 @@ literal:
 
if (!has_errors && digits <= MAX_DEC_DIGITS) {
// The float-like value seems to fit in decimal 
storage
-   double val = strtod($1,NULL);
sql_find_subtype(, "decimal", digits, scale );
-   $$ = _newAtomNode( atom_dec(SA, , value, 
val));
+   $$ = _newAtomNode( atom_dec(SA, , value));
}
else {
/*
-* The float-like value either doesn't fit in 
integer decimal storage
-* or it is not a valid float representation.
-*/
+   * The float-like value either doesn't fit in 
integer decimal storage
+   * or it is not a valid float 

MonetDB: Oct2020-merged-Jun2020 - Fixing testweb: Remove unused ...

2020-11-17 Thread Aris Koning
Changeset: ac0beda2fb13 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac0beda2fb13
Modified Files:
sql/server/sql_decimal.c
Branch: Oct2020-merged-Jun2020
Log Message:

Fixing testweb: Remove unused function.


diffs (11 lines):

diff --git a/sql/server/sql_decimal.c b/sql/server/sql_decimal.c
--- a/sql/server/sql_decimal.c
+++ b/sql/server/sql_decimal.c
@@ -14,6 +14,7 @@
 DEC_TPE
 decimal_from_str(char *dec, int* digits, int* scale, int* has_errors)
 {
+
 #ifdef HAVE_HGE
 const hge max0 = GDK_hge_max / 10, max1 = GDK_hge_max % 10;
 #else
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020-merged-Jun2020 - Fix the use of decimal_from_st...

2020-11-17 Thread Aris Koning
Changeset: 66f98cecddf3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=66f98cecddf3
Modified Files:
sql/server/sql_decimal.c
sql/server/sql_parser.y
Branch: Oct2020-merged-Jun2020
Log Message:

Fix the use of decimal_from_str in bison.


diffs (60 lines):

diff --git a/sql/server/sql_decimal.c b/sql/server/sql_decimal.c
--- a/sql/server/sql_decimal.c
+++ b/sql/server/sql_decimal.c
@@ -69,8 +69,10 @@ fractional_sep_first_opp:
}
}
for (; *dec && (isdigit((unsigned char) *dec)); dec++) {
-   if (res > max0 || (res == max0 && *dec - '0' > max1))
-   break;
+   if (res > max0 || (res == max0 && *dec - '0' > max1)) {
+   *has_errors = 1;
+   return 0;
+   }
res *= 10;
res += *dec - '0';
_digits++;
@@ -86,8 +88,10 @@ trailing_digits:
if (!isdigit((unsigned char) *dec))
goto trailing_whitespace;
for (; *dec && (isdigit((unsigned char) *dec)); dec++) {
-   if (res > max0 || (res == max0 && *dec - '0' > max1))
-   break;
+   if (res > max0 || (res == max0 && *dec - '0' > max1)) {
+   *has_errors = 1;
+   return 0;
+   }
res *= 10;
res += *dec - '0';
_scale++;
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -4717,21 +4717,17 @@ literal:
 
DEC_TPE value = decimal_from_str(s, , , 
_errors);
 
-   if (has_errors) {
-   char *msg = sql_message(SQLSTATE(22003) "Double 
value too large or not a number (%s)", $1);
-
-   yyerror(m, msg);
-   _DELETE(msg);
-   $$ = NULL;
-   YYABORT;
-   }
-
-   if (digits <= MAX_DEC_DIGITS) {
+   if (!has_errors) {
+   // The float-like value seems to fit in decimal 
storage
double val = strtod($1,NULL);
sql_find_subtype(, "decimal", digits, scale );
$$ = _newAtomNode( atom_dec(SA, , value, 
val));
}
else {
+   /*
+* The float-like value either doesn't fit in 
integer decimal storage
+* or it is not a valid float representation.
+*/
char *p = $1;
double val;
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020-merged-Jun2020 - Fixing decimals:

2020-11-17 Thread Aris Koning
Changeset: 3724c13593dd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3724c13593dd
Modified Files:
sql/backends/monet5/sql_result.c
sql/server/sql_decimal.c
sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out
sql/test/BugTracker-2014/Tests/number_4_4.Bug-3543.stable.out
sql/test/Tests/decimal2.stable.out
sql/test/mapi/Tests/sql_dec38.stable.out.int128
sql/test/pg_regress/Tests/numeric.stable.err
sql/test/pg_regress/Tests/numeric.stable.out.int128
Branch: Oct2020-merged-Jun2020
Log Message:

Fixing decimals:
- Length must be based on output instead of input length.
- Fix test results.


diffs (200 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1888,6 +1888,8 @@ get_print_width(int mtype, sql_class ecl
count = 1 + digits;
if (scale > 0)
count += 1;
+   if (scale == digits) // for preceding 0, e.g. 0.
+   count += 1;
return count;
} else if (eclass == EC_DATE) {
return 10;
diff --git a/sql/server/sql_decimal.c b/sql/server/sql_decimal.c
--- a/sql/server/sql_decimal.c
+++ b/sql/server/sql_decimal.c
@@ -47,7 +47,6 @@ decimal_from_str(char *dec, int* digits,
if (*dec == '.') {  // case: (+|-).456
 fractional_sep_first_opp:
dec++;
-   _digits++; // add one to digits for single implicit preceding 
0, e.g. (+|-)0.456
goto trailing_digits;
}
 
@@ -57,10 +56,17 @@ fractional_sep_first_opp:
goto end_state;
}
while (*dec == '0'){
-   // skip leading zeros in preceding digits.
+   // skip leading zeros in preceding digits, e.g. '0004563.1234' 
=> '4563.1234'
dec++;
-   if (*dec == '.')
+   if (*dec == '.') {
+   if (dec[1] == 0) { // special case: '(0...0)0.'. We 
give this expression precision (1,0).
+   _digits = 1;
+   dec++;
+   goto end_state;
+   }
+
goto fractional_sep_first_opp;
+   }
}
for (; *dec && (isdigit((unsigned char) *dec)); dec++) {
if (res > max0 || (res == max0 && *dec - '0' > max1))
diff --git 
a/sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out 
b/sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out
--- a/sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out
+++ b/sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out
@@ -59,7 +59,7 @@ stdout of test 'copy-into-decimal.Bug-32
 % sys.test3265 # table_name
 % x # name
 % decimal # type
-% 11 # length
+% 12 # length
 [ 0.123456789  ]
 [ 0.123456789  ]
 #rollback;
diff --git a/sql/test/BugTracker-2014/Tests/number_4_4.Bug-3543.stable.out 
b/sql/test/BugTracker-2014/Tests/number_4_4.Bug-3543.stable.out
--- a/sql/test/BugTracker-2014/Tests/number_4_4.Bug-3543.stable.out
+++ b/sql/test/BugTracker-2014/Tests/number_4_4.Bug-3543.stable.out
@@ -35,7 +35,7 @@ stdout of test 'number_4_4.Bug-3543` in 
 % sys.fract_only,  sys.fract_only # table_name
 % id,  val # name
 % int, decimal # type
-% 1,   6 # length
+% 1,   7 # length
 [ 1,   -0. ]
 [ 2,   0.  ]
 [ 3,   0.  ]
@@ -43,7 +43,7 @@ stdout of test 'number_4_4.Bug-3543` in 
 % sys.fract_only,  sys.fract_only # table_name
 % id,  val # name
 % int, decimal # type
-% 1,   6 # length
+% 1,   7 # length
 [ 1,   -0. ]
 [ 2,   0.  ]
 [ 3,   0.  ]
@@ -51,7 +51,7 @@ stdout of test 'number_4_4.Bug-3543` in 
 % sys.fract_only,  sys.fract_only # table_name
 % id,  val # name
 % int, decimal # type
-% 1,   6 # length
+% 1,   7 # length
 [ 1,   -0. ]
 [ 2,   0.  ]
 [ 3,   0.  ]
@@ -59,7 +59,7 @@ stdout of test 'number_4_4.Bug-3543` in 
 % sys.fract_only,  sys.fract_only # table_name
 % id,  val # name
 % int, decimal # type
-% 1,   6 # length
+% 1,   7 # length
 [ 1,   -0. ]
 [ 2,   0.  ]
 [ 3,   0.  ]
diff --git a/sql/test/Tests/decimal2.stable.out 
b/sql/test/Tests/decimal2.stable.out
--- a/sql/test/Tests/decimal2.stable.out
+++ b/sql/test/Tests/decimal2.stable.out
@@ -33,25 +33,25 @@ stdout of test 'decimal2` in directory '
 % .%2 # table_name
 % %2 # name
 % decimal # type
-% 4 # length
+% 5 # length
 [ 0.01 ]
 #select .1;
 % .%2 # table_name
 % %2 # name
 % decimal # type
-% 3 # length
+% 4 # length
 [ 0.1  ]
 #select .10;
 % .%2 # table_name
 % %2 # name
 % decimal # type
-% 4 # length
+% 5 # length
 [ 0.10 ]
 #select 01.0;
 % .%2 # table_name
 % %2 # name
 % decimal # type
-% 5 # length
+% 4 # length
 [ 1.0  ]
 #select 10.0;
 % .%2 # table_name
diff --git 

MonetDB: Oct2020-merged-Jun2020 - Stricter decimal parsing.

2020-11-17 Thread Aris Koning
Changeset: eacb1f23e00e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eacb1f23e00e
Modified Files:
sql/backends/monet5/sql_round_impl.h
sql/server/sql_decimal.c
sql/server/sql_decimal.h
sql/server/sql_parser.y
Branch: Oct2020-merged-Jun2020
Log Message:

Stricter decimal parsing.


diffs (truncated from 317 to 300 lines):

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
@@ -309,48 +309,42 @@ nil_2dec(TYPE *res, const void *val, con
 static inline str
 str_2dec_body(TYPE *res, const str val, const int d, const int sc)
 {
-   char *s = val;
-   char *dot, *end;
+   char *s;
int digits;
int scale;
BIG value;
 
-   dot = strchr(s, '.');
-   if (dot != NULL) {
-   s = strip_extra_zeros(s);
-   digits = _strlen(s) - 1;
-   scale = _strlen(dot + 1);
-   } else {
-   digits = _strlen(s);
-   scale = 0;
-   }
-   end = NULL;
+   if (*d < 0 || *d >= (int) (sizeof(scales) / sizeof(scales[0])))
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
+
+   s = *val;
+
+   int has_errors;
value = 0;
 
-   if (digits < 0)
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
-   if (d < 0 || (size_t) d >= sizeof(scales) / sizeof(scales[0]))
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
+   // s = strip_extra_zeros(s);
+
+   value = decimal_from_str(s, , , _errors);
+   if (has_errors)
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
 
-   value = decimal_from_str(s, );
-   if (*s == '+' || *s == '-')
-   digits--;
-   if (scale < sc) {
+   // handle situations where the de facto scale is different from the 
formal scale.
+   if (scale < *sc) {
/* the current scale is too small, increase it by adding 0's */
-   int dff = sc - scale;   /* CANNOT be 0! */
+   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)", s, d, sc);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
 
value *= scales[dff];
scale += dff;
digits += dff;
-   } else if (scale > sc) {
+   } else if (scale > *sc) {
/* 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 */
+   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)", s, d, sc);
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
 
BIG rnd = scales[dff] >> 1;
 
@@ -361,11 +355,13 @@ str_2dec_body(TYPE *res, const str val, 
value /= scales[dff];
scale -= dff;
digits -= dff;
-   if (value >= scales[d] || value <= -scales[d])
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", s, d, sc);
+   if (value >= scales[*d] || value <= -scales[*d]) {
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Rounding of 
decimal (%s) doesn't fit format (%d.%d)", *val, *d, *sc);
+   }
}
-   if (value <= -scales[d] || value >= scales[d]  || *end)
-   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", s, d, sc);
+   if (value <= -scales[*d] || value >= scales[*d]) {
+   throw(SQL, STRING(TYPE), SQLSTATE(42000) "Decimal (%s) doesn't 
have format (%d.%d)", *val, *d, *sc);
+   }
*res = (TYPE) value;
return MAL_SUCCEED;
 }
diff --git a/sql/server/sql_decimal.c b/sql/server/sql_decimal.c
--- a/sql/server/sql_decimal.c
+++ b/sql/server/sql_decimal.c
@@ -10,46 +10,97 @@
 
 #include "sql_decimal.h"
 
-#ifdef HAVE_HGE
-hge
-#else
-lng
-#endif
-decimal_from_str(char *dec, char **end)
+
+DEC_TPE
+decimal_from_str(char *dec, int* digits, int* scale, int* has_errors)
 {
 #ifdef HAVE_HGE
-   hge res = 0;
-   const hge max0 = GDK_hge_max / 10, max1 = GDK_hge_max % 10;
+const hge max0 

MonetDB: Oct2020-merged-Jun2020 - Temporary branch.

2020-11-17 Thread Aris Koning
Changeset: 1adeea5afa2e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1adeea5afa2e
Branch: Oct2020-merged-Jun2020
Log Message:

Temporary branch.

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


MonetDB: Oct2020 - merged with Jun2020

2020-11-03 Thread Niels Nes
Changeset: 5f8e2e0f6c80 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f8e2e0f6c80
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_scenario.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: Oct2020
Log Message:

merged with Jun2020


diffs (264 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -1597,7 +1597,7 @@ str
 mvc_append_column(sql_trans *t, sql_column *c, BAT *ins)
 {
int res = store_funcs.append_col(t, c, ins, TYPE_bat);
-   if (res != 0)
+   if (res != LOG_OK)
throw(SQL, "sql.append", SQLSTATE(42000) "Cannot append 
values");
return MAL_SUCCEED;
 }
@@ -1653,7 +1653,7 @@ mvc_append_wrap(Client cntxt, MalBlkPtr 
const char *tname = *getArgReference_str(stk, pci, 3);
const char *cname = *getArgReference_str(stk, pci, 4);
ptr ins = getArgReference(stk, pci, 5);
-   int tpe = getArgType(mb, pci, 5);
+   int tpe = getArgType(mb, pci, 5), err = 0;
sql_schema *s;
sql_table *t;
sql_column *c;
@@ -1688,12 +1688,15 @@ mvc_append_wrap(Client cntxt, MalBlkPtr 
if( b && BATcount(b) > 4096 && !b->batTransient)
BATmsync(b);
if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
-   store_funcs.append_col(m->session->tr, c, ins, tpe);
+   if (store_funcs.append_col(m->session->tr, c, ins, tpe) != 
LOG_OK)
+   err = 1;
} else if (cname[0] == '%') {
sql_idx *i = mvc_bind_idx(m, s, cname + 1);
-   if (i)
-   store_funcs.append_idx(m->session->tr, i, ins, tpe);
-   }
+   if (i && store_funcs.append_idx(m->session->tr, i, ins, tpe) != 
LOG_OK)
+   err = 1;
+   }
+   if (err)
+   throw(SQL, "sql.append", SQLSTATE(42S02) "append failed");
if (b) {
BBPunfix(b->batCacheid);
}
@@ -1713,7 +1716,7 @@ mvc_update_wrap(Client cntxt, MalBlkPtr 
bat Tids = *getArgReference_bat(stk, pci, 5);
bat Upd = *getArgReference_bat(stk, pci, 6);
BAT *tids, *upd;
-   int tpe = getArgType(mb, pci, 6);
+   int tpe = getArgType(mb, pci, 6), err = 0;
sql_schema *s;
sql_table *t;
sql_column *c;
@@ -1755,14 +1758,17 @@ mvc_update_wrap(Client cntxt, MalBlkPtr 
if( tids && BATcount(tids) > 4096 && !tids->batTransient)
BATmsync(tids);
if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
-   store_funcs.update_col(m->session->tr, c, tids, upd, TYPE_bat);
+   if (store_funcs.update_col(m->session->tr, c, tids, upd, 
TYPE_bat) != LOG_OK)
+   err = 1;
} else if (cname[0] == '%') {
sql_idx *i = mvc_bind_idx(m, s, cname + 1);
-   if (i)
-   store_funcs.update_idx(m->session->tr, i, tids, upd, 
TYPE_bat);
+   if (i && store_funcs.update_idx(m->session->tr, i, tids, upd, 
TYPE_bat) != LOG_OK)
+   err = 1;
}
BBPunfix(tids->batCacheid);
BBPunfix(upd->batCacheid);
+   if (err)
+   throw(SQL, "sql.update", SQLSTATE(42S02) "update failed");
return MAL_SUCCEED;
 }
 
@@ -1789,6 +1795,8 @@ mvc_clear_table_wrap(Client cntxt, MalBl
if (t == NULL)
throw(SQL, "sql.clear_table", SQLSTATE(42S02) "Table missing 
%s.%s", sname,tname);
*res = mvc_clear_table(m, t);
+   if (*res == BUN_NONE)
+   throw(SQL, "sql.clear_table", SQLSTATE(42S02) "clear failed");
return MAL_SUCCEED;
 }
 
@@ -1836,7 +1844,8 @@ mvc_delete_wrap(Client cntxt, MalBlkPtr 
}
if( b && BATcount(b) > 4096 && !b->batTransient)
BATmsync(b);
-   store_funcs.delete_tab(m->session->tr, t, b, tpe);
+   if (store_funcs.delete_tab(m->session->tr, t, b, tpe) != LOG_OK)
+   throw(SQL, "sql.delete", SQLSTATE(3F000) "delete failed");
if (b)
BBPunfix(b->batCacheid);
return MAL_SUCCEED;
@@ -4061,7 +4070,7 @@ vacuum(Client cntxt, MalBlkPtr mb, MalSt
bat bid;
BAT *b, *del;
node *o;
-   int i, bids[2049];
+   int i, bids[2049], err = 0;
 
if ((msg = getSQLContext(cntxt, mb, , NULL)) != NULL)
return msg;
@@ -4126,17 +4135,21 @@ vacuum(Client cntxt, MalBlkPtr mb, MalSt
}
BBPunfix(del->batCacheid);
 
-   mvc_clear_table(m, t);
+   if (mvc_clear_table(m, t) == BUN_NONE)
+   throw(SQL, name, SQLSTATE(42000) "vacumm: clear failed");
for (o = t->columns.set->h, i = 0; o; o = o->next, i++) {
sql_column *c = o->data;
BAT *ins = BATdescriptor(bids[i]);  /* use the insert bat */
 
   

MonetDB: Oct2020 - merged

2020-10-26 Thread Niels Nes
Changeset: cb4cf60c9979 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb4cf60c9979
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Oct2020
Log Message:

merged


diffs (11 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2823,7 +2823,6 @@ update_table(sql_trans *tr, sql_table *f
if (ATOMIC_GET(_nr_active) == 1 || 
(ci->base.wtime && ci->base.allocated)) {
if (ATOMIC_GET(_nr_active) > 1 && 
ci->data) { /* move delta */
sql_delta *b = ci->data;
-   //sql_idx *oldi = NULL;
 
if (!oi->data)
oi->base.allocated = 
ci->base.allocated;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged with jun2020

2020-10-23 Thread Niels Nes
Changeset: 38a19ef1a11f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38a19ef1a11f
Modified Files:
sql/storage/store.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (47 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2199,10 +2199,13 @@ flusher_should_run(void)
char *reason_to = NULL, *reason_not_to = NULL;
int changes;
 
+   if (logger_funcs.changes() >= 100)
+   ATOMIC_SET(_now, 1);
+
if (flusher.countdown_ms <= 0)
reason_to = "timer expired";
 
-   int many_changes = GDKdebug & FORCEMITOMASK ? 100 : 100;
+   int many_changes = GDKdebug & FORCEMITOMASK ? 100 : 10;
if ((changes = logger_funcs.changes()) >= many_changes)
reason_to = "many changes";
else if (changes == 0)
@@ -2330,7 +2333,8 @@ store_apply_deltas(bool not_locked)
 void
 store_flush_log(void)
 {
-   ATOMIC_SET(_now, 1);
+   if (logger_funcs.changes() >= 100)
+   ATOMIC_SET(_now, 1);
 }
 
 /* Call while holding bs_lock */
@@ -7603,9 +7607,18 @@ sql_session_reset(sql_session *s, int ac
 int
 sql_trans_begin(sql_session *s)
 {
+   const int sleeptime = GDKdebug & FORCEMITOMASK ? 10 : 50;
+
sql_trans *tr = s->tr;
int snr = tr->schema_number;
 
+   /* add wait when flush is realy needed */
+   while (ATOMIC_GET(_now)) {
+   MT_lock_unset(_lock);
+   MT_sleep_ms(sleeptime);
+   MT_lock_set(_lock);
+   }
+
TRC_DEBUG(SQL_STORE, "Enter sql_trans_begin for transaction: %d\n", 
snr);
if (tr->parent && tr->parent == gtrans &&
(tr->stime < gtrans->wstime || tr->wtime ||
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged with jun2020

2020-10-23 Thread Niels Nes
Changeset: 2ec2529d51c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ec2529d51c9
Modified Files:
sql/backends/monet5/sql_optimizer.c
Branch: Oct2020
Log Message:

merged with jun2020


diffs (74 lines):

diff --git a/sql/backends/monet5/sql_optimizer.c 
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -29,33 +29,17 @@ static lng
 SQLgetColumnSize(sql_trans *tr, sql_column *c, int access)
 {
lng size = 0;
-   BAT *b;
+
switch(access){
-   case 0:
-   b= store_funcs.bind_col(tr, c, RDONLY);
-   if (b) {
-   size += getBatSpace(b);
-   BBPunfix(b->batCacheid);
-   }
+   case 0: /* Read only */
+   size = store_funcs.count_col(tr, c, 1);
break;
-   case 1:
-   b = store_funcs.bind_col(tr, c, RD_INS);
-   if (b) {
-   size+= getBatSpace(b);
-   BBPunfix(b->batCacheid);
-   }
+   case 1: /* inserts */
+   size = store_funcs.count_col(tr, c, 0);
break;
-   case 2:
-   b = store_funcs.bind_col(tr, c, RD_UPD_VAL);
-   if (b) {
-   size += getBatSpace(b);
-   BBPunfix(b->batCacheid);
-   }
-   b = store_funcs.bind_col(tr, c, RD_UPD_ID);
-   if (b) {
-   size+= getBatSpace(b);
-   BBPunfix(b->batCacheid);
-   }
+   case 2: /* updates */
+   size = store_funcs.count_col_upd(tr, c);
+   break;
}
return size;
 }
@@ -118,24 +102,16 @@ SQLgetSpace(mvc *m, MalBlkPtr mb, int pr
char *idxname = getVarConstant(mb, getArg(p, 3 + 
p->retc)).val.sval;
int access = getVarConstant(mb, getArg(p, 4 + 
p->retc)).val.ival;
sql_schema *s = mvc_bind_schema(m, sname);
-   BAT *b;
 
if (getFunctionId(p) == bindidxRef) {
sql_idx *i = mvc_bind_idx(m, s, idxname);
 
if (i && (!isRemote(i->t) && 
!isMergeTable(i->t))) {
-   b = store_funcs.bind_idx(tr, i, RDONLY);
-   if (b) {
-   space += (size =getBatSpace(b));
-   if (!size) {
-   sql_column *c = 
i->t->columns.set->h->data;
-   size = 
SQLgetColumnSize(tr, c, access);
-   }
+   sql_column *c = 
i->t->columns.set->h->data;
+   size = SQLgetColumnSize(tr, c, access);
 
-   if( !prepare && size == 0 && ! 
i->t->system){
-   setFunctionId(p, 
emptybindidxRef);
-   }
-   BBPunfix(b->batCacheid);
+   if( !prepare && size == 0 && ! 
i->t->system){
+   setFunctionId(p, 
emptybindidxRef);
}
}
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged octbugs branch into Oct2020.

2020-10-19 Thread Sjoerd Mullender
Changeset: 4f1eed25027c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4f1eed25027c
Branch: Oct2020
Log Message:

Merged octbugs branch into Oct2020.


diffs (truncated from 87119 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -4717,9 +4717,6 @@ stdout of test 'MAL-signatures` in direc
 [ "batcalc",   "ifthenelse",   "pattern batcalc.ifthenelse(X_1:bit, X_2:any_1, 
X_3:bat[:any_1]):bat[:any_1] ", "CMDifthen;",   ""  ]
 [ "batcalc",   "ifthenelse",   "pattern batcalc.ifthenelse(X_1:bit, 
X_2:bat[:any_1], X_3:any_1):bat[:any_1] ", "CMDifthen;",   ""  ]
 [ "batcalc",   "ifthenelse",   "pattern batcalc.ifthenelse(X_1:bit, 
X_2:bat[:any_1], X_3:bat[:any_1]):bat[:any_1] ",   "CMDifthen;",   ""  ]
-[ "batcalc",   "index","command batcalc.index(X_1:bat[:str], 
X_2:bit):bat[:bte] ", "BATSTRindex_bte;", ""  ]
-[ "batcalc",   "index","command batcalc.index(X_1:bat[:str], 
X_2:bit):bat[:int] ", "BATSTRindex_int;", ""  ]
-[ "batcalc",   "index","command batcalc.index(X_1:bat[:str], 
X_2:bit):bat[:sht] ", "BATSTRindex_sht;", ""  ]
 [ "batcalc",   "int",  "pattern batcalc.int(X_1:bat[:bit]):bat[:int] ",
"CMDconvertsignal_int;",""  ]
 [ "batcalc",   "int",  "pattern batcalc.int(X_1:bat[:bit], 
X_2:bat[:oid]):bat[:int] ", "CMDconvertsignal_int;",""  ]
 [ "batcalc",   "int",  "pattern batcalc.int(X_1:bat[:bte]):bat[:int] ",
"CMDconvertsignal_int;",""  ]
@@ -5750,7 +5747,6 @@ stdout of test 'MAL-signatures` in direc
 [ "batcalc",   "str",  "pattern batcalc.str(X_1:int, X_2:int, X_3:int, 
X_4:int, X_5:bat[:any_1], X_6:int):bat[:str] ", "SQLbatstr_cast;",  ""  
]
 [ "batcalc",   "str_noerror",  "pattern 
batcalc.str_noerror(X_1:bat[:any]):bat[:str] ","CMDconvert_str;",  
""  ]
 [ "batcalc",   "str_noerror",  "pattern batcalc.str_noerror(X_1:bat[:any], 
X_2:bat[:oid]):bat[:str] ", "CMDconvert_str;",  ""  ]
-[ "batcalc",   "strings",  "command 
batcalc.strings(X_1:bat[:str]):bat[:str] ","BATSTRstrings;",   ""  ]
 [ "batcalc",   "sub_noerror",  "pattern batcalc.sub_noerror(X_1:bat[:bte], 
X_2:bat[:bte], X_3:bat[:oid], X_4:bat[:oid]):bat[:bte] ",   "CMDbatSUB;",   ""  
]
 [ "batcalc",   "sub_noerror",  "pattern batcalc.sub_noerror(X_1:bat[:bte], 
X_2:bat[:dbl], X_3:bat[:oid], X_4:bat[:oid]):bat[:dbl] ",   "CMDbatSUB;",   ""  
]
 [ "batcalc",   "sub_noerror",  "pattern batcalc.sub_noerror(X_1:bat[:bte], 
X_2:bat[:flt], X_3:bat[:oid], X_4:bat[:oid]):bat[:flt] ",   "CMDbatSUB;",   ""  
]
@@ -6083,18 +6079,6 @@ stdout of test 'MAL-signatures` in direc
 [ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:dbl], 
X_2:bat[:oid]):bat[:dbl] ","CMDscience_bat_log;",  ""  ]
 [ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt]):bat[:flt] ",   
"CMDscience_bat_log;",  ""  ]
 [ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt], 
X_2:bat[:oid]):bat[:flt] ","CMDscience_bat_log;",  ""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:dbl], 
X_2:bat[:dbl]):bat[:dbl] ","CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:dbl], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:dbl] ",  "CMDscience_bat_logbs;",""  
]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:dbl], X_2:dbl):bat[:dbl] 
",  "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:dbl], X_2:dbl, 
X_3:bat[:oid]):bat[:dbl] ",   "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt], 
X_2:bat[:flt]):bat[:flt] ","CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:flt] ",  "CMDscience_bat_logbs;",""  
]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt], X_2:flt):bat[:flt] 
",  "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:bat[:flt], X_2:flt, 
X_3:bat[:oid]):bat[:flt] ",   "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:dbl, X_2:bat[:dbl]):bat[:dbl] 
",  "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:dbl, X_2:bat[:dbl], 
X_3:bat[:oid]):bat[:dbl] ",   "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:flt, X_2:bat[:flt]):bat[:flt] 
",  "CMDscience_bat_logbs;",""  ]
-[ "batmmath",  "log",  "pattern batmmath.log(X_1:flt, X_2:bat[:flt], 
X_3:bat[:oid]):bat[:flt] ",   "CMDscience_bat_logbs;",""  ]
 [ "batmmath",  "log10","pattern 

MonetDB: Oct2020 - Merged with Jun2020

2020-10-15 Thread Pedro Ferreira
Changeset: b7c038257710 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b7c038257710
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (293 lines):

diff --git a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out 
b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
--- a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
+++ b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
@@ -32,14 +32,14 @@ stdout of test 'Bug_LargeQueries_6571_66
 # 18:48:54 >  
 
 Created table: tbl6693 Inserting rows. 3 rows inserted
-Script size is 296607
+Script size is 27960
 First test repeat 10 times
 Iteration: 1 2 3 4 5 6 7 8 9 10 
 Completed first test
 Second test repeat 10 times
 Iteration: 1 2 3 4 5 6 7 8 9 10 
 Completed second test
-Script size is 112838
+Script size is 1092
 Third test repeat 3 times
 Iteration: 1 2 3 
 Completed third test
diff --git a/sql/jdbc/tests/Tests/Test_PSsomeamount.stable.out 
b/sql/jdbc/tests/Tests/Test_PSsomeamount.stable.out
--- a/sql/jdbc/tests/Tests/Test_PSsomeamount.stable.out
+++ b/sql/jdbc/tests/Tests/Test_PSsomeamount.stable.out
@@ -27,17 +27,12 @@ stdout of test 'Test_PSsomeamount` in di
 0. truetrue
 1. Preparing and executing a unique statement
 0, true
-1000, true
-2000, true
-3000, true
-4000, true
-5000, true
-6000, true
-7000, true
-8000, true
-9000, true
+20, true
+40, true
+60, true
+80, true
 
-# 18:56:08 >  
-# 18:56:08 >  "Done."
-# 18:56:08 >  
+# 11:53:16 >  
+# 11:53:16 >  "Done."
+# 11:53:16 >  
 
diff --git a/sql/jdbc/tests/Tests/Test_Sbatching.stable.out 
b/sql/jdbc/tests/Tests/Test_Sbatching.stable.out
--- a/sql/jdbc/tests/Tests/Test_Sbatching.stable.out
+++ b/sql/jdbc/tests/Tests/Test_Sbatching.stable.out
@@ -24,234 +24,18 @@ stdout of test 'Test_Sbatching` in direc
 
 0. truetrue
 1. create...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch (400 inserts)...passed :)
-3. checking number of update counts...400 passed :)
-4. checking update counts (should all be 1)...passed :)
-2. executing batch 

MonetDB: Oct2020 - Merged with Jun2020

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

Merged with Jun2020


diffs (101 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -168,6 +168,8 @@ gdk_return GDKssort_rev(void *restrict h
 gdk_return GDKssort(void *restrict h, void *restrict t, const void *restrict 
base, size_t n, int hs, int ts, int tpe)
__attribute__((__warn_unused_result__))
__attribute__((__visibility__("hidden")));
+void GDKtracer_init(void)
+   __attribute__((__visibility__("hidden")));
 gdk_return GDKunlink(int farmid, const char *dir, const char *nme, const char 
*extension)
__attribute__((__visibility__("hidden")));
 void HASHfree(BAT *b)
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -9,6 +9,7 @@
 #include "monetdb_config.h"
 #include "gdk.h"
 #include "gdk_tracer.h"
+#include "gdk_private.h"
 
 #define DEFAULT_ADAPTER BASIC
 #define DEFAULT_LOG_LEVEL M_ERROR
@@ -143,6 +144,13 @@ set_level_for_layer(int layer, int lvl)
const char *tok = NULL;
log_level_t level = (log_level_t) lvl;
 
+   // make sure we initialize before changing the component level
+   MT_lock_set();
+   if (file_name[0] == 0) {
+   _GDKtracer_init_basic_adptr();
+   }
+   MT_lock_unset();
+
for (int i = 0; i < COMPONENTS_COUNT; i++) {
if (layer == MDB_ALL) {
lvl_per_component[i] = level;
@@ -286,6 +294,13 @@ GDKtracer_set_component_level(const char
return GDK_FAIL;
}
 
+   // make sure we initialize before changing the component level
+   MT_lock_set();
+   if (file_name[0] == 0) {
+   _GDKtracer_init_basic_adptr();
+   }
+   MT_lock_unset();
+
lvl_per_component[component] = level;
 
return GDK_SUCCEED;
@@ -400,6 +415,17 @@ GDKtracer_reset_adapter(void)
return GDK_SUCCEED;
 }
 
+static bool add_ts;/* add timestamp to error message to stderr */
+
+void
+GDKtracer_init(void)
+{
+#ifdef _MSC_VER
+   add_ts = GetFileType(GetStdHandle(STD_ERROR_HANDLE)) != FILE_TYPE_PIPE;
+#else
+   add_ts = isatty(2) || lseek(2, 0, SEEK_CUR) != (off_t) -1 || errno != 
ESPIPE;
+#endif
+}
 
 void
 GDKtracer_log(const char *file, const char *func, int lineno,
@@ -475,7 +501,9 @@ GDKtracer_log(const char *file, const ch
}
 
if (level == M_CRITICAL || level == M_ERROR || level == M_WARNING) {
-   fprintf(stderr, "#%s: %s: %s%s%s%s\n",
+   fprintf(stderr, "#%s%s%s: %s: %s%s%s%s\n",
+   add_ts ? ts : "",
+   add_ts ? ": " : "",
MT_thread_getname(), func, GDKERROR,
msg, syserr ? ": " : "",
syserr ? syserr : "");
@@ -484,7 +512,8 @@ GDKtracer_log(const char *file, const ch
}
MT_lock_set();
if (file_name[0] == 0) {
-   _GDKtracer_init_basic_adptr();
+   MT_lock_unset();
+   return;
}
MT_lock_unset();
if (syserr)
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -807,6 +807,7 @@ GDKinit(opt *set, int setlen, bool embed
/* BBP was locked by BBPexit() */
BBPunlock();
}
+   GDKtracer_init();
errno = 0;
if (!GDKinmemory() && !GDKenvironment(dbpath))
return GDK_FAIL;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-10-03 Thread Niels Nes
Changeset: f00a952cc21f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f00a952cc21f
Branch: Oct2020
Log Message:

merged


diffs (83 lines):

diff --git a/ctest/cmake/detect-iconv.cmake b/ctest/cmake/detect-iconv.cmake
--- a/ctest/cmake/detect-iconv.cmake
+++ b/ctest/cmake/detect-iconv.cmake
@@ -20,18 +20,12 @@ if (${LINUX_DISTRO} STREQUAL "debian")
   variablename Iconv_FOUND)
   endif()
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
-  if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "20")
+  if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
   detect TRUE
   legacyvariable HAVE_ICONV
   variablename Iconv_FOUND)
   endif()
-  if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
-assert_package_detected(
-  detect FALSE
-  legacyvariable HAVE_ICONV
-  variablename Iconv_FOUND)
-  endif()
 elseif(${LINUX_DISTRO} STREQUAL "fedora")
   if(${LINUX_DISTRO_VERSION} STREQUAL "30")
 assert_package_detected(
diff --git a/ctest/cmake/detect-libz.cmake b/ctest/cmake/detect-libz.cmake
--- a/ctest/cmake/detect-libz.cmake
+++ b/ctest/cmake/detect-libz.cmake
@@ -22,7 +22,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
   if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
-  detect FALSE
+  detect TRUE
   legacyvariable HAVE_LIBZ
   variablename ZLIB_FOUND)
   endif()
diff --git a/ctest/cmake/detect-openssl.cmake b/ctest/cmake/detect-openssl.cmake
--- a/ctest/cmake/detect-openssl.cmake
+++ b/ctest/cmake/detect-openssl.cmake
@@ -22,7 +22,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
   if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
-  detect FALSE
+  detect TRUE
   legacyvariable HAVE_OPENSSL
   variablename OPENSSL_FOUND)
   endif()
diff --git a/ctest/cmake/detect-pcre.cmake b/ctest/cmake/detect-pcre.cmake
--- a/ctest/cmake/detect-pcre.cmake
+++ b/ctest/cmake/detect-pcre.cmake
@@ -22,7 +22,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
   if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
-  detect FALSE
+  detect TRUE
   legacyvariable HAVE_LIBPCRE
   variablename PCRE_FOUND)
   endif()
diff --git a/ctest/cmake/detect-uuid.cmake b/ctest/cmake/detect-uuid.cmake
--- a/ctest/cmake/detect-uuid.cmake
+++ b/ctest/cmake/detect-uuid.cmake
@@ -22,7 +22,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
   if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
-  detect FALSE
+  detect TRUE
   legacyvariable HAVE_UUID
   variablename HAVE_UUID_GENERATE)
   endif()
diff --git a/ctest/cmake/detect-xml.cmake b/ctest/cmake/detect-xml.cmake
--- a/ctest/cmake/detect-xml.cmake
+++ b/ctest/cmake/detect-xml.cmake
@@ -22,7 +22,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
   if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
-  detect FALSE
+  detect TRUE
   legacyvariable HAVE_LIBXML
   variablename LibXml2_FOUND)
   endif()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-10-02 Thread Niels Nes
Changeset: 8fc91596dd29 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8fc91596dd29
Branch: Oct2020
Log Message:

merged


diffs (truncated from 12297 to 300 lines):

diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -3530,770 +3530,782 @@ insert into sys.args values (37359, 922,
 insert into sys.args values (37360, 922, 'arg_1', 'day_interval', 4, 0, 1, 1);
 insert into sys.functions values (923, 'hour', 'hours', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (37361, 923, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37362, 923, 'arg_1', 'sec_interval', 13, 0, 1, 1);
+insert into sys.args values (37362, 923, 'arg_1', 'day_interval', 4, 0, 1, 1);
 insert into sys.functions values (924, 'minute', 'minutes', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
 insert into sys.args values (37363, 924, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37364, 924, 'arg_1', 'sec_interval', 13, 0, 1, 1);
+insert into sys.args values (37364, 924, 'arg_1', 'day_interval', 4, 0, 1, 1);
 insert into sys.functions values (925, 'second', 'seconds', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
 insert into sys.args values (37365, 925, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37366, 925, 'arg_1', 'sec_interval', 13, 0, 1, 1);
-insert into sys.functions values (926, 'next_value_for', 'next_value', 'sql', 
0, 1, true, false, false, 2000, true, true);
+insert into sys.args values (37366, 925, 'arg_1', 'day_interval', 4, 0, 1, 1);
+insert into sys.functions values (926, 'day', 'day', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (37367, 926, 'res_0', 'bigint', 64, 0, 0, 0);
-insert into sys.args values (37368, 926, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37369, 926, 'arg_2', 'char', 0, 0, 1, 2);
-insert into sys.functions values (927, 'get_value_for', 'get_value', 'sql', 0, 
1, false, false, false, 2000, true, true);
-insert into sys.args values (37370, 927, 'res_0', 'bigint', 64, 0, 0, 0);
-insert into sys.args values (37371, 927, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37372, 927, 'arg_2', 'char', 0, 0, 1, 2);
-insert into sys.functions values (928, 'restart', 'restart', 'sql', 0, 1, 
true, false, false, 2000, true, true);
-insert into sys.args values (37373, 928, 'res_0', 'bigint', 64, 0, 0, 0);
-insert into sys.args values (37374, 928, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37375, 928, 'arg_2', 'char', 0, 0, 1, 2);
-insert into sys.args values (37376, 928, 'arg_3', 'bigint', 64, 0, 1, 3);
-insert into sys.functions values (929, 'index', 'index', 'calc', 0, 1, false, 
false, false, 2000, true, true);
-insert into sys.args values (37377, 929, 'res_0', 'tinyint', 8, 0, 0, 0);
-insert into sys.args values (37378, 929, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37379, 929, 'arg_2', 'boolean', 1, 0, 1, 2);
-insert into sys.functions values (930, 'index', 'index', 'calc', 0, 1, false, 
false, false, 2000, true, true);
-insert into sys.args values (37380, 930, 'res_0', 'smallint', 16, 0, 0, 0);
-insert into sys.args values (37381, 930, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37382, 930, 'arg_2', 'boolean', 1, 0, 1, 2);
-insert into sys.functions values (931, 'index', 'index', 'calc', 0, 1, false, 
false, false, 2000, true, true);
-insert into sys.args values (37383, 931, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37384, 931, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37385, 931, 'arg_2', 'boolean', 1, 0, 1, 2);
-insert into sys.functions values (932, 'strings', 'strings', 'calc', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (37386, 932, 'res_0', 'char', 0, 0, 0, 0);
-insert into sys.args values (37387, 932, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.functions values (933, 'locate', 'locate', 'str', 0, 1, false, 
false, false, 2000, true, false);
-insert into sys.args values (37388, 933, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37389, 933, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37390, 933, 'arg_2', 'char', 0, 0, 1, 2);
-insert into sys.functions values (934, 'locate', 'locate', 'str', 0, 1, false, 
false, false, 2000, true, false);
-insert into sys.args values (37391, 934, 'res_0', 'int', 32, 0, 0, 0);
-insert into sys.args values (37392, 934, 'arg_1', 'char', 0, 0, 1, 1);
-insert into sys.args values (37393, 934, 'arg_2', 'char', 0, 0, 1, 2);
-insert into sys.args values (37394, 934, 'arg_3', 'int', 32, 0, 1, 3);
-insert into sys.functions values (935, 'charindex', 'locate', 'str', 0, 1, 
false, false, false, 2000, 

MonetDB: Oct2020 - merged

2020-10-02 Thread Niels Nes
Changeset: 542458b0ab6c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=542458b0ab6c
Branch: Oct2020
Log Message:

merged


diffs (25 lines):

diff --git a/documentation/source/build.rst b/documentation/source/build.rst
--- a/documentation/source/build.rst
+++ b/documentation/source/build.rst
@@ -61,12 +61,15 @@ Evidently there are several options to c
 ``$SOURCE/cmake/monetdb-options.cmake``
 
 The important once to choose from are ``-DCMAKE_BUILD_TYPE``, which
-takes the value Release or Debug.  The former creates the binary ready
-for shipping, including all compiler optimizations that come with it.
-The Debug mode is necessary if you plan to debug the binary and needs
-access to the symbol tables.  This build type also typically leads to a
-slower execution time, because also all kinds of assertions are being
-checked.
+takes the value Release, Debug, RelWithDebInfo and MinSizeRel. The
+first creates the binary ready for shipping, including all compiler
+optimizations that come with it. The Debug mode is necessary if you
+plan to debug the binary and needs access to the symbol tables. This
+build type also typically leads to a slower execution time, because
+also all kinds of assertions are being checked. The RelWithDebInfo
+combines Release and Debug with both compiler optimizations and symbol
+tables for debugging. Finally MinSizeRel is a Release build optimized
+for binary size instead of speed.
 
 Other relevant properties are also ``-DASSERT=ON`` and ``-DSTRICT=ON``,
 used in combination with a Debug build, e.g.::
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-09-30 Thread Niels Nes
Changeset: 02acc0755614 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=02acc0755614
Branch: Oct2020
Log Message:

merged


diffs (truncated from 725 to 300 lines):

diff --git a/clients/examples/C/streamcat.c b/clients/examples/C/streamcat.c
--- a/clients/examples/C/streamcat.c
+++ b/clients/examples/C/streamcat.c
@@ -191,8 +191,10 @@ int cmd_read(char *argv[])
}
if (wrapper != NULL)
s = wrapper(s, parms);
-   if (s == NULL)
-   croak(2, "Wrapper %s did not return a stream", 
wrapper_name);
+   if (s == NULL || mnstr_errnr(s)) {
+   char *msg = mnstr_error(s);
+   croak(2, "Opener %s failed: %s", opener_name, msg ? msg 
: "");
+   }
}
 
if (out == NULL) {
@@ -300,8 +302,10 @@ int cmd_write(char *argv[])
}
if (wrapper != NULL)
s = wrapper(s, parms);
-   if (s == NULL)
-   croak(2, "Wrapper %s did not return a stream", 
wrapper_name);
+   if (s == NULL || mnstr_errnr(s)) {
+   char *msg = mnstr_error(s);
+   croak(2, "Opener %s failed: %s", opener_name, msg ? msg 
: "");
+   }
}
 
if (in == NULL) {
diff --git a/common/stream/iconv_stream.c b/common/stream/iconv_stream.c
--- a/common/stream/iconv_stream.c
+++ b/common/stream/iconv_stream.c
@@ -292,8 +292,10 @@ iconv_rstream(stream *restrict ss, const
if (ss->isutf8)
return ss;
cd = iconv_open("utf-8", charset);
-   if (cd == (iconv_t) -1)
+   if (cd == (iconv_t) -1) {
+   mnstr_set_open_error(name, errno, "iconv_open");
return NULL;
+   }
s = ic_open(cd, ss, name);
if (s == NULL) {
iconv_close(cd);
@@ -318,8 +320,10 @@ iconv_wstream(stream *restrict ss, const
if (ss->isutf8)
return ss;
cd = iconv_open(charset, "utf-8");
-   if (cd == (iconv_t) -1)
+   if (cd == (iconv_t) -1) {
+   mnstr_set_open_error(name, errno, "iconv_open");
return NULL;
+   }
s = ic_open(cd, ss, name);
if (s == NULL) {
iconv_close(cd);
@@ -341,7 +345,7 @@ iconv_rstream(stream *restrict ss, const
strcmp(charset, "UTF8") == 0)
return ss;
 
-   mnstr_set_open_error(url, 0, "ICONV support has been left out of this 
MonetDB");
+   mnstr_set_open_error(name, 0, "ICONV support has been left out of this 
MonetDB");
return NULL;
 }
 
@@ -356,7 +360,7 @@ iconv_wstream(stream *restrict ss, const
strcmp(charset, "UTF8") == 0)
return ss;
 
-   mnstr_set_open_error(url, 0, "ICONV support has been left out of this 
MonetDB");
+   mnstr_set_open_error(name, 0, "ICONV support has been left out of this 
MonetDB");
return NULL;
 }
 #endif /* HAVE_ICONV */
diff --git a/ctest/cmake/detect-bz2.cmake b/ctest/cmake/detect-bz2.cmake
--- a/ctest/cmake/detect-bz2.cmake
+++ b/ctest/cmake/detect-bz2.cmake
@@ -20,19 +20,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
   variablename BZIP2_FOUND)
   endif()
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
-  if(${LINUX_DISTRO_VERSION} STREQUAL "18")
-assert_package_detected(
-  detect FALSE
-  legacyvariable HAVE_LIBBZ2
-  variablename BZIP2_FOUND)
-  endif()
-  if(${LINUX_DISTRO_VERSION} STREQUAL "19")
-assert_package_detected(
-  detect FALSE
-  legacyvariable HAVE_LIBBZ2
-  variablename BZIP2_FOUND)
-  endif()
-  if(${LINUX_DISTRO_VERSION} STREQUAL "20")
+  if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
   detect FALSE
   legacyvariable HAVE_LIBBZ2
diff --git a/ctest/cmake/detect-commoncrypto.cmake 
b/ctest/cmake/detect-commoncrypto.cmake
--- a/ctest/cmake/detect-commoncrypto.cmake
+++ b/ctest/cmake/detect-commoncrypto.cmake
@@ -20,19 +20,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
   variablename COMMONCRYPTO_FOUND)
   endif()
 elseif (${LINUX_DISTRO} STREQUAL "ubuntu")
-  if(${LINUX_DISTRO_VERSION} STREQUAL "18")
-assert_package_detected(
-  detect FALSE
-  legacyvariable HAVE_COMMONCRYPTO
-  variablename COMMONCRYPTO_FOUND)
-  endif()
-  if(${LINUX_DISTRO_VERSION} STREQUAL "19")
-assert_package_detected(
-  detect FALSE
-  legacyvariable HAVE_COMMONCRYPTO
-  variablename COMMONCRYPTO_FOUND)
-  endif()
-  if(${LINUX_DISTRO_VERSION} STREQUAL "20")
+  if(${LINUX_DISTRO_VERSION} VERSION_GREATER_EQUAL "18")
 assert_package_detected(
   detect FALSE
   legacyvariable HAVE_COMMONCRYPTO
diff --git a/ctest/cmake/detect-curl.cmake b/ctest/cmake/detect-curl.cmake
--- a/ctest/cmake/detect-curl.cmake
+++ b/ctest/cmake/detect-curl.cmake
@@ -20,19 +20,7 @@ if (${LINUX_DISTRO} STREQUAL "debian")
   variablename 

MonetDB: Oct2020 - merged

2020-09-30 Thread Niels Nes
Changeset: ec5e8a25c9e0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ec5e8a25c9e0
Branch: Oct2020
Log Message:

merged


diffs (12 lines):

diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt
--- a/documentation/CMakeLists.txt
+++ b/documentation/CMakeLists.txt
@@ -25,7 +25,7 @@ if(SPHINX_FOUND)
   set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
  
   configure_file(
-"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
+"${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
 "${BINARY_BUILD_DIR}/conf.py"
 @ONLY)
  
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2020-09-30 Thread Pedro Ferreira
Changeset: fa5509339413 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fa5509339413
Modified Files:
tools/merovingian/daemon/controlrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/merovingian.c
tools/merovingian/daemon/merovingian.h
Branch: Oct2020
Log Message:

Merged with Jun2020

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


MonetDB: Oct2020 - Merged with Jun2020

2020-09-23 Thread Pedro Ferreira
Changeset: 67b3b4b28a0d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=67b3b4b28a0d
Modified Files:
sql/server/rel_rel.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (12 lines):

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
@@ -865,7 +865,7 @@ rel_groupby(mvc *sql, sql_rel *l, list *
sql_exp *e = en->data, *ne;
 
if ((ne=exps_find_exp(gexps, e)) == NULL ||
-   strcmp(exp_relname(e),exp_relname(ne)) != 0 ||
+   (exp_relname(e) && exp_relname(ne) && 
strcmp(exp_relname(e),exp_relname(ne)) != 0) ||
strcmp(exp_name(e),exp_name(ne)) != 0  )
append(gexps, e);
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020

2020-09-23 Thread Pedro Ferreira
Changeset: e966c3bdf734 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e966c3bdf734
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/test/BugTracker-2020/Tests/All
sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.sql
sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err
sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out
Branch: Oct2020
Log Message:

Merged with Jun2020

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


MonetDB: Oct2020 - merged

2020-09-18 Thread Niels Nes
Changeset: 0007210e8699 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0007210e8699
Branch: Oct2020
Log Message:

merged


diffs (truncated from 6431 to 300 lines):

diff --git a/clients/odbc/driver/ODBCQueries.h 
b/clients/odbc/driver/ODBCQueries.h
--- a/clients/odbc/driver/ODBCQueries.h
+++ b/clients/odbc/driver/ODBCQueries.h
@@ -9,148 +9,115 @@
 /* this file contains parts of queries that are used in multiple
  * places */
 
-#define DATA_TYPE(t)   \
-   "case " #t ".type " \
-"when 'bigint' then %d "   \
-"when 'blob' then %d " \
-"when 'boolean' then %d "  \
-"when 'char' then %d " \
-"when 'clob' then %d " \
-"when 'date' then %d " \
-"when 'decimal' then %d "  \
-"when 'double' then %d "   \
-"when 'hugeint' then %d "  \
-"when 'int' then %d "  \
-"when 'month_interval' then "  \
- "case " #t ".type_digits "\
-  "when 1 then %d "\
-  "when 2 then %d "\
-  "when 3 then %d "\
- "end "\
-"when 'real' then %d " \
-"when 'sec_interval' then "\
- "case " #t ".type_digits "\
-  "when 4 then %d "\
-  "when 5 then %d "\
-  "when 6 then %d "\
-  "when 7 then %d "\
-  "when 8 then %d "\
-  "when 9 then %d "\
-  "when 10 then %d "   \
-  "when 11 then %d "   \
-  "when 12 then %d "   \
-  "when 13 then %d "   \
- "end "\
-"when 'smallint' then %d " \
-"when 'time' then %d " \
-"when 'timestamp' then %d "\
-"when 'timestamptz' then %d "  \
-"when 'timetz' then %d "   \
-"when 'tinyint' then %d "  \
-"when 'varchar' then %d "  \
+#define DATA_TYPE(t)   \
+   "case " #t ".type " 
\
+"when 'bigint' then %d "   \
+"when 'blob' then %d " \
+"when 'boolean' then %d "  \
+"when 'char' then %d " \
+"when 'clob' then %d " \
+"when 'date' then %d " \
+"when 'decimal' then %d "  \
+"when 'double' then %d "   \
+"when 'hugeint' then %d "  \
+"when 'int' then %d "  \
+"when 'month_interval' then "  \
+ "case " #t ".type_digits "\
+  "when 1 then %d "\
+  "when 2 then %d "\
+  "when 3 then %d "\
+ "end "
\
+"when 'real' then %d " \
+"when 'sec_interval' then "\
+ "case " #t ".type_digits "\
+  "when 4 then %d "\
+  "when 5 then %d "\
+  "when 6 then %d "\
+  "when 7 then %d "\
+  "when 8 then %d "\
+  "when 9 then %d "\
+  "when 10 then %d "   \
+  "when 11 then %d "   \
+  "when 12 then %d "   \
+  "when 13 then %d "   \
+ "end " 

MonetDB: Oct2020 - Merged typing into Oct2020

2020-09-17 Thread Pedro Ferreira
Changeset: f770462cd0fc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f770462cd0fc
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: Oct2020
Log Message:

Merged typing into Oct2020


diffs (truncated from 6889 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -1322,110 +1322,302 @@ stdout of test 'MAL-signatures` in direc
 [ "batcalc",   "*","pattern batcalc.*(X_1:sht, X_2:bat[:sht], 
X_3:bat[:oid]):bat[:int] ",  "CMDbatMULenlarge;",""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:sht, X_2:bat[:sht], 
X_3:bat[:oid]):bat[:lng] ",  "CMDbatMULenlarge;",""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:bte], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:bte] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:bte] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:dbl] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:int] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:lng] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:dbl], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:sht] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:bte] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:flt] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:int] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:lng] ", "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:flt], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:sht] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:int], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:int] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:lng], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:lng] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bat[:sht], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:sht] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:bte, 
X_3:bat[:oid]):bat[:bte] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:dbl, 
X_3:bat[:oid]):bat[:bte] ",  "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:dbl, 
X_3:bat[:oid]):bat[:dbl] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:dbl, 
X_3:bat[:oid]):bat[:int] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:dbl, 
X_3:bat[:oid]):bat[:lng] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:dbl, 
X_3:bat[:oid]):bat[:sht] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:flt, 
X_3:bat[:oid]):bat[:bte] ",  "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:flt, 
X_3:bat[:oid]):bat[:flt] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:flt, 
X_3:bat[:oid]):bat[:int] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:flt, 
X_3:bat[:oid]):bat[:lng] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:flt, 
X_3:bat[:oid]):bat[:sht] ",  "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:int, 
X_3:bat[:oid]):bat[:int] ",  "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:lng, 
X_3:bat[:oid]):bat[:lng] ",  "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern batcalc.*(X_1:bat[:bte], X_2:sht, 
X_3:bat[:oid]):bat[:sht] ",  "CMDbatMULsignal;", ""  ]
+[ "batcalc",   "*","pattern batcalc.*(X_1:bat[:dbl], X_2:bat[:bte], 
X_3:bat[:oid], X_4:bat[:oid]):bat[:bte] ", "CMDbatMULsignal;", ""  ]
 [ "batcalc",   "*","pattern 

MonetDB: Oct2020 - merged

2020-09-16 Thread Niels Nes
Changeset: 2bc8e5ab3218 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2bc8e5ab3218
Modified Files:
monetdb5/optimizer/opt_mergetable.c
sql/backends/monet5/rel_bin.c
sql/jdbc/tests/Tests/Test_PSlargebatchval.stable.out
Branch: Oct2020
Log Message:

merged


diffs (113 lines):

diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -650,7 +650,7 @@ mat_apply4(MalBlkPtr mb, InstrPtr p, mat
 }
 
 static int
-mat_setop(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n)
+mat_setop(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int n, int o)
 {
int tpe = getArgType(mb,p, 0), k, j;
InstrPtr r = newInstruction(mb, matRef, packRef);
@@ -665,6 +665,9 @@ mat_setop(MalBlkPtr mb, InstrPtr p, matl
assert(m>=0 || n>=0);
if (m >= 0 && n >= 0) {
int nr = 1;
+
+   assert(o < 0 || mat[m].mi->argc == mat[o].mi->argc);
+
for(k=1; kargc; k++) {
InstrPtr q = copyInstruction(p);
InstrPtr s = newInstruction(mb, matRef, packRef);
@@ -700,6 +703,8 @@ mat_setop(MalBlkPtr mb, InstrPtr p, matl
getArg(q,0) = newTmpVariable(mb, tpe);
getArg(q,1) = getArg(mat[m].mi,k);
getArg(q,2) = getArg(s,0);
+   if (o >= 0)
+   getArg(q,3) = getArg(mat[o].mi, k);
if(setPartnr(ml, getArg(mat[m].mi,k), getArg(q,0), nr)) 
{
freeInstruction(q);
freeInstruction(r);
@@ -712,6 +717,8 @@ mat_setop(MalBlkPtr mb, InstrPtr p, matl
}
} else {
assert(m >= 0);
+   assert(o < 0 || mat[m].mi->argc == mat[o].mi->argc);
+
for(k=1; kargc; k++) {
InstrPtr q = copyInstruction(p);
if(!q) {
@@ -721,6 +728,8 @@ mat_setop(MalBlkPtr mb, InstrPtr p, matl
 
getArg(q,0) = newTmpVariable(mb, tpe);
getArg(q,1) = getArg(mat[m].mi, k);
+   if (o >= 0)
+   getArg(q,3) = getArg(mat[o].mi, k);
pushInstruction(mb,q);
 
if(setPartnr(ml, getArg(q, 2), getArg(q,0), k)) {
@@ -2302,7 +2311,8 @@ OPTmergetableImplementation(Client cntxt
 getFunctionId(p) == intersectRef) &&
   (m=is_a_mat(getArg(p,1), )) >= 0) {
n=is_a_mat(getArg(p,2), );
-   if(mat_setop(mb, p, , m, n)) {
+   o=is_a_mat(getArg(p,3), );
+   if(mat_setop(mb, p, , m, n, o)) {
msg = 
createException(MAL,"optimizer.mergetable",SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto cleanup;
}
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
@@ -362,7 +362,7 @@ subrel_project( backend *be, stmt *s, li
 }
 
 static stmt *
-handle_in_exps(backend *be, sql_exp *ce, list *nl, stmt *left, stmt *right, 
stmt *grp, stmt *ext, stmt *cnt, stmt *sel, int in, int use_r, int depth, int 
reduce)
+handle_in_exps(backend *be, sql_exp *ce, list *nl, stmt *left, stmt *right, 
stmt *grp, stmt *ext, stmt *cnt, stmt *sel, bool in, int use_r, int depth, int 
reduce)
 {
mvc *sql = be->mvc;
node *n;
@@ -435,10 +435,9 @@ handle_in_exps(backend *be, sql_exp *ce,
s = stmt_project(be, stmt_selectnonil(be, s, NULL), s);
}
 
-   s = stmt_join(be, c, s, in, cmp_equal, 1, 0, false);
-   s = stmt_result(be, s, 0);
-
-   if (!in) {
+   if (in) {
+   s = stmt_semijoin(be, c, s, sel, NULL, 0, false);
+   } else {
if (last_null_value) {
/* CORNER CASE ALERT:
   In case of a not-in-expression with the 
associated in-value-list containing a null value,
@@ -450,24 +449,15 @@ handle_in_exps(backend *be, sql_exp *ce,
   list* singleton_bat = sa_list(sql->sa);
   list_append(singleton_bat, null_value); */
s = stmt_uselect(be, c, last_null_value, 
cmp_equal, NULL, 0, 0);
-   return s;
-   }
-   else {
+   } else {
/* BACK TO HAPPY FLOW:
   Make sure that null values are never 
returned. */
stmt* non_nulls;
-   

MonetDB: Oct2020 - merged

2020-09-15 Thread Niels Nes
Changeset: cf2addc76188 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf2addc76188
Branch: Oct2020
Log Message:

merged


diffs (42 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -294,6 +294,7 @@ macro(monetdb_configure_sizes)
   check_type_size(short SIZEOF_SHORT LANGUAGE C)
   check_type_size(int SIZEOF_INT LANGUAGE C)
   check_type_size(long SIZEOF_LONG LANGUAGE C)
+  check_type_size("long int" SIZEOF_LONG_INT LANGUAGE C)
   check_type_size(double SIZEOF_DOUBLE LANGUAGE C)
   check_type_size(wchar_t SIZEOF_WCHAR_T LANGUAGE C)
   check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C)
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -283,6 +283,7 @@
 #cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
 #cmakedefine SIZEOF_INT @SIZEOF_INT@
 #cmakedefine SIZEOF_LONG @SIZEOF_LONG@
+#cmakedefine SIZEOF_LONG_INT @SIZEOF_LONG_INT@
 #cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
 #cmakedefine SIZEOF_WCHAR_T @SIZEOF_WCHAR_T@
 
diff --git a/testing/monetdb_mtest.bat.in b/testing/monetdb_mtest.bat.in
--- a/testing/monetdb_mtest.bat.in
+++ b/testing/monetdb_mtest.bat.in
@@ -7,4 +7,5 @@
 @echo off
 
 set 
PATH=@CMAKE_INSTALL_FULL_LIBDIR@;@CMAKE_INSTALL_FULL_LIBDIR@\monetdb5;@CMAKE_INSTALL_FULL_BINDIR@;%PATH%
+cd "@CMAKE_HOME_DIRECTORY@"
 @CMAKE_INSTALL_FULL_BINDIR@/Mtest.py
diff --git a/testing/monetdb_mtest.sh.in b/testing/monetdb_mtest.sh.in
--- a/testing/monetdb_mtest.sh.in
+++ b/testing/monetdb_mtest.sh.in
@@ -5,6 +5,7 @@
 #
 # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
 
+cd "@CMAKE_HOME_DIRECTORY@"
 PATH=@CMAKE_INSTALL_FULL_BINDIR@:$PATH @CMAKE_INSTALL_FULL_BINDIR@/Mtest.py
 
 exit 0
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-09-11 Thread Niels Nes
Changeset: 311fe7824f18 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=311fe7824f18
Branch: Oct2020
Log Message:

merged


diffs (277 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
@@ -9559,7 +9559,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int
rel = rel_visitor_bottomup(, rel, 
_reset_used); /* reset used flag, used by rel_merge_select_rse */
}
 
-   if (gp.cnt[op_project] && /* DISABLES CODE */ (0))
+   if (gp.cnt[op_project])
rel = rel_exp_visitor_bottomup(, rel, _merge_project_rse, 
false);
 
if (gp.cnt[op_join])
diff --git a/sql/test/SQLancer/Tests/sqlancer07.sql 
b/sql/test/SQLancer/Tests/sqlancer07.sql
--- a/sql/test/SQLancer/Tests/sqlancer07.sql
+++ b/sql/test/SQLancer/Tests/sqlancer07.sql
@@ -113,3 +113,12 @@ select t0.c1 from t0 where (-5) in (case
 select t0.c1 from t0 where (-5) in (case when t0.c1 then 1 else -2 end, 
(select -3 from t0, t2 where false));
-- empty
 ROLLBACK;
+
+START TRANSACTION;
+CREATE TABLE t1 (c0 DOUBLE PRECISION NOT NULL);
+INSERT INTO t1(c0) 
VALUES((0.6548429615298178*0.3050008736497528)/(0.5061323979270875));
+INSERT INTO t1(c0) VALUES(COALESCE(0.6548429615298178, 
0.20317629894456002))*(COALESCE(0.3050008736497528, 
0.2277902039419617/(0.5061323979270875)));
+SELECT t1.c0 FROM t1;
+   -- 0.3946154725285108
+   -- 0.3946154725285108
+ROLLBACK;
diff --git a/tools/merovingian/daemon/CMakeLists.txt 
b/tools/merovingian/daemon/CMakeLists.txt
--- a/tools/merovingian/daemon/CMakeLists.txt
+++ b/tools/merovingian/daemon/CMakeLists.txt
@@ -36,9 +36,7 @@ target_link_libraries(monetdbd
   mcrypt
   stream
   mapi
-  bat
   msabaoth
-  mal
   ${CMAKE_DL_LIBS}
   Threads::Threads)
 
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -34,9 +34,6 @@
 #include "utils/database.h"
 #include "utils/control.h"
 
-#include "gdk.h"  /* these three for creation of dbs with password */
-#include "mal_authorize.h"
-
 #include "merovingian.h"
 #include "discoveryrunner.h" /* broadcast, remotedb */
 #include "forkmserver.h"
@@ -442,78 +439,60 @@ static void ctl_handle_client(
} else {
if (*p != '\0') {
pid_t child;
-   if ((child = fork()) == 0) {
-   FILE *secretf;
-   size_t len;
+   int pipes[2];
+   if (pipe(pipes) == -1) {
+   Mfprintf(_mero_ctlerr, 
"%s: creating pipe failed\n",
+
origin);
+   } else if ((child = fork()) == 
0) {
+   /* this is the child 
process; exit non-zero
+* on failure */
char *err;
-   char *vaultkey;
-   opt *set = 
malloc(sizeof(opt) * 2);
-   int setlen = 0;
char *sadbfarm;
+   char buf3[8092];
+
+   close(pipes[1]);
+   dup2(pipes[0], 0);
+   close(pipes[0]);
 
if ((err = 
msab_getDBfarm()) != NULL) {
-   
Mfprintf(_mero_ctlerr, "%s: internal error: %s\n",
+   
Mfprintf(_mero_ctlerr,
+   
 "%s: internal error: %s\n",

 origin, err);
-   exit(0);
-   }
-   snprintf(buf2, 
sizeof(buf2), "%s/%s", sadbfarm, q);
-   free(sadbfarm);
-   setlen = 
mo_add_option(, setlen, opt_cmdline, "gdk_dbpath", buf2);
-   

MonetDB: Oct2020 - Merged with Jun2020

2020-09-11 Thread Pedro Ferreira
Changeset: c9b5be23034e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9b5be23034e
Modified Files:
sql/server/rel_optimizer.c
Branch: Oct2020
Log Message:

Merged with Jun2020


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
@@ -9559,7 +9559,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int
rel = rel_visitor_bottomup(, rel, 
_reset_used); /* reset used flag, used by rel_merge_select_rse */
}
 
-   if (gp.cnt[op_project] && /* DISABLES CODE */ (0))
+   if (gp.cnt[op_project])
rel = rel_exp_visitor_bottomup(, rel, _merge_project_rse, 
false);
 
if (gp.cnt[op_join])
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-09-11 Thread Niels Nes
Changeset: 1387d67302b0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1387d67302b0
Branch: Oct2020
Log Message:

merged


diffs (65 lines):

diff --git a/ChangeLog.Oct2020 b/ChangeLog.Oct2020
--- a/ChangeLog.Oct2020
+++ b/ChangeLog.Oct2020
@@ -1,6 +1,22 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Mon Aug 10 2020 Ying Zhang 
+- Finished a first version of the new monitoring function
+  user_statistics(), which is only intended for the DBAs.
+  For each database user who has logged in during the current mserver5
+  session, it returns 
+  "username": login name of the database user,
+  "querycount": the number of queries this user has executed since his/her
+  first login,
+  "totalticks": the total execution time (in microsecond) of the queries ran
+  by this user,
+  "maxquery": the query with the longest execution time (if two queries have
+  the same execution time, the newer overwrites the older),
+  "maxticks": the execution time of the 'maxquery' (in microsecond),
+  "started": the start timestamp of the 'maxquery',
+  "finished": the finish timestamp of the 'maxquery'.
+
 * Wed Jun 10 2020 Sjoerd Mullender 
 - Removed support for LiDAR data, that is the SQL procedures
   sys.lidarattach, sys.lidarload, and sys.lidarexport.
diff --git a/ChangeLog.userstats b/ChangeLog.userstats
deleted file mode 100644
--- a/ChangeLog.userstats
+++ /dev/null
@@ -1,19 +0,0 @@
-# ChangeLog file for userstats
-# This file is updated with Maddlog
-
-* Mon Aug 10 2020 Ying Zhang 
-- Finished a first version of the new monitoring function
-  user_statistics(), which is only intended for the DBAs.
-  For each database user who has logged in during the current mserver5
-  session, it returns 
-  "username": login name of the database user,
-  "querycount": the number of queries this user has executed since his/her
-  first login,
-  "totalticks": the total execution time (in microsecond) of the queries ran
-  by this user,
-  "maxquery": the query with the longest execution time (if two queries have
-  the same execution time, the newer overwrites the older),
-  "maxticks": the execution time of the 'maxquery' (in microsecond),
-  "started": the start timestamp of the 'maxquery',
-  "finished": the finish timestamp of the 'maxquery'.
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -762,6 +762,11 @@ fi
 %setup -q
 
 %build
+%if (0%{?fedora} >= 33)
+# on Fedora 33 we get a crash of the compiler when using -flto, so disable it
+CFLAGS="${CFLAGS:-%optflags} -fno-lto"
+export CFLAGS
+%endif
 %cmake3 \
-DRELEASE_VERSION=ON \
-DASSERT=OFF \
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged and small cleanup

2020-09-11 Thread Niels Nes
Changeset: ffb77f9c0379 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ffb77f9c0379
Modified Files:
sql/backends/monet5/sql_statement.c
sql/server/rel_optimizer.c
Branch: Oct2020
Log Message:

merged and small cleanup


diffs (115 lines):

diff --git a/monetdb5/optimizer/opt_generator.c 
b/monetdb5/optimizer/opt_generator.c
--- a/monetdb5/optimizer/opt_generator.c
+++ b/monetdb5/optimizer/opt_generator.c
@@ -71,14 +71,11 @@ OPTgeneratorImplementation(Client cntxt,
char buf[256];
lng usec= GDKusec();
str msg = MAL_SUCCEED;
+   int needed = 0;
 
-   (void) cntxt;
(void) stk;
(void) pci;
 
-   series = (InstrPtr*) GDKzalloc(sizeof(InstrPtr) * mb->vtop);
-   if(series == NULL)
-   throw(MAL,"optimizer.generator", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
old = mb->stmt;
limit = mb->stop;
slimit = mb->ssize;
@@ -87,12 +84,16 @@ OPTgeneratorImplementation(Client cntxt,
for( i=0; i < limit; i++){
p = old[i];
if ( getModuleId(p) == generatorRef && getFunctionId(p) == 
seriesRef)
-   break;
+   needed = 1;
+   if (p->token == RETURNsymbol || p->barrier == RETURNsymbol)
+   return 0;
}
-   if (i == limit) {
-   GDKfree(series);
+   if (!needed)
return 0;
-   }
+
+   series = (InstrPtr*) GDKzalloc(sizeof(InstrPtr) * mb->vtop);
+   if(series == NULL)
+   throw(MAL,"optimizer.generator", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
 
if (newMalBlkStmt(mb, mb->ssize) < 0) {
GDKfree(series);
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
@@ -480,32 +480,24 @@ stmt_varnr(backend *be, int nr, sql_subt
 stmt *
 stmt_table(backend *be, stmt *cols, int temp)
 {
+   stmt *s = stmt_create(be->mvc->sa, st_table);
MalBlkPtr mb = be->mb;
-   InstrPtr q = newAssignment(mb);
-
-   if (cols->nr < 0)
+
+   if (s == NULL || cols->nr < 0)
return NULL;
 
if (cols->type != st_list) {
+   InstrPtr q = newAssignment(mb);
q = newStmt(mb, sqlRef, printRef);
q = pushStr(mb, q, "not a valid output list\n");
if (q == NULL)
return NULL;
}
-   if (q) {
-   stmt *s = stmt_create(be->mvc->sa, st_table);
-   if (s == NULL) {
-   freeInstruction(q);
-   return NULL;
-   }
-
-   s->op1 = cols;
-   s->flag = temp;
-   s->nr = cols->nr;
-   s->nrcols = cols->nrcols;
-   return s;
-   }
-   return NULL;
+   s->op1 = cols;
+   s->flag = temp;
+   s->nr = cols->nr;
+   s->nrcols = cols->nrcols;
+   return s;
 }
 
 stmt *
@@ -3072,7 +3064,7 @@ stmt_convert(backend *be, stmt *v, stmt 
!EC_INTERVAL(f->type->eclass) &&
f->type->eclass != EC_DEC &&
(t->digits == 0 || f->digits == t->digits) &&
-   type_has_tz(t) == type_has_tz(f)) || 
+   type_has_tz(t) == type_has_tz(f)) ||
(EC_VARCHAR(f->type->eclass) && EC_VARCHAR(t->type->eclass) && 
f->digits > 0 && t->digits >= f->digits)) {
/* set output type. Despite the MAL code already being 
generated,
   the output type may still be checked */
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
@@ -5527,7 +5527,7 @@ rel_push_project_down(visitor *v, sql_re
 
if (rel_is_ref(l))
return rel;
-   if (is_base(l->op)) {
+   if (is_basetable(l->op)) {
if (list_check_prop_all(rel->exps, 
(prop_check_func)_is_useless_rename)) {
/* TODO reduce list (those in the project + 
internal) */
rel->l = NULL;
@@ -9559,7 +9559,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int
rel = rel_visitor_bottomup(, rel, 
_reset_used); /* reset used flag, used by rel_merge_select_rse */
}
 
-   if (gp.cnt[op_project])
+   if (gp.cnt[op_project] && /* DISABLES CODE */ (0))
rel = rel_exp_visitor_bottomup(, rel, _merge_project_rse, 
false);
 
if (gp.cnt[op_join])
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-09-09 Thread Niels Nes
Changeset: bcc00efe3ca1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bcc00efe3ca1
Branch: Oct2020
Log Message:

merged


diffs (47 lines):

diff --git a/monetdb5/modules/mal/mal_io.c b/monetdb5/modules/mal/mal_io.c
--- a/monetdb5/modules/mal/mal_io.c
+++ b/monetdb5/modules/mal/mal_io.c
@@ -670,26 +670,26 @@ IOimport(void *ret, bat *bid, str *fnme)
BBPunfix(b->batCacheid);
fclose(fp);
GDKfree(buf);
-   throw(MAL, "io.import", OPERATION_FAILED " fileno()");
+   throw(MAL, "io.import", OPERATION_FAILED ": fileno()");
}
if (fstat(fn, ) != 0) {
BBPunfix(b->batCacheid);
fclose(fp);
GDKfree(buf);
-   throw(MAL, "io.imports", OPERATION_FAILED "fstat()");
+   throw(MAL, "io.imports", OPERATION_FAILED ": fstat()");
}
 
(void) fclose(fp);
if (st.st_size <= 0) {
BBPunfix(b->batCacheid);
GDKfree(buf);
-   throw(MAL, "io.imports", OPERATION_FAILED "Empty file");
+   throw(MAL, "io.imports", OPERATION_FAILED ": empty 
file");
}
 #if SIZEOF_SIZE_T == SIZEOF_INT
-   if (st.st_size > (off_t) ~ (size_t) 0) {
+   if (st.st_size > 0x7FFF) {
BBPunfix(b->batCacheid);
GDKfree(buf);
-   throw(MAL, "io.imports", OPERATION_FAILED "File too 
large");
+   throw(MAL, "io.imports", OPERATION_FAILED ": file too 
large");
}
 #endif
base = cur = (char *) GDKmmap(*fnme, MMAP_SEQUENTIAL, (size_t) 
st.st_size);
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3059,7 +3059,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
 else:
 s = '%-*s ' % (length, TST)
 STDOUT.write('%s%s' % (prompt(), s))
-if isatty:
+if isatty and TIMEOUT > 0:
 s = '(<=%d,%d,%d)' % (TIMEOUT, CTIMEOUT, STIMEOUT)
 STDOUT.write(s + '\b' * len(s))
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

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

merged


diffs (143 lines):

diff --git a/sql/backends/monet5/sql_subquery.c 
b/sql/backends/monet5/sql_subquery.c
--- a/sql/backends/monet5/sql_subquery.c
+++ b/sql/backends/monet5/sql_subquery.c
@@ -602,12 +602,12 @@ bailout:
} \
} while (0)
 
-#define SQLanyequal_or_not_imp_multi(TPE, OUTPUT) \
+#define SQLanyequal_or_not_imp_multi(TPE, CMP) \
do {\
TPE *rp = (TPE*)Tloc(r, 0), *lp = (TPE*)Tloc(l, 0); \
for (BUN q = 0; q < o; q++) {   \
TPE c = rp[q], d = lp[q]; \
-   res_l[q] = (is_##TPE##_nil(c) || is_##TPE##_nil(d)) ? 
bit_nil : c == d; \
+   res_l[q] = (is_##TPE##_nil(c) || is_##TPE##_nil(d)) ? 
bit_nil : c CMP d; \
} \
} while (0)
 
@@ -635,35 +635,37 @@ SQLanyequal(Client cntxt, MalBlkPtr mb, 
goto bailout;
}
 
+   o = BATcount(r);
if (bret) {
-   o = BATcount(r);
-   if ((res = COLnew(r->hseqbase, TYPE_bit, o, TRANSIENT)) == NULL)
+   if (!(res = COLnew(r->hseqbase, TYPE_bit, o, TRANSIENT))) {
+   msg = createException(SQL, "sql.any =", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
goto bailout;
-   bit *restrict res_l = (bit *) Tloc(res, 0);
+   }
+   bit *restrict res_l = (bit*) Tloc(res, 0);
 
switch (ATOMbasetype(l->ttype)) {
case TYPE_bte:
-   SQLanyequal_or_not_imp_multi(bte, TRUE);
+   SQLanyequal_or_not_imp_multi(bte, ==);
break;
case TYPE_sht:
-   SQLanyequal_or_not_imp_multi(sht, TRUE);
+   SQLanyequal_or_not_imp_multi(sht, ==);
break;
case TYPE_int:
-   SQLanyequal_or_not_imp_multi(int, TRUE);
+   SQLanyequal_or_not_imp_multi(int, ==);
break;
case TYPE_lng:
-   SQLanyequal_or_not_imp_multi(lng, TRUE);
+   SQLanyequal_or_not_imp_multi(lng, ==);
break;
 #ifdef HAVE_HGE
case TYPE_hge:
-   SQLanyequal_or_not_imp_multi(hge, TRUE);
+   SQLanyequal_or_not_imp_multi(hge, ==);
break;
 #endif
case TYPE_flt:
-   SQLanyequal_or_not_imp_multi(flt, TRUE);
+   SQLanyequal_or_not_imp_multi(flt, ==);
break;
case TYPE_dbl:
-   SQLanyequal_or_not_imp_multi(dbl, TRUE);
+   SQLanyequal_or_not_imp_multi(dbl, ==);
break;
default: {
int (*ocmp) (const void *, const void *) = 
ATOMcompare(l->ttype);
@@ -687,7 +689,7 @@ SQLanyequal(Client cntxt, MalBlkPtr mb, 
bit *ret = getArgReference_bit(stk, pci, 0);
 
*ret = FALSE;
-   if (BATcount(r) > 0) {
+   if (o > 0) {
switch (ATOMbasetype(l->ttype)) {
case TYPE_bte:
SQLanyequal_or_not_imp_single(bte, TRUE);
@@ -892,35 +894,37 @@ SQLallnotequal(Client cntxt, MalBlkPtr m
goto bailout;
}
 
+   o = BATcount(r);
if (bret) {
-   o = BATcount(r);
-   if ((res = COLnew(r->hseqbase, TYPE_bit, o, TRANSIENT)) == NULL)
+   if (!(res = COLnew(r->hseqbase, TYPE_bit, o, TRANSIENT))) {
+   msg = createException(SQL, "sql.all <>", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
goto bailout;
-   bit *restrict res_l = (bit *) Tloc(res, 0);
+   }
+   bit *restrict res_l = (bit*) Tloc(res, 0);
 
switch (ATOMbasetype(l->ttype)) {
case TYPE_bte:
-   SQLanyequal_or_not_imp_multi(bte, FALSE);
+   SQLanyequal_or_not_imp_multi(bte, !=);
break;
case TYPE_sht:
-   SQLanyequal_or_not_imp_multi(sht, FALSE);
+   SQLanyequal_or_not_imp_multi(sht, !=);
break;
case TYPE_int:
-   SQLanyequal_or_not_imp_multi(int, FALSE);
+   SQLanyequal_or_not_imp_multi(int, !=);
break;
case TYPE_lng:
-   SQLanyequal_or_not_imp_multi(lng, FALSE);
+   SQLanyequal_or_not_imp_multi(lng, !=);
break;
 #ifdef HAVE_HGE
case 

MonetDB: Oct2020 - merged

2020-09-04 Thread Niels Nes
Changeset: 2d05a0216453 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d05a0216453
Branch: Oct2020
Log Message:

merged


diffs (26 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer06.sql 
b/sql/test/SQLancer/Tests/sqlancer06.sql
--- a/sql/test/SQLancer/Tests/sqlancer06.sql
+++ b/sql/test/SQLancer/Tests/sqlancer06.sql
@@ -224,11 +224,9 @@ DROP TABLE t0;
 DROP TABLE t1;
 DROP TABLE t2;
 
-CREATE TABLE t0(c0 CHAR(473) UNIQUE, c1 INTERVAL SECOND UNIQUE NOT NULL);
-ALTER TABLE t0 ADD UNIQUE(c0, c1);
+CREATE TABLE t0(c1 INTERVAL SECOND UNIQUE);
 DROP INDEX t0_c1_unique;
-INSERT INTO t0 VALUES ('Qnec4v3|', INTERVAL '2071616848' SECOND), ('B', 
INTERVAL '2052804659' SECOND), (NULL, INTERVAL '2052029418' SECOND);
-UPDATE t0 SET c1 = INTERVAL '916700621' SECOND; --error, unique constraint 
violated
+INSERT INTO t0 VALUES (INTERVAL '2071616848' SECOND), (INTERVAL '2071616848' 
SECOND); --error, unique constraint violated
 DROP TABLE t0;
 
 START TRANSACTION;
@@ -315,6 +313,8 @@ 0.713   1970-01-07
 0.199  1970-01-07
 0.109  1970-01-07
 
+SELECT count(*) FROM t1 WHERE t1.c0 <> ALL(SELECT '1' WHERE FALSE);
+   -- 40
 SELECT t1.c0 FROM t1 WHERE t1.c0 <> ALL(SELECT DISTINCT 
CAST(0.5646222839477373 AS INT) FROM t0, t1 WHERE (t0.c1) NOT BETWEEN 
ASYMMETRIC (COALESCE(t0.c1, t0.c1)) AND (t0.c1));
-- 40 rows
 SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT ALL CAST(t1.c0 <> ALL(SELECT 
DISTINCT CAST(0.5646222839477373 AS INT) FROM t0, t1 WHERE (t0.c1) NOT BETWEEN 
ASYMMETRIC (COALESCE(t0.c1, t0.c1)) AND (t0.c1)) AS INT) as count FROM t1) as 
res;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-09-02 Thread Niels Nes
Changeset: 60c4208b7605 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=60c4208b7605
Branch: Oct2020
Log Message:

merged


diffs (truncated from 673 to 300 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
@@ -576,98 +576,97 @@ int win_unlink(const char *);
 int winerror(int);
 
 # mapi
-MapiMsg mapi_bind(MapiHdl hdl, int fnr, char **ptr);
-MapiMsg mapi_bind_numeric(MapiHdl hdl, int fnr, int scale, int precision, void 
*ptr);
-MapiMsg mapi_bind_var(MapiHdl hdl, int fnr, int type, void *ptr);
-MapiMsg mapi_cache_freeup(MapiHdl hdl, int percentage);
-MapiMsg mapi_cache_limit(Mapi mid, int limit);
-MapiMsg mapi_clear_bindings(MapiHdl hdl);
-MapiMsg mapi_clear_params(MapiHdl hdl);
+MapiMsg mapi_bind(MapiHdl hdl, int fnr, char **ptr) 
__attribute__((__nonnull__(1)));
+MapiMsg mapi_bind_numeric(MapiHdl hdl, int fnr, int scale, int precision, void 
*ptr) __attribute__((__nonnull__(1)));
+MapiMsg mapi_bind_var(MapiHdl hdl, int fnr, int type, void *ptr) 
__attribute__((__nonnull__(1)));
+MapiMsg mapi_cache_freeup(MapiHdl hdl, int percentage) 
__attribute__((__nonnull__(1)));
+MapiMsg mapi_cache_limit(Mapi mid, int limit) __attribute__((__nonnull__(1)));
+MapiMsg mapi_clear_bindings(MapiHdl hdl) __attribute__((__nonnull__(1)));
+MapiMsg mapi_clear_params(MapiHdl hdl) __attribute__((__nonnull__(1)));
 MapiMsg mapi_close_handle(MapiHdl hdl);
 Mapi mapi_connect(const char *host, int port, const char *username, const char 
*password, const char *lang, const char *dbname);
-MapiMsg mapi_destroy(Mapi mid);
-MapiMsg mapi_disconnect(Mapi mid);
-MapiMsg mapi_error(Mapi mid);
-const char *mapi_error_str(Mapi mid);
-MapiMsg mapi_execute(MapiHdl hdl);
-void mapi_explain(Mapi mid, FILE *fd);
-void mapi_explain_query(MapiHdl hdl, FILE *fd);
+MapiMsg mapi_destroy(Mapi mid) __attribute__((__nonnull__(1)));
+MapiMsg mapi_disconnect(Mapi mid) __attribute__((__nonnull__(1)));
+MapiMsg mapi_error(Mapi mid) __attribute__((__nonnull__(1)));
+const char *mapi_error_str(Mapi mid) __attribute__((__nonnull__(1)));
+MapiMsg mapi_execute(MapiHdl hdl) __attribute__((__nonnull__(1)));
+void mapi_explain(Mapi mid, FILE *fd) __attribute__((__nonnull__(1)));
+void mapi_explain_query(MapiHdl hdl, FILE *fd) __attribute__((__nonnull__(1)));
 void mapi_explain_result(MapiHdl hdl, FILE *fd);
-int64_t mapi_fetch_all_rows(MapiHdl hdl);
-char *mapi_fetch_field(MapiHdl hdl, int fnr);
-size_t mapi_fetch_field_len(MapiHdl hdl, int fnr);
-char *mapi_fetch_line(MapiHdl hdl);
-MapiMsg mapi_fetch_reset(MapiHdl hdl);
-int mapi_fetch_row(MapiHdl hdl);
-MapiMsg mapi_finish(MapiHdl hdl);
-MapiHdl mapi_get_active(Mapi mid);
-bool mapi_get_autocommit(Mapi mid);
-const char *mapi_get_dbname(Mapi mid);
-int mapi_get_digits(MapiHdl hdl, int fnr);
-int mapi_get_field_count(MapiHdl hdl);
-stream *mapi_get_from(Mapi mid);
-const char *mapi_get_host(Mapi mid);
-const char *mapi_get_lang(Mapi mid);
-int64_t mapi_get_last_id(MapiHdl hdl);
-int mapi_get_len(MapiHdl hdl, int fnr);
-int64_t mapi_get_maloptimizertime(MapiHdl hdl);
-const char *mapi_get_mapi_version(Mapi mid);
-const char *mapi_get_monet_version(Mapi mid);
-const char *mapi_get_motd(Mapi mid);
-char *mapi_get_name(MapiHdl hdl, int fnr);
-char *mapi_get_query(MapiHdl hdl);
-int64_t mapi_get_querytime(MapiHdl hdl);
-int mapi_get_querytype(MapiHdl hdl);
-int64_t mapi_get_row_count(MapiHdl hdl);
-int mapi_get_scale(MapiHdl hdl, int fnr);
-int64_t mapi_get_sqloptimizertime(MapiHdl hdl);
-char *mapi_get_table(MapiHdl hdl, int fnr);
-int mapi_get_tableid(MapiHdl hdl);
-stream *mapi_get_to(Mapi mid);
-bool mapi_get_trace(Mapi mid);
-char *mapi_get_type(MapiHdl hdl, int fnr);
-const char *mapi_get_uri(Mapi mid);
-const char *mapi_get_user(Mapi mid);
-bool mapi_is_connected(Mapi mid);
-MapiMsg mapi_log(Mapi mid, const char *nme);
+int64_t mapi_fetch_all_rows(MapiHdl hdl) __attribute__((__nonnull__(1)));
+char *mapi_fetch_field(MapiHdl hdl, int fnr) __attribute__((__nonnull__(1)));
+size_t mapi_fetch_field_len(MapiHdl hdl, int fnr) 
__attribute__((__nonnull__(1)));
+char *mapi_fetch_line(MapiHdl hdl) __attribute__((__nonnull__(1)));
+MapiMsg mapi_fetch_reset(MapiHdl hdl) __attribute__((__nonnull__(1)));
+int mapi_fetch_row(MapiHdl hdl) __attribute__((__nonnull__(1)));
+MapiMsg mapi_finish(MapiHdl hdl) __attribute__((__nonnull__(1)));
+MapiHdl mapi_get_active(Mapi mid) __attribute__((__nonnull__(1)));
+bool mapi_get_autocommit(Mapi mid) __attribute__((__nonnull__(1)));
+const char *mapi_get_dbname(Mapi mid) __attribute__((__nonnull__(1)));
+int mapi_get_digits(MapiHdl hdl, int fnr) __attribute__((__nonnull__(1)));
+int mapi_get_field_count(MapiHdl hdl) __attribute__((__nonnull__(1)));
+stream *mapi_get_from(Mapi mid) __attribute__((__nonnull__(1)));
+const char *mapi_get_host(Mapi mid) __attribute__((__nonnull__(1)));
+const char *mapi_get_lang(Mapi mid) __attribute__((__nonnull__(1)));

MonetDB: Oct2020 - merged

2020-08-31 Thread Niels Nes
Changeset: 4dc49d9d5052 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4dc49d9d5052
Branch: Oct2020
Log Message:

merged


diffs (44 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
@@ -316,6 +316,8 @@ exp_convert(sql_allocator *sa, sql_exp *
e->r = append(append(sa_list(sa), dup_subtype(sa, fromtype)),totype);
e->tpe = *totype;
e->alias = exp->alias;
+   if (!has_nil(exp))
+   set_has_no_nil(e);
return e;
 }
 
diff --git a/sql/test/Tests/keys.stable.out b/sql/test/Tests/keys.stable.out
--- a/sql/test/Tests/keys.stable.out
+++ b/sql/test/Tests/keys.stable.out
@@ -142,24 +142,24 @@ project (
 % .plan # table_name
 % rel # name
 % clob # type
-% 111 # length
+% 129 # length
 project (
 | group by (
 | | project (
 | | | table(sys.dummyme) [ "dummyme"."a" NOT NULL HASHCOL  ] COUNT 
-| | ) [ bigint["dummyme"."a" NOT NULL HASHCOL ] as "%3"."%3", 
sys.sql_add("%3"."%3", bigint "1") as "%2"."%2" ]
+| | ) [ bigint["dummyme"."a" NOT NULL HASHCOL ] NOT NULL as "%3"."%3", 
sys.sql_add("%3"."%3" NOT NULL, bigint "1") as "%2"."%2" ]
 | ) [  ] [ sys.count unique  no nil ("%2"."%2") as "%1"."%1" ]
 ) [ "%1"."%1" ]
 #plan select count(distinct a + b) from dummyme;
 % .plan # table_name
 % rel # name
 % clob # type
-% 146 # length
+% 164 # length
 project (
 | group by (
 | | project (
 | | | table(sys.dummyme) [ "dummyme"."a" NOT NULL HASHCOL , "dummyme"."b" ] 
COUNT 
-| | ) [ bigint["dummyme"."a" NOT NULL HASHCOL ] as "%3"."%3", 
bigint["dummyme"."b"] as "%4"."%4", sys.sql_add("%3"."%3", "%4"."%4") as 
"%2"."%2" ]
+| | ) [ bigint["dummyme"."a" NOT NULL HASHCOL ] NOT NULL as "%3"."%3", 
bigint["dummyme"."b"] as "%4"."%4", sys.sql_add("%3"."%3" NOT NULL, "%4"."%4") 
as "%2"."%2" ]
 | ) [  ] [ sys.count unique  no nil ("%2"."%2") as "%1"."%1" ]
 ) [ "%1"."%1" ]
 #plan select count(distinct abs(a)) from dummyme;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged with jun

2020-08-31 Thread Niels Nes
Changeset: e6c2658f517c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e6c2658f517c
Branch: Oct2020
Log Message:

merged with jun


diffs (134 lines):

diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -131,7 +131,7 @@ no_updates(InstrPtr *old, int *vars, int
 str
 OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-   int i, j, limit, slimit, actions=0, *vars, *nvars = NULL, *slices = 
NULL, push_down_delta = 0, nr_topn = 0, nr_likes = 0;
+   int i, j, limit, slimit, actions=0, *vars, *nvars = NULL, *slices = 
NULL, push_down_delta = 0, nr_topn = 0, nr_likes = 0, no_mito = 0;
char *rslices = NULL, *oclean = NULL;
InstrPtr p, *old;
subselect_t subselects;
@@ -143,6 +143,7 @@ OPTpushselectImplementation(Client cntxt
if( mb->errors)
return MAL_SUCCEED;
 
+   no_mito = !isOptimizerEnabled(mb, "mitosis");
(void) stk;
(void) pci;
vars= (int*) GDKzalloc(sizeof(int)* mb->vtop);
@@ -176,7 +177,8 @@ OPTpushselectImplementation(Client cntxt
if (isLikeOp(p))
nr_likes++;
 
-   if (getModuleId(p) == sqlRef && getFunctionId(p) == deltaRef)
+   if ((getModuleId(p) == sqlRef && getFunctionId(p) == deltaRef) 
||
+   (no_mito && getModuleId(p) == matRef && 
getFunctionId(p) == packRef && p->argc == (p->retc+2)))
push_down_delta++;
 
if (/* DISABLES CODE */ (0) && getModuleId(p) == sqlRef && 
getFunctionId(p) == tidRef) { /* rewrite equal table ids */
@@ -610,6 +612,10 @@ OPTpushselectImplementation(Client cntxt
 * s = subdelta(nc, uid, nu, ni);
 *
 * doesn't handle Xselect(x, .. z, C1.. cases) ie multicolumn 
selects
+*
+* also handle (if no_mito)
+* c = pack(b, ins)
+* s = select(c, C1..)
 */
lastbat = lastbat_arg(mb, p);
if (isSelect(p) && p->retc == 1 && lastbat == 2) {
@@ -620,7 +626,40 @@ OPTpushselectImplementation(Client cntxt
var = getArg(q, 1);
q = old[vars[var]];
}
-   if (q && getModuleId(q) == sqlRef && getFunctionId(q) 
== deltaRef) {
+   if (no_mito && q && getModuleId(q) == matRef && 
getFunctionId(q) == packRef && q->argc == (q->retc+2)) {
+   InstrPtr r = copyInstruction(p);
+   InstrPtr t = copyInstruction(p);
+
+   if( r == NULL || t == NULL){
+   freeInstruction(r);
+   freeInstruction(t);
+   GDKfree(vars);
+   GDKfree(nvars);
+   GDKfree(slices);
+   GDKfree(rslices);
+   GDKfree(oclean);
+   GDKfree(old);
+   throw(MAL,"optimizer.pushselect", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   }
+   getArg(r, 0) = newTmpVariable(mb, 
newBatType(TYPE_oid));
+   setVarCList(mb,getArg(r,0));
+   getArg(r, 1) = getArg(q, 1); /* column */
+   r->typechk = TYPE_UNKNOWN;
+   pushInstruction(mb,r);
+   getArg(t, 0) = newTmpVariable(mb, 
newBatType(TYPE_oid));
+   setVarCList(mb,getArg(t,0));
+   getArg(t, 1) = getArg(q, 2); /* inserts */
+   pushInstruction(mb,t);
+
+   InstrPtr u = copyInstruction(q); /* pack result 
*/
+   getArg(u, 0) = getArg(p,0);
+   getArg(u, 1) = getArg(r,0);
+   getArg(u, 2) = getArg(t,0);
+   u->typechk = TYPE_UNKNOWN;
+   pushInstruction(mb,u);
+   oclean[i] = 1;
+   continue;
+   } else if (q && getModuleId(q) == sqlRef && 
getFunctionId(q) == deltaRef) {
InstrPtr r = copyInstruction(p);
InstrPtr s = copyInstruction(p);
InstrPtr t = copyInstruction(p);
@@ -673,10 +712,49 @@ OPTpushselectImplementation(Client cntxt
continue;
}
} else if 

MonetDB: Oct2020 - merged

2020-08-28 Thread Niels Nes
Changeset: d7b581e2ad32 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d7b581e2ad32
Branch: Oct2020
Log Message:

merged


diffs (truncated from 356 to 300 lines):

diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -46,7 +46,6 @@ function(monetdb_default_toolchain)
   MT_checkCompilerFlag("-Wvariadic-macros")
   MT_checkCompilerFlag("-Wstack-protector")
   MT_checkCompilerFlag("-fstack-protector-all")
-  MT_checkCompilerFlag("-Wstack-protector")
   MT_checkCompilerFlag("-Wpacked-bitfield-compat")
   MT_checkCompilerFlag("-Wsync-nand")
   MT_checkCompilerFlag("-Wjump-misses-init")
@@ -139,7 +138,6 @@ function(monetdb_default_compiler_option
   add_option_if_available("-Wvariadic-macros")
   add_option_if_available("-Wstack-protector")
   add_option_if_available("-fstack-protector-all")
-  add_option_if_available("-Wstack-protector")
   add_option_if_available("-Wpacked-bitfield-compat")
   add_option_if_available("-Wsync-nand")
   add_option_if_available("-Wjump-misses-init")
@@ -157,6 +155,8 @@ function(monetdb_default_compiler_option
 elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
   if(WIN32)
 add_compile_options("/W3")
+add_compile_options("/Qdiag-disable:11074")
+add_compile_options("/Qdiag-disable:11075")
 add_compile_options("/Wcheck")
 add_compile_options("/Werror-all")
 add_compile_options("/${INTEL_OPTION_EXTRA}wd2259")
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -73,7 +73,7 @@ static pthread_key_t tl_error_key;
 static int
 tl_error_init(void)
 {
-   if (pthread_key_create(_error_key, free) < 0)
+   if (pthread_key_create(_error_key, free) != 0)
return -1;
return 0;
 }
@@ -407,7 +407,7 @@ my_strerror_r(int error_nr, char *buf, s
 #ifndef HAVE_STRERROR_R
// Hope for the best
to_move = strerror(error_nr);
-#elif (_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE
+#elif !defined(_GNU_SOURCE) || !_GNU_SOURCE
// standard strerror_r always writes to buf
int result_code = strerror_r(error_nr, buf, buflen);
if (result_code == 0)
@@ -946,4 +946,3 @@ mnstr_read_block(stream *restrict s, voi
return -1;
return len;
 }
-
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
@@ -1400,8 +1400,10 @@ sqltypeinit( sql_allocator *sa)
sql_create_aggr(sa, "count_no_nil", "aggr", "count_no_nil", TRUE, LNG, 
0);
sql_create_aggr(sa, "count", "aggr", "count", TRUE, LNG, 1, ANY);
 
-   sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, STR, 
1, STR);
-   sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, STR, 
2, STR, STR);
+   for (t = strings; t < numerical; t++) {
+   sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", 
TRUE, *t, 1, *t);
+   sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", 
TRUE, *t, 2, *t, *t);
+   }
 
/* order based operators */
sql_create_analytic(sa, "diff", "sql", "diff", SCALE_NONE, BIT, 1, ANY);
@@ -1591,9 +1593,10 @@ sqltypeinit( sql_allocator *sa)
sql_create_analytic(sa, "avg", "sql", "avg", SCALE_NONE, MONINT, 1, 
MONINT);
sql_create_analytic(sa, "avg", "sql", "avg", SCALE_NONE, SECINT, 1, 
SECINT);
 
-   sql_create_analytic(sa, "listagg", "sql", "str_group_concat", 
SCALE_NONE, STR, 1, STR);
-   sql_create_analytic(sa, "listagg", "sql", "str_group_concat", 
SCALE_NONE, STR, 2, STR, STR);
-
+   for (t = strings; t < numerical; t++) {
+   sql_create_analytic(sa, "listagg", "sql", "str_group_concat", 
SCALE_NONE, *t, 1, *t);
+   sql_create_analytic(sa, "listagg", "sql", "str_group_concat", 
SCALE_NONE, *t, 2, *t, *t);
+   }
sql_create_func(sa, "and", "calc", "and", TRUE, FALSE, SCALE_FIX, 0, 
BIT, 2, BIT, BIT);
sql_create_func(sa, "or",  "calc",  "or", TRUE, FALSE, SCALE_FIX, 0, 
BIT, 2, BIT, BIT);
sql_create_func(sa, "xor", "calc", "xor", FALSE, FALSE, SCALE_FIX, 0, 
BIT, 2, BIT, BIT);
@@ -1800,10 +1803,11 @@ sqltypeinit( sql_allocator *sa)
sql_create_func(sa, "minute", "mtime", "minutes", FALSE, FALSE, 
SCALE_NONE, 0, INT, 1, SECINT);
sql_create_func(sa, "second", "mtime", "seconds", FALSE, FALSE, 
SCALE_NONE, 0, INT, 1, SECINT);
 
-   sql_create_func(sa, "next_value_for", "sql", "next_value", TRUE, TRUE, 
SCALE_NONE, 0, LNG, 2, STR, STR);
-   sql_create_func(sa, "get_value_for", "sql", "get_value", TRUE, FALSE, 
SCALE_NONE, 0, LNG, 2, STR, STR);
-   sql_create_func(sa, "restart", "sql", "restart", TRUE, FALSE, 
SCALE_NONE, 0, LNG, 3, STR, STR, LNG);
for (t = strings; t < numerical; t++) {
+

MonetDB: Oct2020 - merged

2020-08-28 Thread Niels Nes
Changeset: 5b2f7e0f623b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5b2f7e0f623b
Branch: Oct2020
Log Message:

merged


diffs (44 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -403,26 +403,27 @@ my_strerror_r(int error_nr, char *buf, s
// 1. no strerror_r
// 2. gnu strerror_r (returns char* and does not always fill buffer)
// 3. xsi strerror_r (returns int and always fills the buffer)
-   char *ret;
+   char *to_move;
 #ifndef HAVE_STRERROR_R
// Hope for the best
-   ret = strerror(error_nr);
-#else
-#ifdef STRERROR_R_CHAR_P
-   // gnu strerror_r
-   ret = strerror_r(error_nr, buf, buflen);
+   to_move = strerror(error_nr);
+#elif (_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE
+   // standard strerror_r always writes to buf
+   int result_code = strerror_r(error_nr, buf, buflen);
+   if (result_code == 0)
+   to_move = NULL;
+   else
+   to_move = "";
 #else
-   // standard strerror_r
-   (void) strerror_r(error_nr, buf, buflen);
-   ret = NULL;
+   // gnu strerror_r sometimes only returns static string, needs copy
+   to_move = strerror_r(error_nr, buf, buflen);
 #endif
-#endif
-   if (ret != NULL) {
+   if (to_move != NULL) {
// move to buffer
-   size_t size = strlen(ret) + 1;
+   size_t size = strlen(to_move) + 1;
assert(size <= buflen);
// strerror_r may have return a pointer to/into the buffer
-   memmove(buf, ret, size);
+   memmove(buf, to_move, size);
return size - 1;
} else {
return strlen(buf);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-08-27 Thread Niels Nes
Changeset: cf0bcf23dd9d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf0bcf23dd9d
Branch: Oct2020
Log Message:

merged


diffs (truncated from 1081 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -519,8 +519,6 @@ exit 0
 %exclude %{_bindir}/stethoscope
 %{_libdir}/libmonetdb5.so.*
 %dir %{_libdir}/monetdb5
-%{_libdir}/monetdb5/microbenchmark.mal
-%{_libdir}/monetdb5/run_*.mal
 %if %{with cintegration}
 %{_libdir}/monetdb5/lib_capi.so
 %endif
@@ -819,6 +817,10 @@ install -d -m 0775 %{buildroot}%{_rundir
 rm -f %{buildroot}%{_libdir}/*.la
 rm -f %{buildroot}%{_libdir}/monetdb5/*.la
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_opt_sql_append.so
+rm -f %{buildroot}%{_libdir}/monetdb5/run_*.mal
+rm -f %{buildroot}%{_libdir}/monetdb5/lib_run_*.so
+rm -f %{buildroot}%{_libdir}/monetdb5/microbenchmark.mal
+rm -f %{buildroot}%{_libdir}/monetdb5/lib_microbenchmark*.so
 rm -f %{buildroot}%{_bindir}/monetdb_mtest.sh
 rm -rf %{buildroot}%{_datadir}/monetdb # /cmake
 
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -171,11 +171,9 @@ def main():
 print(r'')
 print(r'  ')
 id = comp(features, id, 16,
-  [r'lib\monetdb5\microbenchmark.mal'])
-id = comp(features, id, 16,
-  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.dll') and ('geom' not in x) and ('pyapi' not 
in x) and ('opt_sql_append' not in x), os.listdir(os.path.join(sys.argv[3], 
'lib', 'monetdb5'])
+  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.dll') and ('geom' not in x) and ('pyapi' not 
in x) and ('opt_sql_append' not in x) and ('run_' not in x) and 
('microbenchmark' not in x), os.listdir(os.path.join(sys.argv[3], 'lib', 
'monetdb5'])
 id = comp(debug, id, 16,
-  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.pdb') and ('geom' not in x) and 
('opt_sql_append' not in x), os.listdir(os.path.join(sys.argv[3], 'lib', 
'monetdb5'])
+  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.pdb') and ('geom' not in x) and 
('opt_sql_append' not in x) and ('run_' not in x) and ('microbenchmark' not in 
x), os.listdir(os.path.join(sys.argv[3], 'lib', 'monetdb5'])
 id = comp(geom, id, 16,
   [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and (x.endswith('.dll') or x.endswith('.pdb')) and ('geom' in 
x), os.listdir(os.path.join(sys.argv[3], 'lib', 'monetdb5'])
 id = comp(pyapi3, id, 16,
diff --git a/common/stream/stdio_stream.c b/common/stream/stdio_stream.c
--- a/common/stream/stdio_stream.c
+++ b/common/stream/stdio_stream.c
@@ -410,9 +410,6 @@ stream *
 stdin_rastream(void)
 {
const char *name = "";
-#ifdef _MSC_VER
-   return win_console_in_stream(name);
-#else
// Make an attempt to skip a BOM marker.
// It would be nice to integrate this with with the BOM removal code
// in text_stream.c but that is complicated. In text_stream,
@@ -433,6 +430,9 @@ stdin_rastream(void)
}
}
 
+#ifdef _MSC_VER
+   return win_console_in_stream(name);
+#else
return file_rstream(stdin, false, name);
 #endif
 }
diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt
--- a/common/utils/CMakeLists.txt
+++ b/common/utils/CMakeLists.txt
@@ -63,7 +63,7 @@ target_link_libraries(mcrypt
 if(WIN32)
   target_compile_definitions(mcrypt 
 PRIVATE
-LIBMAL
+LIBMONETDB5
 LIBMAPI
 LIBMCRYPT)
 endif()
@@ -102,12 +102,7 @@ target_link_libraries(msabaoth
 if(WIN32)
   target_compile_definitions(msabaoth
 PRIVATE
-LIBMAL
-LIBATOMS
-LIBKERNEL
 LIBMSABAOTH
-LIBOPTIMIZER
-LIBSCHEDULER
 LIBMONETDB5)
 endif()
 
diff --git a/common/utils/mcrypt.h b/common/utils/mcrypt.h
--- a/common/utils/mcrypt.h
+++ b/common/utils/mcrypt.h
@@ -10,7 +10,7 @@
 #define _SEEN_MCRYPT_H 1
 
 #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
-#if !defined(LIBMAPI) && !defined(LIBMCRYPT) && !defined(LIBMAL)
+#if !defined(LIBMAPI) && !defined(LIBMCRYPT) && !defined(LIBMONETDB5)
 #define mcrypt_export extern __declspec(dllimport)
 #else
 #define mcrypt_export extern __declspec(dllexport)
@@ -45,4 +45,3 @@ mcrypt_export char *mcrypt_RIPEMD160Sum(
 mcrypt_export char *mcrypt_BackendSum(const char *string, size_t len);
 mcrypt_export char *mcrypt_hashPassword(const char *algo, const char 
*password, const char *challenge);
 #endif
-
diff --git a/common/utils/msabaoth.h b/common/utils/msabaoth.h
--- a/common/utils/msabaoth.h
+++ b/common/utils/msabaoth.h
@@ -56,7 +56,7 @@ typedef struct Ssabuplog {
 } sabuplog;
 
 #ifdef WIN32
-#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 

MonetDB: Oct2020 - merged

2020-08-26 Thread Niels Nes
Changeset: 7594e17aad8e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7594e17aad8e
Branch: Oct2020
Log Message:

merged


diffs (truncated from 890 to 300 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
@@ -1580,12 +1580,12 @@ void moveInstruction(MalBlkPtr mb, int p
 void msab_dbfarminit(const char *dbfarm);
 void msab_dbnameinit(const char *dbname);
 void msab_dbpathinit(const char *dbpath);
-char *msab_deserialise(sabdb **ret, char *sabdb);
+char *msab_deserialise(sabdb **ret, const char *sabdb);
 void msab_freeStatus(sabdb **ret);
 char *msab_getDBfarm(char **ret);
 char *msab_getDBname(char **ret);
 char *msab_getMyStatus(sabdb **ret);
-char *msab_getStatus(sabdb **ret, char *dbname);
+char *msab_getStatus(sabdb **ret, const char *dbname);
 char *msab_getUUID(char **ret);
 char *msab_getUplogInfo(sabuplog *ret, const sabdb *db);
 char *msab_marchConnection(const char *host, const int port);
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -33,6 +33,7 @@
 #include "msabaoth.h"
 #include "mutils.h"
 #include "muuid.h"
+#include "mstring.h"
 
 #if defined(_MSC_VER) && _MSC_VER >= 1400
 #define close _close
@@ -895,7 +896,7 @@ msab_getSingleStatus(const char *pathbuf
  * is terminated by a NULL entry.
  */
 char *
-msab_getStatus(sabdb** ret, char *dbname)
+msab_getStatus(sabdb** ret, const char *dbname)
 {
DIR *d;
struct dirent *e;
@@ -1148,272 +1149,202 @@ msab_serialise(char **ret, const sabdb *
  * Produces a sabdb struct out of a serialised string.
  */
 char *
-msab_deserialise(sabdb **ret, char *sdb)
+msab_deserialise(sabdb **ret, const char *sdb)
 {
char *dbname;
char *uri;
-   int locked;
-   int state;
-   char *scens = "";
+   char *scens;
sabdb *s;
sabuplog *u;
-   sablist *l;
-   char *p;
-   char *lasts;
+   const char *lasts;
char buf[FILENAME_MAX];
-   char protover = 0;
 
-   lasts = sdb;
-   if ((p = strchr(lasts, ':')) == NULL) {
+   if (strncmp(sdb, "sabdb:", 6) != 0) {
snprintf(buf, sizeof(buf),
-   "string does not contain a magic: %s", lasts);
-   return(strdup(buf));
-   }
-   *p++ = '\0';
-   if (strcmp(lasts, "sabdb") != 0) {
-   snprintf(buf, sizeof(buf),
-   "string is not a sabdb struct: %s", lasts);
-   return(strdup(buf));
-   }
-   lasts = p;
-   if ((p = strchr(p, ':')) == NULL) {
-   snprintf(buf, sizeof(buf),
-   "string does not contain a version number: %s", 
lasts);
+   "string is not a sabdb struct: %s", sdb);
return(strdup(buf));
}
-   *p++ = '\0';
-   if (strcmp(lasts, "1") == 0) {
-   /* Protocol 1 was used uptil Oct2012.  Since Jul2012 a new state
-* SABdbStarting was introduced, but not exposed to the client
-* in serialise.  In Feb2013, the path component was removed
-* and replaced by an URI field.  This meant dbname could no
-* longer be deduced from path, and hence sent separately.
-* Since the conns property became useless in the light of the
-* added uri, it was dropped.  On top of this, a laststop
-* property was added to the uplog struct.
-* These four changes were effectuated in protocol 2.  When
-* reading protocol 1, we use the path field to set dbname, but
-* ignore the path information (and set uri to "".  The
-* SABdbStarting state never occurs. */
-   } else if (strcmp(lasts, SABDBVER) != 0) {
+   sdb += 6;
+   /* Protocol 1 was used uptil Oct2012 and is no longer supported.
+* Since Jul2012 a new state
+* SABdbStarting was introduced, but not exposed to the client
+* in serialise.  In Feb2013, the path component was removed
+* and replaced by a URI field.  This meant dbname could no
+* longer be deduced from path, and hence sent separately.
+* Since the conns property became useless in the light of the
+* added uri, it was dropped.  On top of this, a laststop
+* property was added to the uplog struct.
+* These four changes were effectuated in protocol 2.  When
+* reading protocol 1, we use the path field to set dbname, but
+* ignore the path information (and set uri to "".  The
+* SABdbStarting state never occurs. */
+   if (strncmp(sdb, SABDBVER ":", sizeof(SABDBVER)) != 0) {
snprintf(buf, sizeof(buf),
-   "string has unsupported version: %s", lasts);
+

MonetDB: Oct2020 - Merged with Jun2020

2020-08-26 Thread Pedro Ferreira
Changeset: b5c1a3514e08 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5c1a3514e08
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (14 lines):

diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -67,8 +67,8 @@ createExceptionInternal(enum malexceptio
// if there is an error we allow memory allocation once again
GDKsetmallocsuccesscount(-1);
 #endif
-   len = snprintf(local, GDKMAXERRLEN - 1, "%s:%s:", exceptionNames[type], 
fcn);
-   len = vsnprintf(local + len, GDKMAXERRLEN -1, format, ap);
+   len = snprintf(local, GDKMAXERRLEN, "%s:%s:", exceptionNames[type], 
fcn);
+   len = vsnprintf(local + len, GDKMAXERRLEN - len, format, ap);
if (len < 0)
TRC_CRITICAL(MAL_SERVER, "called with bad arguments");
char *q = local;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-08-26 Thread Niels Nes
Changeset: 3842e047040f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3842e047040f
Branch: Oct2020
Log Message:

merged


diffs (56 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer05.sql 
b/sql/test/SQLancer/Tests/sqlancer05.sql
--- a/sql/test/SQLancer/Tests/sqlancer05.sql
+++ b/sql/test/SQLancer/Tests/sqlancer05.sql
@@ -11,3 +11,52 @@ INSERT INTO t1(c0) VALUES(INTERVAL '1448
 DELETE FROM t1 WHERE CAST(TRUE AS BOOLEAN);
-- all rows deleted
 DROP TABLE sys.t1;
+
+START TRANSACTION;
+CREATE TABLE "sys"."t0" ("c0" TIMESTAMP,"c1" INTERVAL MONTH,CONSTRAINT 
"t0_c1_unique" UNIQUE ("c1"));
+CREATE TABLE "sys"."t1" ("c0" BOOLEAN, "c1" DECIMAL(18,3) NOT NULL);
+COPY 9 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+NULL   0.526
+true   0.259
+true   0.382
+NULL   0.994
+NULL   0.101
+NULL   0.713
+NULL   0.433
+NULL   0.899
+NULL   0.239
+
+CREATE TABLE "sys"."t2" ("c0" BOOLEAN, "c1" DECIMAL(18,3));
+COPY 3 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+NULL   0.692
+NULL   0.860
+NULL   0.230
+
+SELECT max(t2.c1) FROM t1 LEFT OUTER JOIN t2 ON CASE WHEN t2.c0 < t1.c0 OR 
t1.c0 THEN t1.c0 WHEN t1.c0 THEN t1.c0 END;
+   -- 0.860
+create view v0(c0) as (select all 7.948668E7 from t1) with check option;
+SELECT max(t2.c1) FROM t0, t1 CROSS JOIN v0 LEFT OUTER JOIN t2 
+ON CASE WHEN 
v0.c0)=(v0.c0)))OR(((t1.c0)>=(t1.c0)AND(((t2.c0)<(t1.c0)OR(t1.c0)AND(t1.c0)))AND(t1.c0
 
+THEN t1.c0 WHEN COALESCE(COALESCE(TRUE, t2.c0, t1.c0), CASE t1.c1 WHEN t2.c1 
THEN t2.c0 WHEN t1.c1 THEN t2.c0 ELSE t1.c0 END) 
+THEN t2.c0 WHEN t1.c0 THEN t1.c0 END;
+rollback;
+
+START TRANSACTION;
+CREATE TABLE t0("c1" INTEGER NOT NULL,CONSTRAINT "t0_c1_pkey" PRIMARY KEY 
("c1"),CONSTRAINT "t0_c1_unique" UNIQUE ("c1"));
+COPY 8 RECORDS INTO t0 FROM stdin USING DELIMITERS E'\t',E'\n','"';
+262015489
+-1667887296
+1410307212
+1073218199
+-167204307
+1394786866
+1112194034
+2140251980
+
+SELECT 1 FROM (select time '12:43:09' from t0) as v0(c0) RIGHT OUTER JOIN 
(SELECT INTERVAL '2' SECOND FROM t0) AS sub0 ON 
+TIME '07:04:19' BETWEEN CASE 'b' WHEN 'a' THEN v0.c0 ELSE v0.c0 END AND v0.c0;
+   --8 rows of 1
+create view v0(c0, c1) as (select all time '12:43:09', interval '1251003346' 
second from t0) with check option;
+SELECT count(ALL - (CAST(NULL AS INT))) FROM v0 RIGHT OUTER JOIN (SELECT 
INTERVAL '1380374779' SECOND FROM t0) AS sub0 ON 
+COALESCE(TRUE, (TIME '07:04:19') BETWEEN SYMMETRIC (CASE r'漈' WHEN r'T㊆ßwU.H' 
THEN v0.c0 ELSE v0.c0 END) AND (v0.c0));
+rollback;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-08-25 Thread Niels Nes
Changeset: e2303cab844d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2303cab844d
Branch: Oct2020
Log Message:

merged


diffs (100 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
@@ -1800,9 +1800,33 @@ exp_is_zero(sql_exp *e)
 int
 exp_is_not_null(sql_exp *e)
 {
-   if (e->type == e_atom && e->l)
-   return !(atom_null(e->l));
-   return 0;
+   switch (e->type) {
+   case e_atom:
+   if (e->f) /* values list */
+   return false;
+   if (e->l)
+   return !(atom_null(e->l));
+   return false;
+   case e_convert:
+   return exp_is_not_null(e->l);
+   case e_func:
+   if (!e->semantics && e->l) {
+   list *l = e->l;
+   for (node *n = l->h; n; n=n->next) {
+   sql_exp *p = n->data;
+   if (!exp_is_not_null(p))
+   return false;
+   }
+   return true;
+   }
+   return false;
+   case e_aggr:
+   case e_column:
+   case e_cmp:
+   case e_psm:
+   return false;
+   }
+   return false;
 }
 
 int
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
@@ -7528,6 +7528,22 @@ rel_simplify_predicates(visitor *v, sql_
 {
(void)depth;
if (is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) {
+   if (is_compare(e->type) && is_semantics(e) && (e->flag == 
cmp_equal || e->flag == cmp_notequal) && exp_is_null(e->r)) {
+   /* simplify 'is null' predicates on constants */
+   if (exp_is_null(e->l)) {
+   int nval = e->flag == cmp_equal;
+   if (is_anti(e)) nval = !nval;
+   e = exp_atom_bool(v->sql->sa, nval);
+   v->changes++;
+   return e;
+   } else if (exp_is_not_null(e->l)) {
+   int nval = e->flag == cmp_notequal;
+   if (is_anti(e)) nval = !nval;
+   e = exp_atom_bool(v->sql->sa, nval);
+   v->changes++;
+   return e;
+   }
+   }
if (is_atom(e->type) && ((!e->l && !e->r && !e->f) || e->r)) /* 
prepared statement parameter or argument */
return e;
if (is_atom(e->type) && e->l) { /* direct literal */
@@ -7642,6 +7658,7 @@ rel_simplify_predicates(visitor *v, sql_
}
}
} else if (is_atom(l->type) && is_atom(r->type) && 
!is_semantics(e)) {
+   /* compute comparisons on atoms */
if (exp_is_null(l) || exp_is_null(r)) {
e = exp_null(v->sql->sa, 
sql_bind_localtype("bit"));
v->changes++;
diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.out 
b/sql/test/miscellaneous/Tests/groupby_error.stable.out
--- a/sql/test/miscellaneous/Tests/groupby_error.stable.out
+++ b/sql/test/miscellaneous/Tests/groupby_error.stable.out
@@ -510,6 +510,22 @@ project (
 #CREATE TABLE tab2 ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER);
 #INSERT INTO tab2 VALUES(64,77,40), (75,67,58), (46,51,23);
 [ 3]
+#SELECT col2 FROM tab2 WHERE col2 >= - col1 * 2 AND 1 IS NOT NULL;
+% sys.tab2 # table_name
+% col2 # name
+% int # type
+% 2 # length
+[ 40   ]
+[ 58   ]
+[ 23   ]
+#SELECT col2 FROM tab2 WHERE ( + col2 ) >= - col1 * + + 19 * + col2 AND NOT 79 
/ + 50 IS NULL;
+% sys.tab2 # table_name
+% col2 # name
+% int # type
+% 2 # length
+[ 40   ]
+[ 58   ]
+[ 23   ]
 #ROLLBACK;
 #START TRANSACTION;
 #CREATE TABLE t(x DECIMAL(4,1));
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-08-25 Thread Niels Nes
Changeset: bfb40e21a31a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bfb40e21a31a
Branch: Oct2020
Log Message:

merged


diffs (28 lines):

diff --git a/cmake/monetdb-custom-targets.cmake 
b/cmake/monetdb-custom-targets.cmake
--- a/cmake/monetdb-custom-targets.cmake
+++ b/cmake/monetdb-custom-targets.cmake
@@ -86,7 +86,7 @@ endif()
 if(CANDLE_FOUND)
   add_custom_target(create-wix-packages
 COMMAND
-${CMAKE_CPACK_COMMAND} -G WIX -C Debug
+${CMAKE_CPACK_COMMAND} -G WIX -C Release
 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 else()
   add_custom_target(create-wix-packages
diff --git a/sql/backends/monet5/UDF/pyapi3/CMakeLists.txt 
b/sql/backends/monet5/UDF/pyapi3/CMakeLists.txt
--- a/sql/backends/monet5/UDF/pyapi3/CMakeLists.txt
+++ b/sql/backends/monet5/UDF/pyapi3/CMakeLists.txt
@@ -77,10 +77,10 @@ if(HAVE_LIBPY3)
 configure_file(pyapi_locatepython3.bat.in
   ${CMAKE_CURRENT_BINARY_DIR}/pyapi_locatepython3.bat @ONLY)
 
-install(FILES $ DESTINATION ${LIBDIR}/monetdb5 
OPTIONAL)
+install(FILES $ DESTINATION 
${CMAKE_INSTALL_LIBDIR}/monetdb5 OPTIONAL)
 install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/pyapi_locatepython3.bat
-  DESTINATION ${CMAKE_INSTALL_PREFIX}
+  DESTINATION "."
   COMPONENT server)
   endif()
 endif()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - merged

2020-08-24 Thread Niels Nes
Changeset: 475af50e54c4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=475af50e54c4
Branch: Oct2020
Log Message:

merged


diffs (truncated from 707 to 300 lines):

diff --git a/common/stream/Tests/All b/common/stream/Tests/All
--- a/common/stream/Tests/All
+++ b/common/stream/Tests/All
@@ -1,13 +1,13 @@
 read_uncompressed
 HAVE_LIBBZ2?read_bz2
 HAVE_LIBZ?read_gz
-HAVE_LIBLZ4?read_lz4
+HAVE_LIBLZ4_PYTHON_LZ4?read_lz4
 HAVE_LIBLZMA?read_xz
 
 write_uncompressed
 HAVE_LIBBZ2?write_bz2
 HAVE_LIBZ?write_gz
-HAVE_LIBLZ4?write_lz4
+HAVE_LIBLZ4_PYTHON_LZ4?write_lz4
 HAVE_LIBLZMA?write_xz
 
 urlstream
diff --git a/common/stream/Tests/testdata.py b/common/stream/Tests/testdata.py
--- a/common/stream/Tests/testdata.py
+++ b/common/stream/Tests/testdata.py
@@ -2,10 +2,7 @@
 
 # Generating test files and verifying them after transmission.
 
-import bz2
 import gzip
-import lz4.frame
-import lzma
 
 import os
 import sys
@@ -208,10 +205,13 @@ class TestFile:
 elif self.compression == 'gz':
 f = gzip.GzipFile(filename, 'wb', fileobj=fileobj, 
mtime=131875200, compresslevel=1)
 elif self.compression == 'bz2':
+import bz2
 f = bz2.BZ2File(fileobj, 'wb', compresslevel=1)
 elif self.compression == 'xz':
+import lzma
 f = lzma.LZMAFile(fileobj, 'wb', preset=1)
 elif self.compression == 'lz4': # ok
+import lz4.frame
 f = lz4.frame.LZ4FrameFile(fileobj, 'wb', compression_level=1)
 else:
 raise Exception("Unknown compression scheme: " + self.compression)
@@ -225,10 +225,13 @@ class TestFile:
 elif self.compression == 'gz':
 f = gzip.GzipFile(filename, 'rb', mtime=131875200)
 elif self.compression == 'bz2':
+import bz2
 f = bz2.BZ2File(filename, 'rb')
 elif self.compression == 'xz':
+import lzma
 f = lzma.LZMAFile(filename, 'rb')
 elif self.compression == 'lz4':
+import lz4.frame
 f = lz4.frame.LZ4FrameFile(filename, 'rb')
 else:
 raise Exception("Unknown compression scheme: " + self.compression)
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -272,60 +272,51 @@ static ATOMIC_TYPE threadno = ATOMIC_VAR
 static void
 SERVERlistenThread(SOCKET *Sock)
 {
-   char *msg = 0;
+   char *msg = NULL;
int retval;
-   SOCKET sock = Sock[0];
-   SOCKET usock = Sock[1];
-   SOCKET msgsock = INVALID_SOCKET;
+   SOCKET socks[3] = {Sock[0], Sock[1], Sock[2]};
struct challengedata *data;
MT_Id tid;
stream *s;
+   int i;
 
GDKfree(Sock);
 
(void) ATOMIC_INC();
 
do {
+   SOCKET msgsock = INVALID_SOCKET;
 #ifdef HAVE_POLL
-   struct pollfd pfd[2];
+   struct pollfd pfd[3];
nfds_t npfd;
npfd = 0;
-   if (sock != INVALID_SOCKET)
-   pfd[npfd++] = (struct pollfd) {.fd = sock, .events = 
POLLIN};
-#ifdef HAVE_SYS_UN_H
-   if (usock != INVALID_SOCKET)
-   pfd[npfd++] = (struct pollfd) {.fd = usock, .events = 
POLLIN};
-#endif
+   for (i = 0; i < 3; i++) {
+   if (socks[i] != INVALID_SOCKET)
+   pfd[npfd++] = (struct pollfd) {.fd = socks[i],
+   
   .events = POLLIN};
+   }
/* Wait up to 0.1 seconds (0.01 if testing) */
retval = poll(pfd, npfd, GDKdebug & FORCEMITOMASK ? 10 : 100);
if (retval == -1 && errno == EINTR)
continue;
 #else
-   struct timeval tv;
fd_set fds;
FD_ZERO();
-   if (sock != INVALID_SOCKET)
-   FD_SET(sock, );
-#ifdef HAVE_SYS_UN_H
-   if (usock != INVALID_SOCKET)
-   FD_SET(usock, );
-#endif
+   /* temporarily use msgsock to record the highest socket fd */
+   for (i = 0; i < 3; i++) {
+   if (socks[i] != INVALID_SOCKET) {
+   FD_SET(socks[i], );
+   if (msgsock == INVALID_SOCKET || socks[i] > 
msgsock)
+   msgsock = socks[i];
+   }
+   }
/* Wait up to 0.1 seconds (0.01 if testing) */
-   tv = (struct timeval) {
+   struct timeval tv = (struct timeval) {
.tv_usec = GDKdebug & FORCEMITOMASK ? 1 : 10,
};
 
-   /* temporarily use msgsock to record the larger of sock and 
usock */
-#ifdef _MSC_VER
-   msgsock = 0; 

MonetDB: Oct2020 - merged with jun2020

2020-08-24 Thread Niels Nes
Changeset: 7d46e20dd85a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7d46e20dd85a
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2020/Tests/All
Branch: Oct2020
Log Message:

merged with jun2020


diffs (126 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -9,8 +9,6 @@
 #include "monetdb_config.h"
 #include "rel_select.h"
 #include "sql_tokens.h"
-#include "sql_semantic.h"  /* TODO this dependency should be removed, move
-  the dependent code into sql_mvc */
 #include "sql_privileges.h"
 #include "sql_env.h"
 #include "sql_qc.h"
@@ -2986,7 +2984,8 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e
if (!check_card(card,f))
continue;
 
-   l = exp_check_type(sql, >type, rel, l, 
type_equal);
+   if (f->func->fix_scale != INOUT)
+   l = exp_check_type(sql, >type, rel, 
l, type_equal);
a = m->next->data;
r = exp_check_type(sql, >type, rel, r, 
type_equal);
if (l && r)
@@ -3042,7 +3041,8 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e
node *m = f->func->ops->h;
sql_arg *a = m->data;
 
-   l = exp_check_type(sql, >type, rel, l, type_equal);
+   if (f->func->fix_scale != INOUT)
+   l = exp_check_type(sql, >type, rel, l, 
type_equal);
a = m->next->data;
r = exp_check_type(sql, >type, rel, r, type_equal);
if (l && r)
diff --git a/sql/test/BugTracker-2020/Tests/All 
b/sql/test/BugTracker-2020/Tests/All
--- a/sql/test/BugTracker-2020/Tests/All
+++ b/sql/test/BugTracker-2020/Tests/All
@@ -19,3 +19,4 @@ tpch-cube.Bug-6938
 HAVE_PYMONETDB?remote-table-like.Bug-6841
 KNOWNFAIL?copy-empty-blob.Bug-6948
 values-like-join.Bug-6954
+round.Bug-6955
diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql 
b/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.sql
@@ -0,0 +1,13 @@
+CREATE TABLE decimals(d DECIMAL(4,1), prec INTEGER);
+INSERT INTO decimals VALUES ('999.9', 0);
+SELECT ROUND(d, prec) FROM decimals;
+-- expected: 1000, actual: 100
+SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0);
+-- correct result: 1000
+SELECT ROUND(d, 0) FROM decimals;
+-- correct result: 1000.0
+SELECT ROUND(d, 0.1) FROM decimals;
+-- expected: error or 1000.0, got 100.0
+SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0.1);
+-- same result: got 100.0
+drop table decimals;
diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err 
b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'round.Bug-6955` in directory 'sql/test/BugTracker-2020` itself:
+
+
+# 13:22:40 >  
+# 13:22:40 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-761252" "--port=39464"
+# 13:22:40 >  
+
+
+# 13:22:40 >  
+# 13:22:40 >  "Done."
+# 13:22:40 >  
+
diff --git a/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out 
b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/round.Bug-6955.stable.out
@@ -0,0 +1,46 @@
+stdout of test 'round.Bug-6955` in directory 'sql/test/BugTracker-2020` itself:
+
+
+# 13:22:40 >  
+# 13:22:40 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-761252" "--port=39464"
+# 13:22:40 >  
+
+#CREATE TABLE decimals(d DECIMAL(4,1), prec INTEGER);
+#INSERT INTO decimals VALUES ('999.9', 0);
+[ 1]
+#SELECT ROUND(d, prec) FROM decimals;
+% sys.%1 # table_name
+% %1 # name
+% decimal # type
+% 6 # length
+[ 1000.0   ]
+#SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0);
+% .%2 # table_name
+% %2 # name
+% decimal # type
+% 6 # length
+[ 1000.0   ]
+#SELECT ROUND(d, 0) FROM decimals;
+% sys.%1 # table_name
+% %1 # name
+% decimal # type
+% 6 # length
+[ 1000.0   ]
+#SELECT ROUND(d, 0.1) FROM decimals;
+% sys.%1 # table_name
+% %1 # name
+% decimal # type
+% 6 # length
+[ 1000.0   ]
+#SELECT ROUND(CAST(999.9 AS DECIMAL(4,1)), 0.1);
+% .%2 # table_name
+% %2 # name
+% decimal # type
+% 6 # length
+[ 1000.0   ]
+#drop table decimals;
+
+# 13:22:40 >  
+# 13:22:40 >  "Done."
+# 13:22:40 >  
+
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list