Changeset: 9bd1a7a08203 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9bd1a7a08203 Modified Files: MonetDB.spec clients/Tests/exports.stable.out Branch: default Log Message:
Merge with Jan2022 branch. diffs (truncated from 760 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -616,7 +616,11 @@ This package contains files needed to de %files SQL-server5-devel %defattr(-,root,root) +%{_includedir}/monetdb/exception_buffer.h +%{_includedir}/monetdb/opt_backend.h +%{_includedir}/monetdb/rel_*.h %{_includedir}/monetdb/sql*.h +%{_includedir}/monetdb/store_*.h %package embedded Summary: MonetDB as an embedded library diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -179,7 +179,7 @@ def main(): print(r' <Directory Id="include" Name="include">') print(r' <Directory Id="monetdb" Name="monetdb">') id = comp(extend, id, 16, - sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal') or x.startswith('sql')) and x.endswith('.h'), os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] + + sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal') or x.startswith('sql') or x.startswith('rel') or x.startswith('store') or x.startswith('exception') or x.startswith('opt_backend')) and x.endswith('.h'), os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] + [r'include\monetdb\copybinary.h', r'include\monetdb\mapi.h', r'include\monetdb\matomic.h', 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 @@ -1433,6 +1433,27 @@ const char *wlrRef; Workingset workingset[THREADS]; const char *zero_or_oneRef; +# monetdbe +char *monetdbe_append(monetdbe_database dbhdl, const char *schema, const char *table, monetdbe_column **input, size_t column_count); +char *monetdbe_bind(monetdbe_statement *stmt, void *data, size_t parameter_nr); +char *monetdbe_cleanup_result(monetdbe_database dbhdl, monetdbe_result *result); +char *monetdbe_cleanup_statement(monetdbe_database dbhdl, monetdbe_statement *stmt); +int monetdbe_close(monetdbe_database db); +char *monetdbe_dump_database(monetdbe_database dbhdl, const char *backupfile); +char *monetdbe_dump_table(monetdbe_database dbhdl, const char *schema_name, const char *table_name, const char *backupfile); +char *monetdbe_error(monetdbe_database db); +char *monetdbe_execute(monetdbe_statement *stmt, monetdbe_result **result, monetdbe_cnt *affected_rows); +char *monetdbe_get_autocommit(monetdbe_database dbhdl, int *result); +char *monetdbe_get_columns(monetdbe_database dbhdl, const char *schema_name, const char *table_name, size_t *column_count, monetdbe_column **columns); +int monetdbe_in_transaction(monetdbe_database dbhdl); +const void *monetdbe_null(monetdbe_database dbhdl, monetdbe_types t); +int monetdbe_open(monetdbe_database *db, char *url, monetdbe_options *opts); +char *monetdbe_prepare(monetdbe_database dbhdl, char *query, monetdbe_statement **stmt, monetdbe_result **result); +char *monetdbe_query(monetdbe_database dbhdl, char *query, monetdbe_result **result, monetdbe_cnt *affected_rows); +char *monetdbe_result_fetch(monetdbe_result *mres, monetdbe_column **res, size_t column_index); +char *monetdbe_set_autocommit(monetdbe_database dbhdl, int value); +const char *monetdbe_version(void); + # stream stream *block_stream(stream *s); stream *block_stream2(stream *s, size_t bufsiz, compression_method comp); diff --git a/debian/monetdb5-sql-dev.install b/debian/monetdb5-sql-dev.install --- a/debian/monetdb5-sql-dev.install +++ b/debian/monetdb5-sql-dev.install @@ -1,1 +1,5 @@ +debian/tmp/usr/include/monetdb/exception_buffer.h usr/include/monetdb +debian/tmp/usr/include/monetdb/opt_backend.h usr/include/monetdb +debian/tmp/usr/include/monetdb/rel_*.h usr/include/monetdb debian/tmp/usr/include/monetdb/sql*.h usr/include/monetdb +debian/tmp/usr/include/monetdb/store_*.h usr/include/monetdb diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022 --- a/gdk/ChangeLog.Jan2022 +++ b/gdk/ChangeLog.Jan2022 @@ -1,6 +1,18 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Mon Jan 3 2022 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com> +- Implement string imprints (strimps for short) a pre-filter structure + for strings in order to accelerate LIKE queries. If a strimp exists + for a specific string column the strings are pre-filtered, rejecting + strings that cannot possibly match, before the more expensive and + accurate matching algorithms run. Strimps are created automatically + or using 'sys.strimp_create' with arguments the names of the schema, + table and column. Automatic strimp creation is controlled by two + user settable gdk options: 'gdk_use_strimps' (default value "no") and + 'gdk_strimps_threshold' (default value 1.000.000). See the manual for + more details. + * Wed Aug 11 2021 Sjoerd Mullender <sjo...@acm.org> - Many (most) low level functions that could take a long time (such as BATjoin) can now be aborted with a timeout. When the function takes too diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c --- a/monetdb5/modules/mal/pcre.c +++ b/monetdb5/modules/mal/pcre.c @@ -1870,7 +1870,8 @@ PCRElikeselect(bat *ret, const bat *bid, str msg = MAL_SUCCEED; char *ppat = NULL; bool use_re = false, use_strcmp = false, empty = false; - bool use_strimps = !GDKgetenv_istext("gdk_use_strimps", "no"), with_strimps = false; + bool use_strimps = GDKgetenv_isyes("gdk_use_strimps"), with_strimps = false; + BUN strimp_creation_threshold = GDKgetenv_int("gdk_strimps_threshold", 1000000); if ((b = BATdescriptor(*bid)) == NULL) { msg = createException(MAL, "algebra.likeselect", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); @@ -1893,7 +1894,7 @@ PCRElikeselect(bat *ret, const bat *bid, * A better solution is to run the PCRElikeselect as a LIKE query with * strimps and return the complement of the result. */ - if (!empty && use_strimps && BATcount(b) >= STRIMP_CREATION_THRESHOLD && !*anti) { + if (!empty && use_strimps && BATcount(b) >= strimp_creation_threshold && !*anti) { BAT *tmp_s = NULL; if (STRMPcreate(b, NULL) == GDK_SUCCEED && (tmp_s = STRMPfilter(b, s, *pat))) { if (s) diff --git a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 @@ -5200,6 +5200,7 @@ drop view sys.dump_create_roles; drop view sys.describe_functions; drop view sys.describe_partition_tables; drop view sys.describe_privileges; +drop view sys.fully_qualified_functions; drop view sys.describe_comments; drop view sys.describe_tables; drop view sys.describe_sequences; @@ -5280,6 +5281,28 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; +CREATE VIEW sys.fully_qualified_functions AS + WITH fqn(id, tpe, sig, num) AS + ( + SELECT + f.id, + ft.function_type_keyword, + CASE WHEN a.type IS NULL THEN + sys.fqn(s.name, f.name) || '()' + ELSE + sys.fqn(s.name, f.name) || '(' || group_concat(sys.describe_type(a.type, a.type_digits, a.type_scale), ',') OVER (PARTITION BY f.id ORDER BY a.number) || ')' + END, + a.number + FROM sys.schemas s, sys.function_types ft, sys.functions f LEFT JOIN sys.args a ON f.id = a.func_id + WHERE s.id= f.schema_id AND f.type = ft.function_type_id + ) + SELECT + fqn1.id id, + fqn1.tpe tpe, + fqn1.sig nme + FROM + fqn fqn1 JOIN (SELECT id, max(num) FROM fqn GROUP BY id) fqn2(id, num) + ON fqn1.id = fqn2.id AND (fqn1.num = fqn2.num OR fqn1.num IS NULL AND fqn2.num is NULL); CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -5299,7 +5322,7 @@ CREATE VIEW sys.describe_comments AS UNION ALL SELECT seq.id, 'SEQUENCE', sys.FQN(s.name, seq.name) FROM sys.sequences seq, sys.schemas s WHERE seq.schema_id = s.id UNION ALL - SELECT f.id, ft.function_type_keyword, sys.FQN(s.name, f.name) FROM sys.functions f, sys.function_types ft, sys.schemas s WHERE f.type = ft.function_type_id AND f.schema_id = s.id + SELECT f.id, ft.function_type_keyword, qf.nme FROM sys.functions f, sys.function_types ft, sys.schemas s, sys.fully_qualified_functions qf WHERE f.type = ft.function_type_id AND f.schema_id = s.id AND qf.id = f.id ) AS o(id, tpe, nme) JOIN sys.comments c ON c.id = o.id; CREATE VIEW sys.describe_privileges AS @@ -5488,7 +5511,7 @@ GRANT SELECT ON sys.describe_partition_t GRANT SELECT ON sys.describe_sequences TO PUBLIC; GRANT SELECT ON sys.describe_functions TO PUBLIC; update sys.functions set system = true where system <> true and name in ('sq', 'fqn', 'get_merge_table_partition_expressions', 'get_remote_table_expressions', 'schema_guard') and schema_id = 2000 and type = 1; -update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; +update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'fully_qualified_functions', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; CREATE VIEW sys.dump_create_roles AS SELECT 'CREATE ROLE ' || sys.dq(name) || ';' stmt, diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out --- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out +++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out @@ -4605,6 +4605,7 @@ drop view sys.dump_create_roles; drop view sys.describe_functions; drop view sys.describe_partition_tables; drop view sys.describe_privileges; +drop view sys.fully_qualified_functions; drop view sys.describe_comments; drop view sys.describe_tables; drop view sys.describe_sequences; @@ -4685,6 +4686,28 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; +CREATE VIEW sys.fully_qualified_functions AS + WITH fqn(id, tpe, sig, num) AS + ( + SELECT + f.id, + ft.function_type_keyword, + CASE WHEN a.type IS NULL THEN + sys.fqn(s.name, f.name) || '()' + ELSE + sys.fqn(s.name, f.name) || '(' || group_concat(sys.describe_type(a.type, a.type_digits, a.type_scale), ',') OVER (PARTITION BY f.id ORDER BY a.number) || ')' + END, + a.number + FROM sys.schemas s, sys.function_types ft, sys.functions f LEFT JOIN sys.args a ON f.id = a.func_id + WHERE s.id= f.schema_id AND f.type = ft.function_type_id + ) + SELECT + fqn1.id id, + fqn1.tpe tpe, + fqn1.sig nme + FROM + fqn fqn1 JOIN (SELECT id, max(num) FROM fqn GROUP BY id) fqn2(id, num) + ON fqn1.id = fqn2.id AND (fqn1.num = fqn2.num OR fqn1.num IS NULL AND fqn2.num is NULL); CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -4704,7 +4727,7 @@ CREATE VIEW sys.describe_comments AS UNION ALL SELECT seq.id, 'SEQUENCE', sys.FQN(s.name, seq.name) FROM sys.sequences seq, sys.schemas s WHERE seq.schema_id = s.id UNION ALL - SELECT f.id, ft.function_type_keyword, sys.FQN(s.name, f.name) FROM sys.functions f, sys.function_types ft, sys.schemas s WHERE f.type = ft.function_type_id AND f.schema_id = s.id + SELECT f.id, ft.function_type_keyword, qf.nme FROM sys.functions f, sys.function_types ft, sys.schemas s, sys.fully_qualified_functions qf WHERE f.type = ft.function_type_id AND f.schema_id = s.id AND qf.id = f.id ) AS o(id, tpe, nme) JOIN sys.comments c ON c.id = o.id; CREATE VIEW sys.describe_privileges AS @@ -4893,7 +4916,7 @@ GRANT SELECT ON sys.describe_partition_t GRANT SELECT ON sys.describe_sequences TO PUBLIC; GRANT SELECT ON sys.describe_functions TO PUBLIC; update sys.functions set system = true where system <> true and name in ('sq', 'fqn', 'get_merge_table_partition_expressions', 'get_remote_table_expressions', 'schema_guard') and schema_id = 2000 and type = 1; -update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; +update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'fully_qualified_functions', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; CREATE VIEW sys.dump_create_roles AS SELECT 'CREATE ROLE ' || sys.dq(name) || ';' stmt, diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit @@ -4605,6 +4605,7 @@ drop view sys.dump_create_roles; drop view sys.describe_functions; drop view sys.describe_partition_tables; drop view sys.describe_privileges; +drop view sys.fully_qualified_functions; drop view sys.describe_comments; drop view sys.describe_tables; drop view sys.describe_sequences; @@ -4685,6 +4686,28 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; +CREATE VIEW sys.fully_qualified_functions AS + WITH fqn(id, tpe, sig, num) AS + ( + SELECT + f.id, + ft.function_type_keyword, + CASE WHEN a.type IS NULL THEN + sys.fqn(s.name, f.name) || '()' + ELSE + sys.fqn(s.name, f.name) || '(' || group_concat(sys.describe_type(a.type, a.type_digits, a.type_scale), ',') OVER (PARTITION BY f.id ORDER BY a.number) || ')' + END, + a.number + FROM sys.schemas s, sys.function_types ft, sys.functions f LEFT JOIN sys.args a ON f.id = a.func_id + WHERE s.id= f.schema_id AND f.type = ft.function_type_id + ) + SELECT + fqn1.id id, + fqn1.tpe tpe, + fqn1.sig nme + FROM + fqn fqn1 JOIN (SELECT id, max(num) FROM fqn GROUP BY id) fqn2(id, num) + ON fqn1.id = fqn2.id AND (fqn1.num = fqn2.num OR fqn1.num IS NULL AND fqn2.num is NULL); CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -4704,7 +4727,7 @@ CREATE VIEW sys.describe_comments AS UNION ALL SELECT seq.id, 'SEQUENCE', sys.FQN(s.name, seq.name) FROM sys.sequences seq, sys.schemas s WHERE seq.schema_id = s.id UNION ALL - SELECT f.id, ft.function_type_keyword, sys.FQN(s.name, f.name) FROM sys.functions f, sys.function_types ft, sys.schemas s WHERE f.type = ft.function_type_id AND f.schema_id = s.id + SELECT f.id, ft.function_type_keyword, qf.nme FROM sys.functions f, sys.function_types ft, sys.schemas s, sys.fully_qualified_functions qf WHERE f.type = ft.function_type_id AND f.schema_id = s.id AND qf.id = f.id ) AS o(id, tpe, nme) JOIN sys.comments c ON c.id = o.id; CREATE VIEW sys.describe_privileges AS @@ -4893,7 +4916,7 @@ GRANT SELECT ON sys.describe_partition_t GRANT SELECT ON sys.describe_sequences TO PUBLIC; GRANT SELECT ON sys.describe_functions TO PUBLIC; update sys.functions set system = true where system <> true and name in ('sq', 'fqn', 'get_merge_table_partition_expressions', 'get_remote_table_expressions', 'schema_guard') and schema_id = 2000 and type = 1; -update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; +update sys._tables set system = true where name in ('describe_constraints', 'describe_tables', 'fully_qualified_functions', 'describe_comments', 'describe_privileges', 'describe_partition_tables', 'describe_sequences', 'describe_functions') AND schema_id = 2000; CREATE VIEW sys.dump_create_roles AS SELECT 'CREATE ROLE ' || sys.dq(name) || ';' stmt, diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64 b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64 --- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64 +++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64 @@ -4605,6 +4605,7 @@ drop view sys.dump_create_roles; drop view sys.describe_functions; drop view sys.describe_partition_tables; drop view sys.describe_privileges; +drop view sys.fully_qualified_functions; drop view sys.describe_comments; drop view sys.describe_tables; drop view sys.describe_sequences; @@ -4685,6 +4686,28 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list