MonetDB: gdk_tracer - Added secondary buffer

2019-11-27 Thread Thodoris Zois
Changeset: e36e3485d4bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e36e3485d4bf
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Added secondary buffer


diffs (286 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -40,8 +40,9 @@
 #undef free
 #endif
 
-static gdk_tracer tracer = { .allocated_size = 0, .id = 0, .lock = 
MT_LOCK_INITIALIZER("GDKtracerL") };
-// static gdk_tracer secondary_tracer = { .allocated_size = 0, .id = 1, .lock 
= MT_LOCK_INITIALIZER("GDKtracerL2") };
+static gdk_tracer tracer = { .allocated_size = 0, .id = 0 };
+static gdk_tracer secondary_tracer = { .allocated_size = 0, .id = 1 };
+static MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer");
 static ATOMIC_TYPE SELECTED_tracer_ID = 0;
 
 static FILE *output_file;
@@ -302,6 +303,7 @@ GDKtracer_set_component_level(int *comp,
 return GDK_FAIL;
 
 LVL_PER_COMPONENT[*comp] = level;
+GDKtracer_show_info();
 return GDK_SUCCEED;
 }
 
@@ -409,14 +411,17 @@ GDKtracer_reset_adapter(void)
 gdk_return
 GDKtracer_log(LOG_LEVEL level, char *fmt, ...)
 {  
-(void) level;
-gdk_tracer *fill_tracer = 
-bool FLUSH_buffer = true;
+gdk_tracer *fill_tracer;
 int bytes_written = 0;
 int GDK_result;
 
-MT_lock_set(_tracer->lock);
+MT_lock_set();
 {
+if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
+fill_tracer = 
+else
+fill_tracer = _tracer;
+
 va_list va;
 va_start(va, fmt);
 bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
@@ -427,111 +432,70 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 fill_tracer->allocated_size == 0)
 {
 fill_tracer->allocated_size += bytes_written;
-FLUSH_buffer = false;
 }
-}
-MT_lock_unset(_tracer->lock);
+else
+{
+/* CHECK */
+// Create thread for that
+// Flush the full tracer on a separate thread
+GDKtracer_flush_buffer();
+// MT_Id tid;
+// if(MT_create_thread(, (void(*) (void*)) 
GDKtracer_flush_buffer, NULL, MT_THR_JOINABLE, "GDKtracerFlush") < 0)
+// fprintf(stderr, "MT_create_thread FAILED!\n");
+// // return GDK_FAIL;
+// GDK_result = MT_join_thread(tid);
+// if(GDK_result == GDK_FAIL)
+// fprintf(stderr, "MT_join_thread FAILED!\n");
+// // return GDK_FAIL;
 
-if(FLUSH_buffer)
-{
-GDKtracer_flush_buffer();
-}
-else
-{
-// Flush the current buffer in case the event is 
-// important depending on the flush-level
-if(level == CUR_FLUSH_LEVEL)
-{
-GDK_result = GDKtracer_flush_buffer();
-if(GDK_result == GDK_FAIL)
-return GDK_FAIL;
+// Switch tracer
+if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
+fill_tracer = _tracer;
+else
+fill_tracer = 
+
+// Set the new selected tracer 
+ATOMIC_SET(_tracer_ID, fill_tracer->id);  
+
+// Write to the new tracer
+va_list va;
+va_start(va, fmt);
+bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
+va_end(va);
+
+// The second buffer will always be empty at start
+// So if the message does not fit we cut it off
+// message might be > BUFFER_SIZE
+fill_tracer->allocated_size += bytes_written;  
 }
 }
-
-
-// Select a tracer
-// gdk_tracer *fill_tracer;
-// int GDK_result;
-// bool SWITCH_tracer = true;
-// int bytes_written = 0;
-
-// if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
-// fill_tracer = 
-// else
-// fill_tracer = _tracer;
-
-// MT_lock_set(_tracer->lock);
-// {
-// va_list va;
-// va_start(va, fmt);
-// bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
-// va_end(va);
-
-// // The message fits the buffer OR the buffer is empty (we don't 
care if it fits - just cut it off)
-// if(bytes_written < (BUFFER_SIZE - fill_tracer->allocated_size) || 
-// fill_tracer->allocated_size == 0)
-// {
-// fill_tracer->allocated_size += bytes_written;
-// SWITCH_tracer = false;
-// }
-// }
-// MT_lock_unset(_tracer->lock);
+MT_lock_unset();
 
-// if(SWITCH_tracer)
-// {   
-// // Switch tracer
-// if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
-// fill_tracer = _tracer;
-// else
-// fill_tracer = 
-
-// MT_lock_set(_tracer->lock);
-// {
-// 

MonetDB: mosaic - Temporarily expand macro to find testweb failure.

2019-11-27 Thread Aris Koning
Changeset: 067b994e1f08 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=067b994e1f08
Modified Files:
monetdb5/modules/mosaic/mosaic_raw.c
Branch: mosaic
Log Message:

Temporarily expand macro to find testweb failure.


diffs (truncated from 1061 to 300 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_raw.c 
b/monetdb5/modules/mosaic/mosaic_raw.c
--- a/monetdb5/modules/mosaic/mosaic_raw.c
+++ b/monetdb5/modules/mosaic/mosaic_raw.c
@@ -212,7 +212,1056 @@ MOSdecompress_raw(MOStask task)
 }\
 }
 
