MonetDB: default - also set the estimate of the unique values in...

2024-06-11 Thread Niels Nes via checkin-list
Changeset: 3dbe2dc6934f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3dbe2dc6934f
Modified Files:
monetdb5/modules/mal/mat.c
Branch: default
Log Message:

also set the estimate of the unique values in mat.pack


diffs (19 lines):

diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -172,6 +172,7 @@ MATpackIncrement(Client cntxt, MalBlkPtr
BBPunfix(b->batCacheid);
throw(MAL, "mat.pack", GDK_EXCEPTION);
}
+   bn->tunique_est = b->tunique_est;
bn->unused = (pieces - 1);  /* misuse "unused" field */
BBPunfix(b->batCacheid);
if (bn->tnil && bn->tnonil) {
@@ -208,6 +209,7 @@ MATpackIncrement(Client cntxt, MalBlkPtr
throw(MAL, "mat.pack", GDK_EXCEPTION);
}
BBPunfix(bb->batCacheid);
+   b->tunique_est += bb->tunique_est;
b->unused--;
if (b->unused == 0 && (b = BATsetaccess(b, BAT_READ)) == NULL)
throw(MAL, "mat.pack", GDK_EXCEPTION);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Approve information schema changes.

2024-06-11 Thread Sjoerd Mullender via checkin-list
Changeset: 6c2a629ade03 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6c2a629ade03
Modified Files:

sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128

sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Approve information schema changes.


diffs (truncated from 1200 to 300 lines):

diff --git 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -1059,3 +1059,46 @@ UPDATE sys._tables SET system = true WHE
 Running database upgrade commands:
 ALTER TABLE sys.key_types SET READ ONLY;
 
+Running database upgrade commands:
+DROP VIEW information_schema.check_constraints CASCADE;
+DROP VIEW information_schema.table_constraints CASCADE;
+CREATE VIEW INFORMATION_SCHEMA.CHECK_CONSTRAINTS AS SELECT
+  cast(NULL AS varchar(1)) AS CONSTRAINT_CATALOG,
+  s."name" AS CONSTRAINT_SCHEMA,
+  k."name" AS CONSTRAINT_NAME,
+  cast(sys.check_constraint(s."name", k."name") AS varchar(2048)) AS 
CHECK_CLAUSE,
+  t."schema_id" AS schema_id,
+  t."id" AS table_id,
+  t."name" AS table_name,
+  k."id" AS key_id
+ FROM (SELECT sk."id", sk."table_id", sk."name" FROM sys."keys" sk WHERE 
sk."type" = 4 UNION ALL SELECT tk."id", tk."table_id", tk."name" FROM 
tmp."keys" tk WHERE tk."type" = 4) k
+ INNER JOIN (SELECT st."id", st."schema_id", st."name" FROM sys."_tables" st 
UNION ALL SELECT tt."id", tt."schema_id", tt."name" FROM tmp."_tables" tt) t ON 
k."table_id" = t."id"
+ INNER JOIN sys."schemas" s ON t."schema_id" = s."id"
+ ORDER BY s."name", t."name", k."name";
+GRANT SELECT ON TABLE INFORMATION_SCHEMA.CHECK_CONSTRAINTS TO PUBLIC WITH 
GRANT OPTION;
+CREATE VIEW INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS SELECT
+  cast(NULL AS varchar(1)) AS CONSTRAINT_CATALOG,
+  s."name" AS CONSTRAINT_SCHEMA,
+  k."name" AS CONSTRAINT_NAME,
+  cast(NULL AS varchar(1)) AS TABLE_CATALOG,
+  s."name" AS TABLE_SCHEMA,
+  t."name" AS TABLE_NAME,
+  cast(CASE k."type" WHEN 0 THEN 'PRIMARY KEY' WHEN 1 THEN 'UNIQUE' WHEN 2 
THEN 'FOREIGN KEY' WHEN 3 THEN 'UNIQUE NULLS NOT DISTINCT' WHEN 4 THEN 'CHECK' 
ELSE NULL END AS varchar(26)) AS CONSTRAINT_TYPE,
+  cast('NO' AS varchar(3)) AS IS_DEFERRABLE,
+  cast('NO' AS varchar(3)) AS INITIALLY_DEFERRED,
+  cast('YES' AS varchar(3)) AS ENFORCED,
+  t."schema_id" AS schema_id,
+  t."id" AS table_id,
+  k."id" AS key_id,
+  k."type" AS key_type,
+  t."system" AS is_system
+ FROM (SELECT sk."id", sk."table_id", sk."name", sk."type" FROM sys."keys" sk 
UNION ALL SELECT tk."id", tk."table_id", tk."name", tk."type" FROM tmp."keys" 
tk) k
+ INNER JOIN (SELECT st."id", st."schema_id", st."name", st."system" FROM 
sys."_tables" st UNION ALL SELECT tt."id", tt."schema_id", tt."name", 
tt."system" FROM tmp."_tables" tt) t ON k."table_id" = t."id"
+ INNER JOIN sys."schemas" s ON t."schema_id" = s."id"
+ ORDER BY s."name", t."name", k."name";
+GRANT SELECT ON TABLE INFORMATION_SCHEMA.TABLE_CONSTRAINTS TO PUBLIC WITH 
GRANT OPTION;
+
+UPDATE sys._tables SET system = true where system <> true
+ and schema_id = (select s.id from sys.schemas s where s.name = 
'information_schema')
+ and name in ('check_constraints','table_constraints');
+
diff --git 

MonetDB: Aug2024 - Fixes RTREEdestroy flow for monetdbe

2024-06-11 Thread stefanos mavros via checkin-list
Changeset: 5cb10400f35b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5cb10400f35b
Modified Files:
gdk/gdk_rtree.c
Branch: Aug2024
Log Message:

Fixes RTREEdestroy flow for monetdbe


diffs (12 lines):

diff --git a/gdk/gdk_rtree.c b/gdk/gdk_rtree.c
--- a/gdk/gdk_rtree.c
+++ b/gdk/gdk_rtree.c
@@ -313,7 +313,7 @@ RTREEdestroy(BAT *b)
}
//If the rtree is not loaded (pb->trtree is null), but there is a file 
with the index (from previous execution),
//we should remove the file
-   else if (RTREEexistsonfile(pb)) {
+   else if (pb->theap && !GDKinmemory(pb->theap->farmid) && 
RTREEexistsonfile(pb)) {
GDKunlink(pb->theap->farmid,
BATDIR,
BBP_physical(b->batCacheid),
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Aug2024 - Exit if there is an error in example_proxy test

2024-06-11 Thread stefanos mavros via checkin-list
Changeset: 4c7a3024462b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4c7a3024462b
Modified Files:
ctest/tools/monetdbe/Tests/example_proxy.SQL.py
Branch: Aug2024
Log Message:

Exit if there is an error in example_proxy test


diffs (11 lines):

diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py 
b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
--- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
+++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
@@ -19,6 +19,7 @@ results = subprocess.run(cmd, stdout=sub
 
 if results.stderr:
 print(results.stderr)
+exit(1)
 
 lines = results.stdout.splitlines()
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merges Aug2024

2024-06-11 Thread stefanos mavros via checkin-list
Changeset: fd9ff8ddfe43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fd9ff8ddfe43
Branch: default
Log Message:

Merges Aug2024


diffs (23 lines):

diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py 
b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
--- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
+++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py
@@ -19,6 +19,7 @@ results = subprocess.run(cmd, stdout=sub
 
 if results.stderr:
 print(results.stderr)
+exit(1)
 
 lines = results.stdout.splitlines()
 
diff --git a/gdk/gdk_rtree.c b/gdk/gdk_rtree.c
--- a/gdk/gdk_rtree.c
+++ b/gdk/gdk_rtree.c
@@ -313,7 +313,7 @@ RTREEdestroy(BAT *b)
}
//If the rtree is not loaded (pb->trtree is null), but there is a file 
with the index (from previous execution),
//we should remove the file
-   else if (RTREEexistsonfile(pb)) {
+   else if (pb->theap && !GDKinmemory(pb->theap->farmid) && 
RTREEexistsonfile(pb)) {
GDKunlink(pb->theap->farmid,
BATDIR,
BBP_physical(b->batCacheid),
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Aug2024 - fixed bug in is_distinct. Later we need to fi...

2024-06-11 Thread Niels Nes via checkin-list
Changeset: ca36bc8ab40e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ca36bc8ab40e
Added Files:
sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2024/Tests/All
Branch: Aug2024
Log Message:

fixed bug in is_distinct. Later we need to fix the implementation on the mal 
layer.


diffs (71 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
@@ -2842,8 +2842,10 @@ rel_logical_exp(sql_query *query, sql_re
assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || 
quantifier == 3 || quantifier == 4);
 
if (quantifier >= 3) {
-   if (quantifier == 4)
+   if (quantifier == 4) {
is_distinct_from = true;
+   compare_op = "<>";
+   }
quantifier = 0;
is_semantics = 1;
}
@@ -2859,6 +2861,7 @@ rel_logical_exp(sql_query *query, sql_re
bool rs_is_non_null_atom = exp_is_atom(rs) && 
exp_is_not_null(rs);
 
if (ls_is_non_null_atom || rs_is_non_null_atom) {
+   sql_rel *r = rel_dup(rel);
sql_rel* l = rel_compare(query, rel, sc, lo, 
ro, compare_op, f | sql_or, ek, quantifier, 0);
sql_subtype *t;
if (!(t = 
exp_subtype(rs_is_non_null_atom?ls:rs)))
@@ -2866,9 +2869,10 @@ rel_logical_exp(sql_query *query, sql_re
sql_exp* e = exp_compare(sql->sa, 
rs_is_non_null_atom?ls:rs, exp_atom(sql->sa, atom_general(sql->sa, t, NULL, 
0)), cmp_equal);
set_has_no_nil(e);
set_semantics(e);
-   sql_rel* r = 
rel_select_push_compare_exp_down(sql, rel, e, e->l, e->r, NULL, f | sql_or);
-
-   return rel_or(sql, rel_dup(rel), l, r, NULL, 
NULL, NULL);
+
+   r = rel_select_push_compare_exp_down(sql, r, e, 
e->l, e->r, NULL, f | sql_or);
+
+   return rel_or(sql, rel, l, r, NULL, NULL, NULL);
}
}
 
diff --git a/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test 
b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('a');
+
+query T
+SELECT t0.c0 FROM t0
+
+a
+
+query T
+SELECT (1 AND ('' IS DISTINCT FROM t0.c0)) FROM t0
+
+True
+
+query T
+SELECT t0.c0 FROM t0 WHERE (1 AND ('' IS DISTINCT FROM t0.c0))
+
+a
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
@@ -61,4 +61,5 @@ 7513-uri-authority-parse-issue
 7514-wrong-window-function
 7524-right-outer-join
 7528-jarowinkler-null
+7534-is-distinct-from
 7535-create-view-groupby-func
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with aug2024

2024-06-11 Thread Niels Nes via checkin-list
Changeset: 24f8685ce20c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/24f8685ce20c
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

merged with aug2024


diffs (71 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
@@ -2842,8 +2842,10 @@ rel_logical_exp(sql_query *query, sql_re
assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || 
quantifier == 3 || quantifier == 4);
 
if (quantifier >= 3) {
-   if (quantifier == 4)
+   if (quantifier == 4) {
is_distinct_from = true;
+   compare_op = "<>";
+   }
quantifier = 0;
is_semantics = 1;
}
@@ -2859,6 +2861,7 @@ rel_logical_exp(sql_query *query, sql_re
bool rs_is_non_null_atom = exp_is_atom(rs) && 
exp_is_not_null(rs);
 
if (ls_is_non_null_atom || rs_is_non_null_atom) {
+   sql_rel *r = rel_dup(rel);
sql_rel* l = rel_compare(query, rel, sc, lo, 
ro, compare_op, f | sql_or, ek, quantifier, 0);
sql_subtype *t;
if (!(t = 
exp_subtype(rs_is_non_null_atom?ls:rs)))
@@ -2866,9 +2869,10 @@ rel_logical_exp(sql_query *query, sql_re
sql_exp* e = exp_compare(sql->sa, 
rs_is_non_null_atom?ls:rs, exp_atom(sql->sa, atom_general(sql->sa, t, NULL, 
0)), cmp_equal);
set_has_no_nil(e);
set_semantics(e);
-   sql_rel* r = 
rel_select_push_compare_exp_down(sql, rel, e, e->l, e->r, NULL, f | sql_or);
-
-   return rel_or(sql, rel_dup(rel), l, r, NULL, 
NULL, NULL);
+
+   r = rel_select_push_compare_exp_down(sql, r, e, 
e->l, e->r, NULL, f | sql_or);
+
+   return rel_or(sql, rel, l, r, NULL, NULL, NULL);
}
}
 
diff --git a/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test 
b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('a');
+
+query T
+SELECT t0.c0 FROM t0
+
+a
+
+query T
+SELECT (1 AND ('' IS DISTINCT FROM t0.c0)) FROM t0
+
+True
+
+query T
+SELECT t0.c0 FROM t0 WHERE (1 AND ('' IS DISTINCT FROM t0.c0))
+
+a
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
@@ -61,4 +61,5 @@ 7513-uri-authority-parse-issue
 7514-wrong-window-function
 7524-right-outer-join
 7528-jarowinkler-null
+7534-is-distinct-from
 7535-create-view-groupby-func
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org