Changeset: 8bb215918248 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8bb215918248 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/include/sql_relation.h sql/server/rel_dump.c sql/server/rel_optimize_sel.c sql/server/rel_select.c sql/server/rel_unnest.c sql/server/sql_mvc.h sql/server/sql_parser.y sql/server/sql_scan.c Branch: recursive_cte Log Message:
merged with default diffs (truncated from 9264 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -835,3 +835,4 @@ dce400b68239412b1835fb28bd183bf50f5e8692 dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_release ab5d60be21cd1c65e9de476d71a86c2995f70785 Aug2024_5 ab5d60be21cd1c65e9de476d71a86c2995f70785 Aug2024_SP1_release +30e6380820842b9e0325536eb22d7cb3843ab095 Aug2024_7 diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -95,7 +95,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/Aug2024-SP1/MonetDB-%{version}.tar.bz2 +Source: https://www.monetdb.org/downloads/sources/Aug2024-SP2/MonetDB-%{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 @@ -989,6 +989,26 @@ rm "${RPM_BUILD_ROOT}"%{_unitdir}/monetd %endif %changelog +* Mon Dec 16 2024 Sjoerd Mullender <sjo...@acm.org> - 11.51.7-20241216 +- Rebuilt. +- GH#7112: Need keyboard shortcut to interrupt query execution rather than + session +- GH#7205: Unpredictable performance when performing joins over nested + queries +- GH#7574: Assertion failure at `rel2bin_select` when using `STARTSWITH` +- GH#7588: incorrect output with single row inputs for var_samp(c) over() +- GH#7589: "SELECT * FROM sessions" crashes monetdb/e +- GH#7593: A value is being returned with unnecessary scientific notation +- GH#7595: SQLTestCase leaks pymonetdb connections +- GH#7597: Upgrade + quick restart causes database inconsistency +- GH#7599: str_to_date fails when combined with SQL CASE clause +- GH#7602: COPY INTO from multiple files causes an assertion error. +- GH#7603: COPY INTO from three or more files crashes the server. +- GH#7604: file_loader() causes server crash when csv file contains too + few field separators or contains empty lines +- GH#7607: Adding a column of serial type fails with "Access denied for + <user> to schema 'sys'" + * Thu Oct 24 2024 Sjoerd Mullender <sjo...@acm.org> - 11.51.5-20241024 - Rebuilt. - GH#7281: UDFs defined at compile time in a user schema should not become 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 @@ -1035,6 +1035,7 @@ const char grant_rolesRef[]; const char groupRef[]; const char groupbyRef[]; const char groupdoneRef[]; +const char groupedfirstnRef[]; const char growRef[]; int hasSideEffects(MalBlkPtr mb, InstrPtr p, int strict); const char hgeRef[]; diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake --- a/cmake/monetdb-versions.cmake +++ b/cmake/monetdb-versions.cmake @@ -44,7 +44,7 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M # common/options and common/utils) set(GDK_VERSION_MAJOR "29") set(GDK_VERSION_MINOR "0") -set(GDK_VERSION_PATCH "1") +set(GDK_VERSION_PATCH "2") set(GDK_VERSION "${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}") # version of the MAPI library (subdirectory clients/mapilib) @@ -57,7 +57,7 @@ set(MAPI_VERSION "${MAPI_VERSION_MAJOR}. # extras, and tools/utils/msabaoth.[ch]) set(MONETDB5_VERSION_MAJOR "36") set(MONETDB5_VERSION_MINOR "0") -set(MONETDB5_VERSION_PATCH "2") +set(MONETDB5_VERSION_PATCH "3") set(MONETDB5_VERSION "${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}") # version of the MONETDBE library (subdirectory tools/monetdbe) @@ -75,5 +75,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ # version of the SQL library (subdirectory sql) set(SQL_VERSION_MAJOR "15") set(SQL_VERSION_MINOR "0") -set(SQL_VERSION_PATCH "2") +set(SQL_VERSION_PATCH "3") set(SQL_VERSION "${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}") diff --git a/debian/changelog b/debian/changelog --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,26 @@ +monetdb (11.51.7) unstable; urgency=low + + * Rebuilt. + * GH#7112: Need keyboard shortcut to interrupt query execution rather than + session + * GH#7205: Unpredictable performance when performing joins over nested + queries + * GH#7574: Assertion failure at `rel2bin_select` when using `STARTSWITH` + * GH#7588: incorrect output with single row inputs for var_samp(c) over() + * GH#7589: "SELECT * FROM sessions" crashes monetdb/e + * GH#7593: A value is being returned with unnecessary scientific notation + * GH#7595: SQLTestCase leaks pymonetdb connections + * GH#7597: Upgrade + quick restart causes database inconsistency + * GH#7599: str_to_date fails when combined with SQL CASE clause + * GH#7602: COPY INTO from multiple files causes an assertion error. + * GH#7603: COPY INTO from three or more files crashes the server. + * GH#7604: file_loader() causes server crash when csv file contains too + few field separators or contains empty lines + * GH#7607: Adding a column of serial type fails with "Access denied for + <user> to schema 'sys'" + + -- Sjoerd Mullender <sjo...@acm.org> Mon, 16 Dec 2024 12:45:20 +0100 + monetdb (11.51.5) unstable; urgency=low * Rebuilt. 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 @@ -197,6 +197,7 @@ const char grantRef[] = "grant"; const char grant_rolesRef[] = "grant_roles"; const char groupbyRef[] = "groupby"; const char groupdoneRef[] = "groupdone"; +const char groupedfirstnRef[] = "groupedfirstn"; const char groupRef[] = "group"; const char growRef[] = "grow"; const char hgeRef[] = "hge"; @@ -462,6 +463,7 @@ initNamespace(void) fixName(grant_rolesRef); fixName(groupbyRef); fixName(groupdoneRef); + fixName(groupedfirstnRef); fixName(groupRef); fixName(growRef); fixName(hgeRef); diff --git a/monetdb5/mal/mal_namespace.h b/monetdb5/mal/mal_namespace.h --- a/monetdb5/mal/mal_namespace.h +++ b/monetdb5/mal/mal_namespace.h @@ -123,6 +123,7 @@ mal_export const char grantRef[]; mal_export const char grant_rolesRef[]; mal_export const char groupbyRef[]; mal_export const char groupdoneRef[]; +mal_export const char groupedfirstnRef[]; mal_export const char groupRef[]; mal_export const char growRef[]; mal_export const char hgeRef[]; diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -2317,6 +2317,8 @@ OPTmergetableImplementation(Client cntxt } /* pack if there is a group statement following a groupdone (ie aggr(distinct)) */ + if (getModuleId(p) == algebraRef && getFunctionId(p) == groupedfirstnRef) + groupdone = 1; if (getModuleId(p) == groupRef && p->argc == 5 && (getFunctionId(p) == subgroupRef || getFunctionId(p) == subgroupdoneRef diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c --- a/monetdb5/optimizer/opt_mitosis.c +++ b/monetdb5/optimizer/opt_mitosis.c @@ -67,13 +67,15 @@ OPTmitosisImplementation(Client cntxt, M nr_aggrs += (p->argc > 2 && getModuleId(p) == aggrRef); nr_maps += (isMapOp(p)); - if (p->argc > 2 && getModuleId(p) == aggrRef + if ((getModuleId(p) == algebraRef && + getFunctionId(p) == groupedfirstnRef) || + (p->argc > 2 && getModuleId(p) == aggrRef && getFunctionId(p) != subcountRef && getFunctionId(p) != subminRef && getFunctionId(p) != submaxRef && getFunctionId(p) != subavgRef && getFunctionId(p) != subsumRef && getFunctionId(p) != subprodRef && getFunctionId(p) != countRef && getFunctionId(p) != minRef && getFunctionId(p) != maxRef && getFunctionId(p) != avgRef - && getFunctionId(p) != sumRef && getFunctionId(p) != prodRef) { + && getFunctionId(p) != sumRef && getFunctionId(p) != prodRef)) { pieces = 0; goto bailout; } diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test --- a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test +++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test @@ -86,7 +86,7 @@ DROP LOADER myfunc2 statement ok DROP LOADER myfunc3 -query ITTTIIIIIIII rowsort +query ITTTIIIIIIIII rowsort SELECT * FROM functions WHERE name='myfunc' ---- 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 @@ -1682,10 +1682,17 @@ exp_bin(backend *be, sql_exp *e, stmt *l } break; case e_aggr: { list *attr = e->l; + list *r = e->r; stmt *as = NULL; sql_subfunc *a = e->f; assert(sel == NULL); + /* cases + * 0) count(*) + * 1) general aggregation + * 2) aggregation with required order (quantile etc) + * 3) aggregation with optional order by, group_concat, xml_agg + * */ if (attr && attr->h) { node *en; list *l = sa_list(sql->sa); @@ -1738,6 +1745,37 @@ exp_bin(backend *be, sql_exp *e, stmt *l return NULL; append(l, stmt_project(be, u, a)); } + if (r) { + list *obe = r->h->data; + if (obe && obe->h) { + stmt *orderby = NULL, *orderby_vals, *orderby_ids, *orderby_grp; + /* order by */ + if (grp) { + orderby = stmt_order(be, grp, true, true); + + orderby_vals = stmt_result(be, orderby, 0); + orderby_ids = stmt_result(be, orderby, 1); + orderby_grp = stmt_result(be, orderby, 2); + } + for (node *n = obe->h; n; n = n->next) { + sql_exp *oe = n->data; + stmt *os = exp_bin(be, oe, left, right, NULL, NULL, NULL, sel, depth+1, 0, push); + if (orderby) + orderby = stmt_reorder(be, os, is_ascending(oe), nulls_last(oe), orderby_ids, orderby_grp); + else + orderby = stmt_order(be, os, is_ascending(oe), nulls_last(oe)); + orderby_vals = stmt_result(be, orderby, 0); + orderby_ids = stmt_result(be, orderby, 1); + orderby_grp = stmt_result(be, orderby, 2); + } + /* depending on type of aggr project input or ordered column */ + stmt *h = l->h->data; + l->h->data = h = stmt_project(be, orderby_ids, h); + if (grp) + grp = stmt_project(be, orderby_ids, grp); + (void)orderby_vals; + } + } as = stmt_list(be, l); } else { /* count(*) may need the default group (relation) and @@ -4642,10 +4680,36 @@ rel2bin_project(backend *be, sql_rel *re /* distinct, topn returns at least N (unique groups) */ int distinct = need_distinct(rel); stmt *limit = NULL, *lpiv = NULL, *lgid = NULL; - - for (n=oexps->h; n; n = n->next) { + int nr_obe = list_length(oexps); + + /* check for partition columns */ + stmt *grp = NULL, *ext = NULL, *cnt = NULL; + for (n=oexps->h; n; n = n->next, nr_obe--) { + sql_exp *gbe = n->data; + bool last = (!n->next || !is_partitioning((sql_exp*)n->next->data)); + + if (!topn->grouped || !is_partitioning(gbe)) + break; + /* create group by */ + stmt *gbcol = exp_bin(be, gbe, sub, NULL, NULL, NULL, NULL, NULL, 0, 0, 0); + + if (!gbcol) { + assert(sql->session->status == -10); /* Stack overflow errors shouldn't terminate the server */ + return NULL; + } + if (!gbcol->nrcols) + gbcol = stmt_const(be, bin_find_smallest_column(be, sub), gbcol); + stmt *groupby = stmt_group(be, gbcol, grp, ext, cnt, last); + grp = stmt_result(be, groupby, 0); + ext = stmt_result(be, groupby, 1); + cnt = stmt_result(be, groupby, 2); + gbcol = stmt_alias(be, gbcol, gbe->alias.label, exp_find_rel_name(gbe), exp_name(gbe)); + } + + if (grp) + lgid = grp; + for (; n; n = n->next, nr_obe--) { sql_exp *orderbycole = n->data; - int last = (n->next == NULL); stmt *orderbycolstmt = exp_bin(be, orderbycole, sub, psub, NULL, NULL, NULL, NULL, 0, 0, 0); @@ -4653,18 +4717,18 @@ rel2bin_project(backend *be, sql_rel *re return NULL; /* handle constants */ - if (orderbycolstmt->nrcols == 0 && !last) /* no need to sort on constant */ + if (orderbycolstmt->nrcols == 0 && n->next) /* no need to sort on constant */ continue; orderbycolstmt = column(be, orderbycolstmt); if (!limit) { /* topn based on a single column */ - limit = stmt_limit(be, orderbycolstmt, NULL, NULL, stmt_atom_lng(be, 0), l, distinct, is_ascending(orderbycole), nulls_last(orderbycole), last, 1); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org