MonetDB: string_imprints - Merge with default

2021-08-31 Thread Panagiotis Koutsourakis
Changeset: 8d90a78cdb68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8d90a78cdb68
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_private.h
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
sql/backends/monet5/sql.c
sql/scripts/CMakeLists.txt
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 32345 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -527,7 +527,6 @@ exit 0
 %{_libdir}/monetdb5/lib_capi.so
 %endif
 %{_libdir}/monetdb5/lib_generator.so
-%{_libdir}/monetdb5/lib_udf.so
 %doc %{_mandir}/man1/mserver5.1.gz
 %dir %{_datadir}/doc/MonetDB
 %docdir %{_datadir}/doc/MonetDB
@@ -832,6 +831,7 @@ rm -f %{buildroot}%{_libdir}/monetdb5/ru
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_run_*.so
 rm -f %{buildroot}%{_libdir}/monetdb5/microbenchmark.mal
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_microbenchmark*.so
+rm -f %{buildroot}%{_libdir}/monetdb5/lib_udf*.so
 rm -f %{buildroot}%{_bindir}/monetdb_mtest.sh
 rm -rf %{buildroot}%{_datadir}/monetdb # /cmake
 
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -191,9 +191,9 @@ def main():
 print(r'')
 print(r'  ')
 id = comp(features, id, 16,
-  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.dll') and ('geom' not in x) and ('pyapi' not 
in x) and ('opt_sql_append' not in x) and ('run_' not in x) and 
('microbenchmark' not in x), os.listdir(os.path.join(sys.argv[3], 'lib', 
'monetdb5'])
+  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.dll') and ('geom' not in x) and ('pyapi' not 
in x) and ('opt_sql_append' not in x) and ('run_' not in x) and 
('microbenchmark' not in x) and ('udf' not in x), 
os.listdir(os.path.join(sys.argv[3], 'lib', 'monetdb5'])
 id = comp(debug, id, 16,
-  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.pdb') and ('geom' not in x) and 
('opt_sql_append' not in x) and ('run_' not in x) and ('microbenchmark' not in 
x), os.listdir(os.path.join(sys.argv[3], 'lib', 'monetdb5'])
+  [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and x.endswith('.pdb') and ('geom' not in x) and 
('opt_sql_append' not in x) and ('run_' not in x) and ('microbenchmark' not in 
x) and ('udf' not in x), os.listdir(os.path.join(sys.argv[3], 'lib', 
'monetdb5'])
 id = comp(geom, id, 16,
   [r'lib\monetdb5\{}'.format(x) for x in sorted(filter(lambda x: 
x.startswith('_') and (x.endswith('.dll') or x.endswith('.pdb')) and ('geom' in 
x), os.listdir(os.path.join(sys.argv[3], 'lib', 'monetdb5'])
 id = comp(pyapi3, id, 16,
diff --git a/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
@@ -1,697 +1,694 @@
-stdout of test 'MAL-signatures` in directory 'clients` itself:
-
-#select * from sys.malfunctions() order by module, "function", address, 
signature, comment;
 % .%1, .%1,.%1,.%1,.%1 # table_name
 % module,  function,   signature,  address,comment # name
 % clob,clob,   clob,   clob,   clob # type
-% 12,  28, 313,42, 0 # length
-[ "aggr",  "all",  "command aggr.all(X_0:bat[:any_1]):any_1 ", 
"SQLall;",  ""  ]
-[ "aggr",  "allnotequal",  "pattern aggr.allnotequal(X_0:bat[:any_1], 
X_1:bat[:any_1]):bit ",  "SQLallnotequal;",  ""  ]
+% 12,  28, 313,42, 860 # length
+[ "aggr",  "all",  "command aggr.all(X_0:bat[:any_1]):any_1 ", 
"SQLall;",  "if all values in b are equal return this, else nil"]
+[ "aggr",  "allnotequal",  "pattern aggr.allnotequal(X_0:bat[:any_1], 
X_1:bat[:any_1]):bit ",  "SQLallnotequal;",  "if all values in r are 
not equal to l return true, else if r has nil nil else false"   ]
 [ "aggr",  "anyequal", "pattern aggr.anyequal(X_0:any_1, 
X_1:any_1):bit ", "CMDvarEQ;",""  ]
-[ "aggr",  "anyequal", "pattern aggr.anyequal(X_0:bat[:any_1], 
X_1:bat[:any_1]):bit ", "SQLanyequal;", ""  ]
-[ "aggr",  "avg",  "command aggr.avg(X_0:bat[:bte], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:dbl] ",   "AGGRavg13_dbl;",   ""  ]
-[ "aggr",  "avg",  "command aggr.avg(X_0:bat[:dbl], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:dbl] ",   "AGGRavg13_dbl;",   ""  ]
-[ "aggr",  "avg",  "command aggr.avg(X_0:bat[:flt], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:dbl] ",   "AGGRavg13_dbl;",   ""  ]
-[ "aggr",  "avg",  "command aggr.avg(X_0:bat[:int], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:dbl] ",   "AGGRavg13_dbl;",   ""  ]
-[ "aggr",  "avg",  "command aggr.avg(X_0:bat[:ln

MonetDB: string_imprints - Merge with default

2021-09-06 Thread Panagiotis Koutsourakis
Changeset: f70db48d5bd9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f70db48d5bd9
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_strimps.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.c
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 8029 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9110,6 +9110,8 @@
 [ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",  
"", ""  ]
 [ "optimizer", "wlc",  "pattern optimizer.wlc():str ", "OPTwrapper;",  ""  
]
 [ "optimizer", "wlc",  "pattern optimizer.wlc(X_0:str, X_1:str):str ", 
"OPTwrapper;",  "Inject the workload capture-replay primitives" ]
+[ "optimizer", "wrapper",  "pattern optimizer.wrapper():str ", 
"OPTwrapper;",  ""  ]
+[ "optimizer", "wrapper",  "pattern optimizer.wrapper(X_0:str, 
X_1:str):str ", "OPTwrapper;",  "Fake optimizer"]
 [ "pcre",  "imatch",   "command pcre.imatch(X_0:str, X_1:str):bit ",   
"PCREimatch;",  "Caseless Perl Compatible Regular Expression pattern matching 
against a string" ]
 [ "pcre",  "index","command pcre.index(X_0:pcre, X_1:str):int ",   
"PCREindex;",   "match a pattern, return matched position (or 0 when not 
found)"]
 [ "pcre",  "match","command pcre.match(X_0:str, X_1:str):bit ",
"PCREmatch;",   "Perl Compatible Regular Expression pattern matching against a 
string"  ]
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
@@ -12410,6 +12410,8 @@
 [ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",  
"", ""  ]
 [ "optimizer", "wlc",  "pattern optimizer.wlc():str ", "OPTwrapper;",  ""  
]
 [ "optimizer", "wlc",  "pattern optimizer.wlc(X_0:str, X_1:str):str ", 
"OPTwrapper;",  "Inject the workload capture-replay primitives" ]
+[ "optimizer", "wrapper",  "pattern optimizer.wrapper():str ", 
"OPTwrapper;",  ""  ]
+[ "optimizer", "wrapper",  "pattern optimizer.wrapper(X_0:str, 
X_1:str):str ", "OPTwrapper;",  "Fake optimizer"]
 [ "pcre",  "imatch",   "command pcre.imatch(X_0:str, X_1:str):bit ",   
"PCREimatch;",  "Caseless Perl Compatible Regular Expression pattern matching 
against a string" ]
 [ "pcre",  "index","command pcre.index(X_0:pcre, X_1:str):int ",   
"PCREindex;",   "match a pattern, return matched position (or 0 when not 
found)"]
 [ "pcre",  "match","command pcre.match(X_0:str, X_1:str):bit ",
"PCREmatch;",   "Perl Compatible Regular Expression pattern matching against a 
string"  ]
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
@@ -773,7 +773,8 @@ void MPresetProfiler(stream *fdout);
 char *MSP_locate_sqlscript(const char *mod_name, bit recurse);
 str MSinitClientPrg(Client cntxt, const char *mod, const char *nme);
 void MSresetInstructions(MalBlkPtr mb, int start);
-void MSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start);
+void MSresetStack(Client cntxt, MalBlkPtr mb, MalStkPtr glb);
+void MSresetVariables(MalBlkPtr mb);
 void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout, 
protocol_version protocol, size_t blocksize);
 str MSserveClient(Client cntxt);
 str OIDXcreateImplementation(Client cntxt, int tpe, BAT *b, int pieces);
@@ -1137,6 +1138,7 @@ const char *mdbRef;
 void mdbSetBreakRequest(Client cntxt, MalBlkPtr mb, str request, char cmd);
 const char *mergecandRef;
 const char *mergepackRef;
+const char *mergetableRef;
 const char *minRef;
 const char *min_no_nilRef;
 const char *minusRef;
@@ -1227,7 +1229,6 @@ const char *plusRef;
 const char *postludeRef;
 const char *preludeRef;
 MalStkPtr prepareMALstack(MalBlkPtr mb, int size);
-int prepareMalBlk(MalBlkPtr mb, str s);
 void printFunction(stream *fd, MalBlkPtr mb, MalStkPtr stk, int flg);
 void printInstruction(stream *fd, MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int 
flg);
 const char *printRef;
@@ -1386,6 +1387,7 @@ const char *thetajoinRef;
 const char *thetaselectRef;
 const char *tidRef;
 const char *timestampRef;
+const char *totalRef;
 void traceFunction(component_t comp, MalBlkPtr mb, MalStkPtr stk, int flg);
 void traceInstruction(component_t comp, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p, int flg);
 const char *transactionRef;
diff --git a/common/stream/fwf.c b/common/stream/fwf.c
--- a/common/stream/fwf.c
+++

MonetDB: string_imprints - Merge with default

2021-09-13 Thread Panagiotis Koutsourakis
Changeset: 5d4525349513 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5d4525349513
Modified Files:
gdk/CMakeLists.txt
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_private.h
sql/backends/monet5/CMakeLists.txt
sql/backends/monet5/sql.c
sql/scripts/CMakeLists.txt
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 510485 to 300 lines):

diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -75,7 +75,7 @@ typedef volatile atomic_ulong ATOMIC_TYP
 
 #define ATOMIC_INIT(var, val)  atomic_init(var, (ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_DESTROY(var)((void) 0)
-#define ATOMIC_GET(var)atomic_load(var)
+#define ATOMIC_GET(var)((ATOMIC_BASE_TYPE) 
atomic_load(var))
 #define ATOMIC_SET(var, val)   atomic_store(var, (ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_XCG(var, val)   atomic_exchange(var, (ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_CAS(var, exp, des)  atomic_compare_exchange_strong(var, 
exp, (ATOMIC_BASE_TYPE) (des))
@@ -134,7 +134,7 @@ typedef __declspec(align(8)) volatile AT
 #if SIZEOF_SIZE_T == 8
 
 #ifdef __INTEL_COMPILER
-#define ATOMIC_GET(var)_InterlockedExchangeAdd64(var, 
0)
+#define ATOMIC_GET(var)((ATOMIC_BASE_TYPE) 
_InterlockedExchangeAdd64(var, 0))
 #else
 #define ATOMIC_GET(var)(*(var))
 /* should we use _InterlockedExchangeAdd64(var, 0) instead? */
@@ -162,7 +162,7 @@ ATOMIC_CAS(ATOMIC_TYPE *var, ATOMIC_BASE
 #else
 
 #ifdef DECLSPEC_NOINITALL
-#define ATOMIC_GET(var)
_InlineInterlockedExchangeAdd64(var, 0)
+#define ATOMIC_GET(var)((ATOMIC_BASE_TYPE) 
_InlineInterlockedExchangeAdd64(var, 0))
 #define ATOMIC_SET(var, val)   _InlineInterlockedExchange64(var, 
(ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_XCG(var, val)   _InlineInterlockedExchange64(var, 
(ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_ADD(var, val)   _InlineInterlockedExchangeAdd64(var, 
(ATOMIC_BASE_TYPE) (val))
@@ -172,7 +172,7 @@ ATOMIC_CAS(ATOMIC_TYPE *var, ATOMIC_BASE
 #define ATOMIC_OR(var, val)_InlineInterlockedOr64(var, 
(ATOMIC_BASE_TYPE) (val))
 #define ATOMIC_AND(var, val)   _InlineInterlockedAnd64(var, (ATOMIC_BASE_TYPE) 
(val))
 #else
-#define ATOMIC_GET(var)_InterlockedExchangeAdd64(var, 
0)
+#define ATOMIC_GET(var)((ATOMIC_BASE_TYPE) 
_InterlockedExchangeAdd64(var, 0))
 #define ATOMIC_SET(var, val)   _InterlockedExchange64(var, (ATOMIC_BASE_TYPE) 
(val))
 #define ATOMIC_XCG(var, val)   _InterlockedExchange64(var, (ATOMIC_BASE_TYPE) 
(val))
 #define ATOMIC_ADD(var, val)   _InterlockedExchangeAdd64(var, 
(ATOMIC_BASE_TYPE) (val))
@@ -233,7 +233,7 @@ typedef volatile ATOMIC_BASE_TYPE ATOMIC
 #define ATOMIC_INIT(var, val)  (*(var) = (val))
 #define ATOMIC_DESTROY(var)((void) 0)
 
-#define ATOMIC_GET(var)__atomic_load_n(var, 
__ATOMIC_SEQ_CST)
+#define ATOMIC_GET(var)((ATOMIC_BASE_TYPE) 
__atomic_load_n(var, __ATOMIC_SEQ_CST))
 #define ATOMIC_SET(var, val)   __atomic_store_n(var, (ATOMIC_BASE_TYPE) (val), 
__ATOMIC_SEQ_CST)
 #define ATOMIC_XCG(var, val)   __atomic_exchange_n(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)
 #define ATOMIC_CAS(var, exp, des)  __atomic_compare_exchange_n(var, exp, 
(ATOMIC_BASE_TYPE) (des), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -18,6 +18,7 @@ set(gdk_public_headers
   $
   $
   $
+  $
   $
   $
   $
@@ -28,7 +29,8 @@ set(gdk_public_headers
   $
   $
   $
-  $)
+  $
+  $)
 
 add_library(bat SHARED)
 
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -863,9 +863,6 @@ mskGetVal(BAT *b, BUN p)
  *  HEAPcopy (Heap *dst,*src);
  * @item int
  * @tab
- *  HEAPdelete (Heap *dst, str o, str ext);
- * @item int
- * @tab
  *  HEAPwarm (Heap *h);
  * @end multitable
  *
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -91,7 +91,7 @@ VIEWcreate(oid seq, BAT *b)
return BATdense(seq, b->tseqbase, b->batCount);
}
 
-   bn = BATcreatedesc(seq, b->ttype, false, TRANSIENT);
+   bn = BATcreatedesc(seq, b->ttype, false, TRANSIENT, 0);
if (bn == NULL)
return NULL;
assert(bn->theap == NULL);
@@ -193,8 +193,7 @@ BATmaterialize(BAT *b)
.parentid = b->batCacheid,
.dirty = true,
};
-   strconcat_len(tail->filename, sizeof(tail->filename),
- BBP_physical(b->batCacheid), ".tail", NULL);
+   settailname(tail, BBP_physical(b->batCacheid), TYPE_oid, 0);
if (HEAPalloc(tail, cnt, sizeof(oid), 0) != GDK_SUCCEED) {
GDKfree(tail);
return GDK_FAIL;
diff

MonetDB: string_imprints - Merge with default

2021-09-20 Thread Panagiotis Koutsourakis
Changeset: 39e30b8b6392 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/39e30b8b6392
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_private.h
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/pcre.c
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 9006 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -718,29 +718,29 @@
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:any_1], X_1:bat[:any_1], 
X_2:bat[:oid], X_3:bat[:oid], X_4:bit):bat[:bit] ",   "CMDbatNE;",""
  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:any_1], X_1:bat[:any_1], 
X_2:bit):bat[:bit] ", "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:int]):bat[:bit] ",  "CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:int]):bat[:bit] ",  "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:int], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:int], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:lng]):bat[:bit] ",  "CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:int], 
X_2:bat[:oid], X_3:bat[:oid], X_4:bit):bat[:bit] ",   "CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:int], 
X_2:bit):bat[:bit] ", "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:lng]):bat[:bit] ",  "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:lng], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:lng], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:sht]):bat[:bit] ",  "CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:lng], 
X_2:bat[:oid], X_3:bat[:oid], X_4:bit):bat[:bit] ",   "CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:lng], 
X_2:bit):bat[:bit] ", "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], 
X_1:bat[:sht]):bat[:bit] ",  "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:sht], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:sht], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ","CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int):bat[:bit] 
","CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:sht], 
X_2:bat[:oid], X_3:bat[:oid], X_4:bit):bat[:bit] ",   "CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:bat[:sht], 
X_2:bit):bat[:bit] ", "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int):bat[:bit] 
","CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int, 
X_2:bat[:oid]):bat[:bit] ", "CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int, 
X_2:bat[:oid]):bat[:bit] ", "CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng):bat[:bit] 
","CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int, 
X_2:bat[:oid], X_3:bit):bat[:bit] ","CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:int, 
X_2:bit):bat[:bit] ",   "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng):bat[:bit] 
","CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng, 
X_2:bat[:oid]):bat[:bit] ", "CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng, 
X_2:bat[:oid]):bat[:bit] ", "CMDbatNE;",""  ]
-[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:sht):bat[:bit] 
","CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng, 
X_2:bat[:oid], X_3:bit):bat[:bit] ","CMDbatNE;",""  ]
+[ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:lng, 
X_2:bit):bat[:bit] ",   "CMDbatNE;",""  ]
 [ "batcalc",   "!=",   "pattern batcalc.!=(X_0:bat[:bte], X_1:sht):bat[:bit] 
","CMDbatNE;",""  ]
 [ "batcalc", 

MonetDB: string_imprints - Merge with default

2021-09-22 Thread Panagiotis Koutsourakis
Changeset: 3fc32e309cdc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3fc32e309cdc
Modified Files:
gdk/gdk_bbp.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 2202 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,7 @@ test_big_endian(IS_BIG_ENDIAN)
 include(monetdb-functions)
 include(monetdb-findpackages)
 include(monetdb-toolchain)
-monetdb_default_toolchain()
-#monetdb_default_compiler_options()
+monetdb_default_compiler_options()
 
 include(monetdb-defines)
 monetdb_hg_revision()
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -382,15 +382,16 @@ dump_foreign_keys(Mapi mid, const char *
if (tname != NULL) {
char *s = sescape(schema);
char *t = sescape(tname);
+   if (s == NULL || t == NULL) {
+   free(s);
+   free(t);
+   goto bailout;
+   }
maxquerylen = 1024 + strlen(t) + strlen(s);
query = malloc(maxquerylen);
-   if (s == NULL || t == NULL || query == NULL) {
-   if (s)
-   free(s);
-   if (t)
-   free(t);
-   if (query)
-   free(query);
+   if (query == NULL) {
+   free(s);
+   free(t);
goto bailout;
}
snprintf(query, maxquerylen,
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -1255,6 +1255,7 @@ ODBCTranslateSQL(ODBCDbc *dbc, const SQL
strncpy(q, nquery, pr);
for (r = func->repl; *r; r++) {
if (*r == '\1' || *r == 
'\2' || *r == '\3' || *r == '\4') {
+   assert(*r <= 
func->nargs);
if (args[*r - 
1].argstart[0] == '\'')
q[pr++] 
= 'r';
strncpy(q + pr, 
args[*r - 1].argstart, args[*r - 1].arglen);
diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c
--- a/clients/odbc/driver/SQLTables.c
+++ b/clients/odbc/driver/SQLTables.c
@@ -82,6 +82,8 @@ MNDBTables(ODBCStmt *stmt,
  "cast(null as varchar(1)) as remarks "
   "from sys.env() e "
   "where e.name = 'gdk_dbname'");
+   if (query == NULL)
+   goto nomem;
} else if (NameLength1 == 0 &&
   NameLength3 == 0 &&
   SchemaName &&
@@ -96,6 +98,8 @@ MNDBTables(ODBCStmt *stmt,
* schema remarks */
  "cast(null as varchar(1)) as remarks "
   "from sys.schemas order by table_schem");
+   if (query == NULL)
+   goto nomem;
} else if (NameLength1 == 0 &&
   NameLength2 == 0 &&
   NameLength3 == 0 &&
@@ -108,6 +112,8 @@ MNDBTables(ODBCStmt *stmt,
  "table_type_name as table_type, "
  "cast(null as varchar(1)) as remarks "
   "from sys.table_types order by table_type");
+   if (query == NULL)
+   goto nomem;
} else {
/* no special case argument values */
size_t querylen;
@@ -241,8 +247,6 @@ MNDBTables(ODBCStmt *stmt,
free(sch);
if (tab)
free(tab);
-   if (query)
-   free(query);
/* Memory allocation error */
addStmtError(stmt, "HY001", NULL, 0);
return SQL_ERROR;
diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake
--- a/cmake/monetdb-functions.cmake
+++ b/cmake/monetdb-functions.cmake
@@ -9,73 +9,60 @@
 function(monetdb_hg_revision)
   # Get the current version control revision
   if(EXISTS "${CMAKE_SOURCE_DIR}/.hg_archival.txt")
-execute_process(COMMAND "sed" "-n" "s/^node: 
\\([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\\).*/\\1/p"
 ".hg_archival.txt" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE 
HG_RETURN_CODE
-  OUTPUT_VARIABLE HG_OUPUT_RES OUTPUT_STRIP_TRAILING_WHITESPACE)
-if(HG_RETURN_CODE EQUAL 0 AND HG_OUPUT_RES)
-  set(MERCURIAL_ID "$

MonetDB: string_imprints - Merge with default

2021-10-26 Thread Panagiotis Koutsourakis
Changeset: e412426188a8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e412426188a8
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bbp.c
monetdb5/modules/mal/batExtensions.c
monetdb5/optimizer/opt_pipes.c
sql/backends/monet5/sql.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: string_imprints
Log Message:

Merge with default


diffs (truncated from 26150 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -811,3 +811,11 @@ 404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4
 9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_5
 404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_release
 9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_release
+ceade625915329a9697b5009470ce0251a5e2244 Jul2021_7
+ceade625915329a9697b5009470ce0251a5e2244 Jul2021_SP1_release
+4b353b1f914e3c9c7493117284f9cc06677e4c71 Jul2021_9
+ceade625915329a9697b5009470ce0251a5e2244 Jul2021_SP1_release
+4b353b1f914e3c9c7493117284f9cc06677e4c71 Jul2021_SP1_release
+65065954ca086d01254a20cc145695fa8b9a3db2 Jul2021_11
+4b353b1f914e3c9c7493117284f9cc06677e4c71 Jul2021_SP1_release
+65065954ca086d01254a20cc145695fa8b9a3db2 Jul2021_SP1_release
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,10 +92,14 @@ monetdb_configure_misc()
 # Some custom target will need these setting.
 include(monetdb-custom-targets)
 
-SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
-SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-SET(CMAKE_INSTALL_RPATH 
"${CMAKE_INSTALL_FULL_LIBDIR};${CMAKE_INSTALL_FULL_LIBDIR}/monetdb5")
-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+if(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
+  SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
+  SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+#else()
+#  SET(CMAKE_SKIP_RPATH TRUE)
+endif()
 
 # required for some instalation files
 set(PROGRAM_PERMISSIONS_DEFAULT
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -71,9 +71,6 @@
 %bcond_without fits
 %endif
 
-%{!?__python3: %global __python3 /usr/bin/python3}
-%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-
 Name: %{name}
 Version: %{version}
 Release: %{release}
@@ -84,7 +81,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Jul2021/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jul2021-SP1/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -98,7 +95,7 @@ BuildRequires: hardlink
 BuildRequires: cmake3 >= 3.12
 BuildRequires: gcc
 BuildRequires: bison
-BuildRequires: /usr/bin/python3
+BuildRequires: python3-devel
 %if %{?rhel:1}%{!?rhel:0}
 # RH 7 (and for readline also 8)
 BuildRequires: bzip2-devel
@@ -682,7 +679,6 @@ package.  You probably don't need this, 
 Summary: MonetDB - Monet Database Management System
 Group: Applications/Databases
 Requires: %{name}-client-tests = %{version}-%{release}
-Requires: /usr/bin/python3
 BuildArch: noarch
 
 %description testing-python
@@ -842,7 +838,77 @@ else
 /usr/bin/hardlink -cv %{buildroot}%{_datadir}/selinux
 fi
 
+# update shebang lines for Python scripts
+%if %{?py3_shebang_fix:1}%{!?py3_shebang_fix:0}
+# Fedora has py3_shebang_fix macro
+%{py3_shebang_fix} %{buildroot}%{_bindir}/*.py
+%else
+# EPEL does not, but we can use the script directly
+/usr/bin/pathfix.py -pni "%{__python3} -s" %{buildroot}%{_bindir}/*.py
+%endif
+
 %changelog
+* Thu Sep 30 2021 Sjoerd Mullender  - 11.41.11-20210930
+- Rebuilt.
+
+* Tue Sep 28 2021 Sjoerd Mullender  - 11.41.9-20210928
+- Rebuilt.
+
+* Mon Sep 27 2021 Sjoerd Mullender  - 11.41.7-20210927
+- Rebuilt.
+- GH#7140: SQL Query Plan Non Optimal with View
+- GH#7162: Extend sys.var_values table
+- GH#7165: `JOINIDX: missing '.'` when running distributed join query on
+  merged remote tables
+- GH#7172: Unexpected query result with merge tables
+- GH#7173: If truncate is in transaction then after restart of MonetDB the
+  table is empty
+- GH#7178: Remote Table Throws Error - createExceptionInternal: !ERROR:
+  SQLException:RAstatement2:42000!The number of projections don't match
+  between the generated plan and the expected one: 1 != 1200
+
+* Wed Sep 22 2021 Sjoerd Mullender  - 11.41.7-20210927
+- gdk: Some deadlock and race condition issues were fixed.
+- gdk: Handling of the list of free bats has been improved, leading to less
+  thread contenti

MonetDB: string_imprints - Merge with default

2021-10-27 Thread Panagiotis Koutsourakis
Changeset: e08b1857aa87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e08b1857aa87
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_private.h
monetdb5/optimizer/opt_pipes.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: string_imprints
Log Message:

Merge with default


diffs (truncated from 8929 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -233,6 +233,7 @@ gdk_return BUNreplacemulti(BAT *b, const
 gdk_return BUNreplacemultiincr(BAT *b, oid position, const void *values, BUN 
count, bool force) __attribute__((__warn_unused_result__));
 BAT *COLcopy(BAT *b, int tt, bool writable, role_t role);
 BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role) 
__attribute__((__warn_unused_result__));
+BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width) 
__attribute__((__warn_unused_result__));
 size_t GDK_mem_maxsize;
 size_t GDK_vm_maxsize;
 gdk_return GDKanalytical_correlation(BAT *r, BAT *p, BAT *o, BAT *b1, BAT *b2, 
BAT *s, BAT *e, int tpe, int frame_type);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1063,6 +1063,8 @@ gdk_export void HEAP_free(Heap *heap, va
  */
 gdk_export BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role)
__attribute__((__warn_unused_result__));
+gdk_export BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+   __attribute__((__warn_unused_result__));
 gdk_export BAT *BATdense(oid hseq, oid tseq, BUN cnt)
__attribute__((__warn_unused_result__));
 gdk_export gdk_return BATextend(BAT *b, BUN newcap)
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -255,7 +255,7 @@ BATmaterialize(BAT *b)
b->tunique_est = is_oid_nil(t) ? 1.0 : (double) b->batCount;
MT_lock_unset(&b->theaplock);
b->ttype = TYPE_oid;
-   BATsetdims(b);
+   BATsetdims(b, 0);
b->batDirtydesc = true;
BATsetcount(b, b->batCount);
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -171,9 +171,9 @@ ATOMelmshift(int sz)
 
 
 void
-BATsetdims(BAT *b)
+BATsetdims(BAT *b, uint16_t width)
 {
-   b->twidth = b->ttype == TYPE_str ? 1 : ATOMsize(b->ttype);
+   b->twidth = b->ttype == TYPE_str ? width > 0 ? width : 1 : 
ATOMsize(b->ttype);
b->tshift = ATOMelmshift(b->twidth);
assert_shift_width(b->tshift, b->twidth);
b->tvarsized = b->ttype == TYPE_void || BATatoms[b->ttype].atomPut != 
NULL;
@@ -204,6 +204,7 @@ settailname(Heap *restrict tail, const c
 {
if (tt == TYPE_str) {
switch (width) {
+   case 0:
case 1:
strconcat_len(tail->filename,
  sizeof(tail->filename), physnme,
@@ -241,7 +242,7 @@ settailname(Heap *restrict tail, const c
  * filenames.
  */
 BAT *
-COLnew_intern(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
 {
BAT *bn;
 
@@ -268,20 +269,11 @@ COLnew_intern(oid hseq, int tt, BUN cap,
if (bn == NULL)
return NULL;
 
-   BATsetdims(bn);
+   BATsetdims(bn, width);
bn->batCapacity = cap;
 
if (ATOMstorage(tt) == TYPE_msk)
cap /= 8;   /* 8 values per byte */
-   else if (tt == TYPE_str) {
-   if (width != 0) {
-   /* power of two and not too large */
-   assert((width & (width - 1)) == 0);
-   assert(width <= sizeof(var_t));
-   bn->twidth = width;
-   }
-   settailname(bn->theap, BBP_physical(bn->batCacheid), tt, 
bn->twidth);
-   }
 
/* alloc the main heaps */
if (tt && HEAPalloc(bn->theap, cap, bn->twidth, ATOMsize(bn->ttype)) != 
GDK_SUCCEED) {
@@ -313,7 +305,7 @@ COLnew_intern(oid hseq, int tt, BUN cap,
 BAT *
 COLnew(oid hseq, int tt, BUN cap, role_t role)
 {
-   return COLnew_intern(hseq, tt, cap, role, 0);
+   return COLnew2(hseq, tt, cap, role, 0);
 }
 
 BAT *
@@ -835,16 +827,15 @@ COLcopy(BAT *b, int tt, bool writable, r
slowcopy = true;
}
 
-   bn = COLnew_intern(b->hseqbase, tt, bi.count, role, bi.width);
+   bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
if (bn == NULL) {
bat_iterator_end(&bi);
return NULL;
}
if (bn->tvheap != NULL && bn->tvheap->base == NULL) {
/* this combination can happen since the last
-* argument of COLnew_intern not be

MonetDB: string_imprints - Merge with default

2021-11-03 Thread Panagiotis Koutsourakis
Changeset: acba25365e71 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acba25365e71
Branch: string_imprints
Log Message:

Merge with default


diffs (242 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,10 +24,6 @@ set(CMAKE_PROJECT_HOMEPAGE_URL "https://
 set(C_STANDARD_REQUIRED ON)
 set(CMAKE_C_STANDARD 99)
 
-if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
-  cmake_policy(SET CMP0076 OLD)
-endif()
-
 # We give precedence to UNIX include directories over
 # OS X Frameworks directories
 set(CMAKE_FIND_FRAMEWORK LAST)
diff --git a/sql/ChangeLog.Jul2021 b/sql/ChangeLog.Jul2021
--- a/sql/ChangeLog.Jul2021
+++ b/sql/ChangeLog.Jul2021
@@ -1,3 +1,9 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Thu Oct 28 2021 Sjoerd Mullender 
+- Number parsing for SQL was fixed.  If a number was immediately followed
+  by letters (i.e. without a space), the number was accepted and the
+  alphanumeric string starting with the letter was interpreted as an alias
+  (if aliases were allowed in that position).
+
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -3650,6 +3650,7 @@ sql_update_default(Client c, mvc *sql, c
"drop view sys.describe_privileges;\n"
"drop view sys.describe_comments;\n"
"drop view sys.describe_tables;\n"
+   "drop function sys.schema_guard(string, 
string, string);\n"
"drop function 
sys.get_remote_table_expressions(string, string);\n"
"drop function 
sys.get_merge_table_partition_expressions(int);\n"
"drop view sys.describe_constraints;\n"
@@ -3659,6 +3660,10 @@ sql_update_default(Client c, mvc *sql, c
pos += snprintf(buf + pos, bufsize - pos,
"CREATE FUNCTION sys.SQ (s STRING) 
RETURNS STRING BEGIN RETURN  || sys.replace(s,,'') || ; END;\n"
"CREATE FUNCTION sys.FQN(s STRING, t 
STRING) RETURNS STRING BEGIN RETURN '\"' || sys.replace(s,'\"','\"\"') || 
'\".\"' || sys.replace(t,'\"','\"\"') || '\"'; END;\n"
+   "CREATE FUNCTION sys.schema_guard(sch 
STRING, nme STRING, stmt STRING) RETURNS STRING BEGIN\n"
+   "RETURN\n"
+   "SELECT sys.replace_first(stmt, 
'(s*\"?' || sch ||  '\"?s*.|)s*\"?' || nme || '\"?s*', ' ' 
|| sys.FQN(sch, nme) || ' ', 'imsx');\n"
+   "END;\n"
"CREATE VIEW sys.describe_constraints 
AS\n"
"   SELECT\n"
"   s.name sch,\n"
@@ -3883,7 +3888,7 @@ sql_update_default(Client c, mvc *sql, c
"   LEFT OUTER JOIN 
sys.function_languages fl ON f.language = fl.language_id\n"
"   WHERE s.name <> 'tmp' AND NOT 
f.system;\n");
pos += snprintf(buf + pos, bufsize - pos,
-   "update sys.functions set system = true 
where system <> true and name in ('sq', 'fqn', 
'get_merge_table_partition_expressions', 'get_remote_table_expressions') and 
schema_id = 2000 and type = %d;\n", F_FUNC);
+   "update sys.functions set system = true 
where system <> true and name in ('sq', 'fqn', 
'get_merge_table_partition_expressions', 'get_remote_table_expressions', 
'schema_guard') and schema_id = 2000 and type = %d;\n", F_FUNC);
pos += snprintf(buf + pos, bufsize - pos,
"update sys._tables set system = true where 
name in ('describe_constraints', 'describe_tables', 'describe_comments', 
'describe_privileges', 'describe_partition_tables', 'describe_functions') AND 
schema_id = 2000;\n");
 
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -896,53 +896,88 @@ static int
 number(mvc * c, int cur)
 {
struct scanner *lc = &c->scanner;
-   int token = sqlINT;
-   int before_cur = EOF;
+   int token = cur == '0' ? sqlINT : 0;
 
+   /* a number has one of these forms (expressed in regular expressions):
+* 0x[0-9A-Fa-f]+   -- (hexadecimal) INTEGER
+* \.[0-9]+ -- DECIMAL
+* [0-9]+\.[0-9]*   -- DECIMAL
+* [0-9]+@0 -- OID
+* [0-9]*\.[0-9]+[eE][-+]?[0-9]+-- REAL
+* [0-9]+(\.[0-9]*)?[eE][-+]?[0-9]+ -- REAL
+* [0-9]+ 

MonetDB: string_imprints - Merge with default

2021-11-07 Thread Panagiotis Koutsourakis
Changeset: e49d6897d042 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e49d6897d042
Modified Files:
gdk/gdk_bbp.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: string_imprints
Log Message:

Merge with default


diffs (truncated from 6257 to 300 lines):

diff --git a/ctest/tools/monetdbe/example2.c b/ctest/tools/monetdbe/example2.c
--- a/ctest/tools/monetdbe/example2.c
+++ b/ctest/tools/monetdbe/example2.c
@@ -170,6 +170,20 @@ main(void)
if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
error(err)
 
+   /* NULL value version */
+   if ((err = monetdbe_prepare(mdbe, "SELECT b, t FROM test where t = ?; 
", &stmt, NULL)) != NULL)
+   error(err)
+   char *s2 = NULL;
+   if ((err = monetdbe_bind(stmt, s2, 0)) != NULL)
+   error(err)
+   if ((err = monetdbe_execute(stmt, &result, NULL)) != NULL)
+   error(err)
+   fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", 
result->ncols, result->nrows);
+   if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
+   error(err)
+   if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
+   error(err)
+
if ((err = monetdbe_prepare(mdbe, "SELECT b, y FROM test where y = ?; 
", &stmt, NULL)) != NULL)
error(err)
char *y = "Hello";
@@ -183,6 +197,20 @@ main(void)
if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
error(err)
 
+   /* NULL value version */
+   if ((err = monetdbe_prepare(mdbe, "SELECT b, y FROM test where y = ?; 
", &stmt, NULL)) != NULL)
+   error(err)
+   char *y2 = NULL;
+   if ((err = monetdbe_bind(stmt, y2, 0)) != NULL)
+   error(err)
+   if ((err = monetdbe_execute(stmt, &result, NULL)) != NULL)
+   error(err)
+   fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", 
result->ncols, result->nrows);
+   if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
+   error(err)
+   if ((err = monetdbe_cleanup_statement(mdbe, stmt)) != NULL)
+   error(err)
+
if (monetdbe_close(mdbe))
error("Failed to close database")
return 0;
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -728,6 +728,9 @@ BBPreadEntries(FILE *fp, unsigned bbpver
 
if (buf[nread] != '\n' && buf[nread] != ' ') {
BATdestroy(bn);
+#ifdef GDKLIBRARY_HASHASH
+   GDKfree(hbats);
+#endif
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line 
%d", lineno);
return GDK_FAIL;
}
@@ -736,6 +739,9 @@ BBPreadEntries(FILE *fp, unsigned bbpver
 
if (snprintf(BBP_bak(bid), sizeof(BBP_bak(bid)), "tmp_%o", 
(unsigned) bid) >= (int) sizeof(BBP_bak(bid))) {
BATdestroy(bn);
+#ifdef GDKLIBRARY_HASHASH
+   GDKfree(hbats);
+#endif
TRC_CRITICAL(GDK, "BBP logical filename directory is 
too large, on line %d\n", lineno);
return GDK_FAIL;
}
@@ -754,6 +760,9 @@ BBPreadEntries(FILE *fp, unsigned bbpver
BBP_logical(bid) = GDKstrdup(logical);
if (BBP_logical(bid) == NULL) {
BATdestroy(bn);
+#ifdef GDKLIBRARY_HASHASH
+   GDKfree(hbats);
+#endif
TRC_CRITICAL(GDK, "GDKstrdup failed\n");
return GDK_FAIL;
}
@@ -769,6 +778,9 @@ BBPreadEntries(FILE *fp, unsigned bbpver
BBP_options(bid) = GDKstrdup(options);
if (BBP_options(bid) == NULL) {
BATdestroy(bn);
+#ifdef GDKLIBRARY_HASHASH
+   GDKfree(hbats);
+#endif
TRC_CRITICAL(GDK, "GDKstrdup failed\n");
return GDK_FAIL;
}
@@ -1424,6 +1436,7 @@ BBPinit(bool first)
 #ifdef GDKLIBRARY_HASHASH
bat *hashbats = NULL;
bat nhashbats = 0;
+   gdk_return res = GDK_SUCCEED;
 #endif
 
/* the maximum number of BATs allowed in the system and the
@@ -1565,6 +1578,9 @@ BBPinit(bool first)
if (BBPinithash(0, (bat) ATOMIC_GET(&BBPsize)) != GDK_SUCCEED) {
TRC_CRITICAL(GDK, "BBPinithash failed");
MT_lock_unset(&BBPnameLock);
+#ifdef GDKLIBRARY_HASHASH
+   GDKfree(hashbats);
+#endif
return GDK_FAIL;
}
MT_lock_unset(&BBPnameLock);
@@ -1575,13 +1591,20 @@ BBPinit(bool first)
gdk_return rc = BBPprepare(false);
MT_lock_unset(&G

MonetDB: string_imprints - Merge with default

2021-11-10 Thread Panagiotis Koutsourakis
Changeset: 3ab7e51d3112 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3ab7e51d3112
Modified Files:
monetdb5/optimizer/opt_pipes.c
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 422 to 300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3326,14 +3326,13 @@ BATgroupsize(BAT *b, BAT *g, BAT *e, BAT
i = canditer_next(ci) - hseq;   \
if (!skip_nils ||   \
!is_##TYPE##_nil(vals[i])) {\
-   oids[i] = i + hseq; \
+   oids[gid++] = i + hseq; \
nils--; \
}   \
}   \
TIMEOUT_CHECK(timeoffset,   \
  TIMEOUT_HANDLER(BUN_NONE));   \
} else {\
-   gid = 0; /* in case gids == NULL */ \
TIMEOUT_LOOP(ncand, timeoffset) {   \
i = canditer_next(ci) - hseq;   \
if (gids == NULL || \
@@ -3365,7 +3364,7 @@ do_groupmin(oid *restrict oids, BATiter 
oid min, oid max, struct canditer *restrict ci, BUN ncand,
bool skip_nils, bool gdense)
 {
-   oid gid;
+   oid gid = 0;
BUN i, nils;
int t;
const void *nil;
@@ -3423,15 +3422,16 @@ do_groupmin(oid *restrict oids, BATiter 
while (ncand > 0) {
ncand--;
i = canditer_next(ci);
-   oids[i - hseq] = i;
+   oids[gid++] = i;
nils--;
}
} else {
while (ncand > 0) {
ncand--;
i = canditer_next(ci);
-   if (is_oid_nil(oids[i - hseq])) {
-   oids[i - hseq] = i;
+   gid = gids[i - hseq] - min;
+   if (is_oid_nil(oids[gid])) {
+   oids[gid] = i;
nils--;
}
}
@@ -3447,14 +3447,13 @@ do_groupmin(oid *restrict oids, BATiter 
i = canditer_next(ci) - hseq;
if (!skip_nils ||
(*atomcmp)(BUNtail(*bi, i), nil) != 0) {
-   oids[i] = i + hseq;
+   oids[gid++] = i + hseq;
nils--;
}
}
TIMEOUT_CHECK(timeoffset,
  TIMEOUT_HANDLER(BUN_NONE));
} else {
-   gid = 0; /* in case gids == NULL */
TIMEOUT_LOOP(ncand, timeoffset) {
i = canditer_next(ci) - hseq;
if (gids == NULL ||
@@ -3495,7 +3494,7 @@ do_groupmax(oid *restrict oids, BATiter 
oid min, oid max, struct canditer *restrict ci, BUN ncand,
bool skip_nils, bool gdense)
 {
-   oid gid;
+   oid gid = 0;
BUN i, nils;
int t;
const void *nil;
@@ -3553,16 +3552,17 @@ do_groupmax(oid *restrict oids, BATiter 
while (ncand > 0) {
ncand--;
i = canditer_next(ci);
-   oids[i - hseq] = i;
+   oids[gid++] = i;
nils--;
}
} else {
while (ncand > 0) {
ncand--;
i = canditer_next(ci);
-   if (is_oid_nil(oids[i - hseq]))
+   gid = gids[i - hseq] - min;
+   if (is_oid_nil(oids[gid]))
nils--;
-   oids[i - hseq]

MonetDB: string_imprints - Merge with default

2021-11-10 Thread Panagiotis Koutsourakis
Changeset: d955714c71b3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d955714c71b3
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bbp.c
monetdb5/optimizer/CMakeLists.txt
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.c
sql/backends/monet5/CMakeLists.txt
sql/backends/monet5/sql.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: string_imprints
Log Message:

Merge with default


diffs (truncated from 59222 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -6617,7 +6617,7 @@
 [ "batstr","unicodeAt","pattern batstr.unicodeAt(X_0:bat[:str], 
X_1:int, X_2:bat[:oid]):bat[:int] ",   "STRbatWChrAtcst;", "get a unicode 
character (as an int) from a string position."   ]
 [ "battxtsim", "similarity",   "command battxtsim.similarity(X_0:bat[:str], 
X_1:bat[:str]):bat[:dbl] ","fstrcmp0_impl_bulk;",  "Normalized edit 
distance between two strings"  ]
 [ "batuuid",   "isaUUID",  "command 
batuuid.isaUUID(X_0:bat[:str]):bat[:bit] ","UUIDisaUUID_bulk;","Test a 
string for a UUID format"   ]
-[ "batuuid",   "new",  "unsafe command batuuid.new(X_0:bat[:int]):bat[:uuid] 
","UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version 
for side effect free multiplex loop)"   ]
+[ "batuuid",   "new",  "command batuuid.new(X_0:bat[:int]):bat[:uuid] ",   
"UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version for side 
effect free multiplex loop)"   ]
 [ "batxml","attribute","command batxml.attribute(X_0:str, 
X_1:bat[:str]):bat[:xml] ",  "BATXMLattribute;", "Construct an attribute 
value pair."]
 [ "batxml","comment",  "command 
batxml.comment(X_0:bat[:str]):bat[:xml] ", "BATXMLcomment;",   "Create 
an XML comment element."]
 [ "batxml","concat",   "command batxml.concat(X_0:bat[:xml], 
X_1:bat[:xml]):bat[:xml] ",   "BATXMLconcat;","Concatenate the XML 
values."   ]
@@ -8381,10 +8381,10 @@
 [ "capi",  "eval_aggr","pattern capi.eval_aggr(X_0:ptr, X_1:bit, 
X_2:str, X_3:any...):any... ","CUDFevalAggr;","grouped 
aggregates through CUDF"   ]
 [ "capi",  "prelude",  "command capi.prelude():void ", "CUDFprelude;", 
""  ]
 [ "capi",  "subeval_aggr", "pattern capi.subeval_aggr(X_0:ptr, X_1:bit, 
X_2:str, X_3:any...):any... ", "CUDFevalAggr;","grouped aggregates 
through CUDF"   ]
-[ "clients",   "addUser",  "pattern clients.addUser(X_0:str, X_1:str):oid 
",   "CLTaddUser;",  "Allow user with password access to the given 
scenarios"]
+[ "clients",   "addUser",  "unsafe pattern clients.addUser(X_0:str, 
X_1:str):oid ","CLTaddUser;",  "Allow user with password access to the 
given scenarios"]
 [ "clients",   "backendsum",   "command clients.backendsum(X_0:str):str ", 
"CLTbackendsum;",   "Return hex string representation of the currently used 
hash of the given string"   ]
-[ "clients",   "changePassword",   "pattern 
clients.changePassword(X_0:str, X_1:str):void ",   "CLTchangePassword;",   
"Change the password for the current user"  ]
-[ "clients",   "changeUsername",   "pattern 
clients.changeUsername(X_0:str, X_1:str):void ",   "CLTchangeUsername;",   
"Change the username of the user into the new string"   ]
+[ "clients",   "changePassword",   "unsafe pattern 
clients.changePassword(X_0:str, X_1:str):void ","CLTchangePassword;",   
"Change the password for the current user"  ]
+[ "clients",   "changeUsername",   "unsafe pattern 
clients.changeUsername(X_0:str, X_1:str):void ","CLTchangeUsername;",   
"Change the username of the user into the new string"   ]
 [ "clients",   "checkPermission",  "pattern 
clients.checkPermission(X_0:str, X_1:str):void ",  "CLTcheckPermission;",  
"Check permission for a user, requires hashed password (backendsum)"]
 [ "clients",   "current_sessionid","pattern 
clients.current_sessionid():int ", "CLTgetSessionID;", "return current 
session ID" ]
 [ "clients",   "getId","pattern clients.getId():int ", 
"CLTgetClientId;",  "Return a number that uniquely represents the current 
client."  ]
@@ -8396,42 +8396,42 @@
 [ "clients",   "getUsers", "pattern clients.getUsers() (X_0:bat[:oid], 
X_1:bat[:str]) ",   "CLTgetUsers;", "return a BAT with user id and one with 
name available in the s

MonetDB: string_imprints - Merge with default

2021-11-15 Thread Panagiotis Koutsourakis
Changeset: 1794942fc87b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1794942fc87b
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
monetdb5/modules/mal/pcre.c
sql/backends/monet5/sql.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: string_imprints
Log Message:

Merge with default


diffs (truncated from 3874 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -6248,6 +6248,7 @@
 [ "batmtime",  "year", "pattern batmtime.year(X_0:bat[:timestamp], 
X_1:bat[:oid]):bat[:int] ", "MTIMEtimestamp_year_bulk;",""  ]
 [ "batpcre",   "replace",  "command batpcre.replace(X_0:bat[:str], 
X_1:str, X_2:str, X_3:str):bat[:str] ", "PCREreplace_bat_wrap;",""  
]
 [ "batpcre",   "replace_first","command 
batpcre.replace_first(X_0:bat[:str], X_1:str, X_2:str, X_3:str):bat[:str] ",   
"PCREreplacefirst_bat_wrap;",   ""  ]
+[ "batpyapi3", "eval", "unsafe pattern batpyapi3.eval(X_0:lng, X_1:ptr, 
X_2:str):any... ", "PYAPI3PyAPIevalStd;",  "Execute a simple Python script 
value"  ]
 [ "batpyapi3", "eval", "unsafe pattern batpyapi3.eval(X_0:ptr, X_1:str, 
X_2:any...):any... ",  "PYAPI3PyAPIevalStd;",  "Execute a simple Python script 
value"  ]
 [ "batpyapi3", "eval_aggr","unsafe pattern batpyapi3.eval_aggr(X_0:ptr, 
X_1:str, X_2:any...):any... ", "PYAPI3PyAPIevalAggr;", "grouped aggregates 
through Python" ]
 [ "batpyapi3", "eval_loader",  "unsafe pattern batpyapi3.eval_loader(X_0:ptr, 
X_1:str):any... ",   "PYAPI3PyAPIevalLoader;",   "loader functions 
through Python"   ]
@@ -6256,6 +6257,7 @@
 [ "batpyapi3map",  "eval", "pattern batpyapi3map.eval(X_0:ptr, X_1:str, 
X_2:any...):any... ",  "PYAPI3PyAPIevalStdMap;",   "Execute a simple 
Python script value"  ]
 [ "batpyapi3map",  "eval_aggr","pattern 
batpyapi3map.eval_aggr(X_0:ptr, X_1:str, X_2:any...):any... ", 
"PYAPI3PyAPIevalAggrMap;",  "grouped aggregates through Python" ]
 [ "batpyapi3map",  "subeval_aggr", "pattern 
batpyapi3map.subeval_aggr(X_0:ptr, X_1:str, X_2:any...):any... ",  
"PYAPI3PyAPIevalAggrMap;",  "grouped aggregates through Python" ]
+[ "batrapi",   "eval", "pattern batrapi.eval(X_0:lng, X_1:ptr, X_2:str):any... 
",  "RAPIevalStd;", "Execute a simple R script value"   ]
 [ "batrapi",   "eval", "pattern batrapi.eval(X_0:ptr, X_1:str, 
X_2:any...):any... ",   "RAPIevalStd;", "Execute a simple R script value"   
]
 [ "batrapi",   "eval_aggr","pattern batrapi.eval_aggr(X_0:ptr, X_1:str, 
X_2:any...):any... ",  "RAPIevalAggr;","grouped aggregates through 
R"  ]
 [ "batrapi",   "subeval_aggr", "pattern batrapi.subeval_aggr(X_0:ptr, X_1:str, 
X_2:any...):any... ",   "RAPIevalAggr;","grouped aggregates through R"  
]
@@ -6347,9 +6349,6 @@
 [ "batsql","diff", "pattern batsql.diff(X_0:bat[:bit], 
X_1:bat[:any_1]):bat[:bit] ",   "SQLdiff;", "return true if cur != prev 
row"]
 [ "batsql","diff", "pattern batsql.diff(X_0:bit, 
X_1:bat[:any_1]):bat[:bit] ", "SQLdiff;", "return true if cur != prev 
row"]
 [ "batsql","first_value",  "pattern batsql.first_value(X_0:bat[:any_1], 
X_1:any, X_2:any, X_3:int, X_4:any, X_5:any):bat[:any_1] ",
"SQLfirst_value;",  "return the first value of groups"  ]
-[ "batsql","get_value","pattern batsql.get_value(X_0:bat[:str], 
X_1:bat[:str]):bat[:lng] ","mvc_bat_get_value;",   "return the current 
value of sequences" ]
-[ "batsql","get_value","pattern batsql.get_value(X_0:bat[:str], 
X_1:str):bat[:lng] ",  "mvc_bat_get_value;",   "return the current value of the 
sequence"  ]
-[ "batsql","get_value","pattern batsql.get_value(X_0:str, 
X_1:bat[:str]):bat[:lng] ",  "mvc_bat_get_value;",   "return the current value 
of sequences" ]
 [ "batsql","index","command batsql.index(X_0:bat[:str], 
X_1:bit):bat[:bte] ",  "BATSTRindex_bte;", "Return the offsets as an 
index bat"]
 [ "batsql","index","command batsql.index(X_0:bat[:str], 
X_1:bit):bat[:int] ",  "BATSTRindex_int;", "Return the offsets as an 
index bat"]
 [ "batsql","index","command batsql.index(X_0:bat[:str], 
X_1:bit):bat[:sht] ",  "BATSTRindex_sht;", "Return the offsets as an 
index bat"]
@@ -6378,9 +6377,7 @@
 [ "batsql","lead", "pattern batsql.lead(X_0:bat[:any_1], X_1:bat[:any], 
X_2:bat[:any_1], X_3:any_2, X_4:any_3):bat[:any_1] ",  "SQLlead;", 
"return the value in the next 'l' row in the partition or 'd' if non existent"  
]
 [ "batsql","max",  "pattern batsql.max(X_0:bat[:any_1], X_1:any, X_2:any, 
X_3:int

MonetDB: string_imprints - Merge with default

2021-11-16 Thread Panagiotis Koutsourakis
Changeset: 95af8672c992 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/95af8672c992
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 599 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -6042,6 +6042,7 @@
 [ "batmmath",  "radians",  "pattern batmmath.radians(X_0:bat[:flt], 
X_1:bat[:oid]):bat[:flt] ","CMDscience_bat_radians;",  ""  ]
 [ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:bat[:int]):bat[:int] 
",   "CMDscience_bat_randintarg;",   ""  ]
 [ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:bat[:int], 
X_1:bat[:oid]):bat[:int] ","CMDscience_bat_randintarg;",   ""  ]
+[ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:lng):bat[:int] ", 
"CMDscience_bat_randintarg;",   ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:dbl]):bat[:dbl] ",   
"CMDscience_bat_sin;",  ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:dbl], 
X_1:bat[:oid]):bat[:dbl] ","CMDscience_bat_sin;",  ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:flt]):bat[:flt] ",   
"CMDscience_bat_sin;",  ""  ]
@@ -6607,7 +6608,8 @@
 [ "batstr","unicodeAt","pattern batstr.unicodeAt(X_0:bat[:str], 
X_1:int, X_2:bat[:oid]):bat[:int] ",   "STRbatWChrAtcst;", "get a unicode 
character (as an int) from a string position."   ]
 [ "battxtsim", "similarity",   "command battxtsim.similarity(X_0:bat[:str], 
X_1:bat[:str]):bat[:dbl] ","fstrcmp0_impl_bulk;",  "Normalized edit 
distance between two strings"  ]
 [ "batuuid",   "isaUUID",  "command 
batuuid.isaUUID(X_0:bat[:str]):bat[:bit] ","UUIDisaUUID_bulk;","Test a 
string for a UUID format"   ]
-[ "batuuid",   "new",  "command batuuid.new(X_0:bat[:int]):bat[:uuid] ",   
"UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version for side 
effect free multiplex loop)"   ]
+[ "batuuid",   "new",  "pattern batuuid.new(X_0:bat[:int]):bat[:uuid] ",   
"UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version for side 
effect free multiplex loop)"   ]
+[ "batuuid",   "new",  "pattern batuuid.new(X_0:lng):bat[:uuid] ", 
"UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version for side 
effect free multiplex loop)"   ]
 [ "batxml","attribute","command batxml.attribute(X_0:str, 
X_1:bat[:str]):bat[:xml] ",  "BATXMLattribute;", "Construct an attribute 
value pair."]
 [ "batxml","comment",  "command 
batxml.comment(X_0:bat[:str]):bat[:xml] ", "BATXMLcomment;",   "Create 
an XML comment element."]
 [ "batxml","concat",   "command batxml.concat(X_0:bat[:xml], 
X_1:bat[:xml]):bat[:xml] ",   "BATXMLconcat;","Concatenate the XML 
values."   ]
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
@@ -8572,6 +8572,7 @@
 [ "batmmath",  "radians",  "pattern batmmath.radians(X_0:bat[:flt], 
X_1:bat[:oid]):bat[:flt] ","CMDscience_bat_radians;",  ""  ]
 [ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:bat[:int]):bat[:int] 
",   "CMDscience_bat_randintarg;",   ""  ]
 [ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:bat[:int], 
X_1:bat[:oid]):bat[:int] ","CMDscience_bat_randintarg;",   ""  ]
+[ "batmmath",  "rand", "unsafe pattern batmmath.rand(X_0:lng):bat[:int] ", 
"CMDscience_bat_randintarg;",   ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:dbl]):bat[:dbl] ",   
"CMDscience_bat_sin;",  ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:dbl], 
X_1:bat[:oid]):bat[:dbl] ","CMDscience_bat_sin;",  ""  ]
 [ "batmmath",  "sin",  "pattern batmmath.sin(X_0:bat[:flt]):bat[:flt] ",   
"CMDscience_bat_sin;",  ""  ]
@@ -9166,7 +9167,8 @@
 [ "batstr","unicodeAt","pattern batstr.unicodeAt(X_0:bat[:str], 
X_1:int, X_2:bat[:oid]):bat[:int] ",   "STRbatWChrAtcst;", "get a unicode 
character (as an int) from a string position."   ]
 [ "battxtsim", "similarity",   "command battxtsim.similarity(X_0:bat[:str], 
X_1:bat[:str]):bat[:dbl] ","fstrcmp0_impl_bulk;",  "Normalized edit 
distance between two strings"  ]
 [ "batuuid",   "isaUUID",  "command 
batuuid.isaUUID(X_0:bat[:str]):bat[:bit] ","UUIDisaUUID_bulk;","Test a 
string for a UUID format"   ]
-[ "batuuid",   "new",  "command batuuid.new(X_0:bat[:int]):bat[:uuid] ",   
"UUIDgenerateUuidInt_bulk;","Generate a new uuid (dummy version for side 
effect free multiplex l

MonetDB: string_imprints - Merge with default

2021-11-17 Thread Panagiotis Koutsourakis
Changeset: 99f9be40d724 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/99f9be40d724
Modified Files:
monetdb5/modules/mal/batExtensions.c
monetdb5/modules/mal/pcre.c
sql/backends/monet5/sql.c
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.int128
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 1709 to 300 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -2391,7 +2391,7 @@ dump_database(Mapi mid, stream *toConsol
const char *sequences2 =
"SELECT s.name, "
 "seq.name, "
-"get_value_for(s.name, seq.name), "
+"peak_next_value_for(s.name, seq.name), "
 "seq.\"minvalue\", "
 "seq.\"maxvalue\", "
 "seq.\"increment\", "
diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -57,7 +57,6 @@
 /* #define NO_ATOMIC_INSTRUCTIONS */
 
 /* the atomic type we export is always a 64 bit unsigned integer */
-typedef uint64_t ATOMIC_BASE_TYPE;
 
 /* ignore __STDC_NO_ATOMICS__ if compiling using Intel compiler on
  * Windows since otherwise we can't compile this at all in C99 mode */
@@ -67,8 +66,10 @@ typedef uint64_t ATOMIC_BASE_TYPE;
 
 #if SIZEOF_LONG_LONG == 8
 typedef volatile atomic_ullong ATOMIC_TYPE;
+typedef unsigned long long ATOMIC_BASE_TYPE;
 #elif SIZEOF_LONG == 8
 typedef volatile atomic_ulong ATOMIC_TYPE;
+typedef unsigned long ATOMIC_BASE_TYPE;
 #else
 #error "we need a 64 bit atomic type"
 #endif
@@ -106,6 +107,8 @@ typedef volatile atomic_flag ATOMIC_FLAG
 
 #elif defined(_MSC_VER) && !defined(NO_ATOMIC_INSTRUCTIONS)
 
+typedef uint64_t ATOMIC_BASE_TYPE;
+
 #include 
 
 /* On Windows, with Visual Studio 2005, the compiler uses acquire
@@ -227,6 +230,7 @@ typedef volatile int ATOMIC_FLAG;
 /* the new way of doing this according to GCC (the old way, using
  * __sync_* primitives is not supported) */
 
+typedef uint64_t ATOMIC_BASE_TYPE;
 typedef volatile ATOMIC_BASE_TYPE ATOMIC_TYPE;
 
 #define ATOMIC_VAR_INIT(val)   (val)
@@ -262,6 +266,8 @@ typedef volatile char ATOMIC_FLAG;
 
 /* emulate using mutexes */
 
+typedef uint64_t ATOMIC_BASE_TYPE;
+
 #include  /* required for pthread_mutex_t */
 
 typedef struct {
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
@@ -598,7 +598,7 @@ MCreadClient(Client c)
in->pos++;
 
if (in->pos >= in->len || in->mode) {
-   ssize_t rd, sum = 0;
+   ssize_t rd;
 
if (in->eof || !isa_block_stream(c->fdout)) {
if (!isa_block_stream(c->fdout) && c->promptlength > 0)
@@ -607,7 +607,6 @@ MCreadClient(Client c)
in->eof = false;
}
while ((rd = bstream_next(in)) > 0 && !in->eof) {
-   sum += rd;
if (!in->mode) /* read one line at a time in line mode 
*/
break;
}
diff --git a/monetdb5/modules/mal/batExtensions.c 
b/monetdb5/modules/mal/batExtensions.c
--- a/monetdb5/modules/mal/batExtensions.c
+++ b/monetdb5/modules/mal/batExtensions.c
@@ -100,7 +100,7 @@ CMDBATsingle(Client cntxt, MalBlkPtr mb,
if( b == 0)
throw(MAL,"bat.single", SQLSTATE(HY013) MAL_MALLOC_FAIL);
if (ATOMextern(b->ttype))
-   u = (ptr) *(str *)u;
+   u = (ptr) *(ptr *)u;
if (BUNappend(b, u, false) != GDK_SUCCEED) {
BBPreclaim(b);
throw(MAL, "bat.single", SQLSTATE(HY013) MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/mal/mal_io.c b/monetdb5/modules/mal/mal_io.c
--- a/monetdb5/modules/mal/mal_io.c
+++ b/monetdb5/modules/mal/mal_io.c
@@ -120,8 +120,8 @@ IOprintBoth(Client cntxt, MalBlkPtr mb, 
if (hd)
mnstr_printf(fp, "%s", hd);
 
-   if (ATOMvarsized(tpe))
-   ATOMprint(tpe, *(str *) val, fp);
+   if (ATOMextern(tpe))
+   ATOMprint(tpe, *(ptr *) val, fp);
else
ATOMprint(tpe, val, fp);
 
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -285,8 +285,6 @@ mywstrcasestr(const char *restrict hayst
if (nlen == 0)
return atend ? haystack + strlen(haystack) : haystack;
 
-   size_t hlen = strlen(haystack);
-
while (*haystack) {
size_t i;
size_t h;
@@ -312,7 +310,6 @@ mywstrcasestr(const char *restrict hayst
if (i == nlen && (!atend || haystack[h] == 0))
return haystack;
haystack += step;
-   hlen -= step;
   

MonetDB: string_imprints - Merge with default

2021-11-18 Thread Panagiotis Koutsourakis
Changeset: 252253b81a00 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/252253b81a00
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/test/emptydb/Tests/check.stable.out.32bit
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 30859 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9390,6 +9390,7 @@
 [ "sql",   "optimizer_updates","pattern sql.optimizer_updates():void 
","SQLoptimizersUpdate;", ""  ]
 [ "sql",   "optimizers",   "command sql.optimizers() (X_0:bat[:str], 
X_1:bat[:str], X_2:bat[:str]) ",  "getPipeCatalog;",  ""  ]
 [ "sql",   "password", "pattern sql.password(X_0:str):str ",   
"db_password_wrap;","Return password hash of user"  ]
+[ "sql",   "peak_next_value",  "pattern sql.peak_next_value(X_0:str, 
X_1:str):lng ",   "mvc_peak_next_value;", "Peaks at the next value of the 
sequence"   ]
 [ "sql",   "percent_rank", "pattern sql.percent_rank(X_0:any_1, X_1:bit, 
X_2:bit):dbl ",   "SQLpercent_rank;", "return the percentage into the total 
number of groups for each row"]
 [ "sql",   "prelude",  "pattern sql.prelude():void ",  "SQLprelude;",  
""  ]
 [ "sql",   "prepared_statements",  "pattern sql.prepared_statements() 
(X_0:bat[:int], X_1:bat[:str], X_2:bat[:int], X_3:bat[:str], 
X_4:bat[:timestamp]) ", "SQLsession_prepared_statements;",  "Available 
prepared statements in the current session"  ]
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
@@ -12695,6 +12695,7 @@
 [ "sql",   "optimizer_updates","pattern sql.optimizer_updates():void 
","SQLoptimizersUpdate;", ""  ]
 [ "sql",   "optimizers",   "command sql.optimizers() (X_0:bat[:str], 
X_1:bat[:str], X_2:bat[:str]) ",  "getPipeCatalog;",  ""  ]
 [ "sql",   "password", "pattern sql.password(X_0:str):str ",   
"db_password_wrap;","Return password hash of user"  ]
+[ "sql",   "peak_next_value",  "pattern sql.peak_next_value(X_0:str, 
X_1:str):lng ",   "mvc_peak_next_value;", "Peaks at the next value of the 
sequence"   ]
 [ "sql",   "percent_rank", "pattern sql.percent_rank(X_0:any_1, X_1:bit, 
X_2:bit):dbl ",   "SQLpercent_rank;", "return the percentage into the total 
number of groups for each row"]
 [ "sql",   "prelude",  "pattern sql.prelude():void ",  "SQLprelude;",  
""  ]
 [ "sql",   "prepared_statements",  "pattern sql.prepared_statements() 
(X_0:bat[:int], X_1:bat[:str], X_2:bat[:int], X_3:bat[:str], 
X_4:bat[:timestamp]) ", "SQLsession_prepared_statements;",  "Available 
prepared statements in the current session"  ]
diff --git 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -3463,682 +3463,694 @@ insert into sys.functions values (931, '
 insert into sys.args values (43921, 931, 'res_0', 'bigint', 64, 0, 0, 0);
 insert into sys.args values (43922, 931, 'arg_1', 'clob', 0, 0, 1, 1);
 insert into sys.args values (43923, 931, 'arg_2', 'clob', 0, 0, 1, 2);
-insert into sys.functions values (932, 'restart', 'restart', 'sql', 0, 1, 
true, false, false, 2000, true, true);
+insert into sys.functions values (932, 'peak_next_value_for', 
'peak_next_value', 'sql', 0, 1, false, false, false, 2000, true, true);
 insert into sys.args values (43924, 932, 'res_0', 'bigint', 64, 0, 0, 0);
 insert into sys.args values (43925, 932, 'arg_1', 'clob', 0, 0, 1, 1);
 insert into sys.args values (43926, 932, 'arg_2', 'clob', 0, 0, 1, 2);
-insert into sys.args values (43927, 932, 'arg_3', 'bigint', 64, 0, 1, 3);
-insert into sys.functions values (933, 'index', 'index', 'sql', 0, 1, false, 
false, false, 2000, true, true);
-insert into sys.args values (43928, 933, 'res_0', 'tinyint', 8, 0, 0, 0);
-insert into sys.args values (43929, 933, 'arg_1', 'clob', 0, 0, 1, 1);
-insert into sys.args values (43930, 933, 'arg_2', 'boolean', 1, 0, 1, 2);
+insert into sys.functions values (933, 'restart', 'restart', 'sql', 0, 1, 
true, false, false, 2000, true, true);
+insert into sys.args values (43927, 933, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43928, 933, 'arg_1', 'clob', 0, 0, 1, 1);
+insert into sys.args values (43929, 933, 'arg_2', 'clob', 0, 0, 1, 2);
+insert into sys.args values (43930, 933, 'arg_3', 'bigint', 64, 0, 1, 3);
 insert into sys.functions va

MonetDB: string_imprints - Merge with default

2021-04-07 Thread Panagiotis Koutsourakis
Changeset: 0ce20141e77a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0ce20141e77a
Modified Files:
gdk/CMakeLists.txt
gdk/gdk.h
gdk/gdk_private.h
gdk/gdk_strimps.c
monetdb5/modules/mal/01_calc.mal
monetdb5/modules/mal/batExtensions.c
monetdb5/modules/mal/batcalc.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 418839 to 300 lines):

diff --git a/.github/ISSUE_TEMPLATE/bug_report.md 
b/.github/ISSUE_TEMPLATE/bug_report.md
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -11,9 +11,9 @@ assignees: ''
 A clear and concise description of what the bug is.
 
 **To Reproduce**
-Create a setting with minimal input for an external user to demonstrate him 
the buggy behavior.
-This includes the relevant part of the database  schema description.
-Performance trace of the roque query (using the TRACE command)
+Create a setting with minimal input for an external user to demonstrate the 
buggy behavior.
+This includes the relevant part of the database schema description.
+Performance trace of the rogue query (using the TRACE command)
 
 **Expected behavior**
 A clear and concise description of what you expected to happen.
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -798,3 +798,5 @@ 929f5e280bc1532a2bfaab127ca7915dc3b69a33
 742b7847cfdcea39a6c19ab29eb35471d46bb2bb Oct2020_SP2_release
 17d27ad30941c81e4bc700300912e84e9b9a8c37 Oct2020_13
 17d27ad30941c81e4bc700300912e84e9b9a8c37 Oct2020_SP3_release
+6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_15
+6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_SP4_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP3/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP4/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -302,8 +302,8 @@ This package contains the files needed t
 Summary: MonetDB ODBC driver
 Group: Applications/Databases
 Requires: %{name}-client%{?_isa} = %{version}-%{release}
-Requires(post): unixODBC
-Requires(postun): unixODBC
+Requires(post): %{_bindir}/odbcinst
+Requires(postun): %{_bindir}/odbcinst
 
 %description client-odbc
 MonetDB is a database management system that is developed from a
@@ -828,6 +828,48 @@ else
 fi
 
 %changelog
+* Fri Apr 02 2021 Sjoerd Mullender  - 11.39.15-20210402
+- Rebuilt.
+- GH#6786: function json.isvalid(js json) is not useful, could be removed
+- GH#7016: Database crashes when use similarity function on a table with
+  more than 200k records
+- GH#7037: Clearer err msg for ALTER USER with insufficient privileges
+- GH#7042: AddressSanitizer:DEADLYSIGNAL in Oct2020/gdk/gdk_tracer.c:494
+- GH#7050: file descriptor leak when forward=redirect
+- GH#7057: ODBC driver installer on Windows is missing some DLLs
+- GH#7058: MonetDBe: COPY INTO csv file does not produce any output
+- GH#7059: MonetDBe: 'reverse' C UDF crashes
+- GH#7061: Have bulk load support combined gzip files
+- GH#7064: Temporary hashes created in hash and unique logic should try to
+  use transient data farm first
+- GH#7066: percent_rank function with wrong results
+- GH#7070: double free error when running MonetDBe Example
+- GH#7076: mserver5 ignores memory.low from cgroups v2
+- GH#7077: Oct2020: new default privileges not effectively communicated
+- GH#7083: MonetDBe C++ Compiling Error
+- GH#7085: Mitosis and filter functions
+- GH#7087: SIGSEGV caused by error in subquery's function being ignored by
+  top-level query
+- GH#7089: Data consistency problem of query results in the latest release
+  of Monetdb (Remote Table)
+
+* Wed Mar 31 2021 Sjoerd Mullender  - 11.39.15-20210402
+- odbc: When connecting using a DSN (Data Source Name), information about the
+  data source is retrieved from the ODBC.INI file.  Now we also get the
+  location of the LOGFILE from this file.  The logfile can be used to
+  log all calls to the MonetDB ODBC driver to a file which can be used
+  for debugging.
+
+* Thu Mar 25 2021 Sjoerd Mullender  - 11.39.15-20210402
+- odbc: The ODBC driver now only passes on information about HUGEINT columns
+  as HUGEINT when the application has indicated interest by querying
+  about the SQL_HUGEINT extension type using the SQLGetTypeInfo
+  function or by specifying the type in a call to SQLSetDescField.
+  Otherwise the driver silently translates the HUGEINT type to BIGINT.
+  This means that most application will see BIGINT columns when the
+  server produced a HUGEINT column and only give an error if the value
+  in the HUGEINT column didn't fit into a BIGINT.
+
 * Thu Feb 11 2021 Sjoerd Mullender  - 11.39.13-20

MonetDB: string_imprints - Merge with default

2021-04-22 Thread Panagiotis Koutsourakis
Changeset: 0f94f85f07bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0f94f85f07bf
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 889 to 300 lines):

diff --git a/documentation/index.rst b/documentation/index.rst
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -16,6 +16,9 @@ Welcome to MonetDB's documentation!
monetdbe/examples
monetdbe/installation
monetdbe/monetdbe_api
+   monetdbe/manual_pages/monetdbe_open
+   monetdbe/manual_pages/monetdbe_options
+   monetdbe/manual_pages/monetdbe_remote
source/intro
source/build
source/build-fedora
diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -177,6 +177,7 @@ gdk_export oid canditer_last(const struc
 gdk_export oid canditer_prev(struct canditer *ci);
 gdk_export oid canditer_peekprev(struct canditer *ci);
 gdk_export oid canditer_idx(const struct canditer *ci, BUN p);
+#define canditer_idx_dense(ci, p) ((p >= (ci)->ncand)?oid_nil:((ci)->seq + p))
 gdk_export void canditer_setidx(struct canditer *ci, BUN p);
 gdk_export void canditer_reset(struct canditer *ci);
 gdk_export BUN canditer_search(const struct canditer *ci, oid o, bool next);
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -20,6 +20,57 @@
  * hseqbase + its batCount.
  */
 
+#define project1_loop(TYPE)\
+static gdk_return  \
+project1_##TYPE(BAT *restrict bn, BAT *restrict l, BAT *restrict r1)   \
+{  \
+   BUN lo, hi; \
+   const TYPE *restrict r1t;   \
+   TYPE *restrict bt;  \
+   oid r1seq, r1end;   \
+   \
+   MT_thread_setalgorithm(__func__);   \
+   r1t = (const TYPE *) Tloc(r1, 0);   \
+   bt = (TYPE *) Tloc(bn, 0);  \
+   r1seq = r1->hseqbase;   \
+   r1end = r1seq + BATcount(r1);   \
+   if (BATtdense(l)) { \
+   if (l->tseqbase < r1seq ||  \
+  (l->tseqbase+BATcount(l)) >= r1end) {\
+   GDKerror("does not match always\n");\
+   return GDK_FAIL;\
+   }   \
+   oid off = l->tseqbase - r1seq;  \
+   r1t += off; \
+   for (lo = 0, hi = BATcount(l); lo < hi; lo++)   \
+   bt[lo] = r1t[lo];   \
+   } else {\
+   const oid *restrict ot = (const oid *) Tloc(l, 0);  \
+   for (lo = 0, hi = BATcount(l); lo < hi; lo++) { \
+   oid o = ot[lo]; \
+   if (o < r1seq || o >= r1end) {  \
+   GDKerror("does not match always\n");\
+   return GDK_FAIL;\
+   }   \
+   bt[lo] = r1t[o - r1seq];\
+   }   \
+   }   \
+   BATsetcount(bn, lo);\
+   return GDK_SUCCEED; \
+}
+
+/* project type switch */
+project1_loop(bte)
+project1_loop(sht)
+project1_loop(int)
+project1_loop(flt)
+project1_loop(dbl)
+project1_loop(lng)
+#ifdef HAVE_HGE
+project1_loop(hge)
+#endif
+project1_loop(uuid)
+
 #define project_loop(TYPE) \
 static gdk_return  \
 project_##TYPE(BAT *restrict bn, BAT *restrict l,  \
@@ -34,6 +85,8 @@ project_##TYPE(BAT *restrict bn, BAT *re
oid r1seq, r1end;   \
oid r2seq, r2end;   \
\
+   if ((!ci || ci->tpe == cand_dense) && l->tnonil && !r2) \
+   return project1_##TYPE(bn, l, r1);  \
MT_thr

MonetDB: string_imprints - Merge with default

2021-06-01 Thread Panagiotis Koutsourakis
Changeset: 2925f445b591 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2925f445b591
Modified Files:
gdk/gdk.h
gdk/gdk_private.h
monetdb5/modules/mal/batExtensions.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 38215 to 300 lines):

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 11.40.0
+current_version = 11.42.0
 commit = False
 tag = False
 
diff --git a/.github/lock.yml b/.github/lock.yml
new file mode 100644
--- /dev/null
+++ b/.github/lock.yml
@@ -0,0 +1,38 @@
+# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
+
+# Number of days of inactivity before a closed issue or pull request is locked
+daysUntilLock: 20
+
+# Skip issues and pull requests created before a given timestamp. Timestamp 
must
+# follow ISO 8601 (`-MM-DD`). Set to `false` to disable
+skipCreatedBefore: false
+
+# Issues and pull requests with these labels will be ignored. Set to `[]` to 
disable
+exemptLabels: []
+
+# Label to add before locking, such as `outdated`. Set to `false` to disable
+lockLabel: false
+
+# Comment to post before locking. Set to `false` to disable
+lockComment: >
+  This thread has been automatically locked since there has not been
+  any recent activity after it was closed. Please open a new issue for
+  related bugs.
+
+# Assign `resolved` as the reason for locking. Set to `false` to disable
+setLockReason: false
+
+# Limit to only `issues` or `pulls`
+# only: issues
+
+# Optionally, specify configuration settings just for `issues` or `pulls`
+# issues:
+#   exemptLabels:
+# - help-wanted
+#   lockLabel: outdated
+
+# pulls:
+#   daysUntilLock: 30
+
+# Repository to extend settings from
+# _extends: repo
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -800,3 +800,4 @@ 17d27ad30941c81e4bc700300912e84e9b9a8c37
 17d27ad30941c81e4bc700300912e84e9b9a8c37 Oct2020_SP3_release
 6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_15
 6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_SP4_release
+02fd591b7d3311d566007e1bfb0c59682b17f12c Jul2021_root
diff --git a/ChangeLog b/ChangeLog.Jul2021
copy from ChangeLog
copy to ChangeLog.Jul2021
--- a/ChangeLog
+++ b/ChangeLog.Jul2021
@@ -1,3 +1,6 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Thu Apr 15 2021 svetlin 
+- preserve in query comments
+
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1,5 +1,5 @@
 %global name MonetDB
-%global version 11.40.0
+%global version 11.42.0
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
@@ -523,7 +523,6 @@ exit 0
 %attr(2770,monetdb,monetdb) %dir %{_localstatedir}/monetdb5
 %attr(2770,monetdb,monetdb) %dir %{_localstatedir}/monetdb5/dbfarm
 %{_bindir}/mserver5
-%exclude %{_bindir}/stethoscope
 %{_libdir}/libmonetdb5.so.*
 %{_libdir}/libmonetdbsql.so*
 %dir %{_libdir}/monetdb5
diff --git a/NT/ChangeLog.Oct2020 b/NT/ChangeLog.Oct2020
new file mode 100644
--- /dev/null
+++ b/NT/ChangeLog.Oct2020
@@ -0,0 +1,6 @@
+# ChangeLog file for NT
+# This file is updated with Maddlog
+
+* Fri Apr 23 2021 Sjoerd Mullender 
+- Added the monetdbe library to the Windows installer.
+
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -143,6 +143,7 @@ def main():
r'bin\bat.dll',
r'bin\mapi.dll',
r'bin\monetdb5.dll',
+   r'bin\monetdbe.dll',
r'bin\monetdbsql.dll',
r'bin\stream.dll',
vcpkg.format(r'bin\iconv-2.dll'),
@@ -198,6 +199,7 @@ def main():
   [r'lib\bat.lib',
r'lib\mapi.lib',
r'lib\monetdb5.lib',
+   r'lib\monetdbe.lib',
r'lib\monetdbsql.lib',
r'lib\stream.lib',
vcpkg.format(r'lib\iconv.lib'),
diff --git a/clients/ChangeLog b/clients/ChangeLog.Jul2021
copy from clients/ChangeLog
copy to clients/ChangeLog.Jul2021
diff --git a/clients/NT/stethoscope.bat b/clients/NT/stethoscope.bat
deleted file mode 100755
--- a/clients/NT/stethoscope.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@REM This Source Code Form is subject to the terms of the Mozilla Public
-@REM License, v. 2.0.  If a copy of the MPL was not distributed with this
-@REM file, You can obtain one at http://mozilla.org/MPL/2.0/.
-@REM
-@REM Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
-
-@echo off
-rem figure out the folder name
-set MONETDB=%~dp0
-
-rem remove the final backslash from the path
-set MONETDB=%MONETDB:~0,-1%
-
-rem extend the search path with our EXE and DLL folders
-set PATH=%MONETDB%\bin;%MONETDB%\lib\monetdb5;%PATH%
-
-rem start the real client
-"%MONETDB%\bin\stethoscope.exe" %1 %2 %3 %4 %5 %6 %7 %8
-
-if ERRORLEVEL 1 pause
diff --git a/clients/Tests/MAL-signatures.stable.out 
b/client

MonetDB: string_imprints - Merge with default

2021-06-01 Thread Panagiotis Koutsourakis
Changeset: 4c01bfaad34b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4c01bfaad34b
Modified Files:
gdk/CMakeLists.txt
gdk/gdk.h
gdk/gdk_private.h
monetdb5/modules/mal/batExtensions.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 162895 to 300 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -47,6 +47,7 @@ tags
 *.pyo
 *.rej
 *.orig
+compile_commands.json
 
 # package building on Mac OS X
 MacOSX/build
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -801,3 +801,5 @@ 17d27ad30941c81e4bc700300912e84e9b9a8c37
 6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_15
 6b71a8cc3498561815ac88d6c652922359efd13a Oct2020_SP4_release
 02fd591b7d3311d566007e1bfb0c59682b17f12c Jul2021_root
+5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_17
+5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_SP5_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP4/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP5/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -196,6 +196,7 @@ functionality of MonetDB.
 %files devel
 %defattr(-,root,root)
 %dir %{_includedir}/monetdb
+%{_includedir}/monetdb/copybinary.h
 %{_includedir}/monetdb/gdk*.h
 %{_includedir}/monetdb/matomic.h
 %{_includedir}/monetdb/mstring.h
@@ -628,6 +629,7 @@ This package contains files needed to de
 %package embedded
 Summary: MonetDB as an embedded library
 Group: Applications/Databases
+Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
 
 %description embedded
 MonetDB is a database management system that is developed from a
@@ -636,7 +638,8 @@ automatic index management, extensibilit
 accelerators.  It also has an SQL front end.
 
 This package contains the library to turn MonetDB into an embeddable
-library.  Also see %{name}-embedded-devel to use this in a program.
+library, also known as MonetDBe.  Also see %{name}-embedded-devel to
+use this in a program.
 
 %files embedded
 %{_libdir}/libmonetdbe.so.*
@@ -662,6 +665,24 @@ program that uses MonetDB as an embeddab
 %{_includedir}/monetdb/monetdbe.h
 %{_libdir}/pkgconfig/monetdbe.pc
 
+%package embedded-tests
+Summary: MonetDBe tests package
+Group: Applications/Databases
+Requires: %{name}-embedded%{?_isa} = %{version}-%{release}
+
+%description embedded-tests
+MonetDB is a database management system that is developed from a
+main-memory perspective with use of a fully decomposed storage model,
+automatic index management, extensibility of data types and search
+accelerators.  It also has an SQL front end.
+
+This package contains some test programs using the %{name}-embedded
+package.  You probably don't need this, unless you are a developer.
+
+%files embedded-tests
+%defattr(-,root,root)
+%{_bindir}/example_proxy
+
 %package testing-python
 Summary: MonetDB - Monet Database Management System
 Group: Applications/Databases
@@ -827,6 +848,40 @@ else
 fi
 
 %changelog
+* Mon May 03 2021 Sjoerd Mullender  - 11.39.17-20210503
+- Rebuilt.
+- GH#3336: DB files not removed if all rows are deleted, even after restart
+- GH#7104: Monetdbe NTILE function does not produce correct ordering
+- GH#7108: Monetdb crashes on query execution
+- GH#7109: MERGE Statement incorrectly reports that input relation matches
+  multiple rows
+- GH#7110: Monetdb Query parsing consistency issues in the latest release
+  (Remote Table)
+
+* Mon May  3 2021 Sjoerd Mullender  - 11.39.17-20210503
+- gdk: A bug that would very occasionally produce an error "strPut: incorrectly
+  encoded UTF-8", even when no incorrectly coded characters are used
+  at all, has been fixed.  It was the result of a rare combination of
+  strings having been added to the column that caused essentially an
+  off-by-one type of error to occur.
+
+* Mon May  3 2021 Sjoerd Mullender  - 11.39.17-20210503
+- merovingian: When stopping monetdbd using the `monetdbd stop' command, this 
command
+  now waits for 5 seconds longer than the exittimeout value before it
+  kills the monetdbd daemon instead of only 30 seconds total (or until
+  that daemon stops earlier).  This gives the daemon enough time to
+  terminate the mserver5 processes that it is managing.  If exittimeout
+  is negative, the daemon and the monetdbd process initiating the stop
+  wait indefinitely until the mserver5 processes have stopped.
+
+* Mon May  3 2021 Sjoerd Mullender  - 11.39.17-20210503
+- sql: A bug where a sequence of TRUNCATE TABLE and COPY INTO the just
+  truncated table would result in success being reported to both queries,
+  but the table still being empty afterwards, has been fixed.
+

MonetDB: string_imprints - Merge with default

2021-07-01 Thread Panagiotis Koutsourakis
Changeset: 80f037721006 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80f037721006
Modified Files:
gdk/gdk_private.h
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 5721 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -541,8 +541,8 @@ gdk_return log_bat_transient(logger *lg,
 gdk_return log_constant(logger *lg, int type, ptr val, log_id id, lng offset, 
lng cnt);
 gdk_return log_delta(logger *lg, BAT *uid, BAT *uval, log_id id);
 gdk_return log_sequence(logger *lg, int seq, lng id);
-gdk_return log_tend(logger *lg);
-gdk_return log_tstart(logger *lg, ulng commit_ts, bool flush);
+gdk_return log_tend(logger *lg, ulng commit_ts);
+gdk_return log_tstart(logger *lg, bool flush);
 gdk_return logger_activate(logger *lg);
 lng logger_changes(logger *lg);
 logger *logger_create(int debug, const char *fn, const char *logdir, int 
version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp, void 
*funcdata);
@@ -761,6 +761,7 @@ void MCcloseClient(Client c);
 Client MCforkClient(Client father);
 Client MCgetClient(int id);
 Client MCinitClient(oid user, bstream *fin, stream *fout);
+size_t MCmemoryClaim(void);
 int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt);
 void MCstopClients(Client c);
 str MCsuspendClient(int id);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -809,12 +809,12 @@ COLcopy(BAT *b, int tt, bool writable, r
 
/* first try case (1); create a view, possibly with different
 * atom-types */
-   if (role == b->batRole &&
+   if (!writable &&
+   role == b->batRole &&
b->batRestricted == BAT_READ &&
ATOMstorage(b->ttype) != TYPE_msk && /* no view on TYPE_msk */
(!VIEWtparent(b) ||
-BBP_cache(VIEWtparent(b))->batRestricted == BAT_READ) &&
-   !writable) {
+BBP_cache(VIEWtparent(b))->batRestricted == BAT_READ)) {
bn = VIEWcreate(b->hseqbase, b);
if (bn == NULL)
return NULL;
@@ -875,8 +875,8 @@ COLcopy(BAT *b, int tt, bool writable, r
strconcat_len(thp.filename, sizeof(thp.filename),
  BBP_physical(bn->batCacheid),
  ".theap", NULL);
-   if ((b->ttype && HEAPcopy(&bthp, b->theap) != 
GDK_SUCCEED) ||
-   (bn->tvheap && HEAPcopy(&thp, b->tvheap) != 
GDK_SUCCEED)) {
+   if ((b->ttype && HEAPcopy(&bthp, b->theap, b->tbaseoff 
<< b->tshift) != GDK_SUCCEED) ||
+   (bn->tvheap && HEAPcopy(&thp, b->tvheap, 0) != 
GDK_SUCCEED)) {
HEAPfree(&thp, true);
HEAPfree(&bthp, true);
BBPreclaim(bn);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -32,7 +32,7 @@ unshare_varsized_heap(BAT *b)
h->farmid = BBPselectfarm(b->batRole, TYPE_str, varheap);
strconcat_len(h->filename, sizeof(h->filename),
  BBP_physical(b->batCacheid), ".theap", NULL);
-   if (HEAPcopy(h, b->tvheap) != GDK_SUCCEED) {
+   if (HEAPcopy(h, b->tvheap, 0) != GDK_SUCCEED) {
HEAPfree(h, true);
GDKfree(h);
return GDK_FAIL;
@@ -496,7 +496,7 @@ append_varsized_bat(BAT *b, BAT *n, stru
h->farmid = BBPselectfarm(b->batRole, b->ttype, varheap);
strconcat_len(h->filename, sizeof(h->filename),
  BBP_physical(b->batCacheid), ".theap", NULL);
-   if (HEAPcopy(h, b->tvheap) != GDK_SUCCEED) {
+   if (HEAPcopy(h, b->tvheap, 0) != GDK_SUCCEED) {
HEAPfree(h, true);
GDKfree(h);
return GDK_FAIL;
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -453,41 +453,43 @@ rev(oid x)
return x;
 }
 
-/* population count: count number of 1 bits in a value */
-static inline int
-pop(oid x)
+/* count trailing zeros, also see candmask_lobit in gdk_cand.h */
+static inline int __attribute__((__const__))
+ctz(oid x)
 {
-#ifdef __GNUC__
+#if defined(__GNUC__)
 #if SIZEOF_OID == SIZEOF_INT
-   return __builtin_popcount(x);
+   return __builtin_ctz(x);
 #else
-   return __builtin_popcountl(x);
+   return __builtin_ctzl(x);
 #endif
-#else
-#ifdef _MSC_VER
+#elif defined(_MSC_VER)
 #if SIZEOF_OID == SIZEOF_INT
-   return (int) __popcnt((unsigned int) (x));
-#else
-   return (int) __popcnt64((unsigned __int64) (x));
-#endif
+   unsigned long idx;
+   if (_BitScanForward(&idx, (unsigned 

MonetDB: string_imprints - Merge with default

2021-07-01 Thread Panagiotis Koutsourakis
Changeset: cffe5ff7bdad for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cffe5ff7bdad
Modified Files:
gdk/gdk.h
gdk/gdk_private.h
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 125754 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -5752,7 +5752,7 @@ stdout of test 'MAL-signatures` in direc
 [ "batcalc",   "timestamp","pattern batcalc.timestamp(X_0:bat[:timestamp], 
X_1:bat[:oid], X_2:int):bat[:timestamp] ",  "timestamp_2time_timestamp;",   
""  ]
 [ "batcalc",   "uuid", "command batcalc.uuid(X_0:bat[:str], 
X_1:bat[:oid]):bat[:uuid] ",   "UUIDstr2uuid_bulk;",   ""  ]
 [ "batcalc",   "uuid", "command batcalc.uuid(X_0:bat[:uuid], 
X_1:bat[:oid]):bat[:uuid] ",  "UUIDuuid2uuid_bulk;",  ""  ]
-[ "batcalc",   "wkb",  "command batcalc.wkb(X_0:bat[:wkb], X_1:int, 
X_2:int):bat[:wkb] ",  "geom_2_geom_bat;", ""  ]
+[ "batcalc",   "wkb",  "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid], 
X_2:int, X_3:int):bat[:wkb] ",   "geom_2_geom_bat;", ""  ]
 [ "batcalc",   "xml",  "command batcalc.xml(X_0:bat[:str]):bat[:xml] ",
"BATXMLstr2xml;",   ""  ]
 [ "batcalc",   "xor",  "pattern batcalc.xor(X_0:bat[:bit], 
X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;",   ""  ]
 [ "batcalc",   "xor",  "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit], 
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ",   "CMDbatXOR;",   ""  ]
@@ -9208,7 +9208,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",   "analyze",  "unsafe pattern sql.analyze(X_0:int, X_1:lng, 
X_2:str, X_3:str):void ", "sql_analyze;", ""  ]
 [ "sql",   "analyze",  "unsafe pattern sql.analyze(X_0:int, X_1:lng, 
X_2:str, X_3:str, X_4:str):void ","sql_analyze;", ""  ]
 [ "sql",   "any",  "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ",  
"SQLany_cmp;",  ""  ]
-[ "sql",   "append",   "pattern sql.append(X_0:int, X_1:str, X_2:str, 
X_3:str, X_4:lng, X_5:any):int ","mvc_append_wrap;", ""  ]
+[ "sql",   "append",   "pattern sql.append(X_0:int, X_1:str, X_2:str, 
X_3:str, X_4:bat[:oid], X_5:any):int ",  "mvc_append_wrap;", ""  ]
 [ "sql",   "argRecord","pattern sql.argRecord():str ", 
"SQLargRecord;",""  ]
 [ "sql",   "argRecord","pattern sql.argRecord(X_0:any...):str ",   
"SQLargRecord;",""  ]
 [ "sql",   "assert",   "pattern sql.assert(X_0:bit, X_1:str):void ",   
"SQLassert;",   ""  ]
@@ -9232,7 +9232,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",   "bind_idxbat",  "pattern sql.bind_idxbat(X_0:int, X_1:str, 
X_2:str, X_3:str, X_4:int):bat[:any_1] ","mvc_bind_idxbat_wrap;","" 
 ]
 [ "sql",   "bind_idxbat",  "pattern sql.bind_idxbat(X_0:int, X_1:str, 
X_2:str, X_3:str, X_4:int, X_5:int, X_6:int) (X_7:bat[:oid], X_8:bat[:any_1]) 
", "mvc_bind_idxbat_wrap;",""  ]
 [ "sql",   "bind_idxbat",  "pattern sql.bind_idxbat(X_0:int, X_1:str, 
X_2:str, X_3:str, X_4:int, X_5:int, X_6:int):bat[:any_1] ",  
"mvc_bind_idxbat_wrap;",""  ]
-[ "sql",   "claim","unsafe pattern sql.claim(X_0:int, X_1:str, 
X_2:str, X_3:lng):lng ","mvc_claim_wrap;",  ""  ]
+[ "sql",   "claim","unsafe pattern sql.claim(X_0:int, X_1:str, 
X_2:str, X_3:lng):bat[:oid] ",  "mvc_claim_wrap;",  ""  ]
 [ "sql",   "clear_table",  "unsafe pattern sql.clear_table(X_0:str, 
X_1:str):lng ","mvc_clear_table_wrap;",""  ]
 [ "sql",   "commit",   "unsafe pattern sql.commit():void ",
"SQLcommit;",   ""  ]
 [ "sql",   "copy_from","unsafe pattern sql.copy_from(X_0:ptr, X_1:str, 
X_2:str, X_3:str, X_4:str, X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, 
X_10:int, X_11:int):bat[:any]... ", "mvc_import_table_wrap;",   ""  
]
@@ -9244,6 +9244,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",   "corr", "pattern sql.corr(X_0:int, X_1:int, X_2:bit, X_3:bit, 
X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", ""  ]
 [ "sql",   "corr", "pattern sql.corr(X_0:lng, X_1:lng, X_2:bit, X_3:bit, 
X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", ""  ]
 [ "sql",   "corr", "pattern sql.corr(X_0:sht, X_1:sht, X_2:bit, X_3:bit, 
X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", ""  ]
+[ "sql",   "count","pattern sql.count(X_0:str, X_1:str):lng ", 
"SQLbasecount;",""  ]
 [ "sql",   "count","pattern sql.count(X_0:any_1, X_1:bit, X_2:bit, 
X_3:bit, X_4:int, X_5:oid, X_6:oid):lng ",  "SQLcount;",""  ]
 [ "sql",   "covariance",   "pattern sql.covariance(X_0:bte, X_1:bte, 
X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):dbl ",   "SQLcovar_samp;",   
""  ]
 [ "sql",   "covariance",   "patt

MonetDB: string_imprints - Merge with default

2021-08-05 Thread Panagiotis Koutsourakis
Changeset: efdf0bcb0089 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/efdf0bcb0089
Modified Files:
gdk/gdk.h
gdk/gdk_private.h
monetdb5/modules/mal/CMakeLists.txt
monetdb5/modules/mal/batExtensions.c
sql/backends/monet5/CMakeLists.txt
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 101160 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -803,3 +803,11 @@ 6b71a8cc3498561815ac88d6c652922359efd13a
 02fd591b7d3311d566007e1bfb0c59682b17f12c Jul2021_root
 5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_17
 5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_SP5_release
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_1
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_release
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_3
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_release
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_release
+9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_5
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_release
+9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_release
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ set(CMAKE_FIND_APPBUNDLE LAST)
 include(CheckCSourceCompiles REQUIRED)
 include(CheckCCompilerFlag REQUIRED)
 include(CheckIncludeFile REQUIRED)
+include(CheckIncludeFiles REQUIRED)
 include(CMakePushCheckState REQUIRED)
 include(CheckStructHasMember REQUIRED)
 include(CheckSymbolExists REQUIRED)
@@ -76,7 +77,6 @@ if(NOT HAVE_SYS_SOCKET_H)
 endif()
 set(CMAKE_REQUIRED_INCLUDES "/usr/include")
 
-monetdb_configure_crypto()
 monetdb_configure_sizes()
 
 include(GNUInstallDirs)
diff --git a/ChangeLog.Jul2021 b/ChangeLog.Jul2021
--- a/ChangeLog.Jul2021
+++ b/ChangeLog.Jul2021
@@ -1,6 +1,3 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
-* Thu Apr 15 2021 svetlin 
-- preserve in query comments
-
diff --git a/ChangeLog.Oct2020 b/ChangeLog.Oct2020
deleted file mode 100644
--- a/ChangeLog.Oct2020
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for devel
-# This file is updated with Maddlog
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP5/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jul2021/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -119,18 +119,11 @@ BuildRequires: pkgconfig(libcurl)
 BuildRequires: pkgconfig(liblzma)
 BuildRequires: pkgconfig(uuid)
 BuildRequires: pkgconfig(libxml-2.0)
-BuildRequires: pkgconfig(openssl)
 %if %{with pcre}
 BuildRequires: pkgconfig(libpcre) >= 4.5
 %endif
 BuildRequires: pkgconfig(zlib)
-%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7
-# not on RHEL 7
 BuildRequires: pkgconfig(liblz4) >= 1.8
-%global LZ4 ON
-%else
-%global LZ4 OFF
-%endif
 %if %{with py3integration}
 BuildRequires: pkgconfig(python3) >= 3.5
 BuildRequires: python3-numpy
@@ -281,7 +274,6 @@ Summary: MonetDB - Monet Database Manage
 Group: Applications/Databases
 Requires: %{name}-client%{?_isa} = %{version}-%{release}
 Requires: %{name}-stream-devel%{?_isa} = %{version}-%{release}
-Requires: openssl-devel
 
 %description client-devel
 MonetDB is a database management system that is developed from a
@@ -350,6 +342,10 @@ Recommends: php-monetdb >= 1.0
 %endif
 Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
 Requires: python3-pymonetdb >= 1.0.6
+%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7
+Recommends: python3dist(lz4)
+Recommends: python3dist(scipy)
+%endif
 
 %description client-tests
 MonetDB is a database management system that is developed from a
@@ -794,9 +790,8 @@ fi
-DTESTING=ON \
-DWITH_BZ2=ON \
-DWITH_CMOCKA=OFF \
-   -DWITH_CRYPTO=ON \
-DWITH_CURL=ON \
-   -DWITH_LZ4=%{LZ4} \
+   -DWITH_LZ4=ON \
-DWITH_LZMA=ON \
-DWITH_PCRE=ON \
-DWITH_PROJ=OFF \
@@ -848,6 +843,249 @@ else
 fi
 
 %changelog
+* Tue Aug 03 2021 Sjoerd Mullender  - 11.41.5-20210803
+- Rebuilt.
+- GH#7161: fix priority
+
+* Tue Aug  3 2021 Sjoerd Mullender  - 11.41.5-20210803
+- gdk: A bug in the grouping code has been fixed.
+
+* Tue Aug  3 2021 Sjoerd Mullender  - 11.41.5-20210803
+- sql: The system view sys.ids has been updated to include some more system
+  IDs.
+
+* Fri Jul 30 2021 Sjoerd Mullender  - 11.41.3-20210730
+- Rebuilt.
+
+* Fri Jul 30 2021 Sjoerd Mullender  - 11.41.3-20210730
+- gdk: Hash indexes are no longer maintained at all cost: if the number of
+  distinct values is too small compared to the total number of values,
+  the index is dropped instead of being maintained during updates.
+
+* Fri Jul 30 2021 Sjoerd M

MonetDB: string_imprints - Merge with default

2021-08-13 Thread Panagiotis Koutsourakis
Changeset: 129da86e9686 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/129da86e9686
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_private.h
monetdb5/modules/mal/batExtensions.c
sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 126951 to 300 lines):

diff --git a/clients/ChangeLog b/clients/ChangeLog
--- a/clients/ChangeLog
+++ b/clients/ChangeLog
@@ -1,3 +1,10 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Aug 11 2021 Sjoerd Mullender 
+- A new output formatting mode was added to mclient.  Use -fcsv-noquote
+  to produce a CSV (comma-separated values) output where the quote
+  characters have not been escapes.  This can be useful when producing
+  a single column string output that should be saved as is, e.g. when
+  using the sys.dump_database() function.
+
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
@@ -344,7 +344,7 @@ void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(const Hash *h, const void *v);
 void HEAP_free(Heap *heap, var_t block);
-void HEAP_initialize(Heap *heap, size_t nbytes, size_t nprivate, int 
alignment);
+gdk_return HEAP_initialize(Heap *heap, size_t nbytes, size_t nprivate, int 
alignment);
 var_t HEAP_malloc(BAT *b, size_t nbytes);
 void HEAPdecref(Heap *h, bool remove);
 gdk_return HEAPextend(Heap *h, size_t size, bool mayshare) 
__attribute__((__warn_unused_result__));
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -204,6 +204,7 @@ The possible values are
 .BR expanded ,
 .BR x ,
 .BR csv ,
+.BR csv-noquote ,
 .BR tab ,
 .BR raw ,
 .BR xml ,
@@ -212,6 +213,8 @@ and
 .BR rowcount .
 .B csv
 is comma-separated values;
+.B csv-noquote
+is comma-separated values without escaping any quotes;
 .B tab
 is tab-separated values;
 .B raw
@@ -235,6 +238,10 @@ and
 is a variation on
 .B trash
 where only the number of affected rows is printed.
+Normal \fBcsv\fP and \fBtab\fP formatting will use double quotes
+around any fields that contain double quotes, white space or the
+separator.  The \fBcsv-noquote\fP format will prevent that and dump
+the contents of the field without any interpretation.
 In addition to plain \fBcsv\fP, two other forms are possible.
 \fBcsv=\fP\fIc\fP uses \fIc\fP as column separator; \fBcsv+\fP\fIc\fP
 uses \fIc\fP as column separator and produces a single header line in
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -95,6 +95,7 @@ enum formatters {
 static enum formatters formatter = NOformatter;
 char *separator = NULL;/* column separator for CSV/TAB format 
*/
 bool csvheader = false;/* include header line in CSV format */
+bool noquote = false;  /* don't use quotes in CSV format */
 
 #define DEFWIDTH 80
 
@@ -942,7 +943,7 @@ CSVrenderer(MapiHdl hdl)
while (!mnstr_errnr(toConsole) && (fields = fetch_row(hdl)) != 0) {
for (i = 0; i < fields; i++) {
s = mapi_fetch_field(hdl, i);
-   if (s != NULL && s[strcspn(s, specials)] != '\0') {
+   if (!noquote && s != NULL && s[strcspn(s, specials)] != 
'\0') {
mnstr_printf(toConsole, "%s\"",
 i == 0 ? "" : separator);
while (*s) {
@@ -1647,6 +1648,7 @@ setFormatter(const char *s)
free(separator);
separator = NULL;
csvheader = false;
+   noquote = false;
 #ifdef _TWO_DIGIT_EXPONENT
if (formatter == TESTformatter)
_set_output_format(0);
@@ -1673,6 +1675,29 @@ setFormatter(const char *s)
} else
separator = strdup(s + 4);
csvheader = true;
+   } else if (strcmp(s, "csv-noquote") == 0) {
+   noquote = true;
+   formatter = CSVformatter;
+   separator = strdup(",");
+   } else if (strncmp(s, "csv-noquote=", 12) == 0) {
+   noquote = true;
+   formatter = CSVformatter;
+   if (s[12] == '"') {
+   separator = strdup(s + 13);
+   if (separator[strlen(separator) - 1] == '"')
+   separator[strlen(separator) - 1] = 0;
+   } else
+   separator = strdup(s + 12);
+   } else if (strncmp(s, "csv-noquote+", 12) == 0) {
+   noquote = true;
+   formatter = CSVformatter;
+   if (s[12] == '"') {
+   separator = strdup(s + 13);
+   if (separator[strlen(separator) - 1] == '"')
+   

MonetDB: string_imprints - Merge with default branch

2021-11-01 Thread Panagiotis Koutsourakis
Changeset: a7d6f1b2be59 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7d6f1b2be59
Branch: string_imprints
Log Message:

Merge with default branch


diffs (truncated from 560 to 300 lines):

diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -73,7 +73,7 @@
if (ngrp == maxgrps) {  \
/* we need to extend extents and histo bats, */ \
/* do it at most once */\
-   maxgrps = BATcount(b);  \
+   maxgrps = bi.count; \
if (extents) {  \
BATsetcount(en, ngrp);  \
if (BATextend(en, maxgrps) != GDK_SUCCEED) \
@@ -965,15 +965,13 @@ BATgroup_internal(BAT **groups, BAT **ex
/* byte-sized values, use 256 entry array to keep
 * track of doled out group ids; note that we can't
 * possibly have more than 256 groups, so the group id
-* fits in an unsigned char */
-   unsigned char *restrict bgrps = GDKmalloc(256);
-   const unsigned char *restrict w = (const unsigned char *) 
bi.base;
-   unsigned char v;
+* fits in an uint8_t */
+   uint8_t bgrps[256];
+   const uint8_t *restrict w = (const uint8_t *) bi.base;
+   uint8_t v;
 
algomsg = "byte-sized groups -- ";
-   if (bgrps == NULL)
-   goto error1;
-   memset(bgrps, 0xFF, 256);
+   memset(bgrps, 0xFF, sizeof(bgrps));
if (histo)
memset(cnts, 0, maxgrps * sizeof(lng));
ngrp = 0;
@@ -982,7 +980,7 @@ BATgroup_internal(BAT **groups, BAT **ex
oid o = canditer_next(&ci);
p = o - b->hseqbase;
if ((v = bgrps[w[p]]) == 0xFF && ngrp < 256) {
-   bgrps[w[p]] = v = (unsigned char) ngrp++;
+   bgrps[w[p]] = v = (uint8_t) ngrp++;
maxgrppos = r;
if (extents)
exts[v] = o;
@@ -995,20 +993,19 @@ BATgroup_internal(BAT **groups, BAT **ex
}
TIMEOUT_CHECK(timeoffset,
  GOTO_LABEL_TIMEOUT_HANDLER(error));
-   GDKfree(bgrps);
} else if (g == NULL && t == TYPE_sht) {
/* short-sized values, use 65536 entry array to keep
 * track of doled out group ids; note that we can't
 * possibly have more than 65536 groups, so the group
-* id fits in an unsigned short */
-   unsigned short *restrict sgrps = GDKmalloc(65536 * 
sizeof(short));
-   const unsigned short *restrict w = (const unsigned short *) 
bi.base;
-   unsigned short v;
+* id fits in an uint16_t */
+   uint16_t *restrict sgrps = GDKmalloc(65536 * sizeof(short));
+   const uint16_t *restrict w = (const uint16_t *) bi.base;
+   uint16_t v;
 
algomsg = "short-sized groups -- ";
if (sgrps == NULL)
goto error1;
-   memset(sgrps, 0xFF, 65536 * sizeof(short));
+   memset(sgrps, 0xFF, 65536 * sizeof(uint16_t));
if (histo)
memset(cnts, 0, maxgrps * sizeof(lng));
ngrp = 0;
@@ -1017,7 +1014,7 @@ BATgroup_internal(BAT **groups, BAT **ex
oid o = canditer_next(&ci);
p = o - b->hseqbase;
if ((v = sgrps[w[p]]) == 0x && ngrp < 65536) {
-   sgrps[w[p]] = v = (unsigned short) ngrp++;
+   sgrps[w[p]] = v = (uint16_t) ngrp++;
maxgrppos = r;
if (extents)
exts[v] = o;
@@ -1190,7 +1187,7 @@ BATgroup_internal(BAT **groups, BAT **ex
const bte *w = (bte *) bi.base;
GRP_create_partial_hash_table_core(
(void) 0,
-   (v = ((ulng)grps[r]<<8)|(unsigned 
char)w[p], hash_lng(hs, &v)),
+   (v = ((ulng)grps[r]<<8)|(uint8_t)w[p], 
hash_lng(hs, &v)),
w[p] == w[hb] && grps[r] == grps[q],
(void) 0,
NOGRPTST);
@@ -1207,7 +1204,7 @@ BATgroup_internal(BAT **groups, BAT **ex
cons