Changeset: e5dbd9f1709a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e5dbd9f1709a
Modified Files:
sql/backends/monet5/vaults/parquet/parquet.c
sql/server/rel_optimize_proj.c
sql/test/BugTracker-2026/Tests/8019-rel_bin-exp_bin-assert-failure.test
sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:
issues # 8018, 8019 and 8020 where already fixed by earlier changes
diffs (150 lines):
diff --git a/sql/backends/monet5/vaults/parquet/parquet.c
b/sql/backends/monet5/vaults/parquet/parquet.c
--- a/sql/backends/monet5/vaults/parquet/parquet.c
+++ b/sql/backends/monet5/vaults/parquet/parquet.c
@@ -244,6 +244,8 @@ pqc_find_subtype(mvc *sql, const pqc_sch
return tpe;
break;
case inttype:
+ if (!pse->isSigned)
+ printf("handle unsigned (by 2x width)\n");
if (pse->precision == 8 && sql_find_subtype(tpe,
"tinyint", pse->precision, 0))
return tpe;
if (pse->precision == 16 && sql_find_subtype(tpe,
"smallint", pse->precision, 0))
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
@@ -591,6 +591,11 @@ rel_push_project_up_(visitor *v, sql_rel
return rel;
if (e->alias.label && exps_bind_nid(r_exps,
e->alias.label))
return rel;
+ /* handle old style duplicates needed for
remote plans */
+ if ((e->l && exps_bind_column2(r_exps, e->l,
e->r, NULL) != NULL) ||
+ (exps_bind_column(r_exps, e->r, NULL, NULL,
1) != NULL && (!e->l || !e->r))) {
+ return rel;
+ }
}
/* conflict with new left expressions */
for(n = r_exps->h; n; n = n->next) {
@@ -602,6 +607,11 @@ rel_push_project_up_(visitor *v, sql_rel
return rel;
if (e->alias.label && exps_bind_nid(l_exps,
e->alias.label))
return rel;
+ /* handle old style duplicates needed for
remote plans */
+ if ((e->l && exps_bind_column2(l_exps, e->l,
e->r, NULL) != NULL) ||
+ (exps_bind_column(l_exps, e->r, NULL, NULL,
1) != NULL && (!e->l || !e->r))) {
+ return rel;
+ }
}
}
diff --git
a/sql/test/BugTracker-2026/Tests/8019-rel_bin-exp_bin-assert-failure.test
b/sql/test/BugTracker-2026/Tests/8019-rel_bin-exp_bin-assert-failure.test
--- a/sql/test/BugTracker-2026/Tests/8019-rel_bin-exp_bin-assert-failure.test
+++ b/sql/test/BugTracker-2026/Tests/8019-rel_bin-exp_bin-assert-failure.test
@@ -4,8 +4,8 @@ CREATE TABLE t8019 (
v INT
)
-statement ok rowcount 1
-INSERT INTO t8019 VALUES (1, 5)
+statement ok rowcount 3
+INSERT INTO t8019 VALUES (1, 5), (2, 7), (3, 9)
query II nosort
SELECT k, SUM(DISTINCT v)
@@ -14,13 +14,14 @@ GROUP BY k
----
1
5
+2
+7
+3
+9
--- next query logs server msgs:
--- exp_bin: CRITICAL: Could not find %2.%2
--- exp_bin: ERROR: Query: 'select input.k, sum(distinct input.v)
--- and triggers assert failure: sql/backends/monet5/rel_bin.c:1914: exp_bin:
Assertion `s' failed.
--- An identity derived table must not remove the grouped result.
-query II nosort
+-- grouping through an identity derived table used to drop every result
+-- row (or crash with an exp_bin assert). The grouped result must survive.
+query II rowsort
SELECT input.k, SUM(DISTINCT input.v)
FROM (
SELECT k, v
@@ -30,8 +31,47 @@ GROUP BY input.k
----
1
5
+2
+7
+3
+9
--- next statement triggers assert failure: sql/backends/monet5/rel_bin.c:1914:
exp_bin: Assertion `s' failed.
+-- same query shaped as a CTE
+query II rowsort
+WITH input AS (SELECT k, v FROM t8019)
+SELECT input.k, SUM(DISTINCT input.v) AS s
+FROM input
+GROUP BY input.k
+----
+1
+5
+2
+7
+3
+9
+
+-- same query shaped as a view
+statement ok
+CREATE VIEW v8019 AS
+SELECT k, v
+FROM t8019
+
+query II rowsort
+SELECT k, SUM(DISTINCT v)
+FROM v8019
+GROUP BY k
+----
+1
+5
+2
+7
+3
+9
+
+statement ok
+DROP VIEW IF EXISTS v8019
+
+-- the CREATE TABLE AS form must keep every group too
statement ok
CREATE TABLE t8019_ctas AS
SELECT input.k, SUM(DISTINCT input.v) AS s
@@ -46,6 +86,10 @@ SELECT k, s FROM t8019_ctas
----
1
5
+2
+7
+3
+9
statement ok
DROP TABLE IF EXISTS t8019_ctas
diff --git a/sql/test/BugTracker-2026/Tests/All
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -198,9 +198,9 @@ KNOWNFAIL?8010-first_value-last_value-pa
8014-rel_bin-exp_bin-assert-failure
KNOWNFAIL?8015-join-subquery-NULL-bug
KNOWNFAIL?8017-create-where-exists-select-acos-bug
-KNOWNFAIL?8018-rel2bin_select-assert-failure
-KNOWNFAIL?8019-rel_bin-exp_bin-assert-failure
-KNOWNFAIL?8020-correlated-subquery-bug
+8018-rel2bin_select-assert-failure
+8019-rel_bin-exp_bin-assert-failure
+8020-correlated-subquery-bug
8024-MALoptimizer-bug
8025-having-count-bug
8026-having-expression-bug
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]