MonetDB: default - approved new signatures

2024-05-13 Thread Niels Nes via checkin-list
Changeset: 4311aa896c2d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4311aa896c2d
Modified Files:
clients/Tests/MAL-signatures-hge.test
Branch: default
Log Message:

approved new signatures


diffs (78 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -44980,6 +44980,16 @@ VLTgenerator_noop;
 (empty)
 generator
 parameters
+pattern generator.parameters(X_0:date, X_1:date, X_2:int):bat[:date]
+VLTgenerator_noop;
+Retain the table definition, but don't materialize (months)
+generator
+parameters
+pattern generator.parameters(X_0:date, X_1:date, X_2:lng):bat[:date]
+VLTgenerator_noop;
+Retain the table definition, but don't materialize (days)
+generator
+parameters
 pattern generator.parameters(X_0:dbl, X_1:dbl):bat[:dbl]
 VLTgenerator_noop;
 (empty)
@@ -45050,6 +45060,11 @@ VLTgenerator_projection;
 (empty)
 generator
 projection
+pattern generator.projection(X_0:bat[:oid], X_1:bat[:date]):bat[:date]
+VLTgenerator_projection;
+(empty)
+generator
+projection
 pattern generator.projection(X_0:bat[:oid], X_1:bat[:dbl]):bat[:dbl]
 VLTgenerator_projection;
 (empty)
@@ -45095,6 +45110,16 @@ VLTgenerator_subselect;
 (empty)
 generator
 select
+pattern generator.select(X_0:bat[:date], X_1:bat[:oid], X_2:date, X_3:date, 
X_4:bit, X_5:bit, X_6:bit):bat[:oid]
+VLTgenerator_subselect;
+(empty)
+generator
+select
+pattern generator.select(X_0:bat[:date], X_1:date, X_2:date, X_3:bit, X_4:bit, 
X_5:bit):bat[:oid]
+VLTgenerator_subselect;
+(empty)
+generator
+select
 pattern generator.select(X_0:bat[:dbl], X_1:bat[:oid], X_2:dbl, X_3:dbl, 
X_4:bit, X_5:bit, X_6:bit):bat[:oid]
 VLTgenerator_subselect;
 (empty)
@@ -45175,6 +45200,16 @@ VLTgenerator_table;
 (empty)
 generator
 series
+pattern generator.series(X_0:date, X_1:date, X_2:int):bat[:date]
+VLTgenerator_table;
+date generator with step size in months
+generator
+series
+pattern generator.series(X_0:date, X_1:date, X_2:lng):bat[:date]
+VLTgenerator_table;
+date generator with step size in days
+generator
+series
 pattern generator.series(X_0:dbl, X_1:dbl):bat[:dbl]
 VLTgenerator_table;
 (empty)
@@ -45245,6 +45280,11 @@ VLTgenerator_thetasubselect;
 (empty)
 generator
 thetaselect
+pattern generator.thetaselect(X_0:bat[:date], X_1:bat[:oid], X_2:date, 
X_3:str):bat[:oid]
+VLTgenerator_thetasubselect;
+Overloaded selection routine
+generator
+thetaselect
 pattern generator.thetaselect(X_0:bat[:dbl], X_1:bat[:oid], X_2:dbl, 
X_3:str):bat[:oid]
 VLTgenerator_thetasubselect;
 (empty)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - add generate_series for dates, ie steps of 1 ...

2024-05-13 Thread Niels Nes via checkin-list
Changeset: f7406735f6d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f7406735f6d8
Added Files:
sql/backends/monet5/generator/Tests/generator05.test
Modified Files:
sql/backends/monet5/generator/90_generator.sql
sql/backends/monet5/generator/Tests/All
sql/backends/monet5/generator/generator.c
Branch: default
Log Message:

add generate_series for dates, ie steps of 1 or more days or months.


diffs (truncated from 670 to 300 lines):

diff --git a/sql/backends/monet5/generator/90_generator.sql 
b/sql/backends/monet5/generator/90_generator.sql
--- a/sql/backends/monet5/generator/90_generator.sql
+++ b/sql/backends/monet5/generator/90_generator.sql
@@ -54,6 +54,14 @@ create function sys.generate_series(firs
 returns table (value decimal(10,2))
 external name generator.series;
 
+create function sys.generate_series(first date, "limit" date, stepsize 
interval month)
+returns table (value date)
+external name generator.series;
+
+create function sys.generate_series(first date, "limit" date, stepsize 
interval day)
+returns table (value date)
+external name generator.series;
+
 create function sys.generate_series(first timestamp, "limit" timestamp, 
stepsize interval second)
 returns table (value timestamp)
 external name generator.series;
diff --git a/sql/backends/monet5/generator/Tests/All 
b/sql/backends/monet5/generator/Tests/All
--- a/sql/backends/monet5/generator/Tests/All
+++ b/sql/backends/monet5/generator/Tests/All
@@ -3,6 +3,7 @@ generator01
 generator02
 generator03
 generator04
+generator05
 
 rangejoin
 
diff --git a/sql/backends/monet5/generator/Tests/generator05.test 
b/sql/backends/monet5/generator/Tests/generator05.test
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/generator/Tests/generator05.test
@@ -0,0 +1,24 @@
+query T nosort
+select * from generate_series(date '2023-01-01',date '2024-01-01', interval 
'1' month) where value < date '2023-06-06'
+
+2023-01-01
+2023-02-01
+2023-03-01
+2023-04-01
+2023-05-01
+
+query T nosort
+select * from generate_series(date '2023-01-01',date '2024-01-01', interval 
'15' day) where value < date '2023-06-06'
+
+2023-01-01
+2023-01-16
+2023-01-31
+2023-02-15
+2023-03-02
+2023-03-17
+2023-04-01
+2023-04-16
+2023-05-01
+2023-05-16
+2023-05-31
+
diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -12,7 +12,7 @@
 
 /*
  * (c) Martin Kersten, Sjoerd Mullender
- * Series generating module for integer, decimal, real, double and timestamps.
+ * Series generating module for integer, decimal, real, double, date and 
timestamps.
  */
 
 #include "monetdb_config.h"
@@ -51,11 +51,21 @@ VLTgenerator_noop(Client cntxt, MalBlkPt
case TYPE_flt: VLTnoop(flt); break;
case TYPE_dbl: VLTnoop(dbl); break;
default:
-   if (tpe == TYPE_timestamp){
+   if (tpe == TYPE_date) {
+   /* with date, step is of SQL type "interval month or 
day",
+* i.e., MAL / C type "int" or "lng" */
+   int steptpe = pci->argc==4 ? getArgType(mb,pci,3) : 0;
+   if (steptpe == TYPE_int)
+   VLTnoop(int);
+   else /* default interval days */
+   VLTnoop(lng);
+   } else if (tpe == TYPE_timestamp) {
/* with timestamp, step is of SQL type "interval 
seconds",
 * i.e., MAL / C type "lng" */
 VLTnoop(lng);
-   } else throw(MAL,"generator.noop", SQLSTATE(42000) "unknown 
data type %d", getArgType(mb,pci,1));
+   } else {
+   throw(MAL,"generator.noop", SQLSTATE(42000) "unknown 
data type %d", getArgType(mb,pci,1));
+   }
}
if( zeroerror)
throw(MAL,"generator.noop", SQLSTATE(42000) "Zero step size not 
allowed");
@@ -204,7 +214,77 @@ VLTgenerator_table_(BAT **result, Client
VLTmaterialize_flt(dbl);
break;
default:
-   if (tpe == TYPE_timestamp) {
+   if (tpe == TYPE_date && pci->argc == 3)
+   throw(MAL,"generator.table", SQLSTATE(42000) "Date step 
missing");
+   if (tpe == TYPE_date && getArgType(mb, pci, 3) == TYPE_int) { 
/* months */
+   date *v,f,l;
+   int s;
+   ValRecord ret;
+   if (VARcalccmp(, >stk[pci->argv[1]],
+  >stk[pci->argv[2]]) != GDK_SUCCEED)
+   throw(MAL, "generator.table",
+ SQLSTATE(42000) "Illegal generator 
expression range");
+   f = *getArgReference_TYPE(stk, pci, 1, date);
+   l = 

MonetDB: default - small improvements of the voc dates

2024-05-11 Thread Niels Nes via checkin-list
Changeset: bf76210949e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf76210949e5
Modified Files:
sql/test/VOC/Tests/VOCinsert.test
sql/test/VOC/Tests/VOCquery.test
Branch: default
Log Message:

small improvements of the voc dates


diffs (51 lines):

diff --git a/sql/test/VOC/Tests/VOCinsert.test 
b/sql/test/VOC/Tests/VOCinsert.test
--- a/sql/test/VOC/Tests/VOCinsert.test
+++ b/sql/test/VOC/Tests/VOCinsert.test
@@ -2734,7 +2734,7 @@ 2743  ""  5   ""  "SLOT ALDEGONDE"
"Gillis Ou
 2744   ""  5   ""  "STAD LEIDEN"   "Wouter van Dijk"   1140
NULL"1718"  NULLNULL"A" "A" 1728-06-23  "Texel" 
1728-10-21  1728-11-18  true1729-02-09  "Batavia"   6767
NULL
 2745   ""  4   ""  "CASTRICUM" "Thomas Fletcher"   1150
NULL"1722"  NULLNULL"A" "A" 1728-10-28  "Texel" 
1729-02-23  1729-03-19  true1729-06-13  "Batavia"   6762
NULL
 2746   ""  6   ""  "HUTS DE VLOTTER"   "Jan Molentijn" 528 
"fluit" "1713"  NULLNULL"A" "A" 1728-10-28  "Texel" 
1729-03-29  1729-04-20  true1729-07-12  "Batavia"   6787
NULL
-2747   ""  5   ""  "BORSSELE"  "Jakob Jongerheld"  800 
NULL"1715"  NULLNULL"Z" "Z" 1728-10-29  "Rammekens" 
1729-02-23  1729-03-19  true1129-05-19  "Batavia"   NULL
"Wrecked between Persia and Batavia in 1731."
+2747   ""  5   ""  "BORSSELE"  "Jakob Jongerheld"  800 
NULL"1715"  NULLNULL"Z" "Z" 1728-10-29  "Rammekens" 
1729-02-23  1729-03-19  true1729-05-19  "Batavia"   NULL
"Wrecked between Persia and Batavia in 1731."
 2748   ""  1   ""  "DUINBEEK"  "Marinus Commerse"  800 
NULL"1727"  NULLNULL"Z" "Z" 1728-10-29  "Rammekens" 
1729-02-21  1729-03-12  true1729-05-19  "Batavia"   6829
NULL
 2749   ""  3   ""  "HERSTELLING"   "Jan van der Quade" 600 
NULL"1721"  NULLNULL"D" "R" 1728-10-29  "Goeree"
1729-04-07  1729-04-27  true1729-11-27  "Batavia"   6791
"passengers came aboard."
 2750   ""  3   ""  "LANGERODE" "Kornelis van der Kolster"  
600 NULL"1723"  NULLNULL"D" "D" 1728-10-29  
"Goeree"1729-02-23  1729-03-19  true1729-06-11  
"Batavia"   6766NULL
@@ -3049,7 +3049,7 @@ 3058  ""  1   ""  "WATERVLIET""Pieter 
Korver
 3059   ""  3   ""  "ZORGWIJK"  "Kornelis van der Marie"
650 NULL"1732"  NULLNULL"A" "A" 1737-03-10  "Texel" 
1737-06-18  1737-06-30  true1737-09-16  "Batavia"   7014
"3059/7014 Is the third voyage of the ZORGWIJK, which during its first voyage 
(see 2896/-) was called VOORDUIN."
 3060   ""  5   ""  "KLARABEEK" "Jan Bijland"   705 NULL
"1721"  NULLNULL"Z" "Z" 1737-03-11  "Rammekens" 
1737-07-15  1737-08-06  true1737-10-19  "Batavia"   7007
"During the voyage one of the soldiers became a seafarer. The passengers 
included 11 slaves (6 males and 5 females)."
 3061   ""  2   ""  "HUIS TE RENSBURG"  "Jan de Bruin"  850 
NULL"1733"  NULLNULL"Z" "Z" 1737-03-11  "Rammekens" 
1737-07-09  1737-07-21  true1737-09-23  "Batavia"   7094
"23-06 till 08-07-1737 the ship was at Saldanha Bay."
-3062   ""  1   ""  "ARNESTUN"  "Willem Hendriksz. van Roffe"   
575 NULL"1736"  NULLNULL"Z" "Z" 1737-03-12  
"Rammekens" 1737-06-20  1737-07-06  true1937-09-17  
"Batavia"   7008"During the voyage one of the soldiers became a 
seafarer. The passengers who embarked at the Cape included eight slaves: two 
(married) couples with two children each."
+3062   ""  1   ""  "ARNESTUN"  "Willem Hendriksz. van Roffe"   
575 NULL"1736"  NULLNULL"Z" "Z" 1737-03-12  
"Rammekens" 1737-06-20  1737-07-06  true1737-09-17  
"Batavia"   7008"During the voyage one of the soldiers became a 
seafarer. The passengers who embarked at the Cape included eight slaves: two 
(married) couples with two children each."
 3063   ""  3   ""  "MARIA ADRIANA" "Willem de Wijs"650 
NULL"1730"  NULLNULL"R" "R" 1737-03-12  "Goeree"
1737-06-17  1737-07-02  true1737-09-07  "Batavia"   7055
NULL
 3064   ""  8   ""  "ZOETELINGSKERKE"   "Huibrecht op den Dijk" 
1100NULL"1721"  NULLNULL"Z" "Z" 1737-03-12  
"Rammekens" 1737-06-17  1737-07-07  true 

MonetDB: default - approved output

2024-05-11 Thread Niels Nes via checkin-list
Changeset: a72efd578b97 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a72efd578b97
Modified Files:
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
Branch: default
Log Message:

approved output


diffs (16 lines):

diff --git a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test 
b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
--- a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
+++ b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
@@ -1094,12 +1094,6 @@ DEP_FUNC
 schema_id
 get_remote_table_expressions
 DEP_FUNC
-semantics
-describe_function
-DEP_FUNC
-side_effect
-describe_function
-DEP_FUNC
 srid
 getproj4
 DEP_FUNC
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - fixed bug #7512, protect concurrent instantia...

2024-05-10 Thread Niels Nes via checkin-list
Changeset: 06f20b2c802e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/06f20b2c802e
Added Files:

sql/test/BugTracker-2024/Tests/7512-concurrent-globaltmp-instantiate-crash.test
Modified Files:
sql/scripts/52_describe.sql
sql/storage/sql_catalog.c
sql/storage/store.c
sql/test/BugTracker-2024/Tests/All
Branch: Dec2023
Log Message:

fixed bug #7512, protect concurrent instantiation of the global temps


diffs (99 lines):

diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql
--- a/sql/scripts/52_describe.sql
+++ b/sql/scripts/52_describe.sql
@@ -315,7 +315,6 @@ CREATE VIEW sys.describe_foreign_keys AS
AND ((fkk."action" >> 8) & 255)  = ou.id
ORDER BY fkk.name, fkkc.nr;
 
---TODO: CRASHES when this function gets inlined into describe_tables
 CREATE FUNCTION sys.get_merge_table_partition_expressions(tid INT) RETURNS 
STRING
 BEGIN
RETURN
diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -253,13 +253,20 @@ find_sql_table(sql_trans *tr, sql_schema
}
 
if (t && isTempTable(t) && tr->tmp == s) {
+   sqlstore *store = tr->store;
assert(isGlobal(t));
 
sql_table* lt = (sql_table*) os_find_name(tr->localtmps, tr, 
tname);
if (lt)
return lt;
+   MT_lock_set(>table_locks[t->base.id&(NR_TABLE_LOCKS-1)]);
 
-   t = globaltmp_instantiate(tr, t);
+   lt = (sql_table*) os_find_name(tr->localtmps, tr, tname);
+   if (!lt)
+   t = globaltmp_instantiate(tr, t);
+   else
+   t = lt;
+   
MT_lock_unset(>table_locks[t->base.id&(NR_TABLE_LOCKS-1)]);
return t;
}
 
@@ -276,13 +283,19 @@ find_sql_table_id(sql_trans *tr, sql_sch
}
 
if (t && isTempTable(t) && tr->tmp == s) {
+   sqlstore *store = tr->store;
assert(isGlobal(t));
 
sql_table* lt = (sql_table*) os_find_id(tr->localtmps, tr, id);
if (lt)
return lt;
-
-   t = globaltmp_instantiate(tr, t);
+   MT_lock_set(>table_locks[id&(NR_TABLE_LOCKS-1)]);
+   lt = (sql_table*) os_find_id(tr->localtmps, tr, id);
+   if (!lt)
+   t = globaltmp_instantiate(tr, t);
+   else
+   t = lt;
+   MT_lock_unset(>table_locks[id&(NR_TABLE_LOCKS-1)]);
return t;
}
return t;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3197,9 +3197,6 @@ table_dup(sql_trans *tr, sql_table *ot, 
t->sz = ot->sz;
ATOMIC_PTR_INIT(>data, NULL);
 
-   if ((res = os_add(isLocalTemp(t) ? tr->localtmps : t->s->tables, tr, 
t->base.name, >base)))
-   goto cleanup;
-
if (isPartitionedByExpressionTable(ot)) {
t->part.pexp = ZNEW(sql_expression);
t->part.pexp->exp =_STRDUP(ot->part.pexp->exp);
@@ -3257,6 +3254,8 @@ table_dup(sql_trans *tr, sql_table *ot, 
ATOMIC_PTR_SET(>data, 
store->storage_api.del_dup(ot));
}
}
+   if ((res = os_add(isLocalTemp(t) ? tr->localtmps : t->s->tables, tr, 
t->base.name, >base)))
+   goto cleanup;
 
 cleanup:
if (res) {
diff --git 
a/sql/test/BugTracker-2024/Tests/7512-concurrent-globaltmp-instantiate-crash.test
 
b/sql/test/BugTracker-2024/Tests/7512-concurrent-globaltmp-instantiate-crash.test
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2024/Tests/7512-concurrent-globaltmp-instantiate-crash.test
@@ -0,0 +1,5 @@
+statement error conversion of string '' to type int failed.
+SELECT GET_MERGE_TABLE_PARTITION_EXPRESSIONS('')
+
+statement ok
+SELECT GET_MERGE_TABLE_PARTITION_EXPRESSIONS(0)
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -53,4 +53,5 @@ rel2bin_select-Bug-7496
 multicolumn_IN_value_list-Bug-7497
 field-arg-error-Bug-7506
 7511-password-hash-missing-error
+7512-concurrent-globaltmp-instantiate-crash
 7513-uri-authority-parse-issue
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - fixed issue #7513, the uri parsing didn't res...

2024-05-10 Thread Niels Nes via checkin-list
Changeset: a6bcc084ddee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a6bcc084ddee
Added Files:
sql/test/BugTracker-2024/Tests/7511-password-hash-missing-error.test
sql/test/BugTracker-2024/Tests/7513-uri-authority-parse-issue.test
Modified Files:
monetdb5/modules/atoms/url.c
sql/test/BugTracker-2024/Tests/All
Branch: Dec2023
Log Message:

fixed issue #7513, the uri parsing didn't reset the port after finding the 
username:password@
added tests


diffs (51 lines):

diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c
--- a/monetdb5/modules/atoms/url.c
+++ b/monetdb5/modules/atoms/url.c
@@ -107,8 +107,10 @@ skip_authority(const char *uri, const ch
port = pass = uri + 1;
else
port = uri + 1;
-   } else if (*uri == '@')
+   } else if (*uri == '@') {
host = uri + 1;
+   port = NULL;
+   }
uri += *uri == '%' ? 3 : 1;
}
if (user == host) {
diff --git 
a/sql/test/BugTracker-2024/Tests/7511-password-hash-missing-error.test 
b/sql/test/BugTracker-2024/Tests/7511-password-hash-missing-error.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7511-password-hash-missing-error.test
@@ -0,0 +1,3 @@
+
+statement error 42000!SELECT: Failed to retrieve password hash
+SELECT PASSWORD_HASH('1');
diff --git a/sql/test/BugTracker-2024/Tests/7513-uri-authority-parse-issue.test 
b/sql/test/BugTracker-2024/Tests/7513-uri-authority-parse-issue.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7513-uri-authority-parse-issue.test
@@ -0,0 +1,15 @@
+
+query T
+SELECT GETHOST('https://me:p...@www.monetdb.org/Doc');
+
+www.monetdb.org
+
+query T
+SELECT GETHOST('https://me:p...@www.monetdb.org/Doc');
+
+www.monetdb.org
+
+query T
+SELECT GETHOST('https://me:p...@www.monetdb.org/Doc');
+
+www.monetdb.org
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -53,3 +53,4 @@ rel2bin_select-Bug-7496
 multicolumn_IN_value_list-Bug-7497
 field-arg-error-Bug-7506
 7511-password-hash-missing-error
+7513-uri-authority-parse-issue
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - add error message on missing or incorrect pas...

2024-05-10 Thread Niels Nes via checkin-list
Changeset: 610ed55e5ac0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/610ed55e5ac0
Modified Files:
sql/backends/monet5/sql.c
sql/test/BugTracker-2024/Tests/All
Branch: Dec2023
Log Message:

add error message on missing or incorrect password hash, fixes #7511. Also 
added small test.


diffs (20 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5174,6 +5174,8 @@ SQLuser_password(Client cntxt, MalBlkPtr
return msg;
}
*password = monet5_password_hash(m, username);
+   if (!(*password))
+   throw(SQL, "mvc", SQLSTATE(42000) "SELECT: Failed to retrieve 
password hash");
return MAL_SUCCEED;
 }
 
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -52,3 +52,4 @@ orderby-max-over-rows-Bug-7488
 rel2bin_select-Bug-7496
 multicolumn_IN_value_list-Bug-7497
 field-arg-error-Bug-7506
+7511-password-hash-missing-error
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - improved optimization of relational psm

2024-05-08 Thread Niels Nes via checkin-list
Changeset: e9afbe5ac9c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e9afbe5ac9c3
Modified Files:
sql/server/rel_optimize_others.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_select.c
sql/test/BugTracker-2022/Tests/dependencies.Bug-7328.test
sql/test/Dependencies/Tests/dependency_DBobjects.test
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
sql/test/SQLancer/Tests/sqlancer18.test
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sql_dump/Tests/dump.test
Branch: Dec2023
Log Message:

improved optimization of relational psm


diffs (truncated from 564 to 300 lines):

diff --git a/sql/server/rel_optimize_others.c b/sql/server/rel_optimize_others.c
--- a/sql/server/rel_optimize_others.c
+++ b/sql/server/rel_optimize_others.c
@@ -1054,6 +1054,7 @@ rel_dce_(mvc *sql, sql_rel *rel)
return rel;
 }
 
+
 /* Remove unused expressions */
 static sql_rel *
 rel_dce(visitor *v, global_props *gp, sql_rel *rel)
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -607,8 +607,8 @@ run_optimizer_set(visitor *v, sql_optimi
 
 /* 'profile' means to benchmark each individual optimizer run */
 /* 'instantiate' means to rewrite logical tables: (merge, remote, replica 
tables) */
-sql_rel *
-rel_optimizer(mvc *sql, sql_rel *rel, int profile, int instantiate, int 
value_based_opt, int storage_based_opt)
+static sql_rel *
+rel_optimizer_one(mvc *sql, sql_rel *rel, int profile, int instantiate, int 
value_based_opt, int storage_based_opt)
 {
global_props gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = 0,
  
.has_special_modify = rel && is_modify(rel->op) && rel->flag_COMP};
@@ -635,3 +635,32 @@ rel_optimizer(mvc *sql, sql_rel *rel, in
rel = run_optimizer_set(, sql->runs, rel, , post_sql_optimizers);
return rel;
 }
+
+static sql_exp *
+exp_optimize_one(visitor *v, sql_rel *rel, sql_exp *e, int depth )
+{
+   (void)rel;
+   (void)depth;
+   if (e->type == e_psm && e->flag == PSM_REL && e->l) {
+   e->l = rel_optimizer_one(v->sql, e->l, 0, v->changes, 
v->value_based_opt, v->storage_based_opt);
+   }
+   return e;
+}
+
+sql_rel *
+rel_optimizer(mvc *sql, sql_rel *rel, int profile, int instantiate, int 
value_based_opt, int storage_based_opt)
+{
+   if (rel && rel->op == op_ddl && rel->flag == ddl_psm) {
+   if (!list_empty(rel->exps)) {
+   bool changed = 0;
+   visitor v = { .sql = sql, .value_based_opt = 
value_based_opt, .storage_based_opt = storage_based_opt, .changes = instantiate 
};
+   for(node *n = rel->exps->h; n; n = n->next) {
+   sql_exp *e = n->data;
+   exp_visitor(, rel, e, 1, exp_optimize_one, 
true, true, true, );
+   }
+   }
+   return rel;
+   } else {
+   return rel_optimizer_one(sql, rel, profile, instantiate, 
value_based_opt, storage_based_opt);
+   }
+}
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -2044,17 +2044,17 @@ rel_dependencies(mvc *sql, sql_rel *r)
return l;
 }
 
-static list *exps_exp_visitor(visitor *v, sql_rel *rel, list *exps, int depth, 
exp_rewrite_fptr exp_rewriter, bool topdown, bool relations_topdown);
+static list *exps_exp_visitor(visitor *v, sql_rel *rel, list *exps, int depth, 
exp_rewrite_fptr exp_rewriter, bool topdown, bool relations_topdown, bool 
visit_relations_once);
 
 static inline list *
-exps_exps_exp_visitor(visitor *v, sql_rel *rel, list *lists, int depth, 
exp_rewrite_fptr exp_rewriter, bool topdown, bool relations_topdown)
+exps_exps_exp_visitor(visitor *v, sql_rel *rel, list *lists, int depth, 
exp_rewrite_fptr exp_rewriter, bool topdown, bool relations_topdown, bool 
visit_relations_once)
 {
node *n;
 
if (list_empty(lists))
return lists;
for (n = lists->h; n; n = n->next) {
-   if (n->data && (n->data = exps_exp_visitor(v, rel, n->data, 
depth, exp_rewriter, topdown, relations_topdown)) == NULL)
+   if (n->data && (n->data = exps_exp_visitor(v, rel, n->data, 
depth, exp_rewriter, topdown, relations_topdown, visit_relations_once)) == NULL)
return NULL;
}
return lists;
@@ -2062,8 +2062,8 @@ exps_exps_exp_visitor(visitor *v, sql_re
 
 static sql_rel *rel_exp_visitor(visitor *v, sql_rel *rel, exp_rewrite_fptr 
exp_rewriter, bool topdown, bool relations_topdown);
 
-static sql_exp *

MonetDB: default - #7485 was fixed by recent group by changes

2024-05-08 Thread Niels Nes via checkin-list
Changeset: b729bea76345 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b729bea76345
Modified Files:
sql/test/BugTracker-2024/Tests/rel_groupby_cse-Bug-7485.test
Branch: default
Log Message:

#7485 was fixed by recent group by changes


diffs (28 lines):

diff --git a/sql/test/BugTracker-2024/Tests/rel_groupby_cse-Bug-7485.test 
b/sql/test/BugTracker-2024/Tests/rel_groupby_cse-Bug-7485.test
--- a/sql/test/BugTracker-2024/Tests/rel_groupby_cse-Bug-7485.test
+++ b/sql/test/BugTracker-2024/Tests/rel_groupby_cse-Bug-7485.test
@@ -7,15 +7,18 @@ statement error 42000!SELECT: cannot use
 WITH x ( x ) AS ( SELECT 1 ) SELECT x FROM x GROUP BY x + 1
 
 
-skipif knownfail
-statement error 42000!SELECT: cannot use non GROUP BY column 'x' in query 
results without an aggregate function
+query I nosort
 WITH x ( x ) AS ( SELECT 1 ) SELECT x FROM x GROUP BY x + 1 , x
+
+1
 
-skipif knownfail
-statement error 42000!SELECT: cannot use non GROUP BY column 'x' in query 
results without an aggregate function
+query I nosort
 WITH x ( x ) AS ( SELECT 1 ) SELECT ( x ) FROM x WHERE ( SELECT x FROM x GROUP 
BY x + 1 , x )
+
+1
 
-skipif knownfail
-statement error 42000!SELECT: cannot use non GROUP BY column 'x' in query 
results without an aggregate function
+query I nosort
 SELECT ( WITH x ( x ) AS ( SELECT 1 ) SELECT ( x ) FROM x WHERE ( SELECT x 
FROM x GROUP BY x + 1 , x ) )
+
+1
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - #7506 was recently fixed

2024-05-08 Thread Niels Nes via checkin-list
Changeset: d4f8e2e2ff1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d4f8e2e2ff1f
Modified Files:
sql/test/BugTracker-2024/Tests/rel2bin_select-Bug-7496.test
Branch: default
Log Message:

#7506 was recently fixed


diffs (11 lines):

diff --git a/sql/test/BugTracker-2024/Tests/rel2bin_select-Bug-7496.test 
b/sql/test/BugTracker-2024/Tests/rel2bin_select-Bug-7496.test
--- a/sql/test/BugTracker-2024/Tests/rel2bin_select-Bug-7496.test
+++ b/sql/test/BugTracker-2024/Tests/rel2bin_select-Bug-7496.test
@@ -29,7 +29,6 @@ SELECT "is_generated", length("is_genera
 
 
 -- next query causes: sql/backends/monet5/rel_bin.c:4355: rel2bin_select: 
Assertion `sql->session->status == -10' failed
-skipif knownfail
 query TI nosort
 SELECT "is_generated", length("is_generated") as data_length FROM columns_7496 
WHERE "is_generated" IS NOT NULL AND length("is_generated") > 2
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - bug #7476 fixed by changes to group by

2024-05-08 Thread Niels Nes via checkin-list
Changeset: b247a3a24ae7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b247a3a24ae7
Modified Files:
sql/test/BugTracker-2024/Tests/rel2bin_join-Bug-7476.test
Branch: default
Log Message:

bug #7476 fixed by changes to group by


diffs (17 lines):

diff --git a/sql/test/BugTracker-2024/Tests/rel2bin_join-Bug-7476.test 
b/sql/test/BugTracker-2024/Tests/rel2bin_join-Bug-7476.test
--- a/sql/test/BugTracker-2024/Tests/rel2bin_join-Bug-7476.test
+++ b/sql/test/BugTracker-2024/Tests/rel2bin_join-Bug-7476.test
@@ -26,13 +26,11 @@ SELECT ( WITH x ( x ) AS ( SELECT DISTIN
 1
 
 -- the combination leads to crash in rel2bin_join ()
-skipif knownfail
 query I nosort
 WITH x ( x ) AS ( SELECT DISTINCT 1 ) SELECT ( SELECT x FROM x WHERE x = ( 
SELECT ( CASE WHEN x THEN x END ) WHERE x = ( SELECT x FROM x ) AND x GROUP BY 
1 ) ) FROM x
 
 1
 
-skipif knownfail
 query I nosort
 SELECT ( WITH x ( x ) AS ( SELECT DISTINCT 1 ) SELECT ( SELECT x FROM x WHERE 
x = ( SELECT ( CASE WHEN x THEN x END ) WHERE x = ( SELECT x FROM x ) AND x 
GROUP BY 1 ) ) FROM x )
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - bug #7480 was fixed by recent changes

2024-05-08 Thread Niels Nes via checkin-list
Changeset: 601eea2d633f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/601eea2d633f
Modified Files:
sql/test/BugTracker-2024/Tests/get_rel_count-Bug-7480.test
Branch: default
Log Message:

bug #7480 was fixed by recent changes


diffs (11 lines):

diff --git a/sql/test/BugTracker-2024/Tests/get_rel_count-Bug-7480.test 
b/sql/test/BugTracker-2024/Tests/get_rel_count-Bug-7480.test
--- a/sql/test/BugTracker-2024/Tests/get_rel_count-Bug-7480.test
+++ b/sql/test/BugTracker-2024/Tests/get_rel_count-Bug-7480.test
@@ -8,7 +8,6 @@ SELECT NULL GROUP BY 1
 
 NULL
 
-skipif knownfail
 query I nosort
 SELECT CASE WHEN ( SELECT 2 WHERE FALSE ) > ANY ( 1 ) THEN 1 END GROUP BY 1
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed bug #7475 by improved check for distinc...

2024-05-08 Thread Niels Nes via checkin-list
Changeset: a8b8f3b90564 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a8b8f3b90564
Modified Files:
sql/server/rel_exp.c
sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
Branch: default
Log Message:

fixed bug #7475 by improved check for distinct expression names


diffs (32 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -1169,7 +1169,8 @@ exp_equal( sql_exp *e1, sql_exp *e2)
if (e1 == e2)
return 0;
if (e1->alias.rname && e2->alias.rname && strcmp(e1->alias.rname, 
e2->alias.rname) == 0)
-   return strcmp(e1->alias.name, e2->alias.name);
+   if (e1->alias.name && e2->alias.name && strcmp(e1->alias.name, 
e2->alias.name) == 0)
+   return 0;
if (!e1->alias.rname && !e2->alias.rname && e1->alias.label == 
e2->alias.label && e1->alias.name && e2->alias.name)
return strcmp(e1->alias.name, e2->alias.name);
return -1;
diff --git a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test 
b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
--- a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
+++ b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
@@ -10,7 +10,6 @@ WITH x AS ( SELECT 1 x ) SELECT 1 , ( SE
 1
 1
 
-skipif knownfail
 query II nosort
 SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM x 
WHERE x ) y
 
@@ -23,7 +22,6 @@ SELECT * FROM ( WITH x AS ( SELECT 1 x )
 1
 1
 
-skipif knownfail
 query II nosort
 SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( 
x NATURAL JOIN x y ) WHERE x ) y
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fix compilation (unused variable)

2024-05-08 Thread Niels Nes via checkin-list
Changeset: 5ab32c5ce4a6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5ab32c5ce4a6
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

fix compilation (unused variable)


diffs (20 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5609,7 +5609,7 @@ rel_select_exp(sql_query *query, sql_rel
 
if (ce) {
if (inner && inner->flag && is_groupby(inner->op)) {
-   int found = 0, nratom = 0;
+   int found = 0;
list *gbe = inner->r;
/* flag == 2 just add to group by/ aggrs and 
ref-to pexps*/
/* flag == 1 find group by exp referencing this 
column nr */
@@ -5630,7 +5630,6 @@ rel_select_exp(sql_query *query, sql_rel
if (is_atom(e->type) && 
!e->alias.name) {
atom *a = e->l;
int nr = 
(int)atom_get_int(a);
-   nratom++;
if (nr == 
(list_length(pexps) + 1)) {
n->data = ce;
ce = 
exp_ref(sql, ce);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - restrict aliases, ie should be unique on both...

2024-05-08 Thread Niels Nes via checkin-list
Changeset: 7a0f46ef26fb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7a0f46ef26fb
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
Branch: default
Log Message:

restrict aliases, ie should be unique on both ends of the join


diffs (82 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5978,6 +5978,9 @@ rel_joinquery_(sql_query *query, symbol 
return NULL;
 
query_processed(query);
+   if (strcmp(rel_name(t1), rel_name(t2)) == 0) {
+   return sql_error(sql, 02, SQLSTATE(42000) "SELECT: ERROR:  
table name '%s' specified more than once", rel_name(t1));
+   }
inner = rel = rel_crossproduct(sql->sa, t1, t2, op);
if (!rel)
return NULL;
diff --git a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test 
b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
--- a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
+++ b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
@@ -363,18 +363,18 @@ x
 -- WITH v0 AS (SELECT 14, * FROM v0) INSERT INTO v0 SELECT v1 * 0 FROM v0 
NATURAL JOIN v0, v0, v0 AS v2, v0, v0 AS v3 ORDER BY v1 * 0 / 77
 
 statement ok
-WITH v0 AS (SELECT 14, * FROM v0) INSERT INTO v0 SELECT v0.v1 * 0 FROM v0 
NATURAL JOIN v0, v0, v0 AS v2, v0, v0 AS v3 ORDER BY v0.v1 * 0 / 77
+WITH v0 AS (SELECT 14, * FROM v0) INSERT INTO v0 SELECT v0.v1 * 0 FROM v0 
NATURAL JOIN v0 v, v0 as v1, v0 AS v2, v0 as v3, v0 AS v4 ORDER BY v0.v1 * 0 / 
77
 
 query I nosort
 SELECT count(*) FROM v0
 
-131080
+16392
 
 -- after the second insert, rerun same query as above, since it used to crash 
the server
 query RT rowsort
 SELECT * , 'x' FROM v0 WHERE (SELECT 39 WHERE (v1 + -32768 NOT IN (14, 255))) 
* 87 + 2147483647
 
-131080 values hashing to c051bd7cdccd1fd3636c9e0973aca08e
+32776 values hashing to b2c71832cf3b6b1cb7d9db5b58419143
 
 -- mul_bte_bte_bte: ERROR: 22003!overflow in calculation 87*39.
 
diff --git a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test 
b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
--- a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
+++ b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7475.test
@@ -5,7 +5,7 @@ 1
 1
 
 query II nosort
-WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( x NATURAL JOIN 
x ) WHERE x
+WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( x NATURAL JOIN 
x y ) WHERE x
 
 1
 1
@@ -18,14 +18,14 @@ 1
 1
 
 query II nosort
-SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , x FROM ( x NATURAL JOIN x 
) WHERE x ) y
+SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , x FROM ( x NATURAL JOIN x 
y ) WHERE x ) y
 
 1
 1
 
 skipif knownfail
 query II nosort
-SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( 
x NATURAL JOIN x ) WHERE x ) y
+SELECT * FROM ( WITH x AS ( SELECT 1 x ) SELECT 1 , ( SELECT x FROM x ) FROM ( 
x NATURAL JOIN x y ) WHERE x ) y
 
 1
 1
diff --git a/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test 
b/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
--- a/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
+++ b/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
@@ -1,9 +1,9 @@
 query I nosort
-SELECT ( WITH x AS ( SELECT 1 x ) SELECT 1 FROM ( x NATURAL JOIN x ) WHERE x 
NOT IN ( SELECT CASE WHEN x THEN ( SELECT 1 ) END GROUP BY 1 ) )
+SELECT ( WITH x AS ( SELECT 1 x ) SELECT 1 FROM ( x NATURAL JOIN x as y ) 
WHERE x NOT IN ( SELECT CASE WHEN x THEN ( SELECT 1 ) END GROUP BY 1 ) )
 
 NULL
 
 query I nosort
-SELECT ( WITH x AS ( SELECT 1 x ) SELECT 1 FROM ( x NATURAL JOIN x ) WHERE x 
NOT IN ( SELECT CASE WHEN x THEN ( SELECT 1 ) END GROUP BY ( SELECT 1 ) ) )
+SELECT ( WITH x AS ( SELECT 1 x ) SELECT 1 FROM ( x NATURAL JOIN x as y ) 
WHERE x NOT IN ( SELECT CASE WHEN x THEN ( SELECT 1 ) END GROUP BY ( SELECT 1 ) 
) )
 
 NULL
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - added changelog for group by/order by changes

2024-05-08 Thread Niels Nes via checkin-list
Changeset: e21380596aa6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e21380596aa6
Modified Files:
ChangeLog
Branch: default
Log Message:

added changelog for group by/order by changes


diffs (14 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Wed May  8 2024 Niels Nes 
+- Add support for select exp, count(*) group by 1 order by 1; ie. using
+  numeric references Added support for group by all and order by all. The
+  later is ordering on all columns of the selection.  The group by all
+  finds all expressions from the selections which aren't aggregations
+  and groups on those.  All can also be replaced by '*'.
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - implemented group by and order by reference n...

2024-05-08 Thread Niels Nes via checkin-list
Changeset: 2c2bfc484616 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2c2bfc484616
Added Files:
sql/test/miscellaneous/Tests/group_by_all.test
sql/test/sets/Tests/All
sql/test/sets/Tests/union.test
Modified Files:
sql/include/sql_relation.h
sql/rel.txt
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/sql_parser.y
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.test
sql/test/BugTracker-2024/Tests/aggr-exp-copy-crash-7435.test
sql/test/SQLancer/Tests/sqlancer01.test
sql/test/SQLancer/Tests/sqlancer03.test
sql/test/SQLancer/Tests/sqlancer08.test
sql/test/SQLancer/Tests/sqlancer09.test
sql/test/SQLancer/Tests/sqlancer10.test
sql/test/SQLancer/Tests/sqlancer14.test
sql/test/SQLancer/Tests/sqlancer15.test
sql/test/SQLancer/Tests/sqlancer23.test
sql/test/miscellaneous/Tests/All
sql/test/miscellaneous/Tests/groupby_expressions.test
sql/test/miscellaneous/Tests/simple_selects.test
sql/test/subquery/Tests/subquery3.test
sql/test/subquery/Tests/subquery6.test
Branch: default
Log Message:

implemented group by and order by reference number
corrected handling of constants in group by (ie we now disallow this as defined 
by sql standard)
add support for group by and order by all/*


diffs (truncated from 1011 to 300 lines):

diff --git a/sql/include/sql_relation.h b/sql/include/sql_relation.h
--- a/sql/include/sql_relation.h
+++ b/sql/include/sql_relation.h
@@ -50,7 +50,7 @@ typedef struct expression {
unsigned short tmp;
unsigned int
 card:2,/* card (0 truth value!) (1 atoms) (2 aggr) (3 multi 
value) */
-freevar:4, /* free variable, ie binds to the upper dependent join 
*/
+freevar:8, /* free variable, ie binds to the upper dependent join 
*/
 intern:1,
 selfref:1, /* set when the expression references a 
expression in the same projection list */
 anti:1,
@@ -298,7 +298,7 @@ typedef struct relation {
int nrcols; /* nr of cols */
unsigned int
 flag:16,
-card:4,/* 0, 1 (row), 2 aggr, 3 */
+card:2,/* 0, 1 (row), 2 aggr, 3 */
 dependent:1,   /* dependent join */
 distinct:1,
 processed:1,   /* fully processed or still in the process of building 
*/
diff --git a/sql/rel.txt b/sql/rel.txt
--- a/sql/rel.txt
+++ b/sql/rel.txt
@@ -66,6 +66,7 @@ GROUPBY  (card ATOM (no group by exps), 
-> exps is list of (groupby and) aggregate expressions
-> lis relation
-> ris list of group by expressions
+   -> flag 1 has group by nr , 2 group by all
 
 TOPN   (card ATOM, AGGR, or MULTI (same card as lower relation))
-> exps (list) lng limit, [ lng offset ] -> if the limit is a 
NULL value, then it's ignored, ie only the offset will be used
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2058,6 +2058,99 @@ exp_is_atom( sql_exp *e )
return 0;
 }
 
+static int
+exps_are_aggr(sql_rel *r, list *exps)
+{
+   int aggr = 1;
+   if (!list_empty(exps))
+   for(node *n=exps->h; n && aggr; n=n->next)
+   aggr &= exp_is_aggr(r, n->data);
+   return aggr;
+}
+
+/* is expression e an aggregated result of r */
+int
+exp_is_aggr(sql_rel *r, sql_exp *e)
+{
+   sql_exp *ne = NULL;
+
+   switch (e->type) {
+   case e_atom:
+   return true;
+   case e_convert:
+   return exp_is_aggr(r, e->l);
+   case e_func:
+   return exps_are_aggr(r, e->l);
+   case e_aggr:
+   return true;
+   case e_cmp:
+   if (e->card != CARD_ATOM)
+   return false;
+   if (e->flag == cmp_or || e->flag == cmp_filter)
+   return exps_are_aggr(r, e->l) && exps_are_aggr(r, e->r);
+   if (e->flag == cmp_in || e->flag == cmp_notin)
+   return exp_is_aggr(r, e->l) && exps_are_aggr(r, e->r);
+   return exp_is_aggr(r, e->l) && exp_is_aggr(r, e->r) && (!e->f 
|| exp_is_aggr(r, e->f));
+   case e_column:
+   if (e->freevar)
+   return true;
+   ne = rel_find_exp(r, e);
+   if (ne) /* found local */
+   return true;
+   else
+   return false;
+   case e_psm:
+   return false;
+   }
+   return false;
+}
+
+static int
+exps_have_aggr(sql_rel *r, list *exps)
+{
+   int aggr = 0;
+   if (!list_empty(exps))
+   for(node *n=exps->h; n && !aggr; n=n->next)
+   aggr |= exp_has_aggr(r, 

MonetDB: Dec2023 - small cleanup of persist unlogged table

2024-05-06 Thread Niels Nes via checkin-list
Changeset: a107f9de5e96 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a107f9de5e96
Modified Files:
sql/backends/monet5/sql.c
Branch: Dec2023
Log Message:

small cleanup of persist unlogged table


diffs (124 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4367,8 +4367,10 @@ SQLpersist_unlogged(Client cntxt, MalBlk
sql_trans *tr = m->session->tr;
storage *t_del = bind_del_data(tr, t, NULL);
 
-   BAT *d = BATdescriptor(t_del->cs.bid);
-
+   BAT *d = NULL;
+
+   if (t_del)
+   d = BATdescriptor(t_del->cs.bid);
if (t_del == NULL || d == NULL)
throw(SQL, "sql.persist_unlogged", "Cannot access %s column 
storage.", tname);
 
@@ -4380,15 +4382,17 @@ SQLpersist_unlogged(Client cntxt, MalBlk
assert(d->batInserted <= d_bi.count);
 
if (d->batInserted < d_bi.count) {
-
-   int n = 100;
-   bat *commit_list = GDKzalloc(sizeof(bat) * (n + 1));
-   BUN *sizes = GDKzalloc(sizeof(BUN) * (n + 1));
+   int n = ol_length(t->columns);
+
+   bat *commit_list = GDKzalloc(sizeof(bat) * (n + 2));
+   BUN *sizes = GDKzalloc(sizeof(BUN) * (n + 2));
 
if (commit_list == NULL || sizes == NULL) {
+   bat_iterator_end(_bi);
MT_lock_unset(_persist_unlogged);
GDKfree(commit_list);
GDKfree(sizes);
+   BBPreclaim(d);
throw(SQL, "sql.persist_unlogged", 
SQLSTATE(HY001));
}
 
@@ -4396,51 +4400,41 @@ SQLpersist_unlogged(Client cntxt, MalBlk
sizes[0] = 0;
int i = 1;
 
-   for (node *ncol = ol_first_node(t->columns); ncol; ncol 
= ncol->next) {
+   for (node *ncol = ol_first_node(t->columns); ncol; ncol 
= ncol->next, i++) {
 
sql_column *c = (sql_column *) ncol->data;
BAT *b = store->storage_api.bind_col(tr, c, 
QUICK);
 
if (b == NULL) {
+   bat_iterator_end(_bi);
MT_lock_unset(_persist_unlogged);
GDKfree(commit_list);
GDKfree(sizes);
+   BBPreclaim(d);
throw(SQL, "sql.persist_unlogged", 
"Cannot access column descriptor.");
}
 
-   if (i == n && ncol->next) {
-   n = n * 2;
-   commit_list = GDKrealloc(commit_list, 
sizeof(bat) * n);
-   sizes = GDKrealloc(sizes, sizeof(BUN) * 
n);
-   }
-
-   if (commit_list == NULL || sizes == NULL) {
-   MT_lock_unset(_persist_unlogged);
-   GDKfree(commit_list);
-   GDKfree(sizes);
-   throw(SQL, "sql.persist_unlogged", 
SQLSTATE(HY001));
-   }
-
commit_list[i] = b->batCacheid;
sizes[i] = d_bi.count;
-   i++;
}
 
+   assert(ibatCacheid;
sizes[i] = d_bi.count;
i++;
 
if (TMsubcommit_list(commit_list, sizes, i, -1, -1) != 
GDK_SUCCEED) {
+   bat_iterator_end(_bi);
MT_lock_unset(_persist_unlogged);
GDKfree(commit_list);
GDKfree(sizes);
+   BBPreclaim(d);
throw(SQL, "sql.persist_unlogged", "Lower level 
commit operation failed");
}
 
GDKfree(commit_list);
GDKfree(sizes);
}
-
count = d_bi.count;
}
 
@@ -4452,25 +4446,19 @@ SQLpersist_unlogged(Client cntxt, MalBlk
*tableid = COLnew(0, TYPE_int, 0, TRANSIENT),
*rowcount = COLnew(0, TYPE_lng, 0, TRANSIENT);
 
-   if (table == NULL || tableid == NULL || rowcount == NULL) {
-   BBPnreclaim(3, table, tableid, rowcount);
-   throw(SQL, "sql.persist_unlogged", SQLSTATE(HY001));
-   }
-
-   if (BUNappend(table, tname, false) != GDK_SUCCEED ||
+   if 

MonetDB: default - no more GROUP BY constant (part 1)

2024-05-02 Thread Niels Nes via checkin-list
Changeset: 8bac8f7f028c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8bac8f7f028c
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
sql/test/BugTracker-2024/Tests/where_null-7450.test
sql/test/SQLancer/Tests/sqlancer01.test
sql/test/SQLancer/Tests/sqlancer02.test
sql/test/SQLancer/Tests/sqlancer03.test
sql/test/SQLancer/Tests/sqlancer04.test
sql/test/SQLancer/Tests/sqlancer09.test
sql/test/SQLancer/Tests/sqlancer11.test
sql/test/SQLancer/Tests/sqlancer18.test
sql/test/SQLancer/Tests/sqlancer23.test
sql/test/miscellaneous/Tests/groupby_expressions.test
sql/test/miscellaneous/Tests/simple_selects.test
Branch: default
Log Message:

no more GROUP BY constant (part 1)
We dis-allow grouping by constants.
Todo handle the group by numeric (again), ie lookup the numbered column in the
resulting selection


diffs (truncated from 511 to 300 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4068,6 +4068,15 @@ rel_group_column(sql_query *query, sql_r
exp_kind ek = {type_value, card_value, TRUE};
sql_exp *e = rel_value_exp2(lquery, rel, grp, f, ek);
 
+   if (e && exp_is_atom(e)) {
+   sql_subtype *tpe = exp_subtype(e);
+   if (!tpe || tpe->type->eclass != EC_NUM) {
+   if (!tpe)
+   return sql_error(sql, 02, SQLSTATE(42000) 
"Cannot have a parameter (?) for group by column");
+   return sql_error(sql, 02, SQLSTATE(42000) "SELECT: 
non-integer constant in GROUP BY");
+   }
+   }
+
if (!e) {
char buf[ERRSIZE], *name;
int status = sql->session->status;
diff --git a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test 
b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
--- a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
+++ b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
@@ -111,7 +111,7 @@ CREATE TEMP TABLE Table0 (Col0 INT, PRIM
 
 -- 07.sql
 statement ok
-CREATE VIEW v0 AS SELECT CAST (NULL AS INT) EXCEPT SELECT CAST (NULL AS INT) 
GROUP BY NULL
+CREATE VIEW v0 AS SELECT CAST (NULL AS INT) EXCEPT SELECT CAST (NULL AS INT)
 
 statement ok
 DROP VIEW v0
@@ -452,7 +452,7 @@ statement ok
 CREATE TABLE v0(v2 DOUBLE PRIMARY KEY, v1 VARCHAR(1))
 
 statement ok
-DELETE FROM v0 WHERE (SELECT v2 FROM v0 WHERE v0.v2 = v0.v1 GROUP BY 2.10, 
v1) IN (10.10, 10, 10 )
+DELETE FROM v0 WHERE (SELECT v2 FROM v0 WHERE v0.v2 = v0.v1 GROUP BY v1) IN 
(10.10, 10, 10 )
 
 statement ok
 DROP TABLE v0
@@ -533,7 +533,7 @@ statement ok
 CREATE TABLE v0(v1 VARCHAR(30), v2 CHAR(20))
 
 statement ok
-DELETE FROM v0 WHERE (SELECT v1 WHERE (SELECT COUNT (*) OVER (ORDER BY v1 DESC 
NULLS LAST)) = v2 GROUP BY 2.10 HAVING 0 NOT LIKE v2)
+DELETE FROM v0 WHERE (SELECT v1 WHERE (SELECT COUNT (*) OVER (ORDER BY v1 DESC 
NULLS LAST)) = v2)
 
 statement ok
 DROP TABLE v0
diff --git a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test 
b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
--- a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
+++ b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
@@ -1,10 +1,10 @@
 query T nosort
-WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x GROUP BY 'x' )
+WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x)
 
 NULL
 
 query T nosort
-SELECT ( WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x GROUP BY 
'x' ) )
+SELECT ( WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x) )
 
 NULL
 
diff --git a/sql/test/BugTracker-2024/Tests/where_null-7450.test 
b/sql/test/BugTracker-2024/Tests/where_null-7450.test
--- a/sql/test/BugTracker-2024/Tests/where_null-7450.test
+++ b/sql/test/BugTracker-2024/Tests/where_null-7450.test
@@ -5,7 +5,7 @@ statement ok
 INSERT INTO t0 ( c0) VALUES (false)
 
 statement ok
-CREATE VIEW v0(c0) AS SELECT true FROM t0 WHERE NULL GROUP BY t0.c0, true
+CREATE VIEW v0(c0) AS SELECT true FROM t0 WHERE NULL GROUP BY t0.c0
 
 query I nosort
 SELECT * FROM v0
diff --git a/sql/test/SQLancer/Tests/sqlancer01.test 
b/sql/test/SQLancer/Tests/sqlancer01.test
--- a/sql/test/SQLancer/Tests/sqlancer01.test
+++ b/sql/test/SQLancer/Tests/sqlancer01.test
@@ -279,7 +279,7 @@ 0.835   0
 0.455  -1239303309
 
 query I rowsort
-SELECT MIN(DISTINCT t0.c1) FROM t0 WHERE 1 >= t0.c0 GROUP BY true
+SELECT MIN(DISTINCT t0.c1) FROM t0 WHERE 1 >= t0.c0
 
 -1239303309
 
@@ -547,7 +547,7 @@ 1511423462.000
 NULL
 
 query RR rowsort
-SELECT ALL 0.1002352, AVG(ALL t0.c0) FROM t0 GROUP BY CAST(t0.c0 AS 
STRING(799)), 0.4665444117594173, ((sql_min(+ ("locate"('', 'F', 150648381)), 
(((-1039870396))*(length('u')>>(CAST(0.588018201374832 AS INT)))
+SELECT ALL 0.1002352, 

MonetDB: Dec2023 - Field function needs at least 2 arguments, fi...

2024-05-02 Thread Niels Nes via checkin-list
Changeset: bceaa8a1561d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bceaa8a1561d
Modified Files:
sql/server/rel_optimize_proj.c
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
Branch: Dec2023
Log Message:

Field function needs at least 2 arguments, fixes #7508


diffs (34 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -1781,6 +1781,8 @@ rel_groupby_cse(visitor *v, sql_rel *rel
sql_exp *e1_in_exps = (e1->l && 
e1->alias.rname == e1->l && e1->alias.name == e1->r) ?
exps_bind_column2(rel->exps, 
e1->l, e1->r, NULL) :
exps_bind_column(rel->exps, 
e1->alias.name, NULL, NULL, 0);
+   if (!e1_in_exps)
+   continue;
assert(e1_in_exps);
 
/* write e2 as an e1 alias since the 
expressions are the same */
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -3536,6 +3536,8 @@ rel_nop(sql_query *query, sql_rel **rel,
if (!sname && strcmp(fname, "field") == 0) { /* map into join */
if (err)
return NULL;
+   if (list_length(exps) < 2)
+   return sql_error(sql, 02, SQLSTATE(42000) "Field 
function called with not enough arguments");
sql_exp *le = exps->h->data;
set_freevar(le, 1);
list_remove_data(exps, NULL, le);
diff --git a/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test 
b/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
--- a/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
+++ b/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
@@ -1,2 +1,5 @@
-statement error
+statement error 42000!SELECT: identifier 'x' unknown
 SELECT FIELD(x, '', '', '', '', '', '', '', '', '', '', '', '', '')
+
+statement error 42000!Field function called with not enough arguments
+SELECT 
FIELD('fieldID999')
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - enable test

2024-05-01 Thread Niels Nes via checkin-list
Changeset: 85aaf41e2e88 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/85aaf41e2e88
Modified Files:
sql/test/BugTracker-2024/Tests/multicolumn_IN_value_list-Bug-7497.test
Branch: default
Log Message:

enable test


diffs (11 lines):

diff --git 
a/sql/test/BugTracker-2024/Tests/multicolumn_IN_value_list-Bug-7497.test 
b/sql/test/BugTracker-2024/Tests/multicolumn_IN_value_list-Bug-7497.test
--- a/sql/test/BugTracker-2024/Tests/multicolumn_IN_value_list-Bug-7497.test
+++ b/sql/test/BugTracker-2024/Tests/multicolumn_IN_value_list-Bug-7497.test
@@ -10,7 +10,6 @@ CREATE TABLE s (s1 INT, s2 INT, s3 INT);
 statement ok
 INSERT INTO s VALUES (41, 44, 10), (42, 44, 20), (34, 44, 30), (41, 45, 40), 
(34, 45, 50), (34, 44, 60), (42, 44, 70), (42, 44, 80);
 
-skipif knownfail
 query III nosort
 SELECT * FROM s WHERE (s1, s2) IN ((42,44), (41,45), (43,42)) ORDER BY s3;
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - add support for multi col in statements, fixe...

2024-05-01 Thread Niels Nes via checkin-list
Changeset: d7fec2bf7345 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d7fec2bf7345
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_exp.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/sql_parser.y
sql/test/SQLancer/Tests/sqlancer22.test
sql/test/subquery/Tests/subquery3.test
sql/test/subquery/Tests/subquery4.test
Branch: default
Log Message:

add support for multi col in statements, fixes #7497


diffs (truncated from 513 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -446,8 +446,65 @@ subrel_project(backend *be, stmt *s, lis
 }
 
 static stmt *
+handle_in_tuple_exps(backend *be, sql_exp *ce, list *nl, stmt *left, stmt 
*right, stmt *grp, stmt *ext, stmt *cnt, stmt *sel, bool in, int depth, int 
reduce, int push)
+{
+   mvc *sql = be->mvc;
+   stmt *s = NULL;
+
+   list *lvals = ce->f, *lstmts = sa_list(sql->sa);
+   for(node *n = lvals->h; n; n = n->next) {
+   sql_exp *ce = n->data;
+   stmt *c = exp_bin(be, ce, left, right, grp, ext, cnt, NULL, 
depth+1, 0, push);
+
+   if (c && reduce && c->nrcols == 0)
+   c = stmt_const(be, bin_find_smallest_column(be, left), 
c);
+   if(!c)
+   return NULL;
+   lstmts = append(lstmts, c);
+   }
+
+   sql_subtype *bt = sql_bind_localtype("bit");
+   sql_subfunc *and = sql_bind_func(sql, "sys", "and", bt, bt, F_FUNC, 
true, true);
+   sql_subfunc *or = sql_bind_func(sql, "sys", "or", bt, bt, F_FUNC, true, 
true);
+   for (node *n = nl->h; n; n = n->next) {
+   sql_exp *e = n->data;
+   list *vals = e->f;
+   stmt *cursel = NULL;
+
+   for (node *m = vals->h, *o = lstmts->h; m && o; m = m->next, o 
= o->next) {
+   stmt *c = o->data;
+   sql_subfunc *cmp = (in)
+   ?sql_bind_func(sql, "sys", "=", tail_type(c), 
tail_type(c), F_FUNC, true, true)
+   :sql_bind_func(sql, "sys", "<>", tail_type(c), 
tail_type(c), F_FUNC, true, true);
+   sql_exp *e = m->data;
+
+   stmt *i = exp_bin(be, e, left, right, grp, ext, cnt, 
NULL, depth+1, 0, push);
+   if(!i)
+   return NULL;
+
+   i = stmt_binop(be, c, i, NULL, cmp);
+   if (cursel)
+   cursel = stmt_binop(be, cursel, i, NULL, 
in?and:or);
+   else
+   cursel = i;
+   }
+   if (s)
+   s = stmt_binop(be, s, cursel, NULL, in?or:and);
+   else
+   s = cursel;
+   }
+   if (sel && !(depth || !reduce))
+   s = stmt_uselect(be,
+   s->nrcols == 0?stmt_const(be, 
bin_find_smallest_column(be, left), s): s,
+   stmt_bool(be, 1), cmp_equal, sel, 0, 0);
+   return s;
+}
+
+static stmt *
 handle_in_exps(backend *be, sql_exp *ce, list *nl, stmt *left, stmt *right, 
stmt *grp, stmt *ext, stmt *cnt, stmt *sel, bool in, int depth, int reduce, int 
push)
 {
+   if (ce && is_values(ce))
+   return handle_in_tuple_exps(be, ce, nl, left, right, grp, ext, 
cnt, sel, in, depth, reduce, push);
mvc *sql = be->mvc;
node *n;
stmt *s = NULL, *c = exp_bin(be, ce, left, right, grp, ext, cnt, NULL, 
depth+1, 0, push);
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2036,7 +2036,7 @@ exp_is_atom( sql_exp *e )
switch (e->type) {
case e_atom:
if (e->f) /* values list */
-   return 0;
+   return exps_are_atoms(e->f);
return 1;
case e_convert:
return exp_is_atom(e->l);
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -823,45 +823,84 @@ exp_tuples_set_supertype(mvc *sql, list 
 
for (node *m = vals->h; m; m = m->next) {
sql_exp *tuple = m->data;
-   sql_rel *tuple_relation = exp_rel_get_rel(sql->sa, tuple);
-
-   for(n = tuple_relation->exps->h, i = 0; n; n = n->next, i++) {
-   sql_subtype *tpe;
-   sql_exp *e = n->data;
-
-   if (has_type[i] && e->type == e_atom && !e->l && !e->r 
&& !e->f && !e->tpe.type) {
-   if (set_type_param(sql, types+i, e->flag) == 0)
-   e->tpe = types[i];
-   else
+   if (is_values(tuple)) {
+  

MonetDB: Dec2023 - merged

2024-05-01 Thread Niels Nes via checkin-list
Changeset: 473617d38f50 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/473617d38f50
Branch: Dec2023
Log Message:

merged


diffs (39 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -6658,7 +6658,15 @@ static stmt *
 rel2bin_merge(backend *be, sql_rel *rel, list *refs)
 {
mvc *sql = be->mvc;
-   sql_rel *join = rel->l, *r = rel->r;
+   sql_rel *join;
+
+   if (is_project(((sql_rel*)rel->l)->op)) {
+   join = ((sql_rel*)rel->l)->l;
+   } else {
+   join = rel->l;
+   }
+
+   sql_rel *r = rel->r;
stmt *join_st, *bt_stmt, *target_stmt, *jl, *jr, *ld, *rd = NULL, *ns;
list *slist = sa_list(sql->sa);
 
diff --git a/sql/test/BugTracker-2024/Tests/merge-into-gh-7503.test 
b/sql/test/BugTracker-2024/Tests/merge-into-gh-7503.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/merge-into-gh-7503.test
@@ -0,0 +1,14 @@
+statement ok
+CREATE TABLE logs(id int, activity varchar(255) NOT NULL)
+
+statement ok
+CREATE TABLE stats(activity varchar(255) NOT NULL, absolute_reworks int)
+
+statement ok
+WITH rework_stats AS (SELECT activity, count(*) AS frequency FROM (SELECT 
activity,count(*) AS reworks FROM logs GROUP BY  activity HAVING count(*) > 
1) AS case_reworks GROUP BY activity) MERGE INTO stats USING rework_stats 
on rework_stats.activity = stats.activity WHEN MATCHED THEN UPDATE SET 
absolute_reworks = rework_stats.frequency
+
+statement ok
+DROP TABLE logs
+
+statement ok
+DROP TABLE stats
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - fixed #7506 , properly give an error on incor...

2024-05-01 Thread Niels Nes via checkin-list
Changeset: 1ca42bba0338 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1ca42bba0338
Added Files:
sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/All
Branch: Dec2023
Log Message:

fixed #7506 , properly give an error on incorrect inputs for the field function.


diffs (27 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -3534,6 +3534,8 @@ rel_nop(sql_query *query, sql_rel **rel,
char *sname = qname_schema(l->data.lval);
 
if (!sname && strcmp(fname, "field") == 0) { /* map into join */
+   if (err)
+   return NULL;
sql_exp *le = exps->h->data;
set_freevar(le, 1);
list_remove_data(exps, NULL, le);
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -51,3 +51,4 @@ sql_init_subtype-Bug-7487
 orderby-max-over-rows-Bug-7488
 rel2bin_select-Bug-7496
 multicolumn_IN_value_list-Bug-7497
+field-arg-error-Bug-7506
diff --git a/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test 
b/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/field-arg-error-Bug-7506.test
@@ -0,0 +1,2 @@
+statement error
+SELECT FIELD(x, '', '', '', '', '', '', '', '', '', '', '', '', '')
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - fixed issue #7499, ie keep default schema in ...

2024-04-28 Thread Niels Nes via checkin-list
Changeset: b86245e5174a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b86245e5174a
Added Files:
sql/test/transactions/Tests/rollback_and_schema-Bug-7499.test
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_user.c
sql/include/sql_catalog.h
sql/storage/store.c
sql/test/transactions/Tests/All
Branch: Dec2023
Log Message:

fixed issue #7499, ie keep default schema in the session, on missing default 
schema give an error.


diffs (110 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -821,7 +821,7 @@ SQLtrans(mvc *m)
}
s = m->session;
if (!s->schema) {
-   switch (monet5_user_get_def_schema(m, m->user_id, 
>schema_name)) {
+   switch (monet5_user_get_def_schema(m, m->user_id, 
>def_schema_name)) {
case -1:
mvc_cancel_session(m);
throw(SQL, "sql.trans", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
@@ -834,6 +834,7 @@ SQLtrans(mvc *m)
default:
break;
}
+   s->schema_name = s->def_schema_name;
if (!(s->schema = find_sql_schema(s->tr, 
s->schema_name))) {
mvc_cancel_session(m);
throw(SQL, "sql.trans", SQLSTATE(42000) "The 
session's schema was not found, this session is going to terminate");
diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -849,6 +849,8 @@ monet5_user_set_def_schema(mvc *m, oid u
}
 
/* while getting the session's schema, set the search path as well */
+   /* new default schema */
+   m->session->def_schema_name = schema;
if (!(ok = mvc_set_schema(m, schema)) || (path_err = 
parse_schema_path_str(m, schema_path, true)) != MAL_SUCCEED) {
if (m->session->tr->active && (other = mvc_rollback(m, 0, NULL, 
false)) != MAL_SUCCEED)
freeException(other);
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -750,6 +750,7 @@ typedef struct sql_session {
sql_allocator *sa;
sql_trans *tr;  /* active transaction */
 
+   char *def_schema_name; /* users default schema name */
char *schema_name; /* transaction's schema name */
sql_schema *schema;
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -7214,13 +7214,11 @@ sql_session_destroy(sql_session *s)
 int
 sql_session_reset(sql_session *s, int ac)
 {
-   char *def_schema_name = SA_STRDUP(s->sa, "sys");
-
-   if (!s->tr || !def_schema_name)
+   if (!s->tr)
return 0;
 
assert(s->tr && s->tr->active == 0);
-   s->schema_name = def_schema_name;
+   s->schema_name = s->def_schema_name;
s->schema = NULL;
s->auto_commit = s->ac_on_commit = ac;
s->level = tr_serializable;
@@ -7236,7 +7234,11 @@ sql_trans_begin(sql_session *s)
store_lock(store);
TRC_DEBUG(SQL_STORE, "Enter sql_trans_begin for transaction: " ULLFMT 
"\n", tr->tid);
tr->ts = store_timestamp(store);
-   if (!(s->schema = find_sql_schema(tr, s->schema_name))) {
+   if (s->schema_name && !(s->schema = find_sql_schema(tr, 
s->schema_name)))
+   s->schema_name = s->def_schema_name;
+   if (!s->schema_name)
+   s->schema_name = "sys";
+   if (s->schema_name && !(s->schema = find_sql_schema(tr, 
s->schema_name))) {
TRC_DEBUG(SQL_STORE, "Exit sql_trans_begin for transaction: " 
ULLFMT " with error, the schema %s was not found\n", tr->tid, s->schema_name);
store_unlock(store);
return -3;
@@ -7268,6 +7270,7 @@ sql_trans_end(sql_session *s, int ok)
s->tr->active = 0;
s->tr->status = 0;
s->auto_commit = s->ac_on_commit;
+   s->schema = NULL;
list_remove_data(store->active, NULL, s->tr);
ATOMIC_SET(>lastactive, GDKusec());
ATOMIC_DEC(>nr_active);
diff --git a/sql/test/transactions/Tests/All b/sql/test/transactions/Tests/All
--- a/sql/test/transactions/Tests/All
+++ b/sql/test/transactions/Tests/All
@@ -10,3 +10,4 @@ truncate-insert-restart
 update_drop_crash
 update_drop_crash2
 insert_drop_crash
+rollback_and_schema-Bug-7499
diff --git a/sql/test/transactions/Tests/rollback_and_schema-Bug-7499.test 
b/sql/test/transactions/Tests/rollback_and_schema-Bug-7499.test
new file mode 100644
--- /dev/null
+++ 

MonetDB: default - merged

2024-04-28 Thread Niels Nes via checkin-list
Changeset: 9c38920fe185 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9c38920fe185
Branch: default
Log Message:

merged


diffs (125 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1518,8 +1518,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (!l)
return NULL;
-   s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, from, 
to);
-   }   break;
+   if (from->type->eclass == EC_SEC && to->type->eclass == EC_SEC) 
{
+   // trivial conversion because EC_SEC is always in 
milliseconds
+   s = l;
+   } else {
+   s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, 
from, to);
+   }
+   }   break;
case e_func: {
node *en;
list *l = sa_list(sql->sa), *exps = e->l;
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -421,22 +421,29 @@ subtype_cmp(sql_subtype *t1, sql_subtype
 {
if (!t1->type || !t2->type)
return -1;
+   if (t1->type->eclass != t2->type->eclass)
+   return -1;
+   switch (t1->type->eclass) {
+   case EC_SEC:
+   case EC_MONTH:
+   if (t1->digits != t2->digits)
+   return -1;
+   return 0;
+   case EC_NUM:
+   break;
+   case EC_FLT:
+   if (t1->digits != t2->digits)
+   return -1;
+   break;
+   default:
+   if (t1->digits != t2->digits)
+   return -1;
+   if (t1->scale != t2->scale)
+   return -1;
+   break;
+   }
 
-   if (t1->type->eclass == t2->type->eclass && t1->type->eclass == EC_SEC)
-   return 0;
-   if (t1->type->eclass == t2->type->eclass && t1->type->eclass == 
EC_MONTH)
-   return 0;
-   if ( !(t1->type->eclass == t2->type->eclass &&
- (EC_INTERVAL(t1->type->eclass) || t1->type->eclass == EC_NUM)) &&
- (t1->digits != t2->digits ||
- (!(t1->type->eclass == t2->type->eclass &&
-  t1->type->eclass == EC_FLT) &&
-  t1->scale != t2->scale)) )
-   return -1;
-
-   /* subtypes are only equal iff
-  they map onto the same systemtype */
-   return (type_cmp(t1->type, t2->type));
+   return type_cmp(t1->type, t2->type);
 }
 
 int
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2964,7 +2964,7 @@ exp_scale_algebra(mvc *sql, sql_subfunc 
sql_subtype *lt = exp_subtype(l);
sql_subtype *rt = exp_subtype(r);
 
-   if (lt->type->scale == SCALE_FIX && (lt->scale || rt->scale) &&
+   if (!EC_INTERVAL(lt->type->eclass) && lt->type->scale == SCALE_FIX && 
(lt->scale || rt->scale) &&
strcmp(sql_func_imp(f->func), "/") == 0) {
sql_subtype *res = f->res->h->data;
unsigned int scale, digits, digL, scaleL;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2133,17 +2133,7 @@ exp_physical_types(visitor *v, sql_rel *
if (!e || (e->type != e_func && e->type != e_convert) || !e->l)
return e;
 
-   if (e->type == e_convert) {
-   sql_subtype *ft = exp_fromtype(e);
-   sql_subtype *tt = exp_totype(e);
-
-   /* complex conversion matrix */
-   if (ft->type->eclass == EC_SEC && tt->type->eclass == EC_SEC && 
ft->type->digits > tt->type->digits) {
-   /* no conversion needed, just time adjustment */
-   ne = e->l;
-   ne->tpe = *tt; // ugh
-   }
-   } else {
+   if (e->type != e_convert) {
list *args = e->l;
sql_subfunc *f = e->f;
 
diff --git a/sql/test/BugTracker-2023/Tests/All 
b/sql/test/BugTracker-2023/Tests/All
--- a/sql/test/BugTracker-2023/Tests/All
+++ b/sql/test/BugTracker-2023/Tests/All
@@ -25,3 +25,4 @@ orderby-debug-crash-7416
 newurl-issue-7417
 rel_order_by-assertion-7418
 HAVE_LIBPY3?aggregate-vararg.Bug-7422
+interval-day-and-second.Bug-7353
diff --git 
a/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test 
b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
@@ -0,0 +1,11 @@
+query TTI nosort
+SELECT
+CAST(CAST(value AS TEXT) AS INTERVAL HOUR)AS 

MonetDB: default - implement feature request bug #7500

2024-04-28 Thread Niels Nes via checkin-list
Changeset: a5c4bc890a89 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a5c4bc890a89
Modified Files:
sql/server/rel_psm.c
sql/server/sql_parser.y
Branch: default
Log Message:

implement feature request bug #7500


diffs (237 lines):

diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -614,6 +614,69 @@ has_return( list *l )
 }
 
 static list *
+psm_analyze(sql_query *query, dlist *qname, dlist *columns)
+{
+   mvc *sql = query->sql;
+   const char *sname = qname_schema(qname), *tname = 
qname_schema_object(qname);
+   list *tl = sa_list(sql->sa), *exps = sa_list(sql->sa), *analyze_calls = 
sa_list(sql->sa);
+   sql_subfunc *f = NULL;
+   sql_subtype tpe;
+
+   if (!sql_find_subtype(, "varchar", 1024, 0))
+   return sql_error(sql, 02, SQLSTATE(HY013) "varchar type 
missing?");
+
+   if (sname && tname) {
+   sql_table *t = NULL;
+
+   if (!(t = find_table_or_view_on_scope(sql, NULL, sname, tname, 
"ANALYZE", false)))
+   return NULL;
+   if (isDeclaredTable(t))
+   return sql_error(sql, 02, SQLSTATE(42000) "Cannot 
analyze a declared table");
+   sname = t->s->base.name;
+   }
+   /* call analyze( [schema, [ table ]] ) */
+   if (sname) {
+   sql_exp *sname_exp = exp_atom_str(sql->sa, sname, );
+
+   list_append(exps, sname_exp);
+   list_append(tl, exp_subtype(sname_exp));
+   }
+   if (tname) {
+   sql_exp *tname_exp = exp_atom_str(sql->sa, tname, );
+
+   list_append(exps, tname_exp);
+   list_append(tl, exp_subtype(tname_exp));
+
+   if (columns)
+   list_append(tl, exp_subtype(tname_exp));
+   }
+   if (!columns) {
+   if (!(f = sql_bind_func_(sql, "sys", "analyze", tl, F_PROC, 
true, false)))
+   return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42000) 
"Analyze procedure missing");
+   if (!execute_priv(sql, f->func))
+   return sql_error(sql, 02, SQLSTATE(42000) "No privilege 
to call analyze procedure");
+   list_append(analyze_calls, exp_op(sql->sa, exps, f));
+   } else {
+   if (!sname || !tname)
+   return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42000) 
"Analyze schema or table name missing");
+   if (!(f = sql_bind_func_(sql, "sys", "analyze", tl, F_PROC, 
true, false)))
+   return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42000) 
"Analyze procedure missing");
+   if (!execute_priv(sql, f->func))
+   return sql_error(sql, 02, SQLSTATE(42000) "No privilege 
to call analyze procedure");
+   for(dnode *n = columns->h; n; n = n->next) {
+   const char *cname = n->data.sval;
+   list *nexps = list_dup(exps, NULL);
+   sql_exp *cname_exp = exp_atom_str(sql->sa, cname, );
+
+   list_append(nexps, cname_exp);
+   /* call analyze( opt_minmax, opt_sample_size, sname, 
tname, cname) */
+   list_append(analyze_calls, exp_op(sql->sa, nexps, f));
+   }
+   }
+   return analyze_calls;
+}
+
+static list *
 sequential_block(sql_query *query, sql_subtype *restype, list *restypelist, 
dlist *blk, char *opt_label, int is_func)
 {
mvc *sql = query->sql;
@@ -654,6 +717,11 @@ sequential_block(sql_query *query, sql_s
case SQL_CASE:
res = rel_psm_case(query, restype, restypelist, 
s->data.lval->h, is_func);
break;
+   case SQL_ANALYZE: {
+   dlist *l = s->data.lval;
+
+   reslist = psm_analyze(query, l->h->data.lval /* 
qualified table name */, l->h->next->data.lval /* opt list of column */);
+   }   break;
case SQL_CALL:
assert(s->type == type_symbol);
res = rel_psm_call(query, s->data.sym);
@@ -1427,69 +1495,6 @@ drop_trigger(mvc *sql, dlist *qname, int
return rel_drop_trigger(sql, tr->t->s->base.name, tname, if_exists);
 }
 
-static sql_rel *
-psm_analyze(sql_query *query, dlist *qname, dlist *columns)
-{
-   mvc *sql = query->sql;
-   const char *sname = qname_schema(qname), *tname = 
qname_schema_object(qname);
-   list *tl = sa_list(sql->sa), *exps = sa_list(sql->sa), *analyze_calls = 
sa_list(sql->sa);
-   sql_subfunc *f = NULL;
-   sql_subtype tpe;
-
-   if (!sql_find_subtype(, "varchar", 1024, 0))
-   return sql_error(sql, 02, SQLSTATE(HY013) "varchar type 
missing?");
-
-   if (sname && tname) {
-   sql_table *t = NULL;
-
-   if (!(t = find_table_or_view_on_scope(sql, NULL, sname, 

MonetDB: default - add simple optimizer to rewrite column expres...

2024-04-28 Thread Niels Nes via checkin-list
Changeset: 8c7d4e3a2133 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8c7d4e3a2133
Added Files:
sql/test/miscellaneous/Tests/anti_join_plan.test
Modified Files:
sql/server/rel_optimize_proj.c
sql/storage/bat/bat_storage.c
sql/test/Tests/select_window_pushdown.test
sql/test/mergetables/Tests/mergequery.test
sql/test/miscellaneous/Tests/All
sql/test/miscellaneous/Tests/simple_plans.test
sql/test/miscellaneous/Tests/unique_keys.test
sql/test/prepare/Tests/prepare-utf8.Bug-3930.stable.out
sql/test/prepare/Tests/prepared-statement-with-udf.Bug-6650.stable.out
Branch: default
Log Message:

add simple optimizer to rewrite column expressions into constants when there is 
a col=constant select unter the project


diffs (truncated from 383 to 300 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -2983,10 +2983,41 @@ rel_groupjoin(visitor *v, sql_rel *rel)
return rel;
 }
 
+/* select k1 from bla where k1 = const -> select const from bla where k1 = 
const */
+static sql_rel *
+rel_project_select_exp(visitor *v, sql_rel *rel)
+{
+   if (is_simple_project(rel->op) && rel->exps && rel->l) {
+   sql_rel *l = rel->l;
+   if (is_select(l->op) && l->exps) {
+   for(node *n = rel->exps->h; n; n = n->next) {
+   sql_exp *col = n->data;
+   if (col->type == e_column) {
+   for(node *m = l->exps->h; m; m = 
m->next) {
+   sql_exp *cmp = m->data;
+   if (cmp->type == e_cmp && 
cmp->flag == cmp_equal && !is_anti(cmp) && !is_semantics(cmp) && 
exp_is_atom(cmp->r)) {
+   sql_exp *l = cmp->l;
+   if(l->type == e_column 
&& ((!col->l && !l->l) || (col->l && l->l && strcmp(col->l, l->l) == 0)) && 
strcmp(col->r, l->r) == 0) {
+   /* replace 
column with the constant */
+   sql_exp *e = 
n->data = exp_copy(v->sql, cmp->r);
+   
exp_setname(v->sql->sa, e, exp_relname(col), exp_name(col));
+   
exp_propagate(v->sql->sa, e, col);
+   
list_hash_clear(rel->exps);
+   }
+   }
+   }
+   }
+   }
+   }
+   }
+   return rel;
+}
+
 static sql_rel *
 rel_optimize_projections_(visitor *v, sql_rel *rel)
 {
rel = rel_project_cse(v, rel);
+   rel = rel_project_select_exp(v, rel);
 
if (!rel || !is_groupby(rel->op))
return rel;
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -493,6 +493,8 @@ segs_end( segments *segs, sql_trans *tr,
 {
size_t cnt = 0;
 
+   /* because a table can grow rows over the time a transaction is 
running, we need to find the last valid segment, to
+* keep all of the parts aligned */
lock_table(tr->store, table->base.id);
segment *s = segs->h, *l = NULL;
 
diff --git a/sql/test/Tests/select_window_pushdown.test 
b/sql/test/Tests/select_window_pushdown.test
--- a/sql/test/Tests/select_window_pushdown.test
+++ b/sql/test/Tests/select_window_pushdown.test
@@ -26,11 +26,11 @@ project (
 | | | | | select (
 | | | | | | table("sys"."test") [ "test"."k" NOT NULL, "test"."v" NOT NULL 
UNIQUE ]
 | | | | | ) [ ("test"."k" NOT NULL) = (int(31) "10") ]
-| | | | ) [ "test"."k" NOT NULL as "t1"."k", "test"."v" NOT NULL UNIQUE as 
"t1"."v", "sys"."mod"("test"."v" NOT NULL UNIQUE, int(2) "2") NOT NULL as 
"%1"."%1", "sys"."="("%1"."%1" NOT NULL, int(31) "0") NOT NULL as "t1"."flag" ]
+| | | | ) [ int(31) "10" as "t1"."k", "test"."v" NOT NULL UNIQUE as "t1"."v", 
"sys"."mod"("test"."v" NOT NULL UNIQUE, int(2) "2") NOT NULL as "%1"."%1", 
"sys"."="("%1"."%1" NOT NULL, int(31) "0") NOT NULL as "t1"."flag" ]
 | | | ) [ "t1"."k" NOT NULL, "t1"."v" NOT NULL UNIQUE, "t1"."flag" NOT NULL ] 
[ "t1"."k" ASC NOT NULL, "t1"."v" NULLS LAST NOT NULL UNIQUE ]
-| | ) [ "t1"."k" NOT NULL, "t1"."v" NOT NULL UNIQUE, "t1"."flag" NOT NULL, 
"sys"."rank"(varchar["sys"."star"()], "sys"."diff"("t1"."k" NOT NULL), 
"sys"."diff"("t1"."v" NOT NULL UNIQUE)) as "t2"."rank" ]
+| | ) [ "t1"."v" NOT NULL UNIQUE, "t1"."flag" NOT NULL, 
"sys"."rank"(varchar["sys"."star"()], 

MonetDB: Dec2023 - fixing some leaks

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 7fe74806fa4b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7fe74806fa4b
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Dec2023
Log Message:

fixing some leaks


diffs (59 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -4468,10 +4468,10 @@ tc_gc_col( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
+   if (d->cs.merged && d->next) { // Unreachable can immediately 
be destroyed.
destroy_delta(d->next, true);
-
-   d->next = NULL;
+   d->next = NULL;
+   }
lock_column(store, c->base.id); /* lock for concurrent updates 
(appends) */
merge_delta(d);
unlock_column(store, c->base.id);
@@ -4508,10 +4508,10 @@ tc_gc_upd_col( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
+   if (d->cs.merged && d->next) { // Unreachable can immediately 
be destroyed.
destroy_delta(d->next, true);
-
-   d->next = NULL;
+   d->next = NULL;
+   }
lock_column(store, c->base.id); /* lock for concurrent updates 
(appends) */
merge_delta(d);
unlock_column(store, c->base.id);
@@ -4548,10 +4548,10 @@ tc_gc_idx( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
+   if (d->cs.merged && d->next) { // Unreachable can immediately 
be destroyed.
destroy_delta(d->next, true);
-
-   d->next = NULL;
+   d->next = NULL;
+   }
lock_column(store, i->base.id); /* lock for concurrent updates 
(appends) */
merge_delta(d);
unlock_column(store, i->base.id);
@@ -4588,10 +4588,10 @@ tc_gc_upd_idx( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
+   if (d->cs.merged && d->next) { // Unreachable can immediately 
be destroyed.
destroy_delta(d->next, true);
-
-   d->next = NULL;
+   d->next = NULL;
+   }
lock_column(store, i->base.id); /* lock for concurrent updates 
(appends) */
merge_delta(d);
unlock_column(store, i->base.id);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: jun-order - closing branch (counts are set in the stati...

2024-04-26 Thread Niels Nes via checkin-list
Changeset: a93e012778a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a93e012778a4
Branch: jun-order
Log Message:

closing branch (counts are set in the statistics, todo reorder join based on 
those)

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: strimps2 - closing branch, a new ngrams branch will be ...

2024-04-26 Thread Niels Nes via checkin-list
Changeset: f31cdc3dd8fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f31cdc3dd8fe
Branch: strimps2
Log Message:

closing branch, a new ngrams branch will be created

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: nilmask - merged with default

2024-04-26 Thread Niels Nes via checkin-list
Changeset: e41a45943665 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e41a45943665
Modified Files:
monetdb5/modules/mal/tablet.c
sql/backends/monet5/rel_bin.c
sql/common/sql_types.c
sql/storage/bat/bat_storage.c
Branch: nilmask
Log Message:

merged with default


diffs (288 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,12 @@ jobs:
   ref: ${{ github.ref }}
 
   - name: install pymonetdb cryptography
-run: pip3 install pymonetdb cryptography
+run: pip3 install --user --upgrade pymonetdb cryptography
+if: runner.os != 'macOS'
+
+  - name: install pymonetdb cryptography
+run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
+if: runner.os == 'macOS'
 
   - name: make MonetDB on linux
 run: |
@@ -83,7 +88,23 @@ jobs:
 -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
 -DCMAKE_SUMMARY=ON
   make install -j3
-if: runner.os == 'macOS'
+if: runner.os == 'macOS' && runner.arch == 'x64'
+
+  - name: make MonetDB on macos
+run: |
+  mkdir build
+  cd build 
+  cmake .. \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF  \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \
+-DCMAKE_SUMMARY=ON
+  make install -j3
+if: runner.os == 'macOS' && runner.arch == 'arm64'
 
   - name: choco packages
 run: |
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4065,6 +4065,33 @@ BBPsync(int cnt, bat *restrict subcommit
if (lock)
MT_lock_set((bid));
}
+   if (subcommit) {
+   /* move any tail/theap files we find for this bat that
+* are in the BACKUP directory to the SUBCOMMIT
+* directory */
+   char fname[16]; /* plenty big enough */
+   if (snprintf(fname, sizeof(fname), "%o", i) < 16) {
+   /* the snprintf never fails, any of the
+* below may fail */
+   if (GDKmove(0, BAKDIR, fname, "tail", SUBDIR, 
fname, "tail", false) == GDK_SUCCEED)
+   TRC_DEBUG(BAT_, "moved %s.tail from %s 
to %s\n",
+ fname, BAKDIR, SUBDIR);
+   if (GDKmove(0, BAKDIR, fname, "tail1", SUBDIR, 
fname, "tail1", false) == GDK_SUCCEED)
+   TRC_DEBUG(BAT_, "moved %s.tail1 from %s 
to %s\n",
+ fname, BAKDIR, SUBDIR);
+   if (GDKmove(0, BAKDIR, fname, "tail2", SUBDIR, 
fname, "tail2", false) == GDK_SUCCEED)
+   TRC_DEBUG(BAT_, "moved %s.tail2 from %s 
to %s\n",
+ fname, BAKDIR, SUBDIR);
+#if SIZEOF_VAR_T == 8
+   if (GDKmove(0, BAKDIR, fname, "tail4", SUBDIR, 
fname, "tail4", false) == GDK_SUCCEED)
+   TRC_DEBUG(BAT_, "moved %s.tail4 from %s 
to %s\n",
+ fname, BAKDIR, SUBDIR);
+#endif
+   if (GDKmove(0, BAKDIR, fname, "theap", SUBDIR, 
fname, "theap", false) == GDK_SUCCEED)
+   TRC_DEBUG(BAT_, "moved %s.theap from %s 
to %s\n",
+ fname, BAKDIR, SUBDIR);
+   }
+   }
BAT *b = dirty_bat(, subcommit != NULL);
if (i <= 0)
ret = GDK_FAIL;
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1958,8 +1958,7 @@ SQLload_file(Client cntxt, Tablet *as, b
return BUN_NONE;
 }
 
-/* return the latest reject table, to be on the safe side we should
- * actually create copies within a critical section. Ignored for now. */
+/* return the latest reject table */
 str
 COPYrejects(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
@@ -1971,10 +1970,27 @@ COPYrejects(Client cntxt, MalBlkPtr mb, 
create_rejects_table(cntxt);
if (cntxt->error_row == NULL)
throw(MAL, "sql.rejects", "No reject table available");
-   BBPretain(*row = cntxt->error_row->batCacheid);
-   BBPretain(*fld = cntxt->error_fld->batCacheid);
-   

MonetDB: new-avg - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: e24a0eda02f4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e24a0eda02f4
Branch: new-avg
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: groupjoin - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 68d9fb2bdc0c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/68d9fb2bdc0c
Branch: groupjoin
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: interval-day-second - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 4ba20314af21 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4ba20314af21
Branch: interval-day-second
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: unoptimized-antijoin - closing branch. the 2 anti joins...

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 71e4272f2081 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/71e4272f2081
Branch: unoptimized-antijoin
Log Message:

closing branch. the 2 anti joins aren't the same, ie cannot apply exact same 
optimizations.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: monetdburl - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: bf5b7bb576f4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf5b7bb576f4
Branch: monetdburl
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: copyparpipe - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: d3689f05b9e7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d3689f05b9e7
Branch: copyparpipe
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: directappend - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 7280fd3e3c1a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7280fd3e3c1a
Branch: directappend
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: nilmask - merged with default

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 9d1cfe543e3b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9d1cfe543e3b
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
clients/odbc/tests/ODBCmetadata.c
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_value.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_builder.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_prelude.c
monetdb5/modules/atoms/CMakeLists.txt
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tablet.h
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_result.h
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_statement.h
sql/common/sql_types.c
sql/include/sql_catalog.h
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
sql/storage/bat/bat_table.c
sql/storage/bat/res_table.c
sql/storage/sql_storage.h
sql/storage/store.c
tools/monetdbe/monetdbe.c
Branch: nilmask
Log Message:

merged with default


diffs (truncated from 313809 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.48.0
+current_version = 11.50.0
 commit = False
 tag = False
 
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -16,51 +16,120 @@ jobs:
 strategy:
   fail-fast: false  # don't stop other jobs
   matrix:
-branch: [ master ]
-os: [ ubuntu-latest, macos-latest ]
+os: [ ubuntu-latest, macos-latest, windows-latest ]
+c_compiler: [ gcc, clang, cl ]
+include:
+  - os: windows-latest
+c_compiler: cl
+  - os: macos-latest
+c_compiler: clang
+  - os: macos-latest
+c_compiler: gcc-12
+  - os: ubuntu-latest
+c_compiler: gcc
+  - os: ubuntu-latest
+c_compiler: clang
+exclude:
+  - os: windows-latest
+c_compiler: gcc
+  - os: windows-latest
+c_compiler: clang
+  - os: macos-latest
+c_compiler: cl
+  - os: macos-latest
+c_compiler: gcc
+  - os: ubuntu-latest
+c_compiler: cl
 runs-on: ${{ matrix.os }}
 steps:
   - name: Checkout
-uses: actions/checkout@v3
+uses: actions/checkout@v4
 with:
-  ref: ${{ matrix.branch }}
+  ref: ${{ github.ref }}
+
+  - name: install pymonetdb cryptography
+run: pip3 install pymonetdb cryptography
 
   - name: make MonetDB on linux
 run: |
   mkdir build
   cd build 
-  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF 
\
+  cmake ..  \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
 -DCMAKE_SUMMARY=ON
   make install -j3
 if: runner.os == 'Linux'
-  -
-name: brew packages
+
+  - name: brew packages
 run: brew install bison
 if: runner.os == 'macOS'
+
   - name: make MonetDB on macos
 run: |
   mkdir build
   cd build 
-  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF 
 \
--DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison 
-DCMAKE_SUMMARY=ON
+  cmake .. \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF  \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
+-DCMAKE_SUMMARY=ON
   make install -j3
 if: runner.os == 'macOS'
+
+  - name: choco packages
+run: |
+  choco install winflexbison3
+  vcpkg install libiconv bzip2 libxml2 pcre zlib getopt 
+if: runner.os == 'Windows'
+
+  - name: make MonetDB on Windows
+shell: pwsh
+run: |
+  mkdir build
+  cd build 
+  cmake ..  -DCMAKE_INSTALL_PREFIX=C:\MDB 
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake 
-DPY3INTEGRATION=OFF -DRINTEGRATION=OFF  -DCMAKE_BUILD_TYPE=Release 
-DASSERT=OFF -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}  -DCMAKE_SUMMARY=ON
+  cmake --build . --target install
+

MonetDB: parappend - closing branch

2024-04-26 Thread Niels Nes via checkin-list
Changeset: 7d2123b4b4b5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7d2123b4b4b5
Branch: parappend
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - fix install of pymonetdb on windows

2024-04-25 Thread Niels Nes via checkin-list
Changeset: dcdc1852b47a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dcdc1852b47a
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

fix install of pymonetdb on windows


diffs (12 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -49,7 +49,7 @@ jobs:
 
   - name: install pymonetdb cryptography
 run: pip3 install --user --upgrade pymonetdb cryptography
-if: runner.os == 'Linux'
+if: runner.os != 'macOS'
 
   - name: install pymonetdb cryptography
 run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: efficient-pending-changes - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: b04563fc7bba for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b04563fc7bba
Branch: efficient-pending-changes
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: nospare-aris - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: bb76f217a675 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bb76f217a675
Branch: nospare-aris
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: async-heap-remove - closing experimental branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 3b93b67e65b4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3b93b67e65b4
Branch: async-heap-remove
Log Message:

closing experimental branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: sphload-onclient - close branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 9aef789204e8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9aef789204e8
Branch: sphload-onclient
Log Message:

close branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: multi-cachelock - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 8cac7b7befd8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8cac7b7befd8
Branch: multi-cachelock
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: ir_imprints - close branch we did implement like/ilike ...

2024-04-25 Thread Niels Nes via checkin-list
Changeset: e9d52d1b9a73 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e9d52d1b9a73
Branch: ir_imprints
Log Message:

close branch we did implement like/ilike using strimps later

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: opt_pushoptimizer - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 77ec5c2e79ea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/77ec5c2e79ea
Branch: opt_pushoptimizer
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: trails - closing old ... branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: c1f59951b6af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c1f59951b6af
Branch: trails
Log Message:

closing old ... branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: monetdbe-keywords - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: adcf02e6b734 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/adcf02e6b734
Branch: monetdbe-keywords
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: monetdbe_prepare - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 3a1195d3fc1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3a1195d3fc1f
Branch: monetdbe_prepare
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - use proper and in github action

2024-04-25 Thread Niels Nes via checkin-list
Changeset: ca187134460b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ca187134460b
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

use proper and in github action


diffs (21 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -88,7 +88,7 @@ jobs:
 -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
 -DCMAKE_SUMMARY=ON
   make install -j3
-if: runner.os == 'macOS' and runner.arch == 'x64'
+if: runner.os == 'macOS' && runner.arch == 'x64'
 
   - name: make MonetDB on macos
 run: |
@@ -104,7 +104,7 @@ jobs:
 -DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \
 -DCMAKE_SUMMARY=ON
   make install -j3
-if: runner.os == 'macOS' and runner.arch == 'arm64'
+if: runner.os == 'macOS' && runner.arch == 'arm64'
 
   - name: choco packages
 run: |
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - change bison on arm hardware

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 886471cf6769 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/886471cf6769
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

change bison on arm hardware


diffs (40 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -49,6 +49,11 @@ jobs:
 
   - name: install pymonetdb cryptography
 run: pip3 install --user --upgrade pymonetdb cryptography
+if: runner.os == 'Linux'
+
+  - name: install pymonetdb cryptography
+run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
+if: runner.os == 'macOS'
 
   - name: make MonetDB on linux
 run: |
@@ -83,7 +88,23 @@ jobs:
 -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
 -DCMAKE_SUMMARY=ON
   make install -j3
-if: runner.os == 'macOS'
+if: runner.os == 'macOS' and runner.arch == 'x64'
+
+  - name: make MonetDB on macos
+run: |
+  mkdir build
+  cd build 
+  cmake .. \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF  \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \
+-DCMAKE_SUMMARY=ON
+  make install -j3
+if: runner.os == 'macOS' and runner.arch == 'arm64'
 
   - name: choco packages
 run: |
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - lets first try to get ubuntu back..

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 55038940fa7e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/55038940fa7e
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

lets first try to get ubuntu back..


diffs (12 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,7 @@ jobs:
   ref: ${{ github.ref }}
 
   - name: install pymonetdb cryptography
-run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
+run: pip3 install --user --upgrade pymonetdb cryptography
 
   - name: make MonetDB on linux
 run: |
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: urlfuncs - closing branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 0ac1ab4d08c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0ac1ab4d08c8
Branch: urlfuncs
Log Message:

closing branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - now with --user

2024-04-25 Thread Niels Nes via checkin-list
Changeset: e2d60b79a2dd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e2d60b79a2dd
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

now with --user


diffs (12 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,7 @@ jobs:
   ref: ${{ github.ref }}
 
   - name: install pymonetdb cryptography
-run: pip3 install --break-system-packages pymonetdb cryptography
+run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
 
   - name: make MonetDB on linux
 run: |
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - only free delta's once the parent is merged. ...

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 780c378dd100 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/780c378dd100
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Dec2023
Log Message:

only free delta's once the parent is merged. This makes sure other threads one 
access those older deltas.


diffs (39 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -4468,7 +4468,7 @@ tc_gc_col( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->next) // Unreachable can immediately be destroyed.
+   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
destroy_delta(d->next, true);
 
d->next = NULL;
@@ -4508,7 +4508,7 @@ tc_gc_upd_col( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->next) // Unreachable can immediately be destroyed.
+   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
destroy_delta(d->next, true);
 
d->next = NULL;
@@ -4548,7 +4548,7 @@ tc_gc_idx( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->next) // Unreachable can immediately be destroyed.
+   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
destroy_delta(d->next, true);
 
d->next = NULL;
@@ -4588,7 +4588,7 @@ tc_gc_upd_idx( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
 
// d is oldest reachable delta
-   if (d->next) // Unreachable can immediately be destroyed.
+   if (d->cs.merged && d->next) // Unreachable can immediately be 
destroyed.
destroy_delta(d->next, true);
 
d->next = NULL;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: ci_overhaul - close ci_overhaul branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 6ea2849ab919 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6ea2849ab919
Branch: ci_overhaul
Log Message:

close ci_overhaul branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: faster_segs_end - close branch faster_segs_end.

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 607ce6f9aaf3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/607ce6f9aaf3
Branch: faster_segs_end
Log Message:

close branch faster_segs_end.
Can only be done once we change the segments into a double linked list, we
need to return the end of the for this transaction last 'valid' segment.
Any new segements cannot be included else we get un-aligned columns.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: smapi - closing smapi branch, tls on server side will b...

2024-04-25 Thread Niels Nes via checkin-list
Changeset: de081c3d4230 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de081c3d4230
Branch: smapi
Log Message:

closing smapi branch, tls on server side will be done by stunnel.
Clients mapi, python and java are extended with tls via other branches

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - close no_type_bat branch

2024-04-25 Thread Niels Nes via checkin-list
Changeset: 9e2a84d0e2e4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9e2a84d0e2e4
Branch: no_type_bat
Log Message:

close no_type_bat branch

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - use the pip option --break-system-packages wh...

2024-04-25 Thread Niels Nes via checkin-list
Changeset: a341020b810a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a341020b810a
Modified Files:
.github/workflows/linux.yml
Branch: Dec2023
Log Message:

use the pip option --break-system-packages when we are installing our own 
pymonetdb and cryptography python packages


diffs (12 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,7 @@ jobs:
   ref: ${{ github.ref }}
 
   - name: install pymonetdb cryptography
-run: pip3 install pymonetdb cryptography
+run: pip3 install --break-system-packages pymonetdb cryptography
 
   - name: make MonetDB on linux
 run: |
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: new-avg - approved output

2024-04-16 Thread Niels Nes via checkin-list
Changeset: 422380651016 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/422380651016
Modified Files:

sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
Branch: new-avg
Log Message:

approved output


diffs (14 lines):

diff --git 
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
--- 
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
+++ 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
@@ -20,8 +20,8 @@ project (
 | | | group by (
 | | | | select (
 | | | | | table("sys"."tab0") [ "tab0"."col0" UNIQUE as "cor0"."col0", 
"tab0"."col1" UNIQUE as "cor0"."col1" ]
-| | | | ) [ ("cor0"."col0" UNIQUE) * = (int(32) NULL) ]
-| | | ) [ "cor0"."col1" UNIQUE, "cor0"."col0" UNIQUE ] [ "cor0"."col1" UNIQUE, 
"cor0"."col0" UNIQUE, "sys"."count" unique  no nil ("cor0"."col0" UNIQUE) NOT 
NULL as "%2"."%2", "sys"."sum" unique  no nil ("cor0"."col0" UNIQUE) as 
"%3"."%3" ]
+| | | | ) [ ("cor0"."col0" UNIQUE) * = (int(31) NULL) ]
+| | | ) [ "cor0"."col1" UNIQUE, "cor0"."col0" UNIQUE ] [ "cor0"."col1" UNIQUE, 
"cor0"."col0" UNIQUE, "sys"."count" unique  no nil ("cor0"."col0" UNIQUE) NOT 
NULL as "%2"."%2", "sys"."sum" no nil ("cor0"."col0" UNIQUE) as "%3"."%3" ]
 | | ) [ "cor0"."col1" UNIQUE, "cor0"."col0" UNIQUE, 
"sys"."sql_div"(double(53)["%3"."%3"], double(53)["%2"."%2" NOT NULL] NOT NULL) 
as "%1"."%1" ]
 | ) [ ("sys"."sql_add"(double(53)["sys"."sql_neg"("cor0"."col1" UNIQUE)], 
"%1"."%1")) ! * = (double(53) NULL) ]
 ) [ "sys"."sql_neg"("cor0"."col0" UNIQUE) as "col1" ]
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: new-avg - approved output

2024-04-16 Thread Niels Nes via checkin-list
Changeset: f1675565cb3a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f1675565cb3a
Modified Files:
clients/Tests/MAL-signatures-hge.test
Branch: new-avg
Log Message:

approved output


diffs (69 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -29385,27 +29385,27 @@ CMDbatNOT;
 Unary bitwise not over the tail of the bat with candidates list
 batcalc
 num_div
-pattern batcalc.num_div(X_0:bat[:bte], X_1:bat[:lng]):bat[:bte] 
+pattern batcalc.num_div(X_0:bat[:bte], X_1:bat[:lng]):bat[:bte]
 CMDbatDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 batcalc
 num_div
-pattern batcalc.num_div(X_0:bat[:hge], X_1:bat[:lng]):bat[:hge] 
+pattern batcalc.num_div(X_0:bat[:hge], X_1:bat[:lng]):bat[:hge]
 CMDbatDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 batcalc
 num_div
-pattern batcalc.num_div(X_0:bat[:int], X_1:bat[:lng]):bat[:int] 
+pattern batcalc.num_div(X_0:bat[:int], X_1:bat[:lng]):bat[:int]
 CMDbatDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 batcalc
 num_div
-pattern batcalc.num_div(X_0:bat[:lng], X_1:bat[:lng]):bat[:lng] 
+pattern batcalc.num_div(X_0:bat[:lng], X_1:bat[:lng]):bat[:lng]
 CMDbatDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 batcalc
 num_div
-pattern batcalc.num_div(X_0:bat[:sht], X_1:bat[:lng]):bat[:sht] 
+pattern batcalc.num_div(X_0:bat[:sht], X_1:bat[:lng]):bat[:sht]
 CMDbatDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 batcalc
@@ -43970,27 +43970,27 @@ CMDvarNOT;
 Unary bitwise not of V
 calc
 num_div
-pattern calc.num_div(X_0:bte, X_1:lng):bte 
+pattern calc.num_div(X_0:bte, X_1:lng):bte
 CMDvarDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 calc
 num_div
-pattern calc.num_div(X_0:hge, X_1:lng):hge 
+pattern calc.num_div(X_0:hge, X_1:lng):hge
 CMDvarDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 calc
 num_div
-pattern calc.num_div(X_0:int, X_1:lng):int 
+pattern calc.num_div(X_0:int, X_1:lng):int
 CMDvarDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 calc
 num_div
-pattern calc.num_div(X_0:lng, X_1:lng):lng 
+pattern calc.num_div(X_0:lng, X_1:lng):lng
 CMDvarDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 calc
 num_div
-pattern calc.num_div(X_0:sht, X_1:lng):sht 
+pattern calc.num_div(X_0:sht, X_1:lng):sht
 CMDvarDIV2;
 Return (V1+(V2-1)/2) / V2, nil on divide by zero
 calc
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: new-avg - fixed compilation after merge

2024-04-16 Thread Niels Nes via checkin-list
Changeset: d549a187149a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d549a187149a
Modified Files:
sql/server/rel_optimize_proj.c
Branch: new-avg
Log Message:

fixed compilation after merge


diffs (38 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -2949,7 +2949,7 @@ find_func( mvc *sql, char *name, list *e
 
for(n = exps->h; n; n = n->next)
append(l, exp_subtype(n->data));
-   return sql_bind_func_(sql, "sys", name, l, F_FUNC, false);
+   return sql_bind_func_(sql, "sys", name, l, F_FUNC, false, true);
 }
 
 static sql_exp *
@@ -3047,14 +3047,14 @@ rel_avg_rewrite(visitor *v, sql_rel *rel
 
/* create nsum/cnt exp */
if (!cnt) {
-   sql_subfunc *cf = sql_bind_func_(sql, "sys", 
"count", append(sa_list(sql->sa), avg_input_t), F_AGGR, false);
+   sql_subfunc *cf = sql_bind_func(sql, "sys", 
"count", avg_input_t, NULL, F_AGGR, true, true);
sql_exp *e = exp_aggr(sql->sa, list_dup(avg->l, 
(fdup)NULL), cf, need_distinct(avg), need_no_nil(avg), avg->card, has_nil(avg));
 
append(nexps, e);
cnt = exp_ref(sql, e);
}
if (!sum) {
-   sql_subfunc *sf = sql_bind_func_(sql, "sys", 
"sum", append(sa_list(sql->sa), avg_input_t), F_AGGR, false);
+   sql_subfunc *sf = sql_bind_func(sql, "sys", 
"sum", avg_input_t, NULL, F_AGGR, true, true);
sql_exp *e = exp_aggr(sql->sa, list_dup(avg->l, 
(fdup)NULL), sf, need_distinct(avg), need_no_nil(avg), avg->card, has_nil(avg));
 
append(nexps, e);
@@ -3075,7 +3075,7 @@ rel_avg_rewrite(visitor *v, sql_rel *rel
 
args = new_exp_list(sql->sa);
append(args, cond);
-   append(args, exp_atom(sql->sa, 
atom_general(sql->sa, exp_subtype(cnt_d), NULL)));
+   append(args, exp_atom(sql->sa, 
atom_general(sql->sa, exp_subtype(cnt_d), NULL, 0)));
/* TODO only ifthenelse if value column may 
have nil's*/
append(args, cnt_d);
ifthen = find_func(sql, "ifthenelse", args);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: new-avg - merged with default

2024-04-16 Thread Niels Nes via checkin-list
Changeset: 46d5c75cb94c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/46d5c75cb94c
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/calc.c
sql/common/sql_types.c
sql/scripts/39_analytics.sql
sql/server/rel_optimize_proj.c

sql/test/BugTracker-2017/Tests/sqlitelogictest-aggregation-having-avg.Bug-6428.test
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: new-avg
Log Message:

merged with default


diffs (truncated from 311840 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.48.0
+current_version = 11.50.0
 commit = False
 tag = False
 
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -16,51 +16,120 @@ jobs:
 strategy:
   fail-fast: false  # don't stop other jobs
   matrix:
-branch: [ master ]
-os: [ ubuntu-latest, macos-latest ]
+os: [ ubuntu-latest, macos-latest, windows-latest ]
+c_compiler: [ gcc, clang, cl ]
+include:
+  - os: windows-latest
+c_compiler: cl
+  - os: macos-latest
+c_compiler: clang
+  - os: macos-latest
+c_compiler: gcc-12
+  - os: ubuntu-latest
+c_compiler: gcc
+  - os: ubuntu-latest
+c_compiler: clang
+exclude:
+  - os: windows-latest
+c_compiler: gcc
+  - os: windows-latest
+c_compiler: clang
+  - os: macos-latest
+c_compiler: cl
+  - os: macos-latest
+c_compiler: gcc
+  - os: ubuntu-latest
+c_compiler: cl
 runs-on: ${{ matrix.os }}
 steps:
   - name: Checkout
-uses: actions/checkout@v3
+uses: actions/checkout@v4
 with:
-  ref: ${{ matrix.branch }}
+  ref: ${{ github.ref }}
+
+  - name: install pymonetdb cryptography
+run: pip3 install pymonetdb cryptography
 
   - name: make MonetDB on linux
 run: |
   mkdir build
   cd build 
-  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF 
\
+  cmake ..  \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
 -DCMAKE_SUMMARY=ON
   make install -j3
 if: runner.os == 'Linux'
-  -
-name: brew packages
+
+  - name: brew packages
 run: brew install bison
 if: runner.os == 'macOS'
+
   - name: make MonetDB on macos
 run: |
   mkdir build
   cd build 
-  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF 
 \
--DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison 
-DCMAKE_SUMMARY=ON
+  cmake .. \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF  \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
+-DCMAKE_SUMMARY=ON
   make install -j3
 if: runner.os == 'macOS'
+
+  - name: choco packages
+run: |
+  choco install winflexbison3
+  vcpkg install libiconv bzip2 libxml2 pcre zlib getopt 
+if: runner.os == 'Windows'
+
+  - name: make MonetDB on Windows
+shell: pwsh
+run: |
+  mkdir build
+  cd build 
+  cmake ..  -DCMAKE_INSTALL_PREFIX=C:\MDB 
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake 
-DPY3INTEGRATION=OFF -DRINTEGRATION=OFF  -DCMAKE_BUILD_TYPE=Release 
-DASSERT=OFF -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}  -DCMAKE_SUMMARY=ON
+  cmake --build . --target install
+if: runner.os == 'Windows'
+
   - name: ctest 
 run: |
   cd build 
-  cmake --build . --target test
-  - name: install pymonetdb
-run: pip3 install pymonetdb
-  - name: which python
-run: 
-  head -n 1 $HOME/${{ matrix.branch }}/bin/Mtest.py 
+  cmake --build . --target ${{ runner.os == 'Windows' && 'RUN_TESTS' 
|| 'test' }}
+if: runner.os != 'Windows'
+
   - name: mtest 
 run: |
-  #cd build 
-  #cmake --build . --target 

MonetDB: resource_management - create new branch for resource_ma...

2024-04-15 Thread Niels Nes via checkin-list
Changeset: af12610859ae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/af12610859ae
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_calc_convert.c
gdk/gdk_string.c
gdk/gdk_utils.c
gdk/gdk_value.c
monetdb5/extras/rapi/rapi.c
monetdb5/mal/mal.h
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_function.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_session.c
monetdb5/mal/mal_stack.c
monetdb5/modules/mal/calc.c
monetdb5/modules/mal/iterator.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/remote.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_dict.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_for.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_inline.h
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_profiler.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_support.h
sql/backends/monet5/UDF/capi/capi.c
sql/backends/monet5/UDF/pyapi3/pyapi3.c
sql/backends/monet5/generator/generator.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_statement.h
sql/common/sql_hash.c
sql/common/sql_list.c
sql/include/sql_hash.h
sql/include/sql_list.h
sql/include/sql_mem.h
sql/scripts/23_skyserver.sql
sql/server/rel_basetable.c
sql/server/rel_optimizer.c
sql/server/sql_parser.y
sql/server/sql_var.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_utils.c
sql/storage/sql_catalog.c
sql/storage/store.c
sql/test/prepare/Tests/sqlancer_prepare.sql
sql/test/prepare/Tests/sqlancer_prepare.stable.err
sql/test/prepare/Tests/sqlancer_prepare.stable.err.int128
Branch: resource_management
Log Message:

create new branch for resource_management improvements

first steps:
use allocators in mal interpreter (therefor also the VAL* functions can 
now optionaly have an allocator as first argument)
use temp - allocators instead of temp GDKmalloc's in optimizers


diffs (truncated from 4354 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
@@ -416,11 +416,11 @@ gdk_return TMsubcommit_list(bat *restric
 void VALclear(ValPtr v);
 int VALcmp(const ValRecord *p, const ValRecord *q);
 void *VALconvert(int typ, ValPtr t);
-ValPtr VALcopy(ValPtr dst, const ValRecord *src);
+ValPtr VALcopy(allocator *va, ValPtr dst, const ValRecord *src);
 void VALempty(ValPtr v);
 char *VALformat(const ValRecord *res) __attribute__((__warn_unused_result__));
 void *VALget(ValPtr v);
-ValPtr VALinit(ValPtr d, int tpe, const void *s);
+ValPtr VALinit(allocator *va, ValPtr d, int tpe, const void *s);
 bool VALisnil(const ValRecord *v);
 ValPtr VALset(ValPtr v, int t, void *p);
 gdk_return VARcalcabsolute(ValPtr ret, const ValRecord *v);
@@ -580,8 +580,10 @@ const ptr ptr_nil;
 struct dirent *readdir(DIR *dir);
 void rewinddir(DIR *dir);
 void *sa_alloc(allocator *sa, size_t sz);
+void sa_close(allocator *sa);
 allocator *sa_create(allocator *pa);
 void sa_destroy(allocator *sa);
+void sa_open(allocator *sa);
 void *sa_realloc(allocator *sa, void *ptr, size_t sz, size_t osz);
 allocator *sa_reset(allocator *sa);
 size_t sa_size(allocator *sa);
@@ -880,8 +882,8 @@ char *concatErrors(char *err1, const cha
 const char *connectRef;
 const char 

MonetDB: default - on missing value continue

2024-04-14 Thread Niels Nes via checkin-list
Changeset: d08a1d528d45 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d08a1d528d45
Modified Files:
sql/server/rel_unnest.c
Branch: default
Log Message:

on missing value continue


diffs (12 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2361,6 +2361,8 @@ rel_set_type(visitor *v, sql_rel *rel)
if (l->type == e_column) {
sql_rel *sl = rel->l;
sql_exp *e = 
rel_find_exp(sl, l);
+   if (!e)
+   continue;
if (is_groupby(sl->op) 
&& exp_equal(e, l) == 0) {
sql_exp *e2 = 
list_find_exp(sl->r, l);
if (e2) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - small code layout change

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 5cac5abf2acd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5cac5abf2acd
Modified Files:
sql/server/rel_optimize_sel.c
Branch: default
Log Message:

small code layout change


diffs (13 lines):

diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -3493,8 +3493,7 @@ rel_push_select_down(visitor *v, sql_rel
/* the column in 'like' 
filters is stored inside a list */
if (e->flag == 
cmp_filter) {
column = 
((list*)e->l)->h->data;
-   }
-   else {
+   } else {
column = e->l;
}
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - some more simplified versions too test

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 7c9853c5bd45 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7c9853c5bd45
Modified Files:
sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
Branch: default
Log Message:

some more simplified versions too test


diffs (19 lines):

diff --git a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test 
b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
--- a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
+++ b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
@@ -1,4 +1,15 @@
+query I nosort
+SELECT ( SELECT ( SELECT ( NULLIF ( 9.00 , 0 ) ) FROM GENERATE_SERIES ( 1 
, x )) FROM ( SELECT DISTINCT SUM ( 1 ) ) x (x)) FROM ( SELECT 1 ) x (x)
+
+9
+
+query I nosort
+SELECT ( SELECT ( SELECT ( SELECT ( NULLIF ( 9.00 , 0 ) ) FROM 
GENERATE_SERIES ( 1 , x )) FROM ( SELECT DISTINCT SUM ( 1 ) ) x (x)) FROM ( 
SELECT 1 ) x (x))
+
+9
+
 query I nosort
 SELECT ( WITH x ( x ) AS ( SELECT 1 ) SELECT ( WITH x ( x ) AS ( SELECT 
DISTINCT SUM ( 1 ) ) SELECT ( SELECT ( NULLIF ( 9.00 , 0 ) ) FROM 
GENERATE_SERIES ( 1 , x ) ) FROM x ) FROM x )
 
 9
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fix output after merged fixes

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 677917fc722e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/677917fc722e
Modified Files:
sql/test/pg_regress/Tests/int8.test
Branch: default
Log Message:

fix output after merged fixes


diffs (26 lines):

diff --git a/sql/test/pg_regress/Tests/int8.test 
b/sql/test/pg_regress/Tests/int8.test
--- a/sql/test/pg_regress/Tests/int8.test
+++ b/sql/test/pg_regress/Tests/int8.test
@@ -261,22 +261,10 @@ statement error 42000!SELECT: no such bi
 SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), 
to_char(q2, '9,999,999,999,999,999.999,999')
FROM INT8_TBL
 
-onlyif has-hugeint
-statement error 42000!SELECT: no such binary operator 
'to_char'(hugeint,varchar)
-SELECT '' AS to_char_3, to_char( (q1 * -1), 'PR'), to_char( 
(q2 * -1), '.999PR')
-   FROM INT8_TBL
-
-skipif has-hugeint
 statement error 42000!SELECT: no such binary operator 'to_char'(bigint,varchar)
 SELECT '' AS to_char_3, to_char( (q1 * -1), 'PR'), to_char( 
(q2 * -1), '.999PR')
FROM INT8_TBL
 
-onlyif has-hugeint
-statement error 42000!SELECT: no such binary operator 
'to_char'(hugeint,varchar)
-SELECT '' AS to_char_4, to_char( (q1 * -1), 'S'), to_char( (q2 
* -1), 'S')
-   FROM INT8_TBL
-
-skipif has-hugeint
 statement error 42000!SELECT: no such binary operator 'to_char'(bigint,varchar)
 SELECT '' AS to_char_4, to_char( (q1 * -1), 'S'), to_char( (q2 
* -1), 'S')
FROM INT8_TBL
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with dec2023

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 7713c2fcac34 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7713c2fcac34
Modified Files:
sql/server/rel_optimize_proj.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/test/BugTracker-2023/Tests/All
Branch: default
Log Message:

merged with dec2023


diffs (255 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -691,7 +691,7 @@ rel_push_project_up_(visitor *v, sql_rel
for (n = rel->exps->h; n && !fnd; n = n->next) {
sql_exp *e = n->data;
 
-   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom) {
+   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom && e->card > CARD_ATOM) {
fnd = 1;
}
}
@@ -1370,6 +1370,7 @@ rel_project_cse(visitor *v, sql_rel *rel
sql_exp *ne = 
exp_alias(v->sql->sa, exp_relname(e1), exp_name(e1), exp_relname(e2), 
exp_name(e2), exp_subtype(e2), e2->card, has_nil(e2), is_unique(e2), 
is_intern(e1));
 
ne = exp_propagate(v->sql->sa, 
ne, e1);
+   set_selfref(ne);
exp_prop_alias(v->sql->sa, ne, 
e1);
e1 = ne;
break;
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4143,7 +4143,7 @@ rel_groupings(sql_query *query, sql_rel 
if (e->type != e_column) { /* 
store group by expressions in the stack */
if 
(is_sql_group_totals(f))
return 
sql_error(sql, 02, SQLSTATE(42000) "GROUP BY: grouping expressions not possible 
with ROLLUP, CUBE and GROUPING SETS");
-   if 
(!frame_push_groupby_expression(sql, grp, e))
+   if (!exp_has_rel(e) && 
!frame_push_groupby_expression(sql, grp, e))
return NULL;
}
list_append(next_tuple, e);
@@ -5188,36 +5188,34 @@ group_merge_exps(mvc *sql, list *gexps, 
 {
int nexps = list_length(gexps) + list_length(exps);
 
-   if (nexps < 5) {
-   return list_distinct(list_merge(gexps, exps, (fdup) NULL), 
(fcmp) exp_equal, (fdup) NULL);
-   } else { /* for longer lists, use hashing */
-   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
-
-   for (node *n = gexps->h; n ; n = n->next) { /* first add 
grouping expressions */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-
-   hash_add(ht, key, e);
-   }
-
-   for (node *n = exps->h; n ; n = n->next) { /* then test if the 
new grouping expressions are already there */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
-   bool duplicates = false;
-
-   for (; he && !duplicates; he = he->chain) {
-   sql_exp *f = he->value;
-
-   if (!exp_equal(e, f))
-   duplicates = true;
-   }
-   hash_add(ht, key, e);
-   if (!duplicates)
-   list_append(gexps, e);
-   }
-   return gexps;
-   }
+   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
+
+   for (node *n = gexps->h; n ; n = n->next) { /* first add grouping 
expressions */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+
+   hash_add(ht, key, e);
+   }
+
+   for (node *n = exps->h; n ; n = n->next) { /* then test if the new 
grouping expressions are already there */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
+   bool duplicates = false;
+
+   for (; he && !duplicates; he = he->chain) {
+   sql_exp *f = he->value;
+
+   if (!exp_equal(e, f))
+   duplicates = true;
+   }
+   hash_add(ht, key, e);
+   if (!duplicates) {
+   list_append(gexps, e);
+   

MonetDB: Dec2023 - in group_merge_exps create proper referencing...

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 191efb7c655b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/191efb7c655b
Modified Files:
sql/server/rel_optimize_proj.c
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
Branch: Dec2023
Log Message:

in group_merge_exps create proper referencing expressions in the projection
in rel_push_project_up_ don't remove simple (single value) expressions in the 
expression list of the group by operator
this solves bug #7478


diffs (96 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -691,7 +691,7 @@ rel_push_project_up_(visitor *v, sql_rel
for (n = rel->exps->h; n && !fnd; n = n->next) {
sql_exp *e = n->data;
 
-   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom) {
+   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom && e->card > CARD_ATOM) {
fnd = 1;
}
}
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5651,36 +5651,34 @@ group_merge_exps(mvc *sql, list *gexps, 
 {
int nexps = list_length(gexps) + list_length(exps);
 
-   if (nexps < 5) {
-   return list_distinct(list_merge(gexps, exps, (fdup) NULL), 
(fcmp) exp_equal, (fdup) NULL);
-   } else { /* for longer lists, use hashing */
-   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
-
-   for (node *n = gexps->h; n ; n = n->next) { /* first add 
grouping expressions */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-
-   hash_add(ht, key, e);
-   }
-
-   for (node *n = exps->h; n ; n = n->next) { /* then test if the 
new grouping expressions are already there */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
-   bool duplicates = false;
-
-   for (; he && !duplicates; he = he->chain) {
-   sql_exp *f = he->value;
-
-   if (!exp_equal(e, f))
-   duplicates = true;
-   }
-   hash_add(ht, key, e);
-   if (!duplicates)
-   list_append(gexps, e);
-   }
-   return gexps;
-   }
+   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
+
+   for (node *n = gexps->h; n ; n = n->next) { /* first add grouping 
expressions */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+
+   hash_add(ht, key, e);
+   }
+
+   for (node *n = exps->h; n ; n = n->next) { /* then test if the new 
grouping expressions are already there */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
+   bool duplicates = false;
+
+   for (; he && !duplicates; he = he->chain) {
+   sql_exp *f = he->value;
+
+   if (!exp_equal(e, f))
+   duplicates = true;
+   }
+   hash_add(ht, key, e);
+   if (!duplicates) {
+   list_append(gexps, e);
+   n->data = exp_ref(sql, e);
+   }
+   }
+   return gexps;
 }
 
 static list *
diff --git a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test 
b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
--- a/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
+++ b/sql/test/BugTracker-2024/Tests/exp_equal-Bug-7478.test
@@ -1,10 +1,10 @@
-skipif knownfail
 query T nosort
 WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x GROUP BY 'x' )
 
+NULL
 
-skipif knownfail
 query T nosort
 SELECT ( WITH x AS ( SELECT NULL ) SELECT 'x' IN ( SELECT * FROM x GROUP BY 
'x' ) )
 
+NULL
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - correct test output

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 1158d6d8419c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1158d6d8419c
Modified Files:
sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
Branch: Dec2023
Log Message:

correct test output


diffs (9 lines):

diff --git a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test 
b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
--- a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
+++ b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
@@ -1,4 +1,4 @@
 query I nosort
 SELECT ( WITH x ( x ) AS ( SELECT 1 ) SELECT ( WITH x ( x ) AS ( SELECT 
DISTINCT SUM ( 1 ) ) SELECT ( SELECT ( NULLIF ( 9.00 , 0 ) ) FROM 
GENERATE_SERIES ( 1 , x ) ) FROM x ) FROM x )
 
-1
+9
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - bind variables after push_up_table.

2024-04-14 Thread Niels Nes via checkin-list
Changeset: dc820ea55775 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dc820ea55775
Modified Files:
sql/server/rel_unnest.c
sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
Branch: Dec2023
Log Message:

bind variables after push_up_table.
This solves bug #7473


diffs (91 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1591,6 +1591,8 @@ push_up_table(mvc *sql, sql_rel *rel, li
id = exp_ref(sql, id);
} else {
l->l = rel_dup(d);
+   if (is_project(l->op))
+   rel_bind_vars(sql, l, l->exps);
}
} else {
tf->l = rel_dup(d);
@@ -4257,23 +4259,58 @@ rel_simplify_exp_and_rank(visitor *v, sq
return e;
 }
 
+static inline sql_rel *
+run_exp_rewriter(visitor *v, sql_rel *rel, exp_rewrite_fptr rewriter, bool 
direction, const char *name)
+{
+   (void)name;
+   /*
+#ifndef NDEBUG
+   int changes = v->changes;
+   lng clk = GDKusec();
+   rel = rel_exp_visitor_bottomup(v, rel, rewriter, direction);
+   printf("%s %d " LLFMT "\n", name, (v->changes - changes), (GDKusec() - 
clk));
+   return rel;
+#else
+*/
+   return rel_exp_visitor_bottomup(v, rel, rewriter, direction);
+//#endif
+}
+
+static inline sql_rel *
+run_rel_rewriter(visitor *v, sql_rel *rel, rel_rewrite_fptr rewriter, const 
char *name)
+{
+   (void)name;
+   /*
+#ifndef NDEBUG
+   int changes = v->changes;
+   lng clk = GDKusec();
+   rel = rel_visitor_bottomup(v, rel, rewriter);
+   printf("%s %d " LLFMT "\n", name, (v->changes - changes), (GDKusec() - 
clk));
+   return rel;
+#else
+*/
+   return rel_visitor_bottomup(v, rel, rewriter);
+//#endif
+}
+
 sql_rel *
 rel_unnest(mvc *sql, sql_rel *rel)
 {
visitor v = { .sql = sql };
 
-   rel = rel_exp_visitor_bottomup(, rel, _simplify_exp_and_rank, 
false);
-   rel = rel_visitor_bottomup(, rel, _unnest_simplify);
-
-   rel = rel_exp_visitor_bottomup(, rel, _complex, true);
-   rel = rel_exp_visitor_bottomup(, rel, _ifthenelse, false);
/* add isnull handling */
-   rel = rel_exp_visitor_bottomup(, rel, _exp_rel, true);
-
-   rel = rel_visitor_bottomup(, rel, _unnest_comparison_rewriters);
-   rel = rel_visitor_bottomup(, rel, &_rel_unnest);
-   rel = rel_visitor_bottomup(, rel, _fix_count);/* fix 
count inside a left join (adds a project (if (cnt IS null) then (0) else (cnt)) 
*/
-   rel = rel_visitor_bottomup(, rel, _unnest_projects);
-   rel = rel_exp_visitor_bottomup(, rel, 
_reset_card_and_freevar_set_physical_type, false);
+   rel = run_exp_rewriter(, rel, _simplify_exp_and_rank, false, 
"simplify_exp_and_rank");
+   rel = run_rel_rewriter(, rel, _unnest_simplify, 
"unnest_simplify");
+//if (0) {
+   rel = run_exp_rewriter(, rel, _complex, true, 
"rewrite_complex");
+   rel = run_exp_rewriter(, rel, _ifthenelse, false, 
"rewrite_ifthenelse"); /* add isnull handling */
+   rel = run_exp_rewriter(, rel, _exp_rel, true, 
"rewrite_exp_rel");
+
+   rel = run_rel_rewriter(, rel, _unnest_comparison_rewriters, 
"unnest_comparison_rewriters");
+   rel = run_rel_rewriter(, rel, &_rel_unnest, "unnest");
+   rel = run_rel_rewriter(, rel, _fix_count, "fix_count");   
/* fix count inside a left join (adds a project (if (cnt IS null) then (0) else 
(cnt)) */
+   rel = run_rel_rewriter(, rel, _unnest_projects, 
"unnest_projects");
+//}
+   rel = run_exp_rewriter(, rel, 
_reset_card_and_freevar_set_physical_type, false, 
"exp_reset_card_and_freevar_set_physical_type");
rel = rel_visitor_topdown(, rel, _set_type);
return rel;
 }
diff --git a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test 
b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
--- a/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
+++ b/sql/test/BugTracker-2024/Tests/SQLunionfunc-Bug-7473.test
@@ -1,4 +1,3 @@
-skipif knownfail
 query I nosort
 SELECT ( WITH x ( x ) AS ( SELECT 1 ) SELECT ( WITH x ( x ) AS ( SELECT 
DISTINCT SUM ( 1 ) ) SELECT ( SELECT ( NULLIF ( 9.00 , 0 ) ) FROM 
GENERATE_SERIES ( 1 , x ) ) FROM x ) FROM x )
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Don't do group by expression matching when th...

2024-04-14 Thread Niels Nes via checkin-list
Changeset: df584735e3a3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/df584735e3a3
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
Branch: Dec2023
Log Message:

Don't do group by expression matching when the group by expression has freevars.
This solves bug #7472


diffs (23 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4594,7 +4594,7 @@ rel_groupings(sql_query *query, sql_rel 
if (e->type != e_column) { /* 
store group by expressions in the stack */
if 
(is_sql_group_totals(f))
return 
sql_error(sql, 02, SQLSTATE(42000) "GROUP BY: grouping expressions not possible 
with ROLLUP, CUBE and GROUPING SETS");
-   if 
(!frame_push_groupby_expression(sql, grp, e))
+   if (!exp_has_rel(e) && 
!frame_push_groupby_expression(sql, grp, e))
return NULL;
}
list_append(next_tuple, e);
diff --git a/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test 
b/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
--- a/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
+++ b/sql/test/BugTracker-2024/Tests/groupby-select1-Bug-7472.test
@@ -3,7 +3,6 @@ SELECT ( WITH x AS ( SELECT 1 x ) SELECT
 
 NULL
 
-skipif knownfail
 query I nosort
 SELECT ( WITH x AS ( SELECT 1 x ) SELECT 1 FROM ( x NATURAL JOIN x ) WHERE x 
NOT IN ( SELECT CASE WHEN x THEN ( SELECT 1 ) END GROUP BY ( SELECT 1 ) ) )
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - handle aggregates with variable number of arg...

2024-04-13 Thread Niels Nes via checkin-list
Changeset: bc3b13d59fc0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bc3b13d59fc0
Added Files:
sql/test/BugTracker-2023/Tests/aggregate-vararg.Bug-7422.test
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2023/Tests/All
sql/test/BugTracker-2023/Tests/SingleServer
Branch: Dec2023
Log Message:

handle aggregates with variable number of arguments, fixes bug #7422
Also added a test


diffs (51 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4099,7 +4099,8 @@ static sql_exp *
found = true; /* something was found */
} else {
a = sf;
-   exps = nexps;
+   if (!sf->func->vararg)
+   exps = nexps;
}
}
} else {
diff --git a/sql/test/BugTracker-2023/Tests/All 
b/sql/test/BugTracker-2023/Tests/All
--- a/sql/test/BugTracker-2023/Tests/All
+++ b/sql/test/BugTracker-2023/Tests/All
@@ -22,3 +22,4 @@ insert-delete-insert-crash-7415
 orderby-debug-crash-7416
 newurl-issue-7417
 rel_order_by-assertion-7418
+HAVE_LIBPY3?aggregate-vararg.Bug-7422
diff --git a/sql/test/BugTracker-2023/Tests/SingleServer 
b/sql/test/BugTracker-2023/Tests/SingleServer
--- a/sql/test/BugTracker-2023/Tests/SingleServer
+++ b/sql/test/BugTracker-2023/Tests/SingleServer
@@ -0,0 +1,1 @@
+--set embedded_py=3
diff --git a/sql/test/BugTracker-2023/Tests/aggregate-vararg.Bug-7422.test 
b/sql/test/BugTracker-2023/Tests/aggregate-vararg.Bug-7422.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2023/Tests/aggregate-vararg.Bug-7422.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE OR REPLACE AGGREGATE python_aggregate (*)
+RETURNS INTEGER
+LANGUAGE PYTHON
+{
+try:
+   unique = numpy.unique(aggr_group)
+   x = numpy.zeros(shape=(unique.size))
+   for i in range(0, unique.size):
+   x[i] = numpy.sum(val[aggr_group==unique[i]])
+except NameError:
+# aggr_group doesn't exist. no groups, aggregate on all data
+   x = numpy.sum(arg2)
+return (x)
+}
+
+query I nosort
+select python_aggregate(5,2);
+
+2
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - merged

2024-04-13 Thread Niels Nes via checkin-list
Changeset: c49727ef7caa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c49727ef7caa
Branch: Dec2023
Log Message:

merged


diffs (truncated from 965 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.49.6
+current_version = 11.49.8
 commit = False
 tag = False
 
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -823,3 +823,4 @@ 1230526af30f40eeea30fb87c47c3e414920561f
 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
+d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -9,7 +9,7 @@
 # Copyright 1997 - July 2008 CWI.
 
 %global name MonetDB
-%global version 11.49.6
+%global version 11.49.8
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
@@ -91,7 +91,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP1/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP2/%{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
@@ -922,6 +922,31 @@ fi
 %endif
 
 %changelog
+* Tue Apr 09 2024 Sjoerd Mullender  - 11.49.7-20240409
+- Rebuilt.
+- GH#7469: Crash when using `CONTAINS`
+- GH#7479: MonetDB server crashes in `exp_ref`
+- GH#7490: commonTerms optimizer no longer works
+- GH#7495: Crash when simultaneously querying and updating a string column.
+
+* Thu Mar 28 2024 Sjoerd Mullender  - 11.49.7-20240409
+- gdk: Threads have their own list of free bats.  The list was not returned
+  to the system when a thread exited, meaning that the free bats that
+  were in the list would not be reused by any thread.  This has been
+  fixed.
+
+* Tue Mar 19 2024 Sjoerd Mullender  - 11.49.7-20240409
+- monetdb5: Fixed interaction between mserver5 and remote mserver5 when only 
one
+  of the two has 128 bit integer support.
+
+* Tue Mar 19 2024 Sjoerd Mullender  - 11.49.7-20240409
+- sql: Fixed issue where equal column aliases were created. When those
+  aliases were parsed on the remote side it could give crashes.
+
+* Mon Mar 18 2024 Sjoerd Mullender  - 11.49.7-20240409
+- gdk: Fixed a couple of deadlock situations, one actually observed, one
+  never observed.
+
 * Tue Mar 12 2024 Sjoerd Mullender  - 11.49.5-20240312
 - Rebuilt.
 - GH#7390: Some MonetDB Server crashes found
diff --git a/clients/mapilib/mapi.rc b/clients/mapilib/mapi.rc
--- a/clients/mapilib/mapi.rc
+++ b/clients/mapilib/mapi.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,49,6)
-  PRODUCTVERSION version(11,49,6)
+  FILEVERSION version(11,49,8)
+  PRODUCTVERSION version(11,49,8)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB Foundation\0"
   VALUE "FileDescription", "MonetDB Application Interface DLL\0"
-  VALUE "FileVersion", sversion(11,49,6)
+  VALUE "FileVersion", sversion(11,49,8)
   VALUE "InternalName", "Mapi\0"
   VALUE "LegalCopyright", "Copyright (c) 2024 MonetDB Foundation\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "Mapi.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB Client Libraries\0"
-  VALUE "ProductVersion", sversion(11,49,6)
+  VALUE "ProductVersion", sversion(11,49,8)
   VALUE "SpecialBuild", "\0"
 END
   END
diff --git a/clients/odbc/driver/driver.rc b/clients/odbc/driver/driver.rc
--- a/clients/odbc/driver/driver.rc
+++ b/clients/odbc/driver/driver.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,49,6)
-  PRODUCTVERSION version(11,49,6)
+  FILEVERSION version(11,49,8)
+  PRODUCTVERSION version(11,49,8)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB Foundation\0"
   VALUE "FileDescription", "MonetDB ODBC Driver DLL\0"
-  VALUE "FileVersion", sversion(11,49,6)
+  VALUE "FileVersion", sversion(11,49,8)
   VALUE "InternalName", "MonetODBC\0"
   VALUE "LegalCopyright", "Copyright (c) 2024 MonetDB Foundation\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "MonetODBC.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB SQL Server\0"
-  

MonetDB: Dec2023 - add missing set_selfref fixes bug #7496

2024-04-13 Thread Niels Nes via checkin-list
Changeset: 10974c00a23d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/10974c00a23d
Modified Files:
sql/server/rel_optimize_proj.c
Branch: Dec2023
Log Message:

add missing set_selfref fixes bug #7496


diffs (11 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -1370,6 +1370,7 @@ rel_project_cse(visitor *v, sql_rel *rel
sql_exp *ne = 
exp_alias(v->sql->sa, exp_relname(e1), exp_name(e1), exp_relname(e2), 
exp_name(e2), exp_subtype(e2), e2->card, has_nil(e2), is_unique(e2), 
is_intern(e1));
 
ne = exp_propagate(v->sql->sa, 
ne, e1);
+   set_selfref(ne);
exp_prop_alias(v->sql->sa, ne, 
e1);
e1 = ne;
break;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - return null and cleanup instead of asserts

2024-04-10 Thread Niels Nes via checkin-list
Changeset: a690a976581c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a690a976581c
Modified Files:
sql/storage/bat/bat_storage.c
Branch: default
Log Message:

return null and cleanup instead of asserts


diffs (51 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -1136,7 +1136,8 @@ dict_append_bat(sql_trans *tr, sql_delta
return NULL;
BUN max_cnt = (BATcount(u) < 256)?256:64*1024;
if (DICTprepare4append(, i, u) < 0) {
-   assert(0);
+   bat_destroy(u);
+   return NULL;
} else {
int new = 0;
/* returns new offset bat (ie to be appended), possibly with 
larger type ! */
@@ -1255,7 +1256,8 @@ for_append_bat(column_storage *cs, BAT *
return NULL;
 
if (FORprepare4append(, i, offsetval, b->ttype) < 0) {
-   assert(0);
+   bat_destroy(b);
+   return NULL;
} else {
/* returns new offset bat if values within min/max, else 
decompress */
if (!newoffsets) { /* decompress */
@@ -1707,7 +1709,8 @@ dict_append_val(sql_trans *tr, sql_delta
return NULL;
BUN max_cnt = (BATcount(u) < 256)?256:64*1024;
if (DICTprepare4append_vals(, i, cnt, u) < 0) {
-   assert(0);
+   bat_destroy(u);
+   return NULL;
} else {
int new = 0;
/* returns new offset bat (ie to be appended), possibly with 
larger type ! */
@@ -1810,7 +1813,8 @@ for_append_val(column_storage *cs, void 
return NULL;
 
if (FORprepare4append_vals(, i, cnt, offsetval, tt, 
b->ttype) < 0) {
-   assert(0);
+   bat_destroy(b);
+   return NULL;
} else {
/* returns new offset bat if values within min/max, else 
decompress */
if (!newoffsets) {
@@ -4348,7 +4352,6 @@ static storage *
 savepoint_commit_storage( storage *dbat, ulng commit_ts)
 {
if (dbat && dbat->cs.ts == commit_ts && dbat->next) {
-   assert(0);
storage *od = dbat->next;
if (od->cs.ts == commit_ts) {
storage t = *od, *n = od->next;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - no more TYPE_bat

2024-04-10 Thread Niels Nes via checkin-list
Changeset: 430e06cc7ace for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/430e06cc7ace
Modified Files:
monetdb5/optimizer/opt_for.c
Branch: default
Log Message:

no more TYPE_bat


diffs (33 lines):

diff --git a/monetdb5/optimizer/opt_for.c b/monetdb5/optimizer/opt_for.c
--- a/monetdb5/optimizer/opt_for.c
+++ b/monetdb5/optimizer/opt_for.c
@@ -15,9 +15,9 @@
 
 #if 0
 static InstrPtr
-ReplaceWithNil(MalBlkPtr mb, InstrPtr p, int pos, int tpe)
+ReplaceWithNil(MalBlkPtr mb, InstrPtr p, int pos)
 {
-   p = pushNil(mb, p, tpe);/* push at end */
+   p = pushNilBat(mb, p);  /* push at end */
getArg(p, pos) = getArg(p, p->argc - 1);
p->argc--;
return p;
@@ -239,7 +239,7 @@ OPTforImplementation(Client cntxt, MalBl
}
getArg(r, j) = vardictvalue[k];
if (cand)
-   r = ReplaceWithNil(mb, r, j + 
1, TYPE_bat); /* no candidate list */
+   r = ReplaceWithNil(mb, r, j + 
1);   /* no candidate list */
pushInstruction(mb, r);
 
int tpe = getVarType(mb, varisdict[k]);
@@ -263,7 +263,7 @@ OPTforImplementation(Client cntxt, MalBl
t = pushArgument(mb, t, varisdict[k]);
t = pushArgument(mb, t, getArg(s, 0));
t = pushArgument(mb, t, cand);
-   t = pushNil(mb, t, TYPE_bat);
+   t = pushNilBat(mb, t);
t = pushBit(mb, t, TRUE);   /* nil 
matches */
t = pushBit(mb, t, TRUE);   /* 
max_one */
t = pushNil(mb, t, TYPE_lng);   /* 
estimate */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - code formating

2024-04-10 Thread Niels Nes via checkin-list
Changeset: 2bb94d49fdd6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2bb94d49fdd6
Modified Files:
monetdb5/mal/mal_session.c
Branch: default
Log Message:

code formating


diffs (13 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -858,8 +858,7 @@ optimizeMALBlock(Client cntxt, MalBlkPtr
p = getInstrPtr(mb, pc);
if (getModuleId(p) == optimizerRef && p->fcn && p->token != 
REMsymbol) {
actions++;
-   msg = (*(str (*)(Client, MalBlkPtr, MalStkPtr, 
InstrPtr)) p->
-  fcn) (cntxt, mb, 0, p);
+   msg = (*(str (*)(Client, MalBlkPtr, MalStkPtr, 
InstrPtr)) p->fcn) (cntxt, mb, 0, p);
if (mb->errors) {
freeException(msg);
msg = mb->errors;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - approved new copy_from interface

2024-04-08 Thread Niels Nes via checkin-list
Changeset: 2d76f6b61636 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2d76f6b61636
Modified Files:
clients/Tests/MAL-signatures-hge.test
Branch: default
Log Message:

approved new copy_from interface


diffs (12 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -48925,7 +48925,7 @@ mvc_clear_table_wrap;
 Clear the table sname.tname.
 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]...
+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, X_12:str, 
X_13:str):bat[:any]...
 mvc_import_table_wrap;
 Import a table from bstream s with the @given tuple and seperators (sep/rsep)
 sql
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - some more optional bats, ie reducing number o...

2024-04-08 Thread Niels Nes via checkin-list
Changeset: 8e983ad5d13d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e983ad5d13d
Modified Files:
clients/Tests/MAL-signatures-hge.test
sql/backends/monet5/sql.c
Branch: default
Log Message:

some more optional bats, ie reducing number of mel function definitions


diffs (234 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -34230,142 +34230,72 @@ SQLvar_pop;
 return the variance population of groups
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:bte]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:dbl]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:bte]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:flt]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:hge]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:int]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:lng]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:dbl]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:sht]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bte):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:dbl):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:flt]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:flt):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:hge]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:hge):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:int]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:int):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:lng):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:lng]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:sht):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:bte]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:dbl]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:sht]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:flt]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:bte]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:hge]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:int]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:lng]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, 

MonetDB: default - use floats for number of steps for floating p...

2024-04-08 Thread Niels Nes via checkin-list
Changeset: 852c9602954d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/852c9602954d
Modified Files:
sql/backends/monet5/generator/generator.c
Branch: default
Log Message:

use floats for number of steps for floating point types.


diffs (47 lines):

diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -96,6 +96,30 @@ VLTgenerator_noop(Client cntxt, MalBlkPt
bn->trevsorted = s < 0 || n <= 1;   
\
} while (0)
 
+#define VLTmaterialize_flt(TPE)
\
+   do {
\
+   TPE *v, f, l, s;
\
+   f = *getArgReference_##TPE(stk, pci, 1);
\
+   l = *getArgReference_##TPE(stk, pci, 2);
\
+   if ( pci->argc == 3)
\
+   s = f 0 && f > l) || (s < 0 && f < l) || 
is_##TPE##_nil(f) || is_##TPE##_nil(l)) \
+   throw(MAL, "generator.table",   
\
+ SQLSTATE(42000) "Illegal generator range");   
\
+   n = (BUN) ((l - f) / s);
\
+   if ((TPE) (n * s + f) != l) 
\
+   n++;
\
+   bn = COLnew(0, TYPE_##TPE, n, TRANSIENT);   
\
+   if (bn == NULL) 
\
+   throw(MAL, "generator.table", SQLSTATE(HY013) 
MAL_MALLOC_FAIL); \
+   v = (TPE*) Tloc(bn, 0); 
\
+   for (c = 0; c < n; c++) 
\
+   *v++ = (TPE) (f + c * s);   
\
+   bn->tsorted = s > 0 || n <= 1;  
\
+   bn->trevsorted = s < 0 || n <= 1;   
\
+   } while (0)
+
 static str
 VLTgenerator_table_(BAT **result, Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
@@ -125,10 +149,10 @@ VLTgenerator_table_(BAT **result, Client
break;
 #endif
case TYPE_flt:
-   VLTmaterialize(flt);
+   VLTmaterialize_flt(flt);
break;
case TYPE_dbl:
-   VLTmaterialize(dbl);
+   VLTmaterialize_flt(dbl);
break;
default:
if (tpe == TYPE_timestamp) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - protect against overflow and floating point e...

2024-04-08 Thread Niels Nes via checkin-list
Changeset: c2ca5122d90e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c2ca5122d90e
Modified Files:
sql/backends/monet5/generator/generator.c
sql/test/BugTracker-2024/Tests/VLTgenerator_table-Bug-7474.test
Branch: default
Log Message:

protect against overflow and floating point exception.
Fixes issue # 7474


diffs (40 lines):

diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -78,7 +78,12 @@ VLTgenerator_noop(Client cntxt, MalBlkPt
if (s == 0 || (s > 0 && f > l) || (s < 0 && f < l) || 
is_##TPE##_nil(f) || is_##TPE##_nil(l)) \
throw(MAL, "generator.table",   
\
  SQLSTATE(42000) "Illegal generator range");   
\
-   n = (BUN) ((l - f) / s);
\
+   if (s < 0)  
\
+   n = ((BUN)f - l);   
\
+   else
\
+   n = ((BUN)l - f);   
\
+   step = s<0?-s:s;
\
+   n = n/step; 
\
if ((TPE) (n * s + f) != l) 
\
n++;
\
bn = COLnew(0, TYPE_##TPE, n, TRANSIENT);   
\
@@ -94,7 +99,7 @@ VLTgenerator_noop(Client cntxt, MalBlkPt
 static str
 VLTgenerator_table_(BAT **result, Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-   BUN c, n;
+   BUN c, n, step;
BAT *bn;
int tpe;
(void) cntxt;
diff --git a/sql/test/BugTracker-2024/Tests/VLTgenerator_table-Bug-7474.test 
b/sql/test/BugTracker-2024/Tests/VLTgenerator_table-Bug-7474.test
--- a/sql/test/BugTracker-2024/Tests/VLTgenerator_table-Bug-7474.test
+++ b/sql/test/BugTracker-2024/Tests/VLTgenerator_table-Bug-7474.test
@@ -10,8 +10,7 @@ SELECT ( NULLIF ( -1 , 255 ) ) FROM GENE
 -1
 -1
 
-skipif knownfail
 query I nosort
-SELECT ( NULLIF ( -1 , 255 ) ) FROM GENERATE_SERIES ( 2147483647 , -1 )
+SELECT count(*) FROM GENERATE_SERIES ( 2147483647 , -2, -1000 )
 
--1
+215
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - no popcnt64 on 32 bit windows

2024-04-08 Thread Niels Nes via checkin-list
Changeset: d73ba7630731 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d73ba7630731
Modified Files:
sql/server/rel_optimize_sel.c
Branch: default
Log Message:

no popcnt64 on 32 bit windows


diffs (16 lines):

diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -2049,7 +2049,12 @@ popcount64(uint64_t x)
 #if defined(__GNUC__)
return (uint32_t) __builtin_popcountll(x);
 #elif defined(_MSC_VER)
+#if SIZEOF_OID == 4
+   /* no __popcnt64 on 32 bit Windows */
+   return (int) (__popcnt((uint32_t) x) + __popcnt((uint32_t) (x >> 32)));
+#else
return (uint32_t) __popcnt64(x);
+#endif
 #else
x = (x & 0xULL) + ((x >> 1) & 0xULL);
x = (x & 0xULL) + ((x >> 2) & 0xULL);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - merged with default

2024-04-07 Thread Niels Nes via checkin-list
Changeset: 51041ada91fa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/51041ada91fa
Modified Files:
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_rel.c
sql/server/rel_select.c
Branch: no_type_bat
Log Message:

merged with default


diffs (80 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -1639,7 +1639,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (r[*pos] != '.') {
cname = tname;
tname = NULL;
-   exp_setname(sql->sa, exp, NULL, cname);
+   exp_setname(sql->sa, exp, NULL, sa_strdup(sql->sa, 
cname));
skipWS(r, pos);
} else {
(*pos)++;
@@ -1648,7 +1648,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
convertIdent(cname);
(*pos)++;
skipWS(r, pos);
-   exp_setname(sql->sa, exp, tname, cname);
+   exp_setname(sql->sa, exp, sa_strdup(sql->sa, tname), 
sa_strdup(sql->sa, cname));
}
rlabel = try_update_label_count(sql, tname);
nlabel = try_update_label_count(sql, cname);
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -951,10 +951,11 @@ exp_exception(allocator *sa, sql_exp *co
 void
 exp_setname(allocator *sa, sql_exp *e, const char *rname, const char *name )
 {
+   (void)sa;
e->alias.label = 0;
if (name)
-   e->alias.name = sa_strdup(sa, name);
-   e->alias.rname = (rname)?sa_strdup(sa, rname):NULL;
+   e->alias.name = name;
+   e->alias.rname = (rname);
 }
 
 void
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -793,7 +793,7 @@ rel_label( mvc *sql, sql_rel *r, int all
char tname[16], *tnme;
char cname[16], *cnme = NULL;
 
-   tnme = number2name(tname, sizeof(tname), nr);
+   tnme = sa_strdup(sql->sa, number2name(tname, sizeof(tname), nr));
if (!is_simple_project(r->op))
r = rel_project(sql->sa, r, rel_projections(sql, r, NULL, 1, 
1));
if (!list_empty(r->exps)) {
@@ -804,7 +804,7 @@ rel_label( mvc *sql, sql_rel *r, int all
if (!is_freevar(e)) {
if (all) {
nr = ++sql->label;
-   cnme = number2name(cname, 
sizeof(cname), nr);
+   cnme = sa_strdup(sql->sa, 
number2name(cname, sizeof(cname), nr));
}
exp_setname(sql->sa, e, tnme, cnme );
}
@@ -815,7 +815,7 @@ rel_label( mvc *sql, sql_rel *r, int all
for (node *ne = ((list*)r->r)->h; ne; ne = ne->next) {
if (all) {
nr = ++sql->label;
-   cnme = number2name(cname, sizeof(cname), nr);
+   cnme = sa_strdup(sql->sa, number2name(cname, 
sizeof(cname), nr));
}
exp_setname(sql->sa, ne->data, tnme, cnme );
}
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5870,7 +5870,7 @@ rel_joinquery_(sql_query *query, symbol 
list *outexps = new_exp_list(sql->sa), *exps;
node *m;
 
-   rnme = number2name(rname, sizeof(rname), ++sql->label);
+   rnme = sa_strdup(sql->sa, number2name(rname, sizeof(rname), 
++sql->label));
for (; n; n = n->next) {
char *nm = n->data.sval;
sql_exp *cond, *ls, *rs;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - we need to allocate now that the exp_setname ...

2024-04-07 Thread Niels Nes via checkin-list
Changeset: dc4b070e9529 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dc4b070e9529
Modified Files:
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_rel.c
sql/server/rel_select.c
Branch: default
Log Message:

we need to allocate now that the exp_setname just uses the sql_allocator 
allocated strings


diffs (80 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -1639,7 +1639,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (r[*pos] != '.') {
cname = tname;
tname = NULL;
-   exp_setname(sql->sa, exp, NULL, cname);
+   exp_setname(sql->sa, exp, NULL, sa_strdup(sql->sa, 
cname));
skipWS(r, pos);
} else {
(*pos)++;
@@ -1648,7 +1648,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
convertIdent(cname);
(*pos)++;
skipWS(r, pos);
-   exp_setname(sql->sa, exp, tname, cname);
+   exp_setname(sql->sa, exp, sa_strdup(sql->sa, tname), 
sa_strdup(sql->sa, cname));
}
rlabel = try_update_label_count(sql, tname);
nlabel = try_update_label_count(sql, cname);
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -951,10 +951,11 @@ exp_exception(sql_allocator *sa, sql_exp
 void
 exp_setname(sql_allocator *sa, sql_exp *e, const char *rname, const char *name 
)
 {
+   (void)sa;
e->alias.label = 0;
if (name)
-   e->alias.name = sa_strdup(sa, name);
-   e->alias.rname = (rname)?sa_strdup(sa, rname):NULL;
+   e->alias.name = name;
+   e->alias.rname = (rname);
 }
 
 void
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -793,7 +793,7 @@ rel_label( mvc *sql, sql_rel *r, int all
char tname[16], *tnme;
char cname[16], *cnme = NULL;
 
-   tnme = number2name(tname, sizeof(tname), nr);
+   tnme = sa_strdup(sql->sa, number2name(tname, sizeof(tname), nr));
if (!is_simple_project(r->op))
r = rel_project(sql->sa, r, rel_projections(sql, r, NULL, 1, 
1));
if (!list_empty(r->exps)) {
@@ -804,7 +804,7 @@ rel_label( mvc *sql, sql_rel *r, int all
if (!is_freevar(e)) {
if (all) {
nr = ++sql->label;
-   cnme = number2name(cname, 
sizeof(cname), nr);
+   cnme = sa_strdup(sql->sa, 
number2name(cname, sizeof(cname), nr));
}
exp_setname(sql->sa, e, tnme, cnme );
}
@@ -815,7 +815,7 @@ rel_label( mvc *sql, sql_rel *r, int all
for (node *ne = ((list*)r->r)->h; ne; ne = ne->next) {
if (all) {
nr = ++sql->label;
-   cnme = number2name(cname, sizeof(cname), nr);
+   cnme = sa_strdup(sql->sa, number2name(cname, 
sizeof(cname), nr));
}
exp_setname(sql->sa, ne->data, tnme, cnme );
}
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -5870,7 +5870,7 @@ rel_joinquery_(sql_query *query, symbol 
list *outexps = new_exp_list(sql->sa), *exps;
node *m;
 
-   rnme = number2name(rname, sizeof(rname), ++sql->label);
+   rnme = sa_strdup(sql->sa, number2name(rname, sizeof(rname), 
++sql->label));
for (; n; n = n->next) {
char *nm = n->data.sval;
sql_exp *cond, *ls, *rs;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - merged with default

2024-04-07 Thread Niels Nes via checkin-list
Changeset: 15c345a6b882 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/15c345a6b882
Modified Files:
clients/Tests/exports.stable.out
Branch: no_type_bat
Log Message:

merged with default


diffs (12 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
@@ -404,7 +404,7 @@ void RTREEdestroy(BAT *b);
 bool RTREEexists(BAT *b);
 bool RTREEexists_bid(bat bid);
 void RTREEfree(BAT *b);
-BUN *RTREEsearch(BAT *b, mbr_t *inMBR, int result_limit);
+BUN *RTREEsearch(BAT *b, const void *inMBR, int result_limit);
 BUN SORTfnd(BAT *b, const void *v);
 BUN SORTfndfirst(BAT *b, const void *v);
 BUN SORTfndlast(BAT *b, const void *v);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - fix overwriting names

2024-04-07 Thread Niels Nes via checkin-list
Changeset: 3ac0f374f59b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3ac0f374f59b
Modified Files:
monetdb5/mal/mal_namespace.c
Branch: no_type_bat
Log Message:

fix overwriting names


diffs (13 lines):

diff --git a/monetdb5/mal/mal_namespace.c b/monetdb5/mal/mal_namespace.c
--- a/monetdb5/mal/mal_namespace.c
+++ b/monetdb5/mal/mal_namespace.c
@@ -127,7 +127,8 @@ findName(const char *nme, size_t len, bo
namespace = ns;
}
m = >data[namespace->count++];
-   strncpy(m->nme, nme, len);
+   if (m->nme != nme)
+   strncpy(m->nme, nme, len);
m->nme[len] = 0;
m->length = (unsigned short) len;
m->next = *n;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - changed RTREEsearch export

2024-04-07 Thread Niels Nes via checkin-list
Changeset: de3320b2d5d1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de3320b2d5d1
Modified Files:
clients/Tests/exports.stable.out
Branch: default
Log Message:

changed RTREEsearch export


diffs (12 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
@@ -404,7 +404,7 @@ void RTREEdestroy(BAT *b);
 bool RTREEexists(BAT *b);
 bool RTREEexists_bid(bat bid);
 void RTREEfree(BAT *b);
-BUN *RTREEsearch(BAT *b, mbr_t *inMBR, int result_limit);
+BUN *RTREEsearch(BAT *b, const void *inMBR, int result_limit);
 BUN SORTfnd(BAT *b, const void *v);
 BUN SORTfndfirst(BAT *b, const void *v);
 BUN SORTfndlast(BAT *b, const void *v);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - single threaded gets different output

2024-04-07 Thread Niels Nes via checkin-list
Changeset: 6a195f418d51 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6a195f418d51
Modified Files:
clients/odbc/tests/ODBCmetadata.c
Branch: no_type_bat
Log Message:

single threaded gets different output


diffs (12 lines):

diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -1611,7 +1611,7 @@ main(int argc, char **argv)
"Resultset with 2 columns\n"
"Resultset with 11 rows\n"
"usec   statement\n"
-   "BIGINT WVARCHAR(249)\n"
+   "BIGINT WVARCHAR(240)\n"
"4  variable output\n"
"4  variable output\n"
"4  variable output\n"
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - merged with default

2024-04-06 Thread Niels Nes via checkin-list
Changeset: 73cdbbcb3a7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/73cdbbcb3a7c
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_batop.c
gdk/gdk_tm.c
sql/server/rel_optimize_sel.c
Branch: no_type_bat
Log Message:

merged with default


diffs (truncated from 486 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
@@ -181,7 +181,6 @@ BAT *BATproject2(BAT *restrict l, BAT *r
 BAT *BATprojectchain(BAT **bats);
 gdk_return BATrangejoin(BAT **r1p, BAT **r2p, BAT *l, BAT *rl, BAT *rh, BAT 
*sl, BAT *sr, bool li, bool hi, bool anti, bool symmetric, BUN estimate) 
__attribute__((__warn_unused_result__));
 gdk_return BATreplace(BAT *b, BAT *p, BAT *n, bool force) 
__attribute__((__warn_unused_result__));
-gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr, 
bool force) __attribute__((__warn_unused_result__));
 void BATrmprop(BAT *b, enum prop_t idx);
 void BATrmprop_nolock(BAT *b, enum prop_t idx);
 gdk_return BATrtree(BAT *wkb, BAT *mbr);
@@ -401,12 +400,10 @@ ssize_t OIDtoStr(str *dst, size_t *len, 
 BUN ORDERfnd(BAT *b, Heap *oidxh, const void *v);
 BUN ORDERfndfirst(BAT *b, Heap *oidxh, const void *v);
 BUN ORDERfndlast(BAT *b, Heap *oidxh, const void *v);
-void RTREEdecref(BAT *b);
 void RTREEdestroy(BAT *b);
 bool RTREEexists(BAT *b);
-bool RTREEexists_bid(bat *bid);
+bool RTREEexists_bid(bat bid);
 void RTREEfree(BAT *b);
-void RTREEincref(BAT *b);
 BUN *RTREEsearch(BAT *b, mbr_t *inMBR, int result_limit);
 BUN SORTfnd(BAT *b, const void *v);
 BUN SORTfndfirst(BAT *b, const void *v);
@@ -415,7 +412,6 @@ gdk_return STRMPcreate(BAT *b, BAT *s);
 void STRMPdestroy(BAT *b);
 BAT *STRMPfilter(BAT *b, BAT *s, const char *q, const bool keep_nils);
 bool THRhighwater(void);
-gdk_return TMsubcommit(BAT *bl) __attribute__((__warn_unused_result__));
 gdk_return TMsubcommit_list(bat *restrict subcommit, BUN *restrict sizes, int 
cnt, lng logno) __attribute__((__warn_unused_result__));
 void VALclear(ValPtr v);
 int VALcmp(const ValRecord *p, const ValRecord *q);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -357,13 +357,6 @@ gdk_export _Noreturn void GDKfatal(_In_z
 #include "stream.h"
 #include "mstring.h"
 
-#ifdef HAVE_RTREE
-#ifndef SIZEOF_RTREE_COORD_T
-#define SIZEOF_RTREE_COORD_T 4
-#endif
-#include 
-#endif
-
 #undef MIN
 #undef MAX
 #define MAX(A,B)   ((A)<(B)?(B):(A))
@@ -1314,8 +1307,6 @@ gdk_export gdk_return BATreplace(BAT *b,
__attribute__((__warn_unused_result__));
 gdk_export gdk_return BATupdate(BAT *b, BAT *p, BAT *n, bool force)
__attribute__((__warn_unused_result__));
-gdk_export gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool 
autoincr, bool force)
-   __attribute__((__warn_unused_result__));
 gdk_export gdk_return BATupdatepos(BAT *b, const oid *positions, BAT *n, bool 
autoincr, bool force)
__attribute__((__warn_unused_result__));
 
@@ -1904,21 +1895,12 @@ gdk_export gdk_return BATsetstrimps(BAT 
 
 /* Rtree structure functions */
 #ifdef HAVE_RTREE
-//TODO REMOVE
-typedef struct mbr_t {
-   float xmin;
-   float ymin;
-   float xmax;
-   float ymax;
-
-} mbr_t;
-
 gdk_export bool RTREEexists(BAT *b);
-gdk_export bool RTREEexists_bid(bat *bid);
+gdk_export bool RTREEexists_bid(bat bid);
 gdk_export gdk_return BATrtree(BAT *wkb, BAT* mbr);
-gdk_export BUN* RTREEsearch(BAT *b, mbr_t *inMBR, int result_limit);
-gdk_export void RTREEdecref(BAT *b);
-gdk_export void RTREEincref(BAT *b);
+/* inMBR is really a struct mbr * from geom module, but that is not
+ * available here */
+gdk_export BUN* RTREEsearch(BAT *b, const void *inMBR, int result_limit);
 #endif
 
 gdk_export void RTREEdestroy(BAT *b);
@@ -2100,8 +2082,6 @@ BUNtoid(BAT *b, BUN p)
 /*
  * @+ Transaction Management
  */
-gdk_export gdk_return TMsubcommit(BAT *bl)
-   __attribute__((__warn_unused_result__));
 gdk_export gdk_return TMsubcommit_list(bat *restrict subcommit, BUN *restrict 
sizes, int cnt, lng logno)
__attribute__((__warn_unused_result__));
 
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1783,12 +1783,14 @@ BATupdate(BAT *b, BAT *p, BAT *n, bool f
return BATappend_or_update(b, p, NULL, n, true, false, force);
 }
 
+#if 0  /* not used */
 /* like BATreplace, but the positions are given by an array of oid values */
 gdk_return
 BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr, bool force)
 {
return BATappend_or_update(b, NULL, positions, n, false, autoincr, 
force);
 }
+#endif
 
 /* like BATreplace, but the positions are given by an array of oid
  * values, and they may specify locations beyond the end of b */
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ 

MonetDB: default - fix shifting (lng) vs (ulng)

2024-04-06 Thread Niels Nes via checkin-list
Changeset: 3e4d52251fac for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3e4d52251fac
Modified Files:
sql/server/rel_optimize_sel.c
Branch: default
Log Message:

fix shifting (lng) vs (ulng)


diffs (34 lines):

diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -2110,15 +2110,15 @@ order_joins(visitor *v, list *rels, list
r1[ci] = rels_find_one_rel(rels_a, nr_rels, cje->l);
r2[ci] = rels_find_one_rel(rels_a, nr_rels, cje->r);
if (r1[ci])
-   h[ci] |= LL_CONSTANT(1)<<((r1[ci]-1)%64);
+   h[ci] |= ((ulng)1)<<((r1[ci]-1)%64);
if (r2[ci])
-   h[ci] |= LL_CONSTANT(1)<<((r2[ci]-1)%64);
+   h[ci] |= ((ulng)1)<<((r2[ci]-1)%64);
if (cje->f) {
r3[ci] = rels_find_one_rel(rels_a, nr_rels, 
cje->f);
if (r3[ci] == r2[ci])
r3[ci] = 0;
if (r3[ci])
-   h[ci] |= 
LL_CONSTANT(1)<<((r3[ci]-1)%64);
+   h[ci] |= ((ulng)1)<<((r3[ci]-1)%64);
}
}
}
@@ -2188,9 +2188,9 @@ order_joins(visitor *v, list *rels, list
 
cje = djn->data;
if ((h[cje->tmp] & rel_mask) > 0) {
-   if (rel_mask & 
(LL_CONSTANT(1)<<((r1[cje->tmp]-1)%64)))
+   if (rel_mask & 
(((ulng)1)<<((r1[cje->tmp]-1)%64)))
l = rels_a[r1[cje->tmp]];
-   if (rel_mask & 
(LL_CONSTANT(1)<<((r2[cje->tmp]-1)%64)))
+   if (rel_mask & 
(((ulng)1)<<((r2[cje->tmp]-1)%64)))
r = rels_a[r2[cje->tmp]];
}
if (!direct) { /* check if atleast one side in n_rels */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - merged

2024-04-06 Thread Niels Nes via checkin-list
Changeset: d03c460fe8a6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d03c460fe8a6
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: no_type_bat
Log Message:

merged


diffs (truncated from 725 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -38480,7 +38480,12 @@ SQLwindow_bound;
 computes window ranges for each row
 sqlcatalog
 alter_add_range_partition
-pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void
+SQLalter_add_range_partition;
+Catalog operation alter_add_range_partition
+sqlcatalog
+alter_add_range_partition
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void
 SQLalter_add_range_partition;
 Catalog operation alter_add_range_partition
 sqlcatalog
@@ -38490,12 +38495,22 @@ SQLalter_add_table;
 Catalog operation alter_add_table
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int):void
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void
 SQLalter_add_value_partition;
 Catalog operation alter_add_value_partition
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:any...):void
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void
+SQLalter_add_value_partition;
+Catalog operation alter_add_value_partition
+sqlcatalog
+alter_add_value_partition
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:lng):void
+SQLalter_add_value_partition;
+Catalog operation alter_add_value_partition
+sqlcatalog
+alter_add_value_partition
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:lng, X_7:any...):void
 SQLalter_add_value_partition;
 Catalog operation alter_add_value_partition
 sqlcatalog
@@ -38717,17 +38732,7 @@ str
 contains
 pattern str.contains(X_0:str, X_1:str, X_2:bit):bit
 STRcontains;
-Check if string chaystack contains string needle, icase flag.
-str
-containsjoin
-pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid]
-STRcontainsjoin1;
-The same as STRcontainsjoin, but only produce one output + icase.
-str
-containsjoin
-pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid]
-STRcontainsjoin1;
-The same as STRcontainsjoin, but only produce one output.
+Check if string haystack contains string needle, icase flag.
 str
 containsjoin
 pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], 
X_9:bat[:oid])
@@ -38735,10 +38740,20 @@ STRcontainsjoin;
 Join the string bat L with the bat R if L contains the string of R@with 
optional candidate lists SL and SR@The result is two aligned bats with oids of 
matching rows + icase.
 str
 containsjoin
+pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid]
+STRcontainsjoin;
+The same as STRcontainsjoin, but only produce one output + icase.
+str
+containsjoin
 pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid])
 STRcontainsjoin;
 Join the string bat L with the bat R if L contains the string of R@with 
optional candidate lists SL and SR@The result is two aligned bats with oids of 
matching rows.
 str
+containsjoin
+pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid]
+STRcontainsjoin;
+The same as STRcontainsjoin, but only produce one output.
+str
 containsselect
 pattern str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, 
X_3:bit):bat[:oid]
 STRcontainsselect;
@@ -38760,25 +38775,25 @@ STRendswith;
 Check if string ends with substring, icase flag.
 str
 endswithjoin
-pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid]
-STRendswithjoin1;
-The same as STRendswithjoin, but only produce one output + icase.
-str
-endswithjoin
-pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid]
-STRendswithjoin1;
-The same as STRendswithjoin, but only produce one output.
-str

MonetDB: no_type_bat - fndConstants needs to check also on bat /...

2024-04-06 Thread Niels Nes via checkin-list
Changeset: 145b59486a5e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/145b59486a5e
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: no_type_bat
Log Message:

fndConstants needs to check also on bat / isabat when matching constants.


diffs (16 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -872,8 +872,10 @@ fndConstant(MalBlkPtr mb, const ValRecor
for (i = k; i < mb->vtop - 1; i++) {
VarPtr v = getVar(mb, i);
if (v->constant) {
-   if (v && v->type == cst->vtype && v->value.len == 
cst->len
-   && ATOMcmp(cst->vtype, VALptr(>value), p) == 
0)
+   if (v && v->type == cst->vtype &&
+   v->value.len == cst->len &&
+   isaBatType(v->type) == cst->bat &&
+   ATOMcmp(cst->vtype, VALptr(>value), 
p) == 0)
return i;
}
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: no_type_bat - merged with default

2024-04-04 Thread Niels Nes via checkin-list
Changeset: 64766f88abc0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/64766f88abc0
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_bbp.c
sql/common/sql_types.c
sql/include/sql_catalog.h
sql/server/rel_select.c
sql/storage/bat/bat_storage.c
sql/storage/objectset.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: no_type_bat
Log Message:

merged with default


diffs (truncated from 1065 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
@@ -224,6 +224,7 @@ void BBPlock(void);
 BAT *BBPquickdesc(bat b);
 int BBPreadBBPline(FILE *fp, unsigned bbpversion, int *lineno, BAT *bn, int 
*hashash, char *batname, char *filename, char **options);
 int BBPrelease(bat b);
+void BBPrelinquishbats(void);
 int BBPrename(BAT *b, const char *nme);
 int BBPretain(bat b);
 gdk_return BBPsave(BAT *b);
diff --git a/documentation/monetdbe/monetdbe_api.rst 
b/documentation/monetdbe/monetdbe_api.rst
--- a/documentation/monetdbe/monetdbe_api.rst
+++ b/documentation/monetdbe/monetdbe_api.rst
@@ -167,7 +167,7 @@ Miscellaneous
 
 Return the internal NULL representation for the specific monetdbe type or 
NULL when the type is not found/supported.
 
-.. c:function:: const char* monetdbe_get_mapi_port(void)
+.. c:function:: const char * monetdbe_get_mapi_port(void)
 
 Return the mapi port or NULL if not used.
 
@@ -175,6 +175,10 @@ Miscellaneous
 
 Return the MonetDBe version.
 
+.. c:function:: const char * monetdbe_load_extension(monetdbe_database dbhdl, 
char *module_name)
+
+Load the module with name, module_name. The lib_module_name.so (or ddl) 
should be in the applications current working directory.
+
 Caveats and errors
 --
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -120,6 +120,7 @@ static MT_Lock BBPnameLock = MT_LOCK_INI
 static bat BBP_hash[BBP_mask+1];   /* BBP logical name hash buckets */
 static MT_Lock GDKcacheLock = MT_LOCK_INITIALIZER(GDKcacheLock);
 static bat BBP_free;
+static uint32_t BBP_nfree;
 #define BBP_FREE_LOWATER   10
 #define BBP_FREE_HIWATER   50
 
@@ -2003,6 +2004,7 @@ BBPinit(bool allow_hge_upgrade)
if (BBP_desc(i)->batCacheid == 0) {
BBP_next(i) = BBP_free;
BBP_free = i;
+   BBP_nfree++;
}
}
 
@@ -2693,6 +2695,7 @@ maybeextend(void)
BBP_next(sz) = ++size;
}
BBP_next(size) = 0;
+   BBP_nfree += BBP_FREE_LOWATER;
return GDK_SUCCEED;
 }
 
@@ -2731,6 +2734,7 @@ BBPallocbat(int tt)
for (int x = 0; x < BBP_FREE_LOWATER && i; x++) {
assert(BBP_next(i) == 0 || BBP_next(i) > i);
t->nfreebats++;
+   BBP_nfree--;
l = i;
i = BBP_next(i);
}
@@ -2845,6 +2849,7 @@ BBPhandover(struct freebats *t, uint32_t
if (n >= t->nfreebats) {
bid = t->freebats;
t->freebats = 0;
+   BBP_nfree += t->nfreebats;
t->nfreebats = 0;
} else {
p = >freebats;
@@ -2852,6 +2857,7 @@ BBPhandover(struct freebats *t, uint32_t
p = _next(*p);
bid = *p;
*p = 0;
+   BBP_nfree += n;
t->nfreebats -= n;
}
p = _free;
@@ -2934,9 +2940,10 @@ BBPclear(bat i)
 }
 
 void
-BBPrelinquish(struct freebats *t)
+BBPrelinquishbats(void)
 {
-   if (t->nfreebats == 0)
+   struct freebats *t = MT_thread_getfreebats();
+   if (t == NULL || t->nfreebats == 0)
return;
MT_lock_set();
while (t->nfreebats > 0) {
@@ -4659,6 +4666,7 @@ gdk_bbp_reset(void)
int i;
 
BBP_free = 0;
+   BBP_nfree = 0;
while (BBPlimit > BBPINIT) {
BBPlimit -= BBPINIT;
assert(BBPlimit >= 0);
@@ -4892,4 +4900,5 @@ BBPprintinfo(void)
printf("%d persistent bats using %zu virtual memory (%zu malloced)\n", 
pn, pvm, pmem);
printf("%d transient bats using %zu virtual memory (%zu malloced)\n", 
tn, tvm, tmem);
printf("%d bats are \"hot\" (i.e. currently or recently used)\n", nh);
+   printf("%"PRIu32" bats are in global free list\n", BBP_nfree);
 }
diff --git a/gdk/gdk_bbp.h b/gdk/gdk_bbp.h
--- a/gdk/gdk_bbp.h
+++ b/gdk/gdk_bbp.h
@@ -92,6 +92,7 @@ gdk_export int BBPrelease(bat b);
 gdk_export void BBPkeepref(BAT *b)
__attribute__((__nonnull__(1)));
 gdk_export void BBPcold(bat i);
+gdk_export void BBPrelinquishbats(void);
 #ifdef GDKLIBRARY_JSON
 typedef gdk_return ((*json_storage_conversion)(char **, const char **));
 gdk_export gdk_return BBPjson_upgrade(json_storage_conversion);
diff 

MonetDB: default - add minimal documentation to load extension o...

2024-04-04 Thread Niels Nes via checkin-list
Changeset: cadb9054c46c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cadb9054c46c
Modified Files:
documentation/monetdbe/monetdbe_api.rst
Branch: default
Log Message:

add minimal documentation to load extension option for monetdbe


diffs (23 lines):

diff --git a/documentation/monetdbe/monetdbe_api.rst 
b/documentation/monetdbe/monetdbe_api.rst
--- a/documentation/monetdbe/monetdbe_api.rst
+++ b/documentation/monetdbe/monetdbe_api.rst
@@ -167,7 +167,7 @@ Miscellaneous
 
 Return the internal NULL representation for the specific monetdbe type or 
NULL when the type is not found/supported.
 
-.. c:function:: const char* monetdbe_get_mapi_port(void)
+.. c:function:: const char * monetdbe_get_mapi_port(void)
 
 Return the mapi port or NULL if not used.
 
@@ -175,6 +175,10 @@ Miscellaneous
 
 Return the MonetDBe version.
 
+.. c:function:: const char * monetdbe_load_extension(monetdbe_database dbhdl, 
char *module_name)
+
+Load the module with name, module_name. The lib_module_name.so (or ddl) 
should be in the applications current working directory.
+
 Caveats and errors
 --
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


  1   2   3   4   5   6   7   >