-MOSselect_DEF(raw, bte)
+MOSselect_SIGNATURE(raw, bte) { oid *o; BUN first,last; bte v; (void) v; first 
= task->start; last = first + MOSgetCnt(task->blk); bool nil = 
!task->bsrc->tnonil; o = task->lb; oid c = canditer_next(task->ci); while 
(!is_oid_nil(c) && c < first ) { c = canditer_next(task->ci); } if 
(is_oid_nil(c)) { return MAL_SUCCEED; } else if ( nil && anti){ if 
(task->ci->tpe == cand_dense) do { if ( IS_NIL(bte, tl) && IS_NIL(bte, th) && 
li && hi && !1) { if(1) { 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (is_bte_nil(v))
+*o++ = c;
+}
+} } } else if ( IS_NIL(bte, tl) && IS_NIL(bte, th) && li && hi && 1) { if(1) { 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (!is_bte_nil(v))
+*o++ = c;
+}
+} } else 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (true)
+*o++ = c;
+}
+} } else if ( IS_NIL(bte, tl) && IS_NIL(bte, th) && !(li && hi) && !1) { if(1) 
{ 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (!is_bte_nil(v))
+*o++ = c;
+}
+} } else 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (true)
+*o++ = c;
+}
+} } else if ( IS_NIL(bte, tl) && IS_NIL(bte, th) && !(li && hi) && 1) { } else 
if ( !IS_NIL(bte, tl) && !IS_NIL(bte, th) && tl == th && !(li && hi) && 1) { 
if(1) { 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (!is_bte_nil(v))
+*o++ = c;
+}
+} } else 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (true)
+*o++ = c;
+}
+} } else if ( !IS_NIL(bte, tl) && !IS_NIL(bte, th) && tl == th && !(li && hi) 
&& !1) { } else if ( !IS_NIL(bte, tl) && !IS_NIL(bte, th) && tl > th && !1) { } 
else if ( !IS_NIL(bte, tl) && !IS_NIL(bte, th) && tl > th && 1) { if(1) { 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (!is_bte_nil(v))
+*o++ = c;
+}
+} } else 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = (BUN) (c - first);
+v = val[i];
+/*TODO: change from control to data dependency.*/
+if (true)
+*o++ = c;
+}
+} } else { if( IS_NIL(bte, tl) ){ 
+{
+bte *val= (bte*) (((char*) task->blk) + MosaicBlkSize);
+for (oid c = canditer_peekprev(task->ci); !is_oid_nil(c) && c < last; c = 
canditer_next_dense(task->ci)) {
+BUN i = 

MonetDB: mosaic - Update TODO's.

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

Update TODO's.


diffs (21 lines):

diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt 
b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
--- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt
+++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
@@ -11,15 +11,16 @@ Add test for float/double
 Add test for huge
 Check MOSanalysis and its test.
 Fix/check/test MOSlayout.
+benchmark using TPC-H
 make mitosis work with mosaic and see how this relates to the previous 
landmark stuff.
 Remove floating point support in prefix compression and use prefix-like-frame 
semantics
 consider packing mosaic_block_header's more efficiently.
 Add asserts on type degeneration for bit => bte daytime => lng timestmap => 
lng date => int.
-benchmark
 DO nil checking more efficient similar to gdk_select
 
 code issues
 Replace the MOSskip functions by MOSadvance functions
+Use GDK naming conventions, e.g. o for stuff coming out if canditer_next.
 Make block headers specific by having type parametrized blockheader struct's.
 atomic base type of an oid bat is lng. So we can remove that one.
 It is a bit cleaner if MOSadvance call's are done outside of select functions.
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Simplify macro signature.

2019-11-27 Thread Aris Koning
Changeset: 8a1e1d0c1f38 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8a1e1d0c1f38
Modified Files:
monetdb5/modules/mosaic/mosaic_capped.c
monetdb5/modules/mosaic/mosaic_dictionary.h
monetdb5/modules/mosaic/mosaic_var.c
Branch: mosaic
Log Message:

Simplify macro signature.


diffs (38 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_capped.c 
b/monetdb5/modules/mosaic/mosaic_capped.c
--- a/monetdb5/modules/mosaic/mosaic_capped.c
+++ b/monetdb5/modules/mosaic/mosaic_capped.c
@@ -413,8 +413,7 @@ MOSdecompress_capped(MOStask task)
 }
 
 #define scan_loop_capped(TPE, CANDITER_NEXT, TEST) \
-scan_loop_dictionary(TPE, CANDITER_NEXT, TEST,\
-GET_FINAL_DICT, GET_FINAL_BITS)
+scan_loop_dictionary(TPE, CANDITER_NEXT, TEST)
 
 MOSselect_DEF(capped, bte)
 MOSselect_DEF(capped, sht)
diff --git a/monetdb5/modules/mosaic/mosaic_dictionary.h 
b/monetdb5/modules/mosaic/mosaic_dictionary.h
--- a/monetdb5/modules/mosaic/mosaic_dictionary.h
+++ b/monetdb5/modules/mosaic/mosaic_dictionary.h
@@ -217,7 +217,7 @@ return MAL_SUCCEED;\
decompress_dictionary_##TPE(dict, bits, base, cnt, );\
 }
 
-#define scan_loop_dictionary(TPE, CANDITER_NEXT, TEST, GET_FINAL_DICT, 
GET_FINAL_BITS) {\
+#define scan_loop_dictionary(TPE, CANDITER_NEXT, TEST) {\
 TPE* dict = GET_FINAL_DICT(task, TPE);\
BitVector base = (BitVector) MOScodevectorDict(task);\
 bte bits = GET_FINAL_BITS(task);\
diff --git a/monetdb5/modules/mosaic/mosaic_var.c 
b/monetdb5/modules/mosaic/mosaic_var.c
--- a/monetdb5/modules/mosaic/mosaic_var.c
+++ b/monetdb5/modules/mosaic/mosaic_var.c
@@ -326,8 +326,7 @@ MOSdecompress_var(MOStask task)
 }
 
 #define scan_loop_var(TPE, CANDITER_NEXT, TEST) \
-scan_loop_dictionary(TPE, CANDITER_NEXT, TEST,\
-GET_FINAL_DICT, GET_FINAL_BITS)
+scan_loop_dictionary(TPE, CANDITER_NEXT, TEST)
 
 MOSselect_DEF(var, bte)
 MOSselect_DEF(var, sht)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Update TODO's.

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

Update TODO's.


diffs (28 lines):

diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt 
b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
--- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt
+++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
@@ -1,8 +1,11 @@
 technical depth
+Adapt project and join to use candidate lists properly.
 Factor out boilerplate code mosaic code: resulting mosaic boilerplate is for 
testing purposes.
-make sure that dense candidate lists are not transparently skipped and pushed 
to algebra module operators.
-Introduce mosaic into gdk: create hooks in pointselect and scanselect 
functions/macro's.
-make sure candidate lists are working properly (2)
+Add lots of tests with candidate lists for all 
+Introduce mosaic into gdk: create hooks in scanselect functions/macro's, joins 
and projections.
+Apply compressed operations more directly: on keys in dictionary compression 
(1)
+Apply compressed operations more directly: on prefix|suffix in prefix 
compression (1)
+Apply compressed operations more directly: on linear in prefix compression (1)
 Be sure alignment is correct. Use asserts for this.
 Add test for float/double
 Add test for huge
@@ -10,9 +13,6 @@ Check MOSanalysis and its test.
 Fix/check/test MOSlayout.
 make mitosis work with mosaic and see how this relates to the previous 
landmark stuff.
 Remove floating point support in prefix compression and use prefix-like-frame 
semantics
-Apply compressed operations more directly: on keys in dictionary compression 
(1)
-Apply compressed operations more directly: on prefix|suffix in prefix 
compression (1)
-Apply compressed operations more directly: on linear in prefix compression (1)
 consider packing mosaic_block_header's more efficiently.
 Add asserts on type degeneration for bit => bte daytime => lng timestmap => 
lng date => int.
 benchmark
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Fixed a bug that was causing deadlock - Sw...

2019-11-27 Thread Thodoris Zois
Changeset: 1f6c82be3b71 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f6c82be3b71
Modified Files:
gdk/gdk_tracer.c
Branch: gdk_tracer
Log Message:

Fixed a bug that was causing deadlock - Switched to 1 buffer tracer


diffs (truncated from 307 to 300 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -29,10 +29,19 @@
 #include "gdk.h"
 #include "gdk_tracer.h"
 
-#define _DEBUG_TRACER_
+// We need to get rid of macros defined in gdk.h. Those are using GDKtracer in 
order to produce 
+// messages. At the point malloc is called in gdk_tracer.c (in function 
_GDKtracer_fill_tracer)
+// a lock has already being acquired. Using the macro malloc in gdk.h a call 
to GDKtracer 
+// acquires another lock and results in deadlock.
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef free
+#undef free
+#endif
 
 static gdk_tracer tracer = { .allocated_size = 0, .id = 0, .lock = 
MT_LOCK_INITIALIZER("GDKtracerL") };
-static gdk_tracer secondary_tracer = { .allocated_size = 0, .id = 1, .lock = 
MT_LOCK_INITIALIZER("GDKtracerL2") };
+// static gdk_tracer secondary_tracer = { .allocated_size = 0, .id = 1, .lock 
= MT_LOCK_INITIALIZER("GDKtracerL2") };
 static ATOMIC_TYPE SELECTED_tracer_ID = 0;
 
 static FILE *output_file;
@@ -159,25 +168,30 @@ static int
 // Add \n if it doesn't exist
 if(fmt[fmt_len - 1] != NEW_LINE)
 {
-tmp = GDKmalloc(sizeof(char) * (fmt_len + 2));
-strcpy(tmp, fmt);
-tmp[fmt_len] = NEW_LINE;
-tmp[fmt_len + 1] = NULL_CHAR;
-msg = tmp;
+tmp = malloc(sizeof(char) * (fmt_len + 2));
+if(tmp == NULL)
+{
+fprintf(stderr, "Memory allocation failed\n");
+}
+else
+{
+strcpy(tmp, fmt);
+tmp[fmt_len] = NEW_LINE;
+tmp[fmt_len + 1] = NULL_CHAR;
+msg = tmp;
+}
 }
 else
 {
 msg = fmt;
 }
-
+
 if(msg)
-{
 // vsnprintf(char *str, size_t count, ...) -> including null 
terminating character
 bytes_written = vsnprintf(sel_tracer->buffer + 
sel_tracer->allocated_size, BUFFER_SIZE - sel_tracer->allocated_size, msg, va);
-
-if(tmp)
-GDKfree(tmp);
-}
+
+if(tmp)
+free(tmp);
 
 _GDKtracer_log_output_error(bytes_written);
 
@@ -232,10 +246,8 @@ static gdk_return
 }
 }
 }
-
-#ifdef _DEBUG_TRACER_
+
 GDKtracer_show_info();
-#endif
 
 return GDK_SUCCEED;
 }
@@ -396,17 +408,12 @@ GDKtracer_reset_adapter(void)
 
 gdk_return
 GDKtracer_log(LOG_LEVEL level, char *fmt, ...)
-{   
-// Select a tracer
-gdk_tracer *fill_tracer;
+{  
+(void) level;
+gdk_tracer *fill_tracer = 
+bool FLUSH_buffer = true;
+int bytes_written = 0;
 int GDK_result;
-bool SWITCH_tracer = true;
-int bytes_written = 0;
-
-if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
-fill_tracer = 
-else
-fill_tracer = _tracer;
 
 MT_lock_set(_tracer->lock);
 {
@@ -420,55 +427,102 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 fill_tracer->allocated_size == 0)
 {
 fill_tracer->allocated_size += bytes_written;
-SWITCH_tracer = false;
+FLUSH_buffer = false;
 }
 }
 MT_lock_unset(_tracer->lock);
 
-if(SWITCH_tracer)
-{   
-// Switch tracer
-if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
-fill_tracer = _tracer;
-else
-fill_tracer = 
-
-MT_lock_set(_tracer->lock);
+if(FLUSH_buffer)
+{
+GDKtracer_flush_buffer();
+}
+else
+{
+// Flush the current buffer in case the event is 
+// important depending on the flush-level
+if(level == CUR_FLUSH_LEVEL)
 {
-// Flush current tracer
-MT_Id tid;
-
-if(MT_create_thread(, (void(*) (void*)) 
GDKtracer_flush_buffer, NULL, MT_THR_JOINABLE, "GDKtracerFlush") < 0)
-return GDK_FAIL;
-
-va_list va;
-va_start(va, fmt);
-bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
-va_end(va);
-
-// The second buffer will always be empty at start
-// So if the message does not fit we cut it off
-// message might be > BUFFER_SIZE
-fill_tracer->allocated_size += bytes_written;
-
-GDK_result = MT_join_thread(tid);
+GDK_result = GDKtracer_flush_buffer();
 if(GDK_result == GDK_FAIL)
 return GDK_FAIL;
+}
+}
+
 
-// Set the new selected tracer 
-ATOMIC_SET(_tracer_ID, fill_tracer->id);
-}
-MT_lock_unset(_tracer->lock);
-}
-
+// Select a tracer
+// gdk_tracer *fill_tracer;
+// int 

MonetDB: Nov2019 - Improve syntax of ALTER SEQUENCE and CREATE S...

2019-11-27 Thread Martin van Dinther
Changeset: 0e447dd3c5a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e447dd3c5a4
Modified Files:
clients/mapiclient/mhelp.c
Branch: Nov2019
Log Message:

Improve syntax of ALTER SEQUENCE and CREATE SEQUENCE. They allow a qualified 
name and support only a limited number of integer data types.
Corrected definition of column_ref.
Also updated 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes


