MonetDB: wlcr - Framework for update propagation

2017-01-09 Thread Martin Kersten
Changeset: 0aeed274e6a5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0aeed274e6a5
Modified Files:
sql/backends/monet5/sql_wlcr.c
Branch: wlcr
Log Message:

Framework for update propagation


diffs (70 lines):

diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -275,6 +275,7 @@ CLONEquery(Client cntxt, MalBlkPtr mb, M
 str
 CLONEgeneric(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+   // currently they are informative only
(void) cntxt;
(void) mb;
(void) stk;
@@ -284,13 +285,53 @@ CLONEgeneric(Client cntxt, MalBlkPtr mb,
 
 str
 CLONEappend(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-   (void) cntxt;
-   (void) mb;
-   (void) stk;
-   (void) pci;
+{  str sname, tname, cname;
+int tpe,i;
+   mvc *m=NULL;
+   sql_schema *s;
+   sql_table *t;
+   sql_column *c;
+   BAT *ins = 0;
+   str msg;
+
+   sname = *getArgReference_str(stk,pci,2);
+   tname = *getArgReference_str(stk,pci,3);
+   cname = *getArgReference_str(stk,pci,4);
+
+   if ((msg = getSQLContext(cntxt, mb, , NULL)) != NULL)
+   return msg;
+   if ((msg = checkSQLContext(cntxt)) != NULL)
+   return msg;
+
+   s = mvc_bind_schema(m, sname);
+   if (s == NULL)
+   throw(SQL, "sql.append", "Schema missing");
+   t = mvc_bind_table(m, s, tname);
+   if (t == NULL)
+   throw(SQL, "sql.append", "Table missing");
+   // get the data into local BAT
+
+   tpe= getArgType(mb,pci,5);
+   ins = COLnew(0, tpe, 0, TRANSIENT);
+   if( ins == NULL){
+   throw(SQL,"CLONEappend",MAL_MALLOC_FAIL);
+   }
+
+   for( i = 5; i < pci->argc; i++)
+   BATappend(ins, NULL, (void*) getArgReference(stk,pci,i), FALSE);
+
+   if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
+   store_funcs.append_col(m->session->tr, c, ins, tpe);
+   } 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);
+   }
+   BBPunfix(((BAT *) ins)->batCacheid);
+
return MAL_SUCCEED;
 }
+
 str
 CLONEdelete(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: wlcr - Add SQL transaction bounds

2017-01-09 Thread Martin Kersten
Changeset: 2927da8361fe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2927da8361fe
Modified Files:
sql/backends/monet5/sql_wlcr.c
Branch: wlcr
Log Message:

Add SQL transaction bounds


diffs (40 lines):

diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -92,6 +92,7 @@ WLCRprocess(void *arg)
MalBlkPtr mb;
InstrPtr q;
str msg;
+   mvc *sql;
 
c =MCforkClient(cntxt);
if( c == 0){
@@ -109,6 +110,11 @@ WLCRprocess(void *arg)
msg = SQLinitClient(c);
if( msg != MAL_SUCCEED)
mnstr_printf(c->fdout,"#Failed to initialize the client\n");
+   msg = getSQLContext(c, mb, , NULL);
+   if( msg)
+   mnstr_printf(c->fdout,"#Failed to access the transaction 
context: %s\n",msg);
+if ((msg = checkSQLContext(c)) != NULL)
+   mnstr_printf(c->fdout,"#Inconsitent SQL contex : %s\n",msg);
 
mnstr_printf(c->fdout,"#Ready to start the replayagainst '%s' batches 
%d threshold %d\n", 
wlcr_master, wlcr_replaybatches, wlcr_replaythreshold);
@@ -145,9 +151,16 @@ WLCRprocess(void *arg)
chkTypes(c->fdout,c->nspace, mb, FALSE);
chkFlow(c->fdout,mb);
chkDeclarations(c->fdout,mb);
+   sql->session->auto_commit = 0;
+   sql->session->ac_on_commit = 1;
+   sql->session->level = 0;
+   (void) mvc_trans(sql);
msg= runMAL(c,mb,0,0);
if( msg != MAL_SUCCEED) // they should succeed
break;
+   if( mvc_commit(sql, 0, 0) < 0)
+   mnstr_printf(c->fdout,"#wlcr.process 
transaction commit failed");
+
// cleanup
trimMalVariables(mb, NULL);
resetMalBlk(mb, 1);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: wlcr - Get the WLCR log ready for execution at the clone

2017-01-09 Thread Martin Kersten
Changeset: 2b0530250203 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b0530250203
Modified Files:
monetdb5/mal/mal_client.h
monetdb5/mal/mal_parser.c
monetdb5/modules/mal/wlcr.c
monetdb5/modules/mal/wlcr.h
monetdb5/modules/mal/wlcr.mal
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
sql/backends/monet5/sql_wlcr.c
sql/backends/monet5/sql_wlcr.h
sql/backends/monet5/sql_wlcr.mal
sql/scripts/60_wlcr.sql
Branch: wlcr
Log Message:

Get the WLCR log ready for execution at the clone


diffs (truncated from 786 to 300 lines):

diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -175,6 +175,7 @@ typedef struct CLIENT {
 * The workload for replication/replay is saved initially as a MAL 
block.
 */
int wlcr_kind;  
+   int wlcr_mode;
MalBlkPtr wlcr;
/*  
 *  Errors during copy into are collected in a user specific column 
set
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1753,9 +1753,10 @@ parseMAL(Client cntxt, Symbol curPrg, in
 
echoInput(cntxt);
/* here the work takes place */
-   while ((c = currChar(cntxt)) && lines-- > 0) {
+   while ((c = currChar(cntxt)) && lines > 0) {
switch (c) {
case '\n': case '\r': case '\f':
+   lines -= c =='\n';
nextChar(cntxt);
echoInput(cntxt);
continue;
diff --git a/monetdb5/modules/mal/wlcr.c b/monetdb5/modules/mal/wlcr.c
--- a/monetdb5/modules/mal/wlcr.c
+++ b/monetdb5/modules/mal/wlcr.c
@@ -71,7 +71,8 @@ static MT_Lock wlcr_lock MT_LOCK_INI
 
 
 int wlcr_threshold = 0; // threshold (milliseconds) for keeping readonly 
queries
-int wlcr_batch = 0;// last batch jon identifier 
+int wlcr_batch = 0;// last batch job identifier 
+int wlcr_start = 0;// first batch to check next
 int wlcr_tid = 0;  // last transaction id
 
 static char *wlcr_name[]= {"","query","update","catalog"};
@@ -95,14 +96,14 @@ WLCRloggerfile(Client cntxt)
FILE *fd;
 
(void) cntxt;
-   wlcr_batch++;
-   wlcr_tid = 0;
snprintf(path,PATHLENGTH,"%s%cwlcr_%06d",wlcr_dir,DIR_SEP,wlcr_batch);
mnstr_printf(cntxt->fdout,"#WLCRloggerfile batch %s\n",path);
wlcr_fd = open_wastream(path);
if( wlcr_fd == 0)
throw(MAL,"wlcr.logger","Could not create %s\n",path);
 
+   wlcr_batch++;
+   wlcr_tid = 0;
snprintf(path,PATHLENGTH,"%s%cwlcr",wlcr_dir, DIR_SEP);
mnstr_printf(cntxt->fdout,"#WLCRloggerfile %s\n",wlcr_dir);
fd = fopen(path,"w");
@@ -116,6 +117,7 @@ WLCRloggerfile(Client cntxt)
 /*
  * The existence of the master directory should be checked upon server restart.
  * A new batch file should be created as a result.
+ * We also have to keep track on the files that have been read by the clone 
from the parent.
  */
 str 
 WLCRinit(Client cntxt)
@@ -135,6 +137,7 @@ WLCRinit(Client cntxt)
dir = GDKfilepath(0,0,"master",0);
snprintf(path, PATHLENGTH,"%s%cwlcr",dir, DIR_SEP);
mnstr_printf(cntxt->fdout,"#Testing WLCR %s\n", path);
+   wlcr_start = 0;
fd = fopen(path,"r");
if( fd){
// database is in master tracking mode
@@ -202,9 +205,13 @@ static InstrPtr
 WLCRaddtime(Client cntxt, InstrPtr pci, InstrPtr p)
 {
char tbuf[26];
-time_t clk = pci->clock.tv_sec;
+   struct timeval clock;
+   time_t clk ;
struct tm ctm;
 
+   (void) pci;
+   gettimeofday(,NULL);
+   clk = clock.tv_sec;
ctm = *localtime();
strftime(tbuf, 26, "%Y-%m-%dT%H:%M:%S",);
return pushStr(cntxt->wlcr, p, tbuf);
@@ -219,7 +226,7 @@ WLCRaddtime(Client cntxt, InstrPtr pci, 
s->def = NULL;\
} \
if( cntxt->wlcr->stop == 0){\
-   p = newStmt(cntxt->wlcr,"wlreplay","job");\
+   p = newStmt(cntxt->wlcr,"clone","job");\
p = pushStr(cntxt->wlcr,p, cntxt->username);\
p = pushInt(cntxt->wlcr,p, wlcr_tid);\
p = WLCRaddtime(cntxt,pci, p); \
@@ -240,7 +247,7 @@ WLCRjob(Client cntxt, MalBlkPtr mb, MalS
 }
 
 str
-WLCRfin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+WLCRexec(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
(void) cntxt;
(void) mb;
@@ -257,7 +264,7 @@ WLCRquery(Client cntxt, MalBlkPtr mb, Ma
if ( strcmp("-- no query",getVarConstant(mb, getArg(pci,1)).val.sval) 
== 0)
return MAL_SUCCEED; // ignore system internal queries.
WLCR_start();
-   p = newStmt(cntxt->wlcr, "wlreplay","query");

MonetDB: wlcr - merge default

2017-01-09 Thread Martin Kersten
Changeset: 180109775565 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=180109775565
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
gdk/gdk_utils.c
Branch: wlcr
Log Message:

merge default


diffs (96 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
@@ -7761,7 +7761,7 @@ Ready.
 [ "io","printf",   "pattern io.printf(fmt:str, val:any...):void ", 
"IOprintf;","Select default format "]
 [ "io","printf",   "pattern io.printf(filep:streams, fmt:str):void 
",  "IOprintfStream;",  "Select default format "]
 [ "io","printf",   "pattern io.printf(filep:streams, fmt:str, 
val:any...):void ",  "IOprintfStream;",  "Select default format "]
-[ "io","setmemorylimit",   "command 
io.setmemorylimit(nbytes:lng):void ",  "IOsetmemorylimit;","Set memory 
limit for testing"  ]
+[ "io","setmallocsuccesscount","command 
io.setmallocsuccesscount(count:lng):void ","IOsetmallocsuccesscount;", 
"Set number of mallocs that are allowed to succeed."]
 [ "io","stderr",   "pattern io.stderr():streams ", "io_stderr;",   
"return the error stream for the database console"  ]
 [ "io","stdin","pattern io.stdin():bstream ",  "io_stdin;",
"return the input stream to the database client"]
 [ "io","stdout",   "pattern io.stdout():streams ", "io_stdout;",   
"return the output stream for the database client"  ]
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
@@ -10117,7 +10117,7 @@ Ready.
 [ "io","printf",   "pattern io.printf(fmt:str, val:any...):void ", 
"IOprintf;","Select default format "]
 [ "io","printf",   "pattern io.printf(filep:streams, fmt:str):void 
",  "IOprintfStream;",  "Select default format "]
 [ "io","printf",   "pattern io.printf(filep:streams, fmt:str, 
val:any...):void ",  "IOprintfStream;",  "Select default format "]
-[ "io","setmemorylimit",   "command 
io.setmemorylimit(nbytes:lng):void ",  "IOsetmemorylimit;","Set memory 
limit for testing"  ]
+[ "io","setmallocsuccesscount","command 
io.setmallocsuccesscount(count:lng):void ","IOsetmallocsuccesscount;", 
"Set number of mallocs that are allowed to succeed."]
 [ "io","stderr",   "pattern io.stderr():streams ", "io_stderr;",   
"return the error stream for the database console"  ]
 [ "io","stdin","pattern io.stdin():bstream ",  "io_stdin;",
"return the input stream to the database client"]
 [ "io","stdout",   "pattern io.stdout():streams ", "io_stdout;",   
"return the output stream for the database client"  ]
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
@@ -268,7 +268,7 @@ gdk_return GDKreleasemmap(void *ptr, siz
 gdk_return GDKreleasesem(int sem_id, str *msg);
 void GDKreset(int status, int exit);
 void GDKsetenv(str name, str value);
-void GDKsetmemorylimit(lng nbytes);
+void GDKsetmallocsuccesscount(lng count);
 ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t 
len);
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
@@ -1206,7 +1206,7 @@ str IOimport(void *ret, bat *bid, str *f
 str IOprint_val(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str IOprintf(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str IOprintfStream(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str IOsetmemorylimit(void *res, lng *nbytes);
+str IOsetmallocsuccesscount(void *res, lng *nbytes);
 str IOtable(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ITRbunIterator(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ITRbunNext(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -451,6 +451,10 @@ MT_init(void)
 static void THRinit(void);
 static void GDKlockHome(void);
 
+#ifndef NDEBUG
+static MT_Lock mallocsuccesslock MT_LOCK_INITIALIZER("mallocsuccesslock");
+#endif
+
 int
 GDKinit(opt *set, int setlen)
 {
@@ -481,6 +485,9 @@ GDKinit(opt *set, int setlen)
MT_lock_init(, "GDKnameLock");
MT_lock_init(, "GDKthreadLock");
MT_lock_init(, "GDKtmLock");
+#ifndef NDEBUG
+   

MonetDB: wlcr - merge with default

2017-01-09 Thread Martin Kersten
Changeset: 83a9cbbb1939 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83a9cbbb1939
Added Files:
sql/test/malloc_fail/Tests/mallocs.SQL.py
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.sql

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.err

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
Removed Files:
sql/test/malloc_fail/Tests/initialize.sql
sql/test/malloc_fail/Tests/initialize.stable.err
sql/test/malloc_fail/Tests/initialize.stable.out
sql/test/malloc_fail/Tests/setmemorylimit-fail.reqtests
sql/test/malloc_fail/Tests/setmemorylimit-fail.sql
sql/test/malloc_fail/Tests/setmemorylimit-fail.stable.err
sql/test/malloc_fail/Tests/setmemorylimit-fail.stable.out
sql/test/malloc_fail/Tests/setmemorylimit-fail2.reqtests
sql/test/malloc_fail/Tests/setmemorylimit-fail2.sql
sql/test/malloc_fail/Tests/setmemorylimit.reqtests
sql/test/malloc_fail/Tests/setmemorylimit.sql
sql/test/malloc_fail/Tests/setmemorylimit.stable.err
sql/test/malloc_fail/Tests/setmemorylimit.stable.out
Modified Files:
configure.ag
gdk/gdk_system.c
gdk/gdk_utils.c
gdk/gdk_utils.h
monetdb5/mal/Tests/performanceTests/performanceLog
monetdb5/mal/Tests/performanceTests/tst400d.malC
monetdb5/mal/Tests/performanceTests/tst901a.malC
monetdb5/mal/Tests/performanceTests/tst901b.malC
monetdb5/mal/mal.h
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_stack.c
monetdb5/modules/mal/mal_io.c
monetdb5/modules/mal/mal_io.h
monetdb5/modules/mal/mal_io.mal
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_reorder.c
sql/backends/monet5/UDF/pyapi/Tests/pyapi_types_string.stable.out
sql/backends/monet5/UDF/pyapi/type_conversion.c
sql/backends/monet5/UDF/pyapi/unicode.c
sql/backends/monet5/UDF/pyapi/unicode.h
sql/backends/monet5/sql_optimizer.c
sql/test/malloc_fail/Tests/All
sql/test/sys-schema/Tests/All
testing/Mtest.py.in
Branch: wlcr
Log Message:

merge with default


diffs (truncated from 2046 to 300 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2561,6 +2561,7 @@ AC_CHECK_FUNCS([\
asctime_r \
backtrace \
cbrt \
+   clock_gettime \
ctime_r \
fabsf \
fallocate \
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -895,16 +895,34 @@ GDKusec(void)
return (lng) (((ctr.QuadPart - start.QuadPart) * 100) / 
freq.QuadPart);
}
 #endif
+#ifdef HAVE_CLOCK_GETTIME
+#if defined(CLOCK_UPTIME_FAST)
+#define CLK_ID CLOCK_UPTIME_FAST   /* FreeBSD */
+#else
+#define CLK_ID CLOCK_MONOTONIC /* Posix (fallback) */
+#endif
+   {
+   static struct timespec tsbase;
+   struct timespec ts;
+   if (tsbase.tv_sec == 0) {
+   clock_gettime(CLK_ID, );
+   return tsbase.tv_nsec / 1000;
+   }
+   if (clock_gettime(CLK_ID, ) == 0)
+   return (ts.tv_sec - tsbase.tv_sec) * 100 + 
ts.tv_nsec / 1000;
+   }
+#endif
 #ifdef HAVE_GETTIMEOFDAY
{
static struct timeval tpbase;   /* automatically initialized to 
0 */
struct timeval tp;
 
-   if (tpbase.tv_sec == 0)
+   if (tpbase.tv_sec == 0) {
gettimeofday(, NULL);
+   return (lng) tpbase.tv_usec;
+   }
gettimeofday(, NULL);
-   tp.tv_sec -= tpbase.tv_sec;
-   return (lng) tp.tv_sec * 100 + (lng) tp.tv_usec;
+   return (lng) (tp.tv_sec - tpbase.tv_sec) * 100 + (lng) 
tp.tv_usec;
}
 #else
 #ifdef HAVE_FTIME
@@ -912,11 +930,12 @@ GDKusec(void)
static struct timeb tbbase; /* automatically initialized to 
0 */
struct timeb tb;
 
-   if (tbbase.time == 0)
+   if (tbbase.time == 0) {
ftime();
+   return (lng) tbbase.millitm * 1000;
+   }
ftime();
-   tb.time -= tbbase.time;
-   return (lng) tb.time * 100 + (lng) tb.millitm * 1000;
+   return (lng) (tb.time - tbbase.time) * 100 + (lng) 
tb.millitm * 1000;
}
 #endif
 #endif
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -319,7 +319,7 @@ int GDK_vm_trim = 

MonetDB: wlcr - Minor issues

2017-01-09 Thread Martin Kersten
Changeset: 48452474f33f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=48452474f33f
Modified Files:
monetdb5/mal/mal_import.h
monetdb5/mal/mal_private.h
monetdb5/modules/mal/wlcr.c
sql/backends/monet5/sql_wlcr.c
Branch: wlcr
Log Message:

Minor issues


diffs (146 lines):

diff --git a/monetdb5/mal/mal_import.h b/monetdb5/mal/mal_import.h
--- a/monetdb5/mal/mal_import.h
+++ b/monetdb5/mal/mal_import.h
@@ -14,6 +14,7 @@
 #include "mal_session.h"
 #include "mal_utils.h"
 
+mal_export str malInclude(Client c, str name, int listing);
 mal_export void slash_2_dir_sep(str fname);
 mal_export str evalFile(Client c, str fname, int listing);
 mal_export str compileString(Symbol *fcn, Client c, str s);
diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h
--- a/monetdb5/mal/mal_private.h
+++ b/monetdb5/mal/mal_private.h
@@ -36,8 +36,6 @@
 __hidden str callFactory(Client cntxt, MalBlkPtr mb, ValPtr argv[],char flag)
__attribute__((__visibility__("hidden")));
 
-__hidden str malInclude(Client c, str name, int listing)
-   __attribute__((__visibility__("hidden")));
 #endif
 
 __hidden void initResource(void)
diff --git a/monetdb5/modules/mal/wlcr.c b/monetdb5/modules/mal/wlcr.c
--- a/monetdb5/modules/mal/wlcr.c
+++ b/monetdb5/modules/mal/wlcr.c
@@ -95,6 +95,14 @@ WLCRloggerfile(Client cntxt)
FILE *fd;
 
(void) cntxt;
+   wlcr_batch++;
+   wlcr_tid = 0;
+   snprintf(path,PATHLENGTH,"%s%cwlcr_%06d",wlcr_dir,DIR_SEP,wlcr_batch);
+   mnstr_printf(cntxt->fdout,"#WLCRloggerfile batch %s\n",path);
+   wlcr_fd = open_wastream(path);
+   if( wlcr_fd == 0)
+   throw(MAL,"wlcr.logger","Could not create %s\n",path);
+
snprintf(path,PATHLENGTH,"%s%cwlcr",wlcr_dir, DIR_SEP);
mnstr_printf(cntxt->fdout,"#WLCRloggerfile %s\n",wlcr_dir);
fd = fopen(path,"w");
@@ -102,13 +110,6 @@ WLCRloggerfile(Client cntxt)
throw(MAL,"wlcr.logger","Could not access %s\n",path);
fprintf(fd,"%d %d\n", wlcr_batch, wlcr_threshold);
fclose(fd);
-   wlcr_batch++;
-   wlcr_tid = 0;
-   snprintf(path,PATHLENGTH,"%s%cwlcr_%06d",wlcr_dir,DIR_SEP,wlcr_batch);
-   mnstr_printf(cntxt->fdout,"#WLCRloggerfile batch %s\n",path);
-   wlcr_fd = open_wastream(path);
-   if( wlcr_fd == 0)
-   throw(MAL,"wlcr.logger","Could not create %s\n",path);
return MAL_SUCCEED;
 }
 
@@ -139,7 +140,6 @@ WLCRinit(Client cntxt)
// database is in master tracking mode
if( fscanf(fd,"%d %d", _batch, _threshold) == 
2){
wlcr_dir = dir;
-   wlcr_batch++;
mnstr_printf(cntxt->fdout,"#Master control 
active:%d %d\n", wlcr_batch, wlcr_threshold);
(void) fclose(fd);
msg = WLCRloggerfile(cntxt);
diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -23,6 +23,7 @@
 #include "sql.h"
 #include "wlcr.h"
 #include "sql_wlcr.h"
+#include "mal_parser.h"
 #include "mal_client.h"
 
 #define WLCR_REPLAY 1
@@ -91,20 +92,30 @@ WLCRprocess(void *arg)
 c->prompt = GDKstrdup("");  /* do not produce visible prompts */
 c->promptlength = 0;
 c->listing = 0;
+   c->curprg = newFunction(putName("user"), putName("wlcr"), 
FUNCTIONsymbol);
+
 
mnstr_printf(cntxt->fdout,"#Ready to start the replayagainst '%s' 
batches %d threshold %d", wlcr_master, wlcr_replaybatches, 
wlcr_replaythreshold);
for( i= 0; i < wlcr_replaybatches; i++){
snprintf(path,PATHLENGTH,"%s%cwlcr_%06d", wlcr_master, 
DIR_SEP,i);
-   mnstr_printf(cntxt->fdout,"#WLCR processing %s\n",path);
fd= open_rstream(path);
-   if( c->fdin == NULL || MCpushClientInput(c, bstream_create(fd, 
128 * BLOCK), 0, "") < 0){
-   mnstr_printf(cntxt->fdout,"#wlcr.replay:'%s' can not be 
accessed \n",path);
+   if( fd == NULL){
+   mnstr_printf(cntxt->fdout,"#wlcr.process:'%s' can not 
be accessed \n",path);
+   continue;
}
+   if( MCpushClientInput(c, bstream_create(fd, 128 * BLOCK), 0, 
"") < 0){
+   mnstr_printf(cntxt->fdout,"#wlcr.process: client can 
not be initialized \n");
+   }
+   mnstr_printf(cntxt->fdout,"#wlcr.process:start processing log 
file '%s'\n",path);
c->yycur = 0;
+   if( parseMAL(c, c->curprg, 1, 1)  || c->curprg->def->errors){
+   mnstr_printf(cntxt->fdout,"#wlcr.process:parsing failed 
'%s'\n",path);
+   }
// preload the complete file
// now parse the file line by line
close_stream(fd);

monetdb-java: embedded - Optimization: Got rid of the auxiliary ...

2017-01-09 Thread Pedro Ferreira
Changeset: e087be5c7225 for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=e087be5c7225
Modified Files:
src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java

src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java

src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParserHelper.java
src/main/java/nl/cwi/monetdb/mcl/responses/DataBlockResponse.java
Branch: embedded
Log Message:

Optimization: Got rid of the auxiliary matrix to hold null values. MonetDB's 
null values are now mapped to Java's min values.


diffs (214 lines):

diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java 
b/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
@@ -45,8 +45,7 @@ public abstract class AbstractProtocol {
 public abstract int getNextTableHeader(String[] columnNames, int[] 
columnLengths, String[] types,
String[] tableNames) throws 
ProtocolException;
 
-public abstract int parseTupleLines(int firstLineNumber, int[] typesMap, 
Object[] values,
-boolean[][] nulls) throws 
ProtocolException;
+public abstract int parseTupleLines(int firstLineNumber, int[] typesMap, 
Object[] values) throws ProtocolException;
 
 public abstract String getRemainingStringLine(int startIndex);
 
diff --git 
a/src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java 
b/src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java
@@ -66,7 +66,7 @@ public class NewMapiProtocol extends Abs
 }
 
 @Override
-public int parseTupleLines(int lineNumber, int[] typesMap, Object[] 
values, boolean[][] nulls) throws ProtocolException {
+public int parseTupleLines(int lineNumber, int[] typesMap, Object[] 
values) throws ProtocolException {
 return 0;
 }
 
diff --git 
a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java 
b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
@@ -123,14 +123,14 @@ public class OldMapiProtocol extends Abs
 }
 
 @Override
-public int getNextTableHeader(String[] columnNames, int[] columnLengths, 
String[] types, String[] tableNames) throws ProtocolException {
+public int getNextTableHeader(String[] columnNames, int[] columnLengths, 
String[] types, String[] tableNames)
+throws ProtocolException {
 return OldMapiTableHeaderParser.GetNextTableHeader(this.lineBuffer, 
columnNames, columnLengths, types, tableNames);
 }
 
 @Override
-public int parseTupleLines(int firstLineNumber, int[] typesMap, Object[] 
data, boolean[][] nulls)
-throws ProtocolException {
-OldMapiTupleLineParser.OldMapiParseTupleLine(this, firstLineNumber, 
typesMap, data, nulls);
+public int parseTupleLines(int firstLineNumber, int[] typesMap, Object[] 
data) throws ProtocolException {
+OldMapiTupleLineParser.OldMapiParseTupleLine(this, firstLineNumber, 
typesMap, data);
 return firstLineNumber;
 }
 
diff --git 
a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java 
b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java
--- 
a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java
+++ 
b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java
@@ -20,13 +20,14 @@ import java.nio.CharBuffer;
 import java.sql.Types;
 import java.text.ParsePosition;
 import java.util.Calendar;
+import java.util.Map;
 
 final class OldMapiTupleLineParser {
 
 private static final char[] NULL_STRING = new char[]{'N','U','L','L'};
 
-static int OldMapiParseTupleLine(OldMapiProtocol protocol, int lineNumber, 
int[] typesMap, Object[] values,
- boolean[][] nulls) throws 
ProtocolException {
+static int OldMapiParseTupleLine(OldMapiProtocol protocol, int lineNumber, 
int[] typesMap, Object[] values)
+throws ProtocolException {
 CharBuffer lineBuffer = protocol.lineBuffer;
 CharBuffer tupleLineBuffer = protocol.tupleLineBuffer;
 
@@ -127,13 +128,10 @@ final class OldMapiTupleLineParser {
 // put the unescaped string in the right place
 

MonetDB: default - Merge with Dec2016 branch.

2017-01-09 Thread Sjoerd Mullender
Changeset: cab6171bd6f4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cab6171bd6f4
Modified Files:
gdk/gdk_batop.c
gdk/gdk_hash.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_project.c
Branch: default
Log Message:

Merge with Dec2016 branch.


diffs (237 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1065,7 +1065,9 @@ BATkeyed(BAT *b)
 int
 BATordered(BAT *b)
 {
-   lng t0 = GDKusec();
+   lng t0 = 0;
+
+   ALGODEBUG t0 = GDKusec();
 
if (b->ttype == TYPE_void)
return 1;
@@ -1151,7 +1153,9 @@ BATordered(BAT *b)
 int
 BATordered_rev(BAT *b)
 {
-   lng t0 = GDKusec();
+   lng t0 = 0;
+
+   ALGODEBUG t0 = GDKusec();
 
if (b == NULL)
return 0;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -193,11 +193,11 @@ int
 BATcheckhash(BAT *b)
 {
int ret;
-   lng t;
+   lng t = 0;
 
-   t = GDKusec();
+   ALGODEBUG t = GDKusec();
MT_lock_set((b->batCacheid));
-   t = GDKusec() - t;
+   ALGODEBUG t = GDKusec() - t;
if (b->thash == (Hash *) 1) {
Hash *h;
Heap *hp;
@@ -285,9 +285,11 @@ BAThashsync(void *arg)
struct hashsync *hs = arg;
Heap *hp = hs->hp;
int fd;
-   lng t0 = GDKusec();
+   lng t0 = 0;
const char *failed = " failed";
 
+   ALGODEBUG t0 = GDKusec();
+
if (HEAPsave(hp, hp->filename, NULL) == GDK_SUCCEED &&
(fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) {
((size_t *) hp->base)[0] |= 1 << 24;
@@ -391,7 +393,7 @@ BAThash(BAT *b, BUN masksize)
p = q;
}
 
-   t0 = GDKusec();
+   ALGODEBUG t0 = GDKusec();
 
do {
BUN nslots = mask >> 3; /* 1/8 full is too full */
@@ -519,9 +521,11 @@ BAThash(BAT *b, BUN masksize)
ALGODEBUG fprintf(stderr, "#BAThash: NOT persisting 
hash %d\n", b->batCacheid);
 #endif
b->thash = h;
-   t1 = GDKusec();
-   ALGODEBUG fprintf(stderr, "#BAThash: hash construction " LLFMT 
" usec\n", t1 - t0);
-   ALGODEBUG HASHcollisions(b, b->thash);
+   ALGODEBUG {
+   t1 = GDKusec();
+   fprintf(stderr, "#BAThash: hash construction " LLFMT " 
usec\n", t1 - t0);
+   HASHcollisions(b, b->thash);
+   }
}
MT_lock_unset((b->batCacheid));
return GDK_SUCCEED;
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -279,7 +279,7 @@ BATimprints(BAT *b)
 {
BAT *o = NULL, *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL;
Imprints *imprints;
-   lng t0 = 0, t1 = 0;
+   lng t0 = 0;
 
/* we only create imprints for types that look like types we know */
switch (ATOMbasetype(b->ttype)) {
@@ -316,7 +316,7 @@ BATimprints(BAT *b)
assert(b->timprints == NULL);
}
MT_lock_set((b->batCacheid));
-   t0 = GDKusec();
+   ALGODEBUG t0 = GDKusec();
if (b->timprints == NULL) {
BUN cnt;
str nme = BBP_physical(b->batCacheid);
@@ -496,8 +496,7 @@ BATimprints(BAT *b)
b->timprints = imprints;
}
 
-   t1 = GDKusec();
-   ALGODEBUG fprintf(stderr, "#BATimprints: imprints construction " LLFMT 
" usec\n", t1 - t0);
+   ALGODEBUG fprintf(stderr, "#BATimprints: imprints construction " LLFMT 
" usec\n", GDKusec() - t0);
MT_lock_unset((b->batCacheid));
 
/* BBPUnfix tries to get the imprints lock which might lead to a 
deadlock
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3821,7 +3821,8 @@ gdk_return
 BATleftjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int 
nil_matches, BUN estimate)
 {
return subleftjoin(r1p, r2p, l, r, sl, sr, nil_matches,
-  0, 0, 0, estimate, "BATleftjoin", GDKusec());
+  0, 0, 0, estimate, "BATleftjoin",
+  GDKdebug & ALGOMASK ? GDKusec() : 0);
 }
 
 /* Performs a left outer join over l and r.  Returns two new, aligned,
@@ -3833,7 +3834,8 @@ gdk_return
 BATouterjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int 
nil_matches, BUN estimate)
 {
return subleftjoin(r1p, r2p, l, r, sl, sr, nil_matches,
-  1, 0, 0, estimate, "BATouterjoin", GDKusec());
+  1, 0, 0, estimate, "BATouterjoin",
+  GDKdebug & ALGOMASK ? GDKusec() : 0);
 }
 
 /* Perform a semi-join over l and r.  Returns two new, aligned,
@@ -3844,7 +3846,8 @@ gdk_return
 BATsemijoin(BAT **r1p, BAT 

MonetDB: Dec2016 - Avoid calling GDKusec (system calls) when it'...

2017-01-09 Thread Sjoerd Mullender
Changeset: 245c6a69e2d0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=245c6a69e2d0
Modified Files:
gdk/gdk_batop.c
gdk/gdk_hash.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_project.c
Branch: Dec2016
Log Message:

Avoid calling GDKusec (system calls) when it's not necessary.


diffs (237 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -833,7 +833,9 @@ BATslice(BAT *b, BUN l, BUN h)
 int
 BATordered(BAT *b)
 {
-   lng t0 = GDKusec();
+   lng t0 = 0;
+
+   ALGODEBUG t0 = GDKusec();
 
if (b->ttype == TYPE_void)
return 1;
@@ -919,7 +921,9 @@ BATordered(BAT *b)
 int
 BATordered_rev(BAT *b)
 {
-   lng t0 = GDKusec();
+   lng t0 = 0;
+
+   ALGODEBUG t0 = GDKusec();
 
if (b == NULL)
return 0;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -193,11 +193,11 @@ int
 BATcheckhash(BAT *b)
 {
int ret;
-   lng t;
+   lng t = 0;
 
-   t = GDKusec();
+   ALGODEBUG t = GDKusec();
MT_lock_set((b->batCacheid));
-   t = GDKusec() - t;
+   ALGODEBUG t = GDKusec() - t;
if (b->thash == (Hash *) 1) {
Hash *h;
Heap *hp;
@@ -285,9 +285,11 @@ BAThashsync(void *arg)
struct hashsync *hs = arg;
Heap *hp = hs->hp;
int fd;
-   lng t0 = GDKusec();
+   lng t0 = 0;
const char *failed = " failed";
 
+   ALGODEBUG t0 = GDKusec();
+
if (HEAPsave(hp, hp->filename, NULL) == GDK_SUCCEED &&
(fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) {
((size_t *) hp->base)[0] |= 1 << 24;
@@ -391,7 +393,7 @@ BAThash(BAT *b, BUN masksize)
p = q;
}
 
-   t0 = GDKusec();
+   ALGODEBUG t0 = GDKusec();
 
do {
BUN nslots = mask >> 3; /* 1/8 full is too full */
@@ -519,9 +521,11 @@ BAThash(BAT *b, BUN masksize)
ALGODEBUG fprintf(stderr, "#BAThash: NOT persisting 
hash %d\n", b->batCacheid);
 #endif
b->thash = h;
-   t1 = GDKusec();
-   ALGODEBUG fprintf(stderr, "#BAThash: hash construction " LLFMT 
" usec\n", t1 - t0);
-   ALGODEBUG HASHcollisions(b, b->thash);
+   ALGODEBUG {
+   t1 = GDKusec();
+   fprintf(stderr, "#BAThash: hash construction " LLFMT " 
usec\n", t1 - t0);
+   HASHcollisions(b, b->thash);
+   }
}
MT_lock_unset((b->batCacheid));
return GDK_SUCCEED;
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -279,7 +279,7 @@ BATimprints(BAT *b)
 {
BAT *o = NULL, *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL;
Imprints *imprints;
-   lng t0 = 0, t1 = 0;
+   lng t0 = 0;
 
/* we only create imprints for types that look like types we know */
switch (ATOMbasetype(b->ttype)) {
@@ -316,7 +316,7 @@ BATimprints(BAT *b)
assert(b->timprints == NULL);
}
MT_lock_set((b->batCacheid));
-   t0 = GDKusec();
+   ALGODEBUG t0 = GDKusec();
if (b->timprints == NULL) {
BUN cnt;
str nme = BBP_physical(b->batCacheid);
@@ -496,8 +496,7 @@ BATimprints(BAT *b)
b->timprints = imprints;
}
 
-   t1 = GDKusec();
-   ALGODEBUG fprintf(stderr, "#BATimprints: imprints construction " LLFMT 
" usec\n", t1 - t0);
+   ALGODEBUG fprintf(stderr, "#BATimprints: imprints construction " LLFMT 
" usec\n", GDKusec() - t0);
MT_lock_unset((b->batCacheid));
 
/* BBPUnfix tries to get the imprints lock which might lead to a 
deadlock
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3821,7 +3821,8 @@ gdk_return
 BATleftjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int 
nil_matches, BUN estimate)
 {
return subleftjoin(r1p, r2p, l, r, sl, sr, nil_matches,
-  0, 0, 0, estimate, "BATleftjoin", GDKusec());
+  0, 0, 0, estimate, "BATleftjoin",
+  GDKdebug & ALGOMASK ? GDKusec() : 0);
 }
 
 /* Performs a left outer join over l and r.  Returns two new, aligned,
@@ -3833,7 +3834,8 @@ gdk_return
 BATouterjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int 
nil_matches, BUN estimate)
 {
return subleftjoin(r1p, r2p, l, r, sl, sr, nil_matches,
-  1, 0, 0, estimate, "BATouterjoin", GDKusec());
+  1, 0, 0, estimate, "BATouterjoin",
+  GDKdebug & ALGOMASK ? GDKusec() : 0);
 }
 
 /* Perform a semi-join over l and r.  Returns two new, aligned,
@@ -3844,7 +3846,8 

MonetDB: default - Merge with Dec2016 branch.

2017-01-09 Thread Sjoerd Mullender
Changeset: c9b2bbc3e0c1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9b2bbc3e0c1
Added Files:
sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.sql
sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.stable.err
sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.stable.out
Modified Files:
sql/server/rel_optimizer.c
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
sql/test/BugTracker-2017/Tests/All

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
sql/test/testdb/Tests/testdb-dump.stable.out.Windows
Branch: default
Log Message:

Merge with Dec2016 branch.


diffs (truncated from 1213 to 300 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
@@ -4354,6 +4354,8 @@ rel_push_join_down_union(int *changes, m
je && !find_prop(je->p, PROP_JOINIDX) && /* FKEY JOIN */
!rel_is_join_on_pkey(rel))) /* aligned PKEY JOIN */
return rel;
+   if (is_semi(rel->op) && is_union(l->op) && je && 
!find_prop(je->p, PROP_JOINIDX))
+   return rel;
 
ol->subquery = or->subquery = 0;
if ((is_union(l->op) && !need_distinct(l)) && !is_union(r->op)){
diff --git a/sql/test/BugTracker-2017/Tests/All 
b/sql/test/BugTracker-2017/Tests/All
--- a/sql/test/BugTracker-2017/Tests/All
+++ b/sql/test/BugTracker-2017/Tests/All
@@ -1,2 +1,3 @@
 shutdown.Bug-6182
 avggroupbysq.Bug-6178
+semijoinunion.Bug-6150
diff --git a/sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.sql 
b/sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/semijoinunion.Bug-6150.sql
@@ -0,0 +1,1056 @@
+CREATE TABLE "test_join_right_table" ("r_c" VARCHAR(255), "d" VARCHAR(255));
+
+INSERT INTO "test_join_right_table"("r_c", "d") values ('c1', 'd1');
+INSERT INTO "test_join_right_table"("r_c", "d") values ('c2', 'd2');
+INSERT INTO "test_join_right_table"("r_c", "d") values ('c5', 'd3');
+INSERT INTO "test_join_right_table"("r_c", "d") values (null, 'd4');
+
+CREATE TABLE lineitem_denormalized_first1k
+(
+   customer_gender char(1),
+   customer_region varchar(15) NOT NULL,
+   customer_country varchar(40) NOT NULL,
+   customer_state varchar(40),
+   customer_city varchar(50) NOT NULL,
+   customer_date_of_birth date,
+   customer_id integer NOT NULL,
+   product_family varchar(20) NOT NULL,
+   product_category varchar(30) NOT NULL,
+   product_subcategory varchar(30) NOT NULL,
+   product_name varchar(50) NOT NULL,
+   product_id integer NOT NULL,
+   store_id integer NOT NULL,
+   store_longitude decimal(12, 8) NOT NULL,
+   store_latitude decimal(12, 8) NOT NULL,
+   store_name varchar(50) NOT NULL,
+   store_manager varchar(50) NOT NULL,
+   store_phone_number varchar(20) NOT NULL,
+   store_region varchar(15) NOT NULL,
+   store_country varchar(40) NOT NULL,
+   store_state varchar(40),
+   store_city varchar(50) NOT NULL,
+   order_date date NOT NULL,
+   year_begin_date date,
+   quarter_begin_date date,
+   month_begin_date date,
+   mm integer,
+   mmdd integer,
+   ddmon varchar(9),
+   line_price decimal(12, 2) NOT NULL,
+   line_cost decimal(12, 2) NOT NULL,
+   line_margin decimal(13, 2) NOT NULL,
+   line_margin_percent decimal(12,8) NOT NULL
+);
+
+copy 1000 records into lineitem_denormalized_first1k from stdin using 
delimiters ',','\n','\"';
+F,APAC,People's Republic of 
China,Sichuan,Yibin,1957-09-19,99425,Non-consumables,Clothing,Clothing,Croft & 
Barrow Velour Separates,1757,30,-3.2000,55.9500,"Edinburgh, United 
Kingdom",Melody J. Hambard,+44-875-777-1712,EUROPE,United 
Kingdom,Scotland,Edinburgh,2010-11-03,2010-01-01,2010-10-01,2010-11-01,201011,20101103,03NOV2010,482.70,354.87,127.83,26.482
+F,APAC,People's Republic of 
China,Sichuan,Yibin,1957-09-19,99425,Non-consumables,Clothing,Clothing,Men's 
Beanies,2951,30,-3.2000,55.9500,"Edinburgh, United Kingdom",Melody J. 
Hambard,+44-875-777-1712,EUROPE,United 
Kingdom,Scotland,Edinburgh,2010-11-03,2010-01-01,2010-10-01,2010-11-01,201011,20101103,03NOV2010,260.20,72.76,187.44,72.036
+F,APAC,People's Republic of 
China,Sichuan,Yibin,1957-09-19,99425,Non-consumables,Clothing,Clothing,Smartwool
 Ski Socks,3502,30,-3.2000,55.9500,"Edinburgh, United Kingdom",Melody 
J. Hambard,+44-875-777-1712,EUROPE,United 
Kingdom,Scotland,Edinburgh,2010-11-03,2010-01-01,2010-10-01,2010-11-01,201011,20101103,03NOV2010,384.87,287.16,97.71,25.387
+F,APAC,People's Republic of 
China,Sichuan,Yibin,1957-09-19,99425,Non-consumables,Electronics,Digital 
media,HP 8GB USB Flash Drive,4154,30,-3.2000,55.9500,"Edinburgh, United 
Kingdom",Melody J. Hambard,+44-875-777-1712,EUROPE,United 

MonetDB: Dec2016 - Approvals.

2017-01-09 Thread Sjoerd Mullender
Changeset: fad95961255a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fad95961255a
Added Files:

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out.int128
Modified Files:
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
sql/test/testdb/Tests/testdb-dump.stable.out.Windows
Branch: Dec2016
Log Message:

Approvals.


diffs (68 lines):

diff --git a/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out 
b/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
--- a/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
+++ b/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
@@ -69,11 +69,11 @@ function user.s8_1():void;
 C_4:bat[:oid] := sql.tid(X_3,"sys","dbg");
 X_7:bat[:int] := sql.bind(X_3,"sys","dbg","a",0:int);
 X_10 := algebra.projection(C_4,X_7);
-(X_11,r1_14,r2_14) := group.subgroupdone(X_10);
-X_14 := algebra.projection(r1_14,X_10);
+(X_11,C1_14,r2_14) := group.subgroupdone(X_10);
+X_14 := algebra.projection(C1_14,X_10);
 X_17:bat[:int] := sql.bind(X_3,"sys","dbg","b",0:int);
 X_19 := algebra.projection(C_4,X_17);
-X_20:bat[:lng] := aggr.subsum(X_19,X_11,r1_14,true,true);
+X_20:bat[:lng] := aggr.subsum(X_19,X_11,C1_14,true,true);
 X_15 := bat.setKey(X_14,true);
 X_22:bat[:lng] := batcalc./(X_20,2:bte);
 X_26:bat[:lng] := batcalc.*(X_22,2:bte);
@@ -155,11 +155,11 @@ function user.s20_1():void;
 C_4:bat[:oid] := sql.tid(X_3,"sys","dbg");
 X_7:bat[:int] := sql.bind(X_3,"sys","dbg","a",0:int);
 X_10 := algebra.projection(C_4,X_7);
-(X_11,r1_14,r2_14) := group.subgroupdone(X_10);
-X_14 := algebra.projection(r1_14,X_10);
+(X_11,C1_14,r2_14) := group.subgroupdone(X_10);
+X_14 := algebra.projection(C1_14,X_10);
 X_17:bat[:int] := sql.bind(X_3,"sys","dbg","b",0:int);
 X_19 := algebra.projection(C_4,X_17);
-X_20:bat[:lng] := aggr.subsum(X_19,X_11,r1_14,true,true);
+X_20:bat[:lng] := aggr.subsum(X_19,X_11,C1_14,true,true);
 X_15 := bat.setKey(X_14,true);
 X_22:bat[:lng] := batcalc./(X_20,2:bte);
 X_26:bat[:lng] := batcalc.*(X_22,2:bte);
diff --git 
a/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out 
b/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
--- 
a/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
+++ 
b/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
@@ -400,12 +400,12 @@ Ready.
 #SELECT * FROM sys.tablestoragemodel WHERE schema NOT IN (SELECT name FROM 
sys.schemas);
 % .tablestoragemodel,  .tablestoragemodel, .tablestoragemodel, 
.tablestoragemodel, .tablestoragemodel, .tablestoragemodel, 
.tablestoragemodel, .tablestoragemodel # table_name
 % schema,  table,  count,  columnsize, heapsize,   hashes, 
imprints,   auxiliary # name
-% clob,clob,   bigint, bigint, bigint, bigint, bigint, hugeint # type
+% clob,clob,   bigint, bigint, bigint, bigint, bigint, bigint # type
 % 0,   0,  1,  1,  1,  1,  1,  1 # length
 #SELECT * FROM sys.tablestoragemodel WHERE table NOT IN (SELECT name FROM 
sys._tables);
 % .tablestoragemodel,  .tablestoragemodel, .tablestoragemodel, 
.tablestoragemodel, .tablestoragemodel, .tablestoragemodel, 
.tablestoragemodel, .tablestoragemodel # table_name
 % schema,  table,  count,  columnsize, heapsize,   hashes, 
imprints,   auxiliary # name
-% clob,clob,   bigint, bigint, bigint, bigint, bigint, hugeint # type
+% clob,clob,   bigint, bigint, bigint, bigint, bigint, bigint # type
 % 0,   0,  1,  1,  1,  1,  1,  1 # length
 
 # 16:15:38 >  
diff --git 
a/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out 
b/sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out.int128
copy from 
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
copy to 
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out.int128
diff --git a/sql/test/testdb/Tests/testdb-dump.stable.out.Windows 
b/sql/test/testdb/Tests/testdb-dump.stable.out.Windows
--- a/sql/test/testdb/Tests/testdb-dump.stable.out.Windows
+++ b/sql/test/testdb/Tests/testdb-dump.stable.out.Windows
@@ -101174,8 +101174,8 @@ CREATE TABLE "testschema"."typestest" (
"json"   JSON
 );
 COPY 2 RECORDS INTO "testschema"."typestest" FROM stdin USING DELIMITERS 
'\t','\n','"';
-true   10  1   100 100 100 1e+030  1e+020  1.000   
123456789   12345.678   3.1415  3.1415  3.1415  2009-04-15  24  
18  3   1728000.000 108000.000  12.000  10.000  
36000.000   6000.0002000.000 

MonetDB: default - Approvals.

2017-01-09 Thread Sjoerd Mullender
Changeset: ce1d3176efa2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ce1d3176efa2
Added Files:

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out.int128
Removed Files:
sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out.int128
sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out.int128.single
sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out.single
Modified Files:
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out
sql/test/leaks/Tests/check0.stable.out
sql/test/leaks/Tests/check1.stable.out
sql/test/leaks/Tests/check2.stable.out
sql/test/leaks/Tests/check3.stable.out
sql/test/leaks/Tests/check4.stable.out
sql/test/leaks/Tests/check5.stable.out
sql/test/leaks/Tests/drop3.stable.out
sql/test/leaks/Tests/select1.stable.out
sql/test/leaks/Tests/select2.stable.out
sql/test/leaks/Tests/temp1.stable.out
sql/test/leaks/Tests/temp2.stable.out
sql/test/leaks/Tests/temp3.stable.out

sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
Branch: default
Log Message:

Approvals.


diffs (truncated from 1230 to 300 lines):

diff --git a/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out 
b/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
--- a/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
+++ b/sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out
@@ -38,69 +38,6 @@ project (
 | ) [ dbg.a as d ] [ dbg.d, sys.sum no nil (dbg.b) as L3.L3, L3.L3 as L6.L6 ]
 ) [ dbg.d, L3 as L4.L3, sys.sql_mul(sys.sql_div(L6, tinyint "2" as L10.L10), 
tinyint "2") as L11.f ]
 #set optimizer = 'sequential_pipe';
-#explain SELECT a as d, SUM(b), (2 * (SUM(b) / (SELECT 2))) as f FROM dbg 
GROUP BY d;
-% .explain # table_name
-% mal # name
-% clob # type
-% 145 # length
-function user.s8_1():void;
-X_59:void := querylog.define("explain select a as d, sum(b), (2 * (sum(b) 
/ (select 2))) as f from dbg group by d;","sequential_pipe",35);
-X_26 := bat.new(nil:str);
-X_33 := bat.append(X_26,"sys.dbg");
-X_43 := bat.append(X_33,"sys.L4");
-X_52 := bat.append(X_43,"sys.L11");
-X_28 := bat.new(nil:str);
-X_35 := bat.append(X_28,"d");
-X_45 := bat.append(X_35,"L3");
-X_54 := bat.append(X_45,"f");
-X_29 := bat.new(nil:str);
-X_37 := bat.append(X_29,"int");
-X_47 := bat.append(X_37,"bigint");
-X_56 := bat.append(X_47,"bigint");
-X_30 := bat.new(nil:int);
-X_39 := bat.append(X_30,32);
-X_49 := bat.append(X_39,64);
-X_57 := bat.append(X_49,64);
-X_32 := bat.new(nil:int);
-X_41 := bat.append(X_32,0);
-X_51 := bat.append(X_41,0);
-X_58 := bat.append(X_51,0);
-X_0 := sql.mvc();
-C_1:bat[:oid] := sql.tid(X_0,"sys","dbg");
-X_4:bat[:int] := sql.bind(X_0,"sys","dbg","a",0);
-X_7 := algebra.projection(C_1,X_4);
-(X_8,r1_11,r2_11) := group.groupdone(X_7);
-X_11 := algebra.projection(r1_11,X_7);
-X_14:bat[:int] := sql.bind(X_0,"sys","dbg","b",0);
-X_16 := algebra.projection(C_1,X_14);
-X_17:bat[:lng] := aggr.subsum(X_16,X_8,r1_11,true,true);
-X_12 := bat.setKey(X_11,true);
-X_19:bat[:lng] := batcalc./(X_17,2);
-X_23:bat[:lng] := batcalc.*(X_19,2);
-sql.resultSet(X_52,X_54,X_56,X_57,X_58,X_12,X_17,X_23);
-end user.s8_1;
-#inline   actions= 0 time=4 usec 
-#remapactions= 2 time=57 usec 
-#costmodelactions= 1 time=2 usec 
-#coercion actions= 0 time=1 usec 
-#evaluate actions= 2 time=16 usec 
-#emptybindactions= 0 time=7 usec 
-#aliases  actions= 2 time=6 usec 
-#mergetable   actions= 0 time=39 usec 
-#deadcode actions= 0 time=6 usec 
-#aliases  actions= 0 time=5 usec 
-#constantsactions= 4 time=10 usec 
-#commonTerms  actions= 0 time=6 usec 
-#projectionpath   actions= 0 time=3 usec 
-#reorder  actions= 1 time=24 usec 
-#deadcode actions= 0 time=5 usec 
-#reduce   actions=26 time=8 usec 
-#matpack  actions= 0 time=3 usec 
-#multiplexactions= 0 time=2 usec 
-#profiler actions= 1 time=1 usec 
-#candidates   actions= 1 time=0 usec 
-#garbagecollector actions= 1 time=15 usec 
-#totalactions= 1 time=311 usec 
 #set optimizer = 'default_pipe';
 #SELECT a as d, SUM(b), (2 * (SUM(b) / (SELECT 2))) as f FROM dbg GROUP BY d;
 % sys.dbg, sys.L4, sys.L11 # table_name
@@ -124,69 +61,6 @@ project (
 | ) [ dbg.a as d ] [ dbg.d, sys.sum no nil (dbg.b) as L3.L3, L3.L3 as L6.L6 ]
 ) [ dbg.d, L3 as L4.e, sys.sql_mul(sys.sql_div(L6, tinyint "2" as L10.L10), 
tinyint "2") as L11.f ]
 #set optimizer = 'sequential_pipe';
-#explain 

MonetDB: default - Approve non-128 bit output.

2017-01-09 Thread Sjoerd Mullender
Changeset: a1d6e733ac42 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1d6e733ac42
Modified Files:
monetdb5/modules/mal/Tests/inspect05.stable.out
Branch: default
Log Message:

Approve non-128 bit output.


diffs (146 lines):

diff --git a/monetdb5/modules/mal/Tests/inspect05.stable.out 
b/monetdb5/modules/mal/Tests/inspect05.stable.out
--- a/monetdb5/modules/mal/Tests/inspect05.stable.out
+++ b/monetdb5/modules/mal/Tests/inspect05.stable.out
@@ -29,73 +29,75 @@ Ready.
 # tt   t   t   t  # name
 # str  str str str str  # type
 #--#
-[ 0@0, "append",   "command",  "bat",  
"(i:bat[:any_1],u:any_1):bat[:any_1] ", "BKCappend_val_wrap;"   ]
-[ 1@0, "append",   "command",  "bat",  
"(tt:int,heapfile:str):bat[:any_1] ",   "BKCattach;"]
-[ 2@0, "append",   "command",  "bat",  
"(i:bat[:any_1],u:any_1,force:bit):bat[:any_1] ",   
"BKCappend_val_force_wrap;" ]
-[ 3@0, "append",   "command",  "bat",  
"(i:bat[:any_1],u:bat[:any_1],force:bit):bat[:any_1] ", "BKCappend_force_wrap;" 
]
-[ 4@0, "attach",   "command",  "bat",  
"(i:bat[:any_1],u:bat[:any_1]):bat[:any_1] ",   "BKCappend_wrap;"   ]
-[ 5@0, "delete",   "command",  "bat",  "(sz:lng):bat[:oid] ",  
"BKCdensebat;"  ]
-[ 6@0, "delete",   "command",  "bat",  "(b:bat[:any_1]):bat[:any_1] ", 
"BKCdelete_all;"]
-[ 7@0, "delete",   "command",  "bat",  
"(b:bat[:any_1],d:bat[:oid]):bat[:any_1] ", "BKCdelete_multi;"  ]
-[ 8@0, "densebat", "command",  "bat",  
"(b:bat[:any_1],h:oid):bat[:any_1] ",   "BKCdelete;"]
-[ 9@0, "getAccess","pattern",  "bat",  "(bv:bat[:any_1]):bat[:oid] ",  
"OIDXgetorderidx;"  ]
-[ 10@0,"getCapacity",  "command",  "bat",  "(b:bat[:any_1]):str ", 
"BKCgetBBPname;"]
-[ 11@0,"getColumnType","command",  "bat",  
"(b:bat[:any_1]):oid ", "BKCgetSequenceBase;"   ]
-[ 12@0,"getName",  "command",  "bat",  "(b:bat[:any_1]):str ", 
"BKCgetAccess;" ]
-[ 13@0,"getRole",  "command",  "bat",  "(bid:bat[:any_1]):str 
",   "BKCgetRole;"   ]
-[ 14@0,"getSequenceBase",  "command",  "bat",  
"(b:bat[:any_1]):str ", "BKCgetColumnType;" ]
-[ 15@0,"getSize",  "command",  "bat",  "(b:bat[:any_1]):lng ", 
"BKCgetCapacity;"   ]
-[ 16@0,"getorderidx",  "command",  "bat",  "(b:bat[:any_1]):lng ", 
"BKCgetSize;"   ]
-[ 17@0,"hasorderidx",  "pattern",  "bat",  "(bv:bat[:any_1]):bit 
","OIDXhasorderidx;"  ]
-[ 18@0,"imprints", "command",  "bat",  "(b:bat[:dbl]):lng ",   
"CMDBATimprintsize;"]
-[ 19@0,"imprints", "command",  "bat",  "(b:bat[:flt]):lng ",   
"CMDBATimprintsize;"]
-[ 20@0,"imprints", "command",  "bat",  "(b:bat[:lng]):lng ",   
"CMDBATimprintsize;"]
-[ 21@0,"imprints", "command",  "bat",  "(b:bat[:int]):lng ",   
"CMDBATimprintsize;"]
-[ 22@0,"imprints", "command",  "bat",  "(b:bat[:sht]):lng ",   
"CMDBATimprintsize;"]
-[ 23@0,"imprints", "command",  "bat",  "(b:bat[:bte]):lng ",   
"CMDBATimprintsize;"]
-[ 24@0,"imprintsize",  "command",  "bat",  "(b:bat[:dbl]):void ",  
"CMDBATimprints;"   ]
-[ 25@0,"imprintsize",  "command",  "bat",  "(b:bat[:flt]):void ",  
"CMDBATimprints;"   ]
-[ 26@0,"imprintsize",  "command",  "bat",  "(b:bat[:lng]):void ",  
"CMDBATimprints;"   ]
-[ 27@0,"imprintsize",  "command",  "bat",  "(b:bat[:int]):void ",  
"CMDBATimprints;"   ]
-[ 28@0,"imprintsize",  "command",  "bat",  "(b:bat[:sht]):void ",  
"CMDBATimprints;"   ]
-[ 29@0,"imprintsize",  "command",  "bat",  "(b:bat[:bte]):void ",  
"CMDBATimprints;"   ]
-[ 30@0,"info", "command",  "bat",  
"(a:bat[:oid],b:bat[:oid]):bat[:oid] ", "BKCintersectcand;" ]
-[ 31@0,"intersectcand","command",  "bat",  
"(b1:bat[:any_1],b2:bat[:any_2]):bit ", "BKCisSynced;"  ]
-[ 32@0,"isPersistent", "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCisPersistent;"  ]
-[ 33@0,"isSorted", "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCisTransient;"   ]
-[ 34@0,"isSortedReverse",  "command",  "bat",  
"(b:bat[:any_1]):bit ", "BKCisSortedReverse;"   ]
-[ 35@0,"isSynced", "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCisSorted;"  ]
-[ 36@0,"isTransient",  "command",  "bat",  "(b:bat[:any_1]):bit ", 
"BKCgetKey;"]
-[ 37@0,"isaKey",   "command",  "bat",  "(b:bat[:any_1]) 
(X_0:bat[:str],X_1:bat[:str]) ",   "BKCinfo;"  ]
-[ 38@0,"mergecand","command",  "bat",  
"(a:bat[:oid],b:bat[:oid]):bat[:oid] ", "BKCmergecand;" ]
-[ 39@0,"mirror",   "command",  "bat",  

MonetDB: default - Make query independent of what happens to be ...

2017-01-09 Thread Sjoerd Mullender
Changeset: 4402dbd26688 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4402dbd26688
Modified Files:
sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.sql
sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.stable.out
Branch: default
Log Message:

Make query independent of what happens to be in sys.tables.


diffs (124 lines):

diff --git a/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.sql 
b/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.sql
--- a/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.sql
+++ b/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.sql
@@ -1,1 +1,65 @@
-select name from (select name, id from tables order by id) as x;
+create table foo (
+id int,
+name varchar(100)
+);
+copy 56 records into foo from stdin;
+2001|schemas
+2007|types
+2016|functions
+2027|args
+2036|sequences
+2046|dependencies
+2050|connections
+2059|_tables
+2068|_columns
+2079|keys
+2086|idxs
+2091|triggers
+2102|objects
+2107|_tables
+2116|_columns
+2127|keys
+2134|idxs
+2139|triggers
+2150|objects
+5956|tables
+5966|columns
+5982|db_user_info
+5988|users
+5992|user_role
+5995|auths
+5999|privileges
+6221|querylog_catalog
+6232|querylog_calls
+6250|querylog_history
+6289|tracelog
+6432|sessions
+6499|optimizers
+6507|environment
+6557|queue
+6587|rejects
+6905|spatial_ref_sys
+6914|geometry_columns
+7622|keywords
+7630|table_types
+7638|dependency_types
+7655|netcdf_files
+7661|netcdf_dims
+7669|netcdf_vars
+7675|netcdf_vardim
+7683|netcdf_attrs
+7749|storage
+7827|storagemodelinput
+7881|storagemodel
+7891|tablestoragemodel
+7905|statistics
+8008|files
+8021|sq
+8040|rg
+8052|pg
+8065|export
+8147|systemfunctions
+
+select name from (select name, id from foo order by id) as x;
+
+drop table foo;
diff --git a/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.stable.out 
b/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.stable.out
--- a/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.stable.out
+++ b/sql/test/BugTracker/Tests/subquery_orderby.SF-1688915.stable.out
@@ -54,8 +54,48 @@ Ready.
 # 14:49:17 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-71873" "--port=32077"
 # 14:49:17 >  
 
-#select name from (select name, id from tables order by id) as x;
-% .x # table_name
+#create table foo (
+#id int,
+#name varchar(100)
+#);
+#copy 56 records into foo from stdin;
+#2001|schemas
+#2007|types
+#2016|functions
+#2027|args
+#2036|sequences
+#2046|dependencies
+#2050|connections
+#2059|_tables
+#2068|_columns
+#2079|keys
+#2086|idxs
+#2091|triggers
+#2102|objects
+#2107|_tables
+#2116|_columns
+#2127|keys
+#2134|idxs
+#2139|triggers
+#2150|objects
+#5956|tables
+#5966|columns
+#5982|db_user_info
+#5988|users
+#5992|user_role
+#5995|auths
+#5999|privileges
+#6221|querylog_catalog
+#6232|querylog_calls
+#6250|querylog_history
+#6289|tracelog
+#6432|sessions
+#6499|optimizers
+#6507|environment
+#6557|queue
+[ 56   ]
+#select name from (select name, id from foo order by id) as x;
+% sys.x # table_name
 % name # name
 % varchar # type
 % 17 # length
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list