Changeset: 9d3a3c7dcdda for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9d3a3c7dcdda
Modified Files:
        MonetDB.spec
        sql/backends/monet5/sql.c
        sql/server/rel_optimizer.c
        sql/storage/bat/bat_storage.c
Branch: default
Log Message:

Merge with Jan2022 branch.


diffs (truncated from 88042 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -823,9 +823,7 @@ install -d -m 0775 %{buildroot}%{_rundir
 rm -f %{buildroot}%{_libdir}/*.la
 rm -f %{buildroot}%{_libdir}/monetdb5/*.la
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_opt_sql_append.so
-rm -f %{buildroot}%{_libdir}/monetdb5/run_*.mal
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_run_*.so
-rm -f %{buildroot}%{_libdir}/monetdb5/microbenchmark.mal
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_microbenchmark*.so
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_udf*.so
 rm -f %{buildroot}%{_bindir}/monetdb_mtest.sh
diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py
--- a/NT/mkodbcwxs.py
+++ b/NT/mkodbcwxs.py
@@ -45,7 +45,9 @@ def main():
         if vsdir is not None:
             vcdir = os.path.join(vsdir, 'VC')
     if vcdir is None:
-        if os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'):
+        if os.path.exists(r'C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC'):
+            vcdir = r'C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC'
+        elif os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'):
             vcdir = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'
         elif os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC'):
             vcdir = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC'
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -52,7 +52,9 @@ def main():
         if vsdir is not None:
             vcdir = os.path.join(vsdir, 'VC')
     if vcdir is None:
-        if os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'):
+        if os.path.exists(r'C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC'):
+            vcdir = r'C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC'
+        elif os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'):
             vcdir = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC'
         elif os.path.exists(r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC'):
             vcdir = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC'
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
@@ -9077,14 +9077,6 @@
 [ "netcdf",    "importvar",    "unsafe command netcdf.importvar(X_0:str, 
X_1:int):str ",       "NCDFimportVarStmt;",   "Import variable: compose create 
array string"  ]
 [ "netcdf",    "importvariable",       "unsafe pattern 
netcdf.importvariable(X_0:int, X_1:str):void ", "NCDFimportVariable;",  "Import 
variable: create array and load data from variable varname of file fileid"      
]
 [ "netcdf",    "test", "command netcdf.test(X_0:str):int ",    "NCDFtest;",    
"Returns number of variables in a given NetCDF dataset (file)"  ]
-[ "oltp",      "disable",      "unsafe pattern oltp.disable():void ",  
"OLTPdisable;", "Disable the OLTP delay monitor"        ]
-[ "oltp",      "enable",       "unsafe pattern oltp.enable():void ",   
"OLTPenable;",  "Enable the OLTP delay monitor" ]
-[ "oltp",      "init", "unsafe pattern oltp.init():void ",     "OLTPinit;",    
"Initialize the lock table"     ]
-[ "oltp",      "isenabled",    "unsafe command oltp.isenabled():int ", 
"OLTPis_enabled;",      "Query the OLTP state"  ]
-[ "oltp",      "lock", "unsafe pattern oltp.lock(X_0:int...):void ",   
"OLTPlock;",    "Wait for all write locks needed"       ]
-[ "oltp",      "release",      "unsafe pattern oltp.release(X_0:int...):void 
",        "OLTPrelease;", "Release for all write locks needed"    ]
-[ "oltp",      "reset",        "unsafe pattern oltp.reset():void ",    
"OLTPreset;",   "Reset the OLTP lock table"     ]
-[ "oltp",      "table",        "unsafe pattern oltp.table() 
(X_0:bat[:timestamp], X_1:bat[:str], X_2:bat[:int], X_3:bat[:int]) ",      
"OLTPtable;",   "Show status of lock table"     ]
 [ "optimizer", "aliases",      "pattern optimizer.aliases():str ",     
"OPTwrapper;",  ""      ]
 [ "optimizer", "aliases",      "pattern optimizer.aliases(X_0:str, 
X_1:str):str ",     "OPTwrapper;",  "Alias removal optimizer"       ]
 [ "optimizer", "bincopyfrom",  "pattern optimizer.bincopyfrom():str ", 
"OPTwrapper;",  ""      ]
@@ -9143,9 +9135,6 @@
 [ "optimizer", "multiplex",    "pattern optimizer.multiplex():str ",   
"OPTwrapper;",  ""      ]
 [ "optimizer", "multiplex",    "pattern optimizer.multiplex(X_0:str, 
X_1:str):str ",   "OPTwrapper;",  "Compiler for multiplexed instructions" ]
 [ "optimizer", "no_mitosis_pipe",      "function 
optimizer.no_mitosis_pipe():void;",   "",     ""      ]
-[ "optimizer", "oltp", "pattern optimizer.oltp():str ",        "OPTwrapper;",  
""      ]
-[ "optimizer", "oltp", "pattern optimizer.oltp(X_0:str, X_1:str):str ",        
"OPTwrapper;",  "Inject the OLTP locking primitives"    ]
-[ "optimizer", "oltp_pipe",    "function optimizer.oltp_pipe():void;", "",     
""      ]
 [ "optimizer", "optimize",     "pattern optimizer.optimize(X_0:str, 
X_1:str):void ",   "QOToptimize;", "Optimize a specific operation" ]
 [ "optimizer", "orcam",        "pattern optimizer.orcam(X_0:str, X_1:str):void 
",      "OPTorcam;",    "Inverse macro processor for current function"  ]
 [ "optimizer", "orcam",        "pattern optimizer.orcam(X_0:str, X_1:str, 
X_2:str, X_3:str):void ",    "OPTorcam;",    "Inverse macro, find pattern and 
replace with a function call." ]
@@ -9263,10 +9252,10 @@
 [ "sql",       "affectedRows", "unsafe pattern sql.affectedRows(X_0:int, 
X_1:lng):int ",       "mvc_affected_rows_wrap;",      "export the number of 
affected rows by the current query"       ]
 [ "sql",       "all",  "pattern sql.all(X_0:bit, X_1:bit, X_2:bit):bit ",      
"SQLall_cmp;",  "if !cmp then false, (nl or nr) then nil, else true"    ]
 [ "sql",       "alpha",        "command sql.alpha(X_0:dbl, X_1:dbl):dbl ",     
"SQLcst_alpha_cst;",    "Implementation of astronomy alpha function: expands 
the radius theta depending on the declination"     ]
-[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:int, 
X_1:lng):void ",   "sql_analyze;", ""      ]
-[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:int, X_1:lng, 
X_2:str):void ",  "sql_analyze;", ""      ]
-[ "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;", "Update the database 
statistics table"  ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze():void ",   
"sql_analyze;", "Update statistics for every column in the database"    ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str):void ",    
"sql_analyze;", "Update statistics for schema"  ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str, 
X_1:str):void ",   "sql_analyze;", "Update statistics for table"   ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str, X_1:str, 
X_2:str):void ",  "sql_analyze;", "Update statistics for column"  ]
 [ "sql",       "any",  "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ",      
"SQLany_cmp;",  "if cmp then true, (nl or nr) nil then nil, else false" ]
 [ "sql",       "append",       "pattern sql.append(X_0:int, X_1:str, X_2:str, 
X_3:str, X_4:oid, X_5:bat[:oid], X_6:any):int ", "mvc_append_wrap;",     
"Append to the column tname.cname (possibly optimized to replace the insert bat 
of tname.cname. Returns sequence number for order dependence."  ]
 [ "sql",       "argRecord",    "pattern sql.argRecord():str ", 
"SQLargRecord;",        "Glue together the calling sequence"    ]
@@ -9429,6 +9418,10 @@
 [ "sql",       "shutdown",     "unsafe pattern sql.shutdown(X_0:sht):str ",    
"SQLshutdown_wrap;",    ""      ]
 [ "sql",       "shutdown",     "unsafe pattern sql.shutdown(X_0:sht, 
X_1:bit):str ",   "SQLshutdown_wrap;",    ""      ]
 [ "sql",       "sql_variables",        "pattern sql.sql_variables() 
(X_0:bat[:str], X_1:bat[:str], X_2:bat[:str], X_3:bat[:str]) ",    
"sql_variables;",       "return the table with session variables"       ]
+[ "sql",       "statistics",   "pattern sql.statistics() (X_0:bat[:int], 
X_1:bat[:str], X_2:bat[:str], X_3:bat[:str], X_4:bat[:str], X_5:bat[:int], 
X_6:bat[:lng], X_7:bat[:bit], X_8:bat[:bit], X_9:bat[:str], X_10:bat[:str], 
X_11:bat[:bit], X_12:bat[:bit]) ",     "sql_statistics;",      "return a table 
with statistics information"    ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str) 
(X_1:bat[:int], X_2:bat[:str], X_3:bat[:str], X_4:bat[:str], X_5:bat[:str], 
X_6:bat[:int], X_7:bat[:lng], X_8:bat[:bit], X_9:bat[:bit], X_10:bat[:str], 
X_11:bat[:str], X_12:bat[:bit], X_13:bat[:bit]) ",     "sql_statistics;",      
"return a table with statistics information for a particular schema"    ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str, X_1:str) 
(X_2:bat[:int], X_3:bat[:str], X_4:bat[:str], X_5:bat[:str], X_6:bat[:str], 
X_7:bat[:int], X_8:bat[:lng], X_9:bat[:bit], X_10:bat[:bit], X_11:bat[:str], 
X_12:bat[:str], X_13:bat[:bit], X_14:bat[:bit]) ",   "sql_statistics;",      
"return a table with statistics information for a particular table"     ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str, X_1:str, 
X_2:str) (X_3:bat[:int], X_4:bat[:str], X_5:bat[:str], X_6:bat[:str], 
X_7:bat[:str], X_8:bat[:int], X_9:bat[:lng], X_10:bat[:bit], X_11:bat[:bit], 
X_12:bat[:str], X_13:bat[:str], X_14:bat[:bit], X_15:bat[:bit]) ", 
"sql_statistics;",      "return a table with statistics information for a 
particular column"    ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:bte, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:dbl, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:flt, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
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
@@ -12377,14 +12377,6 @@
 [ "netcdf",    "importvar",    "unsafe command netcdf.importvar(X_0:str, 
X_1:int):str ",       "NCDFimportVarStmt;",   "Import variable: compose create 
array string"  ]
 [ "netcdf",    "importvariable",       "unsafe pattern 
netcdf.importvariable(X_0:int, X_1:str):void ", "NCDFimportVariable;",  "Import 
variable: create array and load data from variable varname of file fileid"      
]
 [ "netcdf",    "test", "command netcdf.test(X_0:str):int ",    "NCDFtest;",    
"Returns number of variables in a given NetCDF dataset (file)"  ]
-[ "oltp",      "disable",      "unsafe pattern oltp.disable():void ",  
"OLTPdisable;", "Disable the OLTP delay monitor"        ]
-[ "oltp",      "enable",       "unsafe pattern oltp.enable():void ",   
"OLTPenable;",  "Enable the OLTP delay monitor" ]
-[ "oltp",      "init", "unsafe pattern oltp.init():void ",     "OLTPinit;",    
"Initialize the lock table"     ]
-[ "oltp",      "isenabled",    "unsafe command oltp.isenabled():int ", 
"OLTPis_enabled;",      "Query the OLTP state"  ]
-[ "oltp",      "lock", "unsafe pattern oltp.lock(X_0:int...):void ",   
"OLTPlock;",    "Wait for all write locks needed"       ]
-[ "oltp",      "release",      "unsafe pattern oltp.release(X_0:int...):void 
",        "OLTPrelease;", "Release for all write locks needed"    ]
-[ "oltp",      "reset",        "unsafe pattern oltp.reset():void ",    
"OLTPreset;",   "Reset the OLTP lock table"     ]
-[ "oltp",      "table",        "unsafe pattern oltp.table() 
(X_0:bat[:timestamp], X_1:bat[:str], X_2:bat[:int], X_3:bat[:int]) ",      
"OLTPtable;",   "Show status of lock table"     ]
 [ "optimizer", "aliases",      "pattern optimizer.aliases():str ",     
"OPTwrapper;",  ""      ]
 [ "optimizer", "aliases",      "pattern optimizer.aliases(X_0:str, 
X_1:str):str ",     "OPTwrapper;",  "Alias removal optimizer"       ]
 [ "optimizer", "bincopyfrom",  "pattern optimizer.bincopyfrom():str ", 
"OPTwrapper;",  ""      ]
@@ -12443,9 +12435,6 @@
 [ "optimizer", "multiplex",    "pattern optimizer.multiplex():str ",   
"OPTwrapper;",  ""      ]
 [ "optimizer", "multiplex",    "pattern optimizer.multiplex(X_0:str, 
X_1:str):str ",   "OPTwrapper;",  "Compiler for multiplexed instructions" ]
 [ "optimizer", "no_mitosis_pipe",      "function 
optimizer.no_mitosis_pipe():void;",   "",     ""      ]
-[ "optimizer", "oltp", "pattern optimizer.oltp():str ",        "OPTwrapper;",  
""      ]
-[ "optimizer", "oltp", "pattern optimizer.oltp(X_0:str, X_1:str):str ",        
"OPTwrapper;",  "Inject the OLTP locking primitives"    ]
-[ "optimizer", "oltp_pipe",    "function optimizer.oltp_pipe():void;", "",     
""      ]
 [ "optimizer", "optimize",     "pattern optimizer.optimize(X_0:str, 
X_1:str):void ",   "QOToptimize;", "Optimize a specific operation" ]
 [ "optimizer", "orcam",        "pattern optimizer.orcam(X_0:str, X_1:str):void 
",      "OPTorcam;",    "Inverse macro processor for current function"  ]
 [ "optimizer", "orcam",        "pattern optimizer.orcam(X_0:str, X_1:str, 
X_2:str, X_3:str):void ",    "OPTorcam;",    "Inverse macro, find pattern and 
replace with a function call." ]
@@ -12563,10 +12552,10 @@
 [ "sql",       "affectedRows", "unsafe pattern sql.affectedRows(X_0:int, 
X_1:lng):int ",       "mvc_affected_rows_wrap;",      "export the number of 
affected rows by the current query"       ]
 [ "sql",       "all",  "pattern sql.all(X_0:bit, X_1:bit, X_2:bit):bit ",      
"SQLall_cmp;",  "if !cmp then false, (nl or nr) then nil, else true"    ]
 [ "sql",       "alpha",        "command sql.alpha(X_0:dbl, X_1:dbl):dbl ",     
"SQLcst_alpha_cst;",    "Implementation of astronomy alpha function: expands 
the radius theta depending on the declination"     ]
-[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:int, 
X_1:lng):void ",   "sql_analyze;", ""      ]
-[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:int, X_1:lng, 
X_2:str):void ",  "sql_analyze;", ""      ]
-[ "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;", "Update the database 
statistics table"  ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze():void ",   
"sql_analyze;", "Update statistics for every column in the database"    ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str):void ",    
"sql_analyze;", "Update statistics for schema"  ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str, 
X_1:str):void ",   "sql_analyze;", "Update statistics for table"   ]
+[ "sql",       "analyze",      "unsafe pattern sql.analyze(X_0:str, X_1:str, 
X_2:str):void ",  "sql_analyze;", "Update statistics for column"  ]
 [ "sql",       "any",  "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ",      
"SQLany_cmp;",  "if cmp then true, (nl or nr) nil then nil, else false" ]
 [ "sql",       "append",       "pattern sql.append(X_0:int, X_1:str, X_2:str, 
X_3:str, X_4:oid, X_5:bat[:oid], X_6:any):int ", "mvc_append_wrap;",     
"Append to the column tname.cname (possibly optimized to replace the insert bat 
of tname.cname. Returns sequence number for order dependence."  ]
 [ "sql",       "argRecord",    "pattern sql.argRecord():str ", 
"SQLargRecord;",        "Glue together the calling sequence"    ]
@@ -12739,6 +12728,10 @@
 [ "sql",       "shutdown",     "unsafe pattern sql.shutdown(X_0:sht):str ",    
"SQLshutdown_wrap;",    ""      ]
 [ "sql",       "shutdown",     "unsafe pattern sql.shutdown(X_0:sht, 
X_1:bit):str ",   "SQLshutdown_wrap;",    ""      ]
 [ "sql",       "sql_variables",        "pattern sql.sql_variables() 
(X_0:bat[:str], X_1:bat[:str], X_2:bat[:str], X_3:bat[:str]) ",    
"sql_variables;",       "return the table with session variables"       ]
+[ "sql",       "statistics",   "pattern sql.statistics() (X_0:bat[:int], 
X_1:bat[:str], X_2:bat[:str], X_3:bat[:str], X_4:bat[:str], X_5:bat[:int], 
X_6:bat[:lng], X_7:bat[:bit], X_8:bat[:bit], X_9:bat[:str], X_10:bat[:str], 
X_11:bat[:bit], X_12:bat[:bit]) ",     "sql_statistics;",      "return a table 
with statistics information"    ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str) 
(X_1:bat[:int], X_2:bat[:str], X_3:bat[:str], X_4:bat[:str], X_5:bat[:str], 
X_6:bat[:int], X_7:bat[:lng], X_8:bat[:bit], X_9:bat[:bit], X_10:bat[:str], 
X_11:bat[:str], X_12:bat[:bit], X_13:bat[:bit]) ",     "sql_statistics;",      
"return a table with statistics information for a particular schema"    ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str, X_1:str) 
(X_2:bat[:int], X_3:bat[:str], X_4:bat[:str], X_5:bat[:str], X_6:bat[:str], 
X_7:bat[:int], X_8:bat[:lng], X_9:bat[:bit], X_10:bat[:bit], X_11:bat[:str], 
X_12:bat[:str], X_13:bat[:bit], X_14:bat[:bit]) ",   "sql_statistics;",      
"return a table with statistics information for a particular table"     ]
+[ "sql",       "statistics",   "pattern sql.statistics(X_0:str, X_1:str, 
X_2:str) (X_3:bat[:int], X_4:bat[:str], X_5:bat[:str], X_6:bat[:str], 
X_7:bat[:str], X_8:bat[:int], X_9:bat[:lng], X_10:bat[:bit], X_11:bat[:bit], 
X_12:bat[:str], X_13:bat[:str], X_14:bat[:bit], X_15:bat[:bit]) ", 
"sql_statistics;",      "return a table with statistics information for a 
particular column"    ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:bte, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:dbl, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
 [ "sql",       "stdev",        "pattern sql.stdev(X_0:flt, X_1:bit, X_2:bit, 
X_3:int, X_4:oid, X_5:oid):dbl ", "SQLstddev_samp;",      "return the standard 
deviation sample of groups"        ]
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
@@ -1127,7 +1127,6 @@ int mal_init(char *modules[], int embedd
 void mal_instruction_reset(void);
 void mal_module(str name, mel_atom *atoms, mel_func *funcs);
 void mal_module2(str name, mel_atom *atoms, mel_func *funcs, mel_init 
initfunc, const char *code);
-MT_Lock mal_oltpLock;
 MT_Lock mal_profileLock;
 str mal_quote(const char *msg, size_t size);
 MT_Lock mal_remoteLock;
@@ -1217,7 +1216,6 @@ const char *not_uniqueRef;
 const char *nth_valueRef;
 const char *ntileRef;
 const char *oidRef;
-const char *oltpRef;
 str openProfilerStream(Client cntxt);
 const char *openRef;
 str operatorName(int i);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1163,15 +1163,13 @@ BUNappendmulti(BAT *b, const void *value
                int (*atomcmp) (const void *, const void *) = 
ATOMcompare(b->ttype);
                const void *atomnil = ATOMnilptr(b->ttype);
                MT_lock_set(&b->theaplock);
-               BUN minpos = b->tminpos;
-               BUN maxpos = b->tmaxpos;
                MT_lock_unset(&b->theaplock);
                const void *minvalp = NULL, *maxvalp = NULL;
                BATiter bi = bat_iterator_nolock(b);
-               if (minpos != BUN_NONE)
-                       minvalp = BUNtail(bi, minpos);
-               if (maxpos != BUN_NONE)
-                       maxvalp = BUNtail(bi, maxpos);
+               if (bi.minpos != BUN_NONE)
+                       minvalp = BUNtail(bi, bi.minpos);
+               if (bi.maxpos != BUN_NONE)
+                       maxvalp = BUNtail(bi, bi.maxpos);
                if (b->tvarsized) {
                        const void *vbase = b->tvheap->base;
                        for (BUN i = 0; i < count; i++) {
@@ -1189,27 +1187,27 @@ BUNappendmulti(BAT *b, const void *value
                                         * we don't know) */
                                        bi = bat_iterator_nolock(b);
                                        vbase = b->tvheap->base;
-                                       if (minpos != BUN_NONE)
-                                               minvalp = BUNtvar(bi, minpos);
-                                       if (maxpos != BUN_NONE)
-                                               maxvalp = BUNtvar(bi, maxpos);
+                                       if (bi.minpos != BUN_NONE)
+                                               minvalp = BUNtvar(bi, 
bi.minpos);
+                                       if (bi.maxpos != BUN_NONE)
+                                               maxvalp = BUNtvar(bi, 
bi.maxpos);
                                }
                                if (b->thash) {
                                        HASHappend_locked(b, p, t);
                                }
                                if (atomcmp(t, atomnil) != 0) {
                                        if (p == 0) {
-                                               minpos = maxpos = 0;
+                                               bi.minpos = bi.maxpos = 0;
                                                minvalp = maxvalp = t;
                                        } else {
-                                               if (minpos != BUN_NONE &&
+                                               if (bi.minpos != BUN_NONE &&
                                                    atomcmp(minvalp, t) > 0) {
-                                                       minpos = p;
+                                                       bi.minpos = p;
                                                        minvalp = t;
                                                }
-                                               if (maxpos != BUN_NONE &&
+                                               if (bi.maxpos != BUN_NONE &&
                                                    atomcmp(maxvalp, t) < 0) {
-                                                       maxpos = p;
+                                                       bi.maxpos = p;
                                                        maxvalp = t;
                                                }
                                        }
@@ -1217,7 +1215,7 @@ BUNappendmulti(BAT *b, const void *value
                                p++;
                        }
                } else if (ATOMstorage(b->ttype) == TYPE_msk) {
-                       minpos = maxpos = BUN_NONE;
+                       bi.minpos = bi.maxpos = BUN_NONE;
                        minvalp = maxvalp = NULL;
                        for (BUN i = 0; i < count; i++) {
                                t = (void *) ((char *) values + (i << 
b->tshift));
@@ -1237,17 +1235,17 @@ BUNappendmulti(BAT *b, const void *value
                                }
                                if (atomcmp(t, atomnil) != 0) {
                                        if (p == 0) {
-                                               minpos = maxpos = 0;
+                                               bi.minpos = bi.maxpos = 0;
                                                minvalp = maxvalp = t;
                                        } else {
-                                               if (minpos != BUN_NONE &&
+                                               if (bi.minpos != BUN_NONE &&
                                                    atomcmp(minvalp, t) > 0) {
-                                                       minpos = p;
+                                                       bi.minpos = p;
                                                        minvalp = t;
                                                }
-                                               if (maxpos != BUN_NONE &&
+                                               if (bi.maxpos != BUN_NONE &&
                                                    atomcmp(maxvalp, t) < 0) {
-                                                       maxpos = p;
+                                                       bi.maxpos = p;
                                                        maxvalp = t;
                                                }
                                        }
@@ -1256,8 +1254,8 @@ BUNappendmulti(BAT *b, const void *value
                        }
                }
                MT_lock_set(&b->theaplock);
-               b->tminpos = minpos;
-               b->tmaxpos = maxpos;
+               b->tminpos = bi.minpos;
+               b->tmaxpos = bi.maxpos;
                MT_lock_unset(&b->theaplock);
        } else {
                for (BUN i = 0; i < count; i++) {
@@ -1411,8 +1409,6 @@ BUNinplacemulti(BAT *b, const oid *posit
        } else if (count > BATcount(b) / GDK_UNIQUE_ESTIMATE_KEEP_FRACTION) {
                b->tunique_est = 0;
        }
-       BUN minpos = b->tminpos;
-       BUN maxpos = b->tmaxpos;
        MT_lock_unset(&b->theaplock);
        MT_rwlock_wrlock(&b->thashlock);
        for (BUN i = 0; i < count; i++) {
@@ -1453,36 +1449,36 @@ BUNinplacemulti(BAT *b, const oid *posit
                                b->tnil = false;
                        }
                        if (b->ttype != TYPE_void) {
-                               if (maxpos != BUN_NONE) {
-                                       if (!isnil && ATOMcmp(b->ttype, 
BUNtail(bi, maxpos), t) < 0) {
+                               if (bi.maxpos != BUN_NONE) {
+                                       if (!isnil && ATOMcmp(b->ttype, 
BUNtail(bi, bi.maxpos), t) < 0) {
                                                /* new value is larger
                                                 * than previous
                                                 * largest */
-                                               maxpos = p;
-                                       } else if (maxpos == p && 
ATOMcmp(b->ttype, BUNtail(bi, maxpos), t) != 0) {
+                                               bi.maxpos = p;
+                                       } else if (bi.maxpos == p && 
ATOMcmp(b->ttype, BUNtail(bi, bi.maxpos), t) != 0) {
                                                /* old value is equal to
                                                 * largest and new value
                                                 * is smaller or nil (see
                                                 * above), so we don't
                                                 * know anymore which is
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to