diffs (52 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -72,9 +72,9 @@ SQLhelp sqlhelp1[] = {
 "See also https://www.monetdb.org/Documentation/SQLreference/Alter"},
{"ALTER SEQUENCE",
 "",
-"ALTER SEQUENCE ident [ AS data_type] [ RESTART [WITH start]] 
[INCREMENT BY increment]\n"
-"[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] 
[CACHE cachevalue] [[NO] CYCLE]",
-"ident,data_type",
+"ALTER SEQUENCE qname [ AS int_datatype] [ RESTART [WITH intval]] 
[INCREMENT BY intval]\n"
+"[MINVALUE intval | NO MINVALUE] [MAXVALUE intval | NO MAXVALUE] 
[CACHE intval] [[NO] CYCLE]",
+"int_datatype,intval",
 "See also 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes"},
{"ALTER USER",
 "Change a user's login name or password or default schema",
@@ -209,9 +209,9 @@ SQLhelp sqlhelp1[] = {
 "See also https://www.monetdb.org/Documentation/SQLreference/Schema"},
{"CREATE SEQUENCE",
 "Define a new integer number sequence generator",
-"CREATE SEQUENCE ident [ AS data_type] [ START [WITH start]] 
[INCREMENT BY increment]\n"
-"[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] 
[CACHE cachevalue] [[NO] CYCLE]",
-"ident,data_type",
+"CREATE SEQUENCE qname [ AS int_datatype] [ START [WITH intval]] 
[INCREMENT BY intval]\n"
+"[MINVALUE intval | NO MINVALUE] [MAXVALUE intval | NO MAXVALUE] 
[CACHE intval] [[NO] CYCLE]",
+"int_datatype,intval",
 "See also 
https://www.monetdb.org/Documentation/Manuals/SQLreference/SerialTypes"},
{"CREATE STREAM TABLE",
 "Temporary table, locked during updates/ continues query processing",
@@ -548,8 +548,8 @@ SQLhelp sqlhelp2[] = {
 NULL},
{"column_def",
 NULL,
-"COLUMN { data_type [ column_option ... ] | SERIAL | BIGSERIAL }",
-"data_type,column_option",
+"ident { data_type [ column_option ... ] | SERIAL | BIGSERIAL }",
+"ident,data_type,column_option",
 NULL},
{"column_list",
 NULL,
@@ -646,6 +646,11 @@ SQLhelp sqlhelp2[] = {
 "ident [',' ...]",
 "ident",
 NULL},
+   {"int_datatype",
+NULL,
+"BIGINT | INTEGER | INT | SMALLINT | TINYINT",
+NULL,
+NULL},
{"interval",
 NULL,
 "INTERVAL [ '+' | '-' ] string start_field TO end_field",
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - merged

2019-11-27 Thread Niels Nes
Changeset: 951cd5575e69 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=951cd5575e69
Modified Files:
MonetDB.spec
debian/changelog
gdk/gdk_utils.c

sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
tools/mserver/mserver5.c
Branch: default
Log Message:

merged


diffs (80 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1063,8 +1063,6 @@ fi
 - Rebuilt.
 - BZ#3533: SQL aggregate functions avg(), sum() and median() return an
   error when used on a column with datatype interval second
-- BZ#6723: columns aliases duplicates should not be allowed. automatic
-  aliasing required.
 
 * Mon Nov 18 2019 Sjoerd Mullender  - 11.35.1-20191118
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,6 @@ monetdb (11.35.3) unstable; urgency=low
   * Rebuilt.
   * BZ#3533: SQL aggregate functions avg(), sum() and median() return an
 error when used on a column with datatype interval second
-  * BZ#6723: columns aliases duplicates should not be allowed. automatic
-aliasing required.
 
  -- Sjoerd Mullender   Mon, 25 Nov 2019 12:34:22 +0100
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -679,6 +679,11 @@ GDKinit(opt *set, int setlen)
}
 
/* Mserver by default takes 80% of all memory as a default */
+#if SIZEOF_SIZE_T == 4
+   if ((double) MT_npages() * (double) MT_pagesize() * 0.815 >= (double) 
GDK_VM_MAXSIZE)
+   GDK_mem_maxsize = GDK_VM_MAXSIZE;
+   else
+#endif
GDK_mem_maxsize = (size_t) ((double) MT_npages() * (double) 
MT_pagesize() * 0.815);
if (BBPinit() != GDK_SUCCEED)
return GDK_FAIL;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
@@ -10,4 +10,8 @@ SELECT CAST(SUM(col0) AS BIGINT) FROM ta
 SELECT CAST(SUM(col0) AS BIGINT) FROM tab0 WHERE + + col0 NOT BETWEEN NULL AND 
+ col2;
 SELECT DISTINCT COUNT(*) FROM tab0 WHERE NOT col2 NOT BETWEEN ( 35 ) AND ( 
NULL );
 SELECT CAST(- COUNT(*) * - - 61 + + + ( + COUNT(*) ) AS BIGINT) FROM tab0 
WHERE NOT col0 + + 10 BETWEEN NULL AND NULL;
+
+SELECT ALL * FROM tab0 AS cor0 WHERE col2 BETWEEN NULL AND NULL; --empty
+SELECT COUNT ( * ) FROM tab0 WHERE NOT col1 NOT BETWEEN NULL AND NULL; --0
+SELECT - 78 * + MAX ( DISTINCT col2 ) + - 52 AS col1 FROM tab0 AS cor0 WHERE 
NOT - col0 + col2 NOT BETWEEN ( NULL ) AND NULL; --NULL
 DROP TABLE tab0;
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -121,7 +121,7 @@ usage(char *prog, int xit)
 static void
 monet_hello(void)
 {
-   dbl sz_mem_h;
+   double sz_mem_h;
char  *qc = " kMGTPE";
int qi = 0;
 
@@ -149,14 +149,14 @@ monet_hello(void)
""
 #endif
);
-   sz_mem_h = (dbl) (MT_npages() * MT_pagesize());
+   sz_mem_h = (double) MT_npages() * MT_pagesize();
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
qi++;
}
printf("# Found %.3f %ciB available main-memory",
sz_mem_h, qc[qi]);
-   sz_mem_h = (dbl) GDK_mem_maxsize;
+   sz_mem_h = (double) GDK_mem_maxsize;
qi = 0;
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - algebra.h not needed in the optimizer (and pr...

2019-11-27 Thread Niels Nes
Changeset: 5f68ad3fe593 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f68ad3fe593
Modified Files:
monetdb5/optimizer/opt_postfix.c
Branch: default
Log Message:

algebra.h not needed in the optimizer (and preference not to include this in 
that
directory)


diffs (11 lines):

diff --git a/monetdb5/optimizer/opt_postfix.c b/monetdb5/optimizer/opt_postfix.c
--- a/monetdb5/optimizer/opt_postfix.c
+++ b/monetdb5/optimizer/opt_postfix.c
@@ -13,7 +13,6 @@
 #include "monetdb_config.h"
 #include "mal_instruction.h"
 #include "opt_postfix.h"
-#include "algebra.h"
 
 #define isCandidateList(M,P,I) ((M)->var[getArg(P,I)].id[0]== 'C')
 str
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Nov2019 branch.

2019-11-27 Thread Sjoerd Mullender
Changeset: 9d0623ae89aa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d0623ae89aa
Modified Files:
MonetDB.spec
debian/changelog
gdk/gdk_utils.c

sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
tools/mserver/mserver5.c
Branch: default
Log Message:

Merge with Nov2019 branch.


diffs (80 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1063,8 +1063,6 @@ fi
 - Rebuilt.
 - BZ#3533: SQL aggregate functions avg(), sum() and median() return an
   error when used on a column with datatype interval second
-- BZ#6723: columns aliases duplicates should not be allowed. automatic
-  aliasing required.
 
 * Mon Nov 18 2019 Sjoerd Mullender  - 11.35.1-20191118
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,6 @@ monetdb (11.35.3) unstable; urgency=low
   * Rebuilt.
   * BZ#3533: SQL aggregate functions avg(), sum() and median() return an
 error when used on a column with datatype interval second
-  * BZ#6723: columns aliases duplicates should not be allowed. automatic
-aliasing required.
 
  -- Sjoerd Mullender   Mon, 25 Nov 2019 12:34:22 +0100
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -679,6 +679,11 @@ GDKinit(opt *set, int setlen)
}
 
/* Mserver by default takes 80% of all memory as a default */
+#if SIZEOF_SIZE_T == 4
+   if ((double) MT_npages() * (double) MT_pagesize() * 0.815 >= (double) 
GDK_VM_MAXSIZE)
+   GDK_mem_maxsize = GDK_VM_MAXSIZE;
+   else
+#endif
GDK_mem_maxsize = (size_t) ((double) MT_npages() * (double) 
MT_pagesize() * 0.815);
if (BBPinit() != GDK_SUCCEED)
return GDK_FAIL;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
@@ -10,4 +10,8 @@ SELECT CAST(SUM(col0) AS BIGINT) FROM ta
 SELECT CAST(SUM(col0) AS BIGINT) FROM tab0 WHERE + + col0 NOT BETWEEN NULL AND 
+ col2;
 SELECT DISTINCT COUNT(*) FROM tab0 WHERE NOT col2 NOT BETWEEN ( 35 ) AND ( 
NULL );
 SELECT CAST(- COUNT(*) * - - 61 + + + ( + COUNT(*) ) AS BIGINT) FROM tab0 
WHERE NOT col0 + + 10 BETWEEN NULL AND NULL;
+
+SELECT ALL * FROM tab0 AS cor0 WHERE col2 BETWEEN NULL AND NULL; --empty
+SELECT COUNT ( * ) FROM tab0 WHERE NOT col1 NOT BETWEEN NULL AND NULL; --0
+SELECT - 78 * + MAX ( DISTINCT col2 ) + - 52 AS col1 FROM tab0 AS cor0 WHERE 
NOT - col0 + col2 NOT BETWEEN ( NULL ) AND NULL; --NULL
 DROP TABLE tab0;
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -121,7 +121,7 @@ usage(char *prog, int xit)
 static void
 monet_hello(void)
 {
-   dbl sz_mem_h;
+   double sz_mem_h;
char  *qc = " kMGTPE";
int qi = 0;
 
@@ -149,14 +149,14 @@ monet_hello(void)
""
 #endif
);
-   sz_mem_h = (dbl) (MT_npages() * MT_pagesize());
+   sz_mem_h = (double) MT_npages() * MT_pagesize();
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
qi++;
}
printf("# Found %.3f %ciB available main-memory",
sz_mem_h, qc[qi]);
-   sz_mem_h = (dbl) GDK_mem_maxsize;
+   sz_mem_h = (double) GDK_mem_maxsize;
qi = 0;
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Compilation fix

2019-11-27 Thread Thodoris Zois
Changeset: 6780ceb0ac1a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6780ceb0ac1a
Modified Files:
monetdb5/scheduler/run_memo.c
Branch: gdk_tracer
Log Message:

Compilation fix


diffs (21 lines):

diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -177,7 +177,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
}
 
-   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), mincost);
(void) cntxt;
 
/* remove non-qualifying variables */
@@ -189,7 +189,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
propagateNonTarget(mb, pc + 1);
 
-   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), mincost);
debugFunction(MAL_MEMO, mb, stk, 1);
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Nov2019 - Remove BZ#6723 from changelog. It's not in t...

2019-11-27 Thread Sjoerd Mullender
Changeset: 8ff30e559284 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ff30e559284
Modified Files:
MonetDB.spec
debian/changelog
Branch: Nov2019
Log Message:

Remove BZ#6723 from changelog.  It's not in this release.


diffs (24 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1063,8 +1063,6 @@ fi
 - Rebuilt.
 - BZ#3533: SQL aggregate functions avg(), sum() and median() return an
   error when used on a column with datatype interval second
-- BZ#6723: columns aliases duplicates should not be allowed. automatic
-  aliasing required.
 
 * Mon Nov 18 2019 Sjoerd Mullender  - 11.35.1-20191118
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,6 @@ monetdb (11.35.3) unstable; urgency=low
   * Rebuilt.
   * BZ#3533: SQL aggregate functions avg(), sum() and median() return an
 error when used on a column with datatype interval second
-  * BZ#6723: columns aliases duplicates should not be allowed. automatic
-aliasing required.
 
  -- Sjoerd Mullender   Mon, 25 Nov 2019 12:34:22 +0100
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Renamed macro CRITICAL to TRC_CRITICAL

2019-11-27 Thread Thodoris Zois
Changeset: e0d5c9894184 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e0d5c9894184
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_client.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_namespace.c
monetdb5/modules/mal/mal_mapi.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_user.c
sql/backends/monet5/vaults/shp/shp.c
sql/backends/monet5/wlr.c
sql/server/sql_mvc.c
sql/storage/store.c
Branch: gdk_tracer
Log Message:

Renamed macro CRITICAL to TRC_CRITICAL


diffs (truncated from 364 to 300 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -219,7 +219,7 @@ extern LOG_LEVEL LVL_PER_COMPONENT[COMPO
 ## __VA_ARGS__); \
 }\
 
-#define CRITICAL(COMP, MSG, ...) \
+#define TRC_CRITICAL(COMP, MSG, ...) \
 GDK_TRACER_LOG(M_CRITICAL, COMP, MSG, ## __VA_ARGS__)\
 
 #define TRC_ERROR(COMP, MSG, ...)\
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -70,7 +70,7 @@ MCinit(void)
if (maxclients <= 0) {
maxclients = 64;
if (GDKsetenv("max_clients", "64") != GDK_SUCCEED) {
-   CRITICAL(MAL_CLIENT, "GDKsetenv failed\n");
+   TRC_CRITICAL(MAL_CLIENT, "GDKsetenv failed\n");
return false;
}
}
@@ -78,7 +78,7 @@ MCinit(void)
MAL_MAXCLIENTS = /* client connections */ maxclients;
mal_clients = GDKzalloc(sizeof(ClientRec) * MAL_MAXCLIENTS);
if( mal_clients == NULL){
-   CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL 
"\n");
+   TRC_CRITICAL(MAL_CLIENT, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
return false;
}
for (int i = 0; i < MAL_MAXCLIENTS; i++)
@@ -222,7 +222,7 @@ MCinitClientRecord(Client c, oid user, b
MT_lock_set(_contextLock);
c->mode = FREECLIENT;
MT_lock_unset(_contextLock);
-   CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL 
"\n");
+   TRC_CRITICAL(MAL_CLIENT, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
return NULL;
}
c->yycur = 0;
@@ -259,7 +259,7 @@ MCinitClientRecord(Client c, oid user, b
c->mode = FREECLIENT;
MT_lock_unset(_contextLock);
}
-   CRITICAL(MAL_CLIENT, "Initialization failed: " MAL_MALLOC_FAIL 
"\n");
+   TRC_CRITICAL(MAL_CLIENT, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
return NULL;
}
c->promptlength = strlen(prompt);
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -337,7 +337,7 @@ DFLOWworker(void *T)
 #endif
GDKsetbuf(GDKmalloc(GDKMAXERRLEN)); /* where to leave errors */
if( GDKerrbuf == 0) {
-   CRITICAL(MAL_DATAFLOW, "Could not allocate GDKerrbuf\n");
+   TRC_CRITICAL(MAL_DATAFLOW, "Could not allocate GDKerrbuf\n");
} else {
GDKclrerr();
}
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -294,7 +294,7 @@ mdbInit(void)
 */
mdbTable = GDKzalloc(sizeof(mdbStateRecord) * MAL_MAXCLIENTS);
if (mdbTable == NULL) {
-   CRITICAL(MAL_DEBUGGER, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
+   TRC_CRITICAL(MAL_DEBUGGER, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
return false;
}
return true;
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
@@ -68,7 +68,7 @@ createExceptionInternal(enum malexceptio
/* Leave a message behind in the logging system */
len = snprintf(local, GDKMAXERRLEN, "%s:%s:", 
exceptionNames[type], fcn);
len = vsnprintf(local + len, GDKMAXERRLEN, format, ap);
-   CRITICAL(MAL_EXCEPTION, "%s\n", local);
+   TRC_CRITICAL(MAL_EXCEPTION, "%s\n", local);
return M5OutOfMemory;   /* last resort */
}
len = snprintf(message, GDKMAXERRLEN, "%s:%s:", exceptionNames[type], 
fcn);
diff --git 

MonetDB: gdk_tracer - Renamed macro ERROR to TRC_ERROR

2019-11-27 Thread Thodoris Zois
Changeset: 7ccfbff467dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ccfbff467dc
Modified Files:
gdk/gdk_bat.c
gdk/gdk_posix.c
gdk/gdk_system.c
gdk/gdk_tm.c
gdk/gdk_tracer.h
gdk/gdk_utils.c
monetdb5/mal/mal.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_session.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_mergetable.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/vaults/bam/bam_loader.c
sql/backends/monet5/wlr.c
sql/storage/bat/bat_table.c
sql/storage/store.c
Branch: gdk_tracer
Log Message:

Renamed macro ERROR to TRC_ERROR


diffs (truncated from 1046 to 300 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2114,7 +2114,7 @@ BATmode(BAT *b, bool transient)
 #ifdef NDEBUG
 /* assertions are disabled, turn failing tests into a message */
 #undef assert
-#define assert(test)   ((void) ((test) || ERROR(BAT_, "Assertion `%s' 
failed\n", #test)))
+#define assert(test)   ((void) ((test) || TRC_ERROR(BAT_, "Assertion `%s' 
failed\n", #test)))
 #endif
 
 /* Assert that properties are set correctly.
@@ -2387,13 +2387,13 @@ BATassertProps(BAT *b)
int len;
 
if ((hs = GDKzalloc(sizeof(Hash))) == NULL) {
-   ERROR(BAT_, "Cannot allocate hash table\n");
+   TRC_ERROR(BAT_, "Cannot allocate hash table\n");
goto abort_check;
}
len = snprintf(hs->heap.filename, 
sizeof(hs->heap.filename), "%s.hash%d", nme, THRgettid());
if (len == -1 || len > (int) sizeof(hs->heap.filename)) 
{
GDKfree(hs);
-   ERROR(BAT_, "Heap filename is too large\n");
+   TRC_ERROR(BAT_, "Heap filename is too large\n");
goto abort_check;
}
if (ATOMsize(b->ttype) == 1)
@@ -2407,7 +2407,7 @@ BATassertProps(BAT *b)
HASHnew(hs, b->ttype, BUNlast(b),
mask, BUN_NONE) != GDK_SUCCEED) {
GDKfree(hs);
-   ERROR(BAT_, "Cannot allocate hash table\n");
+   TRC_ERROR(BAT_, "Cannot allocate hash table\n");
goto abort_check;
}
BATloop(b, p, q) {
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -414,7 +414,7 @@ MT_mremap(const char *path, int mode, vo
GDKsyserror("MT_mremap: munmap(%p,%zu) failed\n",
((char *) old_address + *new_size),
old_size - *new_size);
-   ERROR(GDK_POSIX, "MT_mremap(%s,%p,%zu,%zu): munmap() 
failed\n", path?path:"NULL", old_address, old_size, *new_size);
+   TRC_ERROR(GDK_POSIX, "MT_mremap(%s,%p,%zu,%zu): 
munmap() failed\n", path?path:"NULL", old_address, old_size, *new_size);
/* even though the system call failed, we
 * don't need to propagate the error up: the
 * address should still work in the same way
@@ -422,7 +422,7 @@ MT_mremap(const char *path, int mode, vo
return old_address;
}
if (path && truncate(path, *new_size) < 0)
-   ERROR(GDK_POSIX, "MT_mremap(%s): truncate failed\n", 
path);
+   TRC_ERROR(GDK_POSIX, "MT_mremap(%s): truncate 
failed\n", path);
TRC_DEBUG(GDK_POSIX, "MT_mremap(%s,%p,%zu,%zu) -> shrinking\n", 
path?path:"NULL", old_address, old_size, *new_size);
 #endif /* !STATIC_CODE_ANALYSIS */
return old_address;
@@ -438,12 +438,12 @@ MT_mremap(const char *path, int mode, vo
 
if ((fd = open(path, O_RDWR | O_CLOEXEC)) < 0) {
GDKsyserror("MT_mremap: open(%s) failed\n", path);
-   ERROR(GDK_POSIX, "MT_mremap(%s,%p,%zu,%zu): open() 
failed\n", path, old_address, old_size, *new_size);
+   TRC_ERROR(GDK_POSIX, "MT_mremap(%s,%p,%zu,%zu): open() 
failed\n", path, old_address, old_size, *new_size);
return NULL;
}
if 

MonetDB: Nov2019 - On 64 bit systems with 32 bit builds, don't o...

2019-11-27 Thread Sjoerd Mullender
Changeset: 5aa004a42bd3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5aa004a42bd3
Modified Files:
gdk/gdk_utils.c
tools/mserver/mserver5.c
Branch: Nov2019
Log Message:

On 64 bit systems with 32 bit builds, don't overflow memory calculations.


diffs (44 lines):

diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -676,6 +676,11 @@ GDKinit(opt *set, int setlen)
}
 
/* Mserver by default takes 80% of all memory as a default */
+#if SIZEOF_SIZE_T == 4
+   if ((double) MT_npages() * (double) MT_pagesize() * 0.815 >= (double) 
GDK_VM_MAXSIZE)
+   GDK_mem_maxsize = GDK_VM_MAXSIZE;
+   else
+#endif
GDK_mem_maxsize = (size_t) ((double) MT_npages() * (double) 
MT_pagesize() * 0.815);
if (BBPinit() != GDK_SUCCEED)
return GDK_FAIL;
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -121,7 +121,7 @@ usage(char *prog, int xit)
 static void
 monet_hello(void)
 {
-   dbl sz_mem_h;
+   double sz_mem_h;
char  *qc = " kMGTPE";
int qi = 0;
 
@@ -149,14 +149,14 @@ monet_hello(void)
""
 #endif
);
-   sz_mem_h = (dbl) (MT_npages() * MT_pagesize());
+   sz_mem_h = (double) MT_npages() * MT_pagesize();
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
qi++;
}
printf("# Found %.3f %ciB available main-memory",
sz_mem_h, qc[qi]);
-   sz_mem_h = (dbl) GDK_mem_maxsize;
+   sz_mem_h = (double) GDK_mem_maxsize;
qi = 0;
while (sz_mem_h >= 1000.0 && qi < 6) {
sz_mem_h /= 1024.0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Renamed macro INFO to TRC_INFO and replace...

2019-11-27 Thread Thodoris Zois
Changeset: 012c28f2ae0e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=012c28f2ae0e
Modified Files:
gdk/gdk_bat.c
gdk/gdk_imprints.c
gdk/gdk_posix.c
gdk/gdk_tracer.h
gdk/gdk_utils.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_listing.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/wlc.c
monetdb5/scheduler/run_memo.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/vaults/fits/fits.c
sql/backends/monet5/vaults/lidar/lidar.c
sql/backends/monet5/wlr.c
sql/server/sql_atom.c
sql/server/sql_mvc.c
Branch: gdk_tracer
Log Message:

Renamed macro INFO to TRC_INFO and replaced in code


diffs (truncated from 466 to 300 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -449,7 +449,7 @@ BATextend(BAT *b, BUN newcap)
 
theap_size *= Tsize(b);
if (b->theap.base && GDKdebug & HEAPMASK)
-   INFO(BAT_, "HEAPextend in BATextend %s %zu %zu\n", 
b->theap.filename, b->theap.size, theap_size);
+   TRC_INFO(BAT_, "HEAPextend in BATextend %s %zu %zu\n", 
b->theap.filename, b->theap.size, theap_size);
if (b->theap.base &&
HEAPextend(>theap, theap_size, b->batRestricted == BAT_READ) != 
GDK_SUCCEED)
return GDK_FAIL;
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -659,7 +659,7 @@ IMPSremove(BAT *b)
 
if ((GDKdebug & ALGOMASK) &&
* (size_t *) imprints->imprints.base & (1 << 16))
-   DEBUG(GDK_IMPRINTS, "Removing persisted imprints\n");
+   TRC_DEBUG(GDK_IMPRINTS, "Removing persisted 
imprints\n");
if (HEAPdelete(>imprints, BBP_physical(b->batCacheid),
   "timprints") != GDK_SUCCEED)
TRC_DEBUG(IO_, "IMPSremove(%s): imprints heap\n", 
BATgetId(b));
@@ -740,7 +740,7 @@ IMPSprint(BAT *b)
int i;
 
if (!BATcheckimprints(b)) {
-   DEBUG(GDK_IMPRINTS, "No imprint\n");
+   TRC_DEBUG(GDK_IMPRINTS, "No imprint\n");
return;
}
imprints = b->timprints;
@@ -749,33 +749,33 @@ IMPSprint(BAT *b)
max_bins = min_bins + 64;
cnt_bins = max_bins + 64;
 
-   DEBUG(GDK_IMPRINTS,
+   TRC_DEBUG(GDK_IMPRINTS,
"bits = %d, impcnt = " BUNFMT ", dictcnt = " BUNFMT "\n",
imprints->bits, imprints->impcnt, imprints->dictcnt);
-   DEBUG(GDK_IMPRINTS, "MIN\n");
+   TRC_DEBUG(GDK_IMPRINTS, "MIN\n");
for (i = 0; i < imprints->bits; i++) {
-   DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", min_bins[i]);
+   TRC_DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", min_bins[i]);
}

-   DEBUG(GDK_IMPRINTS, "MAX\n");
+   TRC_DEBUG(GDK_IMPRINTS, "MAX\n");
for (i = 0; i < imprints->bits; i++) {
-   DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", max_bins[i]);
+   TRC_DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", max_bins[i]);
}
-   DEBUG(GDK_IMPRINTS, "COUNT\n");
+   TRC_DEBUG(GDK_IMPRINTS, "COUNT\n");
for (i = 0; i < imprints->bits; i++) {
-   DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", cnt_bins[i]);
+   TRC_DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]\n", cnt_bins[i]);
}
for (dcnt = 0, icnt = 0, pages = 1; dcnt < imprints->dictcnt; dcnt++) {
if (d[dcnt].repeat) {
BINSIZE(imprints->bits, IMPSPRNTMASK, " ");
pages += d[dcnt].cnt;
-   DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]r %s\n", pages, s);
+   TRC_DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]r %s\n", pages, 
s);
icnt++;
} else {
l = icnt + d[dcnt].cnt;
for (; icnt < l; icnt++) {
BINSIZE(imprints->bits, IMPSPRNTMASK, " ");
-   DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]  %s\n", 
pages++, s);
+   TRC_DEBUG(GDK_IMPRINTS, "[ " BUNFMT " ]  %s\n", 
pages++, s);
}
}
}
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -383,7 +383,7 @@ MT_munmap(void *p, size_t len)
GDKsyserror("MT_munmap: munmap(%p,%zu) failed\n",
p, len);
VALGRIND_FREELIKE_BLOCK(p, 0);
-   DEBUG(GDK_POSIX, "munmap(%p,%zu) = %d\n", p, len, ret);
+   TRC_DEBUG(GDK_POSIX, "munmap(%p,%zu) = %d\n", p, len, ret);
return ret;
 }
 
@@ -423,13 +423,13 @@ MT_mremap(const char *path, int mode, vo
}
if (path && 

MonetDB: gdk_tracer - Rename DEBUG - previous commit

2019-11-27 Thread Thodoris Zois
Changeset: dfcbc44b927b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfcbc44b927b
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Rename DEBUG - previous commit


diffs (12 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -234,7 +234,7 @@ extern LOG_LEVEL LVL_PER_COMPONENT[COMPO
 #define INFO(COMP, MSG, ...) \
 GDK_TRACER_LOG(M_INFO, COMP, MSG, ## __VA_ARGS__)\
 
-#define DEBUG(COMP, MSG, ...)\
+#define TRC_DEBUG(COMP, MSG, ...)\
 GDK_TRACER_LOG(M_DEBUG, COMP, MSG, ## __VA_ARGS__)   \
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Renamed macro DEBUG to TRC_DEBUG - conflic...

2019-11-27 Thread Thodoris Zois
Changeset: f2f2acafe77d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2f2acafe77d
Modified Files:
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_cand.c
gdk/gdk_cross.c
gdk/gdk_delta.c
gdk/gdk_delta.h
gdk/gdk_group.c
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_posix.c
gdk/gdk_private.h
gdk/gdk_project.c
gdk/gdk_sample.c
gdk/gdk_select.c
gdk/gdk_storage.c
gdk/gdk_string.c
gdk/gdk_system.c
gdk/gdk_system.h
gdk/gdk_unique.c
gdk/gdk_utils.c
geom/monetdb5/geom.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_factory.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_resolve.c
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_session.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/oltp.c
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_json.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_oltp.c
monetdb5/optimizer/opt_postfix.c
monetdb5/optimizer/opt_profiler.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c
monetdb5/optimizer/opt_reduce.c
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_volcano.c
monetdb5/optimizer/opt_wlc.c
monetdb5/scheduler/run_memo.c
monetdb5/scheduler/run_pipeline.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_orderidx.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statistics.c
sql/backends/monet5/sql_user.c
sql/backends/monet5/vaults/bam/bam_loader.c
sql/backends/monet5/vaults/bam/bam_wrapper.c
sql/backends/monet5/vaults/fits/fits.c
sql/backends/monet5/vaults/lidar/lidar.c
sql/backends/monet5/wlr.c
sql/include/sql_mem.h
sql/server/rel_optimizer.c
sql/server/sql_atom.c
sql/server/sql_mvc.c
sql/server/sql_privileges.c
sql/server/sql_symbol.c
sql/storage/store.c
Branch: gdk_tracer
Log Message:

Renamed macro DEBUG to TRC_DEBUG - conflicts with other libs


diffs (truncated from 6726 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1960,7 +1960,7 @@ gdk_export str GDKstrndup(const char *s,
({  \
size_t _size = (s); \
void *_res = GDKmalloc(_size);  \
-   DEBUG(ALLOC, "GDKmalloc(%zu) -> %p\n",  \
+   TRC_DEBUG(ALLOC, "GDKmalloc(%zu) -> %p\n",  \
_size, _res);   \
_res;   \
})
@@ -1968,7 +1968,7 @@ gdk_export str GDKstrndup(const char *s,
({  \
size_t _size = (s); \
void *_res = GDKzalloc(_size);  \
-   DEBUG(ALLOC, "GDKzalloc(%zu) -> %p\n",  \
+   TRC_DEBUG(ALLOC, "GDKzalloc(%zu) -> %p\n",  \
_size, _res);   \
_res;   \
})
@@ -1977,7 +1977,7 @@ gdk_export str GDKstrndup(const char *s,
void *_ptr = 

MonetDB: Nov2019 - between null and null with bugs

2019-11-27 Thread Pedro Ferreira
Changeset: f7e6ba6f02c2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f7e6ba6f02c2
Modified Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
Branch: Nov2019
Log Message:

between null and null with bugs


diffs (12 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.sql
@@ -10,4 +10,8 @@ SELECT CAST(SUM(col0) AS BIGINT) FROM ta
 SELECT CAST(SUM(col0) AS BIGINT) FROM tab0 WHERE + + col0 NOT BETWEEN NULL AND 
+ col2;
 SELECT DISTINCT COUNT(*) FROM tab0 WHERE NOT col2 NOT BETWEEN ( 35 ) AND ( 
NULL );
 SELECT CAST(- COUNT(*) * - - 61 + + + ( + COUNT(*) ) AS BIGINT) FROM tab0 
WHERE NOT col0 + + 10 BETWEEN NULL AND NULL;
+
+SELECT ALL * FROM tab0 AS cor0 WHERE col2 BETWEEN NULL AND NULL; --empty
+SELECT COUNT ( * ) FROM tab0 WHERE NOT col1 NOT BETWEEN NULL AND NULL; --0
+SELECT - 78 * + MAX ( DISTINCT col2 ) + - 52 AS col1 FROM tab0 AS cor0 WHERE 
NOT - col0 + col2 NOT BETWEEN ( NULL ) AND NULL; --NULL
 DROP TABLE tab0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - No hugeint in the output

2019-11-27 Thread Pedro Ferreira
Changeset: 7683c7c78e96 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7683c7c78e96
Modified Files:
sql/test/analytics/Tests/analytics13.sql
sql/test/analytics/Tests/analytics13.stable.out
Branch: default
Log Message:

No hugeint in the output


diffs (33 lines):

diff --git a/sql/test/analytics/Tests/analytics13.sql 
b/sql/test/analytics/Tests/analytics13.sql
--- a/sql/test/analytics/Tests/analytics13.sql
+++ b/sql/test/analytics/Tests/analytics13.sql
@@ -141,12 +141,12 @@ SELECT
 EXISTS (SELECT col2 FROM tbl_ProductSales WHERE tbl_ProductSales.ColID = 
another_T.col1) a6,
 col1 + col5 = (SELECT MIN(ColID) FROM tbl_ProductSales) a7,
 CAST(SUM(DISTINCT CASE WHEN col5 - col8 = (SELECT MIN(ColID / col2) FROM 
tbl_ProductSales) THEN col2 - 5 ELSE ABS(col1) END) AS BIGINT) a8,
-(SELECT MAX(ColID + col2) FROM tbl_ProductSales) * DENSE_RANK() OVER 
(PARTITION BY AVG(DISTINCT col5)) a9,
+CAST((SELECT MAX(ColID + col2) FROM tbl_ProductSales) * DENSE_RANK() OVER 
(PARTITION BY AVG(DISTINCT col5)) AS BIGINT) a9,
 GROUPING(col1, col5, col8) * MIN(col8) OVER (PARTITION BY col5 ORDER BY 
col1 NULLS LAST ROWS UNBOUNDED PRECEDING) a10,
 MAX(col3) / 10 + GROUPING(col1, col5, col2) * 10 a11,
 GROUP_CONCAT(CAST(col4 AS VARCHAR(32)), '-sep-') || ' plus ' || 
GROUPING(col1) a12,
 FIRST_VALUE(col1) OVER (ORDER BY col8 DESC NULLS FIRST) a13,
-col2 * NULL a14
+CAST(col2 * NULL AS BIGINT) a14
 FROM another_T
 GROUP BY CUBE(col1, col2, col5, col8), GROUPING SETS (())
 ORDER BY 
diff --git a/sql/test/analytics/Tests/analytics13.stable.out 
b/sql/test/analytics/Tests/analytics13.stable.out
--- a/sql/test/analytics/Tests/analytics13.stable.out
+++ b/sql/test/analytics/Tests/analytics13.stable.out
@@ -506,9 +506,9 @@ stdout of test 'analytics13` in director
 #col5 = ALL (SELECT 1 FROM tbl_ProductSales HAVING MIN(col8) IS NULL) a5,
 #EXISTS (SELECT col2 FROM tbl_ProductSales WHERE tbl_ProductSales.ColID = 
another_T.col1) a6,
 #col1 + col5 = (SELECT MIN(ColID) FROM tbl_ProductSales) a7,
-% .%1, .%60,   .,  .,  .,  .,  .,  .%13,   .,  .,  
.,  .,  .,  . # table_name
+% .%1, .%62,   .,  .,  .,  .,  .,  .%13,   .,  .,  
.,  .,  .,  . # table_name
 % a1,  a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11,a12,a13,a14 # name
-% tinyint, boolean,boolean,int,boolean,
boolean,boolean,bigint, hugeint,bigint, bigint, 
varchar,int,hugeint # type
+% tinyint, boolean,boolean,int,boolean,
boolean,boolean,bigint, bigint, bigint, bigint, varchar,
int,bigint # type
 % 2,   5,  5,  4,  5,  5,  5,  4,  4,  5,  
3,  32, 3,  1 # length
 [ 0,   false,  true,   ,   true,   false,  false,  ,   2226,   0,  
333," plus 0",  111,NULL]
 [ 0,   false,  true,   NULL,   true,   true,   false,  1,  6,  0,  
0,  "4 plus 0", 111,NULL]
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Nov2019

2019-11-27 Thread Pedro Ferreira
Changeset: b8a00fcd2d1b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8a00fcd2d1b
Added Files:
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
Modified Files:
sql/server/rel_optimizer.c
sql/test/BugTracker-2019/Tests/All
Branch: default
Log Message:

Merge with Nov2019


diffs (243 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
@@ -2493,9 +2493,7 @@ rel_distinct_aggregate_on_unique_values(
for (node *m = ((list*)exp->l)->h; m && 
all_unique; m = m->next) {
sql_exp *arg = (sql_exp*) m->data;
 
-   if (arg->card == CARD_ATOM) /* 
constants are always unique */
-   continue;
-   else if (arg->type == e_column) {
+   if (arg->type == e_column) {
fcmp cmp = (fcmp)_column_cmp;
sql_column *c = 
exp_find_column(rel, arg, -2);
 
@@ -7463,7 +7461,7 @@ rel_simplify_predicates(int *changes, mv
if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
rel->exps && rel->card > CARD_ATOM) {
node *n;
list *exps = sa_list(sql->sa);
-   
+
for (n = rel->exps->h; n; n = n->next) {
sql_exp *e = n->data;
 
@@ -7491,7 +7489,7 @@ rel_simplify_predicates(int *changes, mv
 
if (l->type == e_func) {
sql_subfunc *f = l->f;
-   
+
/* rewrite isnull(x) = TRUE/FALSE => x 
=/<> NULL */
if (is_select(rel->op) && !f->func->s 
&& !strcmp(f->func->base.name, "isnull") && 
 is_atom(r->type) && r->l) { /* 
direct literal */
diff --git a/sql/test/BugTracker-2019/Tests/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -48,3 +48,4 @@ rank-nan.Bug-6780
 index-insert-crash.Bug-6781
 avg-changes-value-scale.Bug-6783
 isaUUID.Bug-6784
+count-distinct.Bug-6790
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
@@ -0,0 +1,19 @@
+START TRANSACTION;
+CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+CREATE TABLE tab2(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+INSERT INTO tab0 VALUES (97,1,99), (15,81,47),(87,21,10);
+INSERT INTO tab1 VALUES (51,14,96), (85,5,59), (91,47,68);
+INSERT INTO tab2 VALUES (64,77,40), (75,67,58),(46,51,23);
+
+SELECT COUNT ( DISTINCT + 45 ) AS col2 FROM tab0;
+SELECT DISTINCT CAST( - SUM ( DISTINCT 10 ) AS BIGINT) AS col1 FROM tab2;
+SELECT DISTINCT CAST(49 * + 78 + + COUNT ( DISTINCT + 5 ) AS BIGINT) AS col0 
FROM tab1 AS cor0;
+SELECT CAST(72 + - + COUNT ( * ) - - - COUNT ( DISTINCT + ( - 2 ) ) * + + 57 
AS BIGINT) FROM tab2;
+SELECT DISTINCT - 37, - COUNT ( DISTINCT - + 96 ) col1 FROM tab2;
+
+SELECT DISTINCT + ( CAST ( NULL AS INTEGER ) ) AS col0, col0 FROM tab0;
+SELECT DISTINCT CAST ( NULL AS INTEGER ) - - 95 AS col1, CAST(col2 * + + col1 
AS BIGINT) AS col1 FROM tab2 AS cor0;
+SELECT DISTINCT + 14 AS col2, + col0 - - CAST ( NULL AS INTEGER ) AS col2 FROM 
tab2 AS cor0;
+SELECT DISTINCT col1, + col0 col1 FROM tab1;
+ROLLBACK;
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'count-distinct.Bug-6790` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 10:33:38 >  
+# 10:33:38 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30367" "--set" 
"mapi_usock=/var/tmp/mtest-125811/.s.monetdb.30367" "--forcemito" 
"--dbpath=/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 10:33:38 >  
+
+# builtin opt  gdk_dbpath = 
/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 5
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  

MonetDB: Nov2019 - Backported changeset 93e6f1786a8b into Nov2019

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

Backported changeset 93e6f1786a8b into Nov2019


diffs (24 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
@@ -7454,7 +7454,7 @@ rel_simplify_predicates(int *changes, mv
if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
rel->exps) {
node *n;
list *exps = sa_list(sql->sa);
-   
+
for (n = rel->exps->h; n; n = n->next) {
sql_exp *e = n->data;
 
@@ -7482,9 +7482,9 @@ rel_simplify_predicates(int *changes, mv
 
if (l->type == e_func) {
sql_subfunc *f = l->f;
-   
+
/* rewrite isnull(x) = TRUE/FALSE => x 
=/<> NULL */
-   if (!f->func->s && 
!strcmp(f->func->base.name, "isnull") && 
+   if (is_select(rel->op) && !f->func->s 
&& !strcmp(f->func->base.name, "isnull") && 
 is_atom(r->type) && r->l) { /* 
direct literal */
atom *a = r->l;
int flag = a->data.val.bval;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Nov2019 - Fix for bug 6790. At rel_distinct_aggregate_o...

2019-11-27 Thread Pedro Ferreira
Changeset: f389a425dd85 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f389a425dd85
Modified Files:
sql/server/rel_optimizer.c
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
Branch: Nov2019
Log Message:

Fix for bug 6790. At rel_distinct_aggregate_on_unique_values optimizer, ignore 
constants because on a column projection they won't be distinct anymore


diffs (51 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
@@ -2492,9 +2492,7 @@ rel_distinct_aggregate_on_unique_values(
for (node *m = ((list*)exp->l)->h; m && 
all_unique; m = m->next) {
sql_exp *arg = (sql_exp*) m->data;
 
-   if (arg->card == CARD_ATOM) /* 
constants are always unique */
-   continue;
-   else if (arg->type == e_column) {
+   if (arg->type == e_column) {
fcmp cmp = (fcmp)_column_cmp;
sql_column *c = 
exp_find_column(rel, arg, -2);
 
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
--- a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
@@ -78,13 +78,13 @@ stdout of test 'count-distinct.Bug-6790`
 % 1 # length
 [ 1]
 #SELECT DISTINCT CAST( - SUM ( DISTINCT 10 ) AS BIGINT) AS col1 FROM tab2;
-% .L3 # table_name
+% .L4 # table_name
 % col1 # name
 % bigint # type
 % 3 # length
 [ -10  ]
 #SELECT DISTINCT CAST(49 * + 78 + + COUNT ( DISTINCT + 5 ) AS BIGINT) AS col0 
FROM tab1 AS cor0;
-% .L3 # table_name
+% .L4 # table_name
 % col0 # name
 % bigint # type
 % 4 # length
@@ -93,7 +93,7 @@ stdout of test 'count-distinct.Bug-6790`
 % .L4 # table_name
 % L4 # name
 % bigint # type
-% 4 # length
+% 2 # length
 [ 12   ]
 #SELECT DISTINCT - 37, - COUNT ( DISTINCT - + 96 ) col1 FROM tab2;
 % .L1, .L4 # table_name
@@ -110,7 +110,7 @@ stdout of test 'count-distinct.Bug-6790`
 [ NULL,15  ]
 [ NULL,87  ]
 #SELECT DISTINCT CAST ( NULL AS INTEGER ) - - 95 AS col1, CAST(col2 * + + col1 
AS BIGINT) AS col1 FROM tab2 AS cor0;
-% .L2, sys.L3 # table_name
+% .L2, sys.L4 # table_name
 % col1,col1 # name
 % bigint,  bigint # type
 % 1,   4 # length
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Nov2019 - Added test for bug 6790

2019-11-27 Thread Pedro Ferreira
Changeset: 6ad525e8e28a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6ad525e8e28a
Added Files:
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
Modified Files:
sql/test/BugTracker-2019/Tests/All
Branch: Nov2019
Log Message:

Added test for bug 6790


diffs (211 lines):

diff --git a/sql/test/BugTracker-2019/Tests/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -48,3 +48,4 @@ rank-nan.Bug-6780
 index-insert-crash.Bug-6781
 avg-changes-value-scale.Bug-6783
 isaUUID.Bug-6784
+count-distinct.Bug-6790
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.sql
@@ -0,0 +1,19 @@
+START TRANSACTION;
+CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+CREATE TABLE tab2(col0 INTEGER, col1 INTEGER, col2 INTEGER);
+INSERT INTO tab0 VALUES (97,1,99), (15,81,47),(87,21,10);
+INSERT INTO tab1 VALUES (51,14,96), (85,5,59), (91,47,68);
+INSERT INTO tab2 VALUES (64,77,40), (75,67,58),(46,51,23);
+
+SELECT COUNT ( DISTINCT + 45 ) AS col2 FROM tab0;
+SELECT DISTINCT CAST( - SUM ( DISTINCT 10 ) AS BIGINT) AS col1 FROM tab2;
+SELECT DISTINCT CAST(49 * + 78 + + COUNT ( DISTINCT + 5 ) AS BIGINT) AS col0 
FROM tab1 AS cor0;
+SELECT CAST(72 + - + COUNT ( * ) - - - COUNT ( DISTINCT + ( - 2 ) ) * + + 57 
AS BIGINT) FROM tab2;
+SELECT DISTINCT - 37, - COUNT ( DISTINCT - + 96 ) col1 FROM tab2;
+
+SELECT DISTINCT + ( CAST ( NULL AS INTEGER ) ) AS col0, col0 FROM tab0;
+SELECT DISTINCT CAST ( NULL AS INTEGER ) - - 95 AS col1, CAST(col2 * + + col1 
AS BIGINT) AS col1 FROM tab2 AS cor0;
+SELECT DISTINCT + 14 AS col2, + col0 - - CAST ( NULL AS INTEGER ) AS col2 FROM 
tab2 AS cor0;
+SELECT DISTINCT col1, + col0 col1 FROM tab1;
+ROLLBACK;
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'count-distinct.Bug-6790` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 10:33:38 >  
+# 10:33:38 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30367" "--set" 
"mapi_usock=/var/tmp/mtest-125811/.s.monetdb.30367" "--forcemito" 
"--dbpath=/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 10:33:38 >  
+
+# builtin opt  gdk_dbpath = 
/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 5
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 30367
+# cmdline opt  mapi_usock = /var/tmp/mtest-125811/.s.monetdb.30367
+# cmdline opt  gdk_dbpath = 
/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2019
+# cmdline opt  embedded_c = true
+
+# 10:33:39 >  
+# 10:33:39 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-125811" "--port=30367"
+# 10:33:39 >  
+
+
+# 10:33:39 >  
+# 10:33:39 >  "Done."
+# 10:33:39 >  
+
diff --git a/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out 
b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
@@ -0,0 +1,139 @@
+stdout of test 'count-distinct.Bug-6790` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 10:33:38 >  
+# 10:33:38 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30367" "--set" 
"mapi_usock=/var/tmp/mtest-125811/.s.monetdb.30367" "--forcemito" 
"--dbpath=/home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 10:33:38 >  
+
+# MonetDB 5 server v11.35.2 (hg id: ccacebde5b21)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2019', using 8 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 15.504 GiB available main-memory of which we use 12.635 GiB
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on 

MonetDB: default - Updated ChangeLog

2019-11-27 Thread Pedro Ferreira
Changeset: fc8a04a82937 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc8a04a82937
Modified Files:
sql/ChangeLog
Branch: default
Log Message:

Updated ChangeLog


diffs (18 lines):

diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Nov 27 2019 Pedro Ferreira 
+- Implemented ROLLUP, CUBE and GROUPING SETS from SQL:1999. They define
+  grouping subsets used at GROUP BY clause in order to compute partial
+  groupings. At the same time, the GROUPING aggregate was added. This
+  aggregate is a bitmask identifying the grouping columns not present
+  in the generated grouping row when used with the operators described
+  above.
+
 * Tue Nov 19 2019 Pedro Ferreira 
 - Updated user session procedures by adding te possibility to set properties
   based on a session identifier. The optimizer pipeline, number of worker
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Test approval and fixed identation

2019-11-27 Thread Pedro Ferreira
Changeset: f31f83a403df for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f31f83a403df
Modified Files:
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Test approval and fixed identation


diffs (truncated from 413 to 300 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
@@ -2916,7 +2916,7 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e
}
if (l && r) 
return exp_binop(sql->sa, l, r, f);
-   
+
/* reset error */
sql->session->status = 0;
sql->errstr[0] = '\0';
@@ -2955,7 +2955,7 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e
 
l = ol;
r = or;
-   }
+   }
}
/* try finding function based on both arguments */
if (rel_convert_types(sql, rel, rel, , , 1/*fix scale*/, 
type_equal) >= 0){
@@ -3406,7 +3406,7 @@ static sql_exp *
if (list_length(exps) != 2 || (!EC_NUMBER(t1->type->eclass) || 
!a || is_group_concat || subtype_cmp(

&((sql_arg*)a->aggr->ops->h->data)->type,

&((sql_arg*)a->aggr->ops->h->next->data)->type) != 0) )  {
-   if(!a && is_group_concat) {
+   if (!a && is_group_concat) {
sql_subtype *tstr = sql_bind_localtype("str");
list *sargs = sa_list(sql->sa);
if (list_length(exps) >= 1)
@@ -3947,7 +3947,7 @@ rel_groupings(sql_query *query, sql_rel 
list *exps = new_exp_list(sql->sa);
 
if (THRhighwater())
-   return sql_error(sql, 10, SQLSTATE(42000) "SELECT: too many 
nested grouping clauses");
+   return sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
 
for (dnode *o = groupby->data.lval->h; o; o = o->next) {
symbol *grouping = o->data.sym;
@@ -4258,7 +4258,7 @@ rel_order_by(sql_query *query, sql_rel *
 static int
 generate_window_bound(tokens sql_token, bool first_half)
 {
-   switch(sql_token) {
+   switch (sql_token) {
case SQL_PRECEDING:
return first_half ? BOUND_FIRST_HALF_PRECEDING : 
BOUND_SECOND_HALF_PRECEDING;
case SQL_FOLLOWING:
@@ -4280,7 +4280,7 @@ generate_window_bound_call(mvc *sql, sql
sql_subfunc *dc1, *dc2;
sql_subtype *it = sql_bind_localtype("int");
 
-   if(pe) {
+   if (pe) {
append(targs1, exp_subtype(pe));
append(targs2, exp_subtype(pe));
append(rargs1, exp_copy(sql, pe));
@@ -4325,18 +4325,18 @@ calculate_window_bound(sql_query *query,
sql_class bclass = EC_ANY;
sql_exp *res = NULL;
 
-   if((bound->token == SQL_PRECEDING || bound->token == SQL_FOLLOWING || 
bound->token == SQL_CURRENT_ROW) && bound->type == type_int) {
+   if ((bound->token == SQL_PRECEDING || bound->token == SQL_FOLLOWING || 
bound->token == SQL_CURRENT_ROW) && bound->type == type_int) {
atom *a = NULL;
bt = (frame_type == FRAME_ROWS || frame_type == FRAME_GROUPS) ? 
lon : exp_subtype(ie);
bclass = bt->type->eclass;
 
-   if((bound->data.i_val == UNBOUNDED_PRECEDING_BOUND || 
bound->data.i_val == UNBOUNDED_FOLLOWING_BOUND)) {
-   if(EC_NUMBER(bclass))
+   if ((bound->data.i_val == UNBOUNDED_PRECEDING_BOUND || 
bound->data.i_val == UNBOUNDED_FOLLOWING_BOUND)) {
+   if (EC_NUMBER(bclass))
a = atom_general(sql->sa, bt, NULL);
else
a = atom_general(sql->sa, it, NULL);
-   } else if(bound->data.i_val == CURRENT_ROW_BOUND) {
-   if(EC_NUMBER(bclass))
+   } else if (bound->data.i_val == CURRENT_ROW_BOUND) {
+   if (EC_NUMBER(bclass))
a = atom_zero_value(sql->sa, bt);
else
a = atom_zero_value(sql->sa, it);
@@ -4358,32 +4358,32 @@ calculate_window_bound(sql_query *query,
return sql_error(sql, 02, SQLSTATE(42000) "%s offset 
must not be NULL", bound_desc);
}
res = rel_value_exp2(query, , bound, f, ek, _last);
-   if(!res)
+   if (!res)
return NULL;

MonetDB: grouping-analytics - Closing grouping-analytics branch ...

2019-11-27 Thread Pedro Ferreira
Changeset: 85ff2bb38788 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=85ff2bb38788
Branch: grouping-analytics
Log Message:

Closing grouping-analytics branch after merge into default

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


MonetDB: default - Merged grouping-analytics into default

2019-11-27 Thread Pedro Ferreira
Changeset: 4e9936cc28ab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4e9936cc28ab
Added Files:
sql/test/analytics/Tests/analytics10.sql
sql/test/analytics/Tests/analytics10.stable.err
sql/test/analytics/Tests/analytics10.stable.out
sql/test/analytics/Tests/analytics11.sql
sql/test/analytics/Tests/analytics11.stable.err
sql/test/analytics/Tests/analytics11.stable.out
sql/test/analytics/Tests/analytics12.sql
sql/test/analytics/Tests/analytics12.stable.err
sql/test/analytics/Tests/analytics12.stable.out
sql/test/analytics/Tests/analytics13.sql
sql/test/analytics/Tests/analytics13.stable.err
sql/test/analytics/Tests/analytics13.stable.out
Modified Files:
clients/mapiclient/mhelp.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/common/sql_list.c
sql/common/sql_types.c
sql/common/sql_types.h
sql/include/sql_list.h
sql/include/sql_relation.h
sql/scripts/51_sys_schema_extension.sql
sql/server/Makefile.ag
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_prop.c
sql/server/rel_prop.h
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
sql/server/sql_atom.c
sql/server/sql_atom.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_parser.y
sql/server/sql_partition.c
sql/server/sql_scan.c
sql/server/sql_semantic.c
sql/server/sql_tokens.h
sql/test/analytics/Tests/All
sql/test/sys-schema/Tests/check_AlternateKey_uniqueness.stable.out
sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out
sql/test/sys-schema/Tests/check_Not_Nullable_columns.stable.out
sql/test/sys-schema/Tests/check_PrimaryKey_uniqueness.stable.out
sql/test/sys-schema/Tests/geom_tables_checks.stable.out
sql/test/sys-schema/Tests/netcdf_tables_checks.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Merged grouping-analytics into default


diffs (truncated from 4585 to 300 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -434,14 +434,14 @@ SQLhelp sqlhelp1[] = {
 "[ FROM from_item [',' ...] ]\n"
 "[ WINDOW window_definition [',' ...] ]\n"
 "[ WHERE condition ]\n"
-"[ GROUP BY expression [',' ...] ]\n"
+"[ GROUP BY group_by_element [',' ...] ]\n"
 "[ HAVING condition [',' ...] ]\n"
 "[ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] [ CORRESPONDING ] 
select ]\n"
 "[ ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [',' 
...] ]\n"
 "[ LIMIT { count | param } ]\n"
 "[ OFFSET { count | param } ]\n"
 "[ SAMPLE size [ SEED size ] ]",
-"cte_list,expression,window_definition",
+"cte_list,expression,group_by_element,window_definition",
 "See also 
https://www.monetdb.org/Documentation/SQLreference/TableExpressions"},
{"SET",
 "Assign a value to a variable or column",
@@ -630,6 +630,12 @@ SQLhelp sqlhelp2[] = {
 "{ PUBLIC | authid } ",
 "authid",
 NULL},
+   {"group_by_element",
+NULL,
+"{ expression | '(' ')' | ROLLUP '(' ident [',' ... ] ')' | CUBE '(' 
ident [',' ... ] ')'\n"
+"| GROUPING SETS '(' group_by_element [',' ... ] ')' }",
+"expression",
+NULL},
{"headerlist",
 NULL,
 "'(' { ident [string] } [',' ...] ')'",
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
@@ -3306,7 +3306,9 @@ sql_parse(backend *be, sql_allocator *sa
sql_query *query = query_create(m);
sql_rel *r = rel_semantic(query, m->sym);
 
-   if (r && (r = rel_unnest(m,r)) != NULL && (r = rel_optimizer(m, 
r, 1)) != NULL)
+   if (r)
+   r = sql_processrelation(m, r, 1);
+   if (r)
sq = rel_bin(be, r);
}
 
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
@@ -114,23 +114,21 @@ rel_need_distinct_query(sql_rel *rel)
 }
 
 sql_rel *
-sql_symbol2relation(mvc *c, symbol *sym)
+sql_symbol2relation(mvc *sql, symbol *sym)
 {
-   sql_rel *r;
-