Changeset: 2c1cb35a353f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c1cb35a353f Modified Files: sql/server/rel_optimize_sel.c sql/server/rel_unnest.c sql/test/BugTracker-2026/Tests/All Branch: manti-classic Log Message:
merged from default diffs (truncated from 5926 to 300 lines): diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,28 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Wed Nov 18 2026 Martin van Dinther <[email protected]> +- Queries to a proto_loader('odbc:...') function with a limit-clause + will now push the limit value down to the ODBC driver via ODBC call + SQLSetStmtAttr(stmt, SQL_ATTR_MAX_ROWS, limit, 0). This reduces + the amount of rows retrieved from the connected ODBC Data Source. Example: + SELECT * FROM proto_loader('odbc:DRIVER=/usr/lib64/libsqlite3odbc.so; + Database=/home/user1/sqlite_dbs/chinook.db; + QUERY=SELECT * FROM tracks') LIMIT 10; + Note: this limit push down is only possible when there are no other + clauses between the FROM-clause and the LIMIT-OFFSET-clause or + OFFSET-FETCHFIRST-clause. If you need extra clauses specify + them in the QUERY= part of the string literal, example: + SELECT * FROM proto_loader('odbc:DRIVER=/usr/lib64/libsqlite3odbc.so; + Database=/home/user1/sqlite_dbs/chinook.db; + QUERY=SELECT * FROM tracks WHERE Name LIKE ''%Love%'' ORDER BY Name') + LIMIT 10; + +* Wed Nov 18 2026 Ying Zhang <[email protected]> +- Added support for tuple matching at projections, so now one can run + queries like 'SELECT (1, 2) IN (SELECT 1, 2)' and 'SELECT (1, 2) NOT IN + (SELECT 1, 2)' + * Thu Oct 22 2026 Martin van Dinther <[email protected]> - Added support for reading DNA sequence alignment data from *.sam and *.bam files. Usage examples: 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 @@ -712,6 +712,7 @@ algebra likeselect command algebra.likes algebra markjoin command algebra.markjoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng) (X_6:bat[:oid], X_7:bat[:bit]) ALGmark2join Mark join with candidate lists algebra markjoin command algebra.markjoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng) (X_6:bat[:oid], X_7:bat[:oid], X_8:bat[:bit]) ALGmark3join Mark join with candidate lists algebra markselect command algebra.markselect(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit]) ALGmarkselect Group on group-ids, return aggregated anyequal or allnotequal +algebra markselect command algebra.markselect(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:bit]) ALGmarkselect2 Return (gid, mark&&pred). If 'aggr', group on gid, return aggregated (gid, mark&&pred). If 'outer', return a row for each (grouped) gid; otherwise, return only the rows where mark&&pred != FALSE. algebra not_like command algebra.not_like(X_0:str, X_1:str, X_2:str, X_3:bit):bit PCREnotlike (empty) algebra orderidx command algebra.orderidx(X_0:bat[:any_1], X_1:bit):bat[:any_1] OIDXorderidx Create an order index algebra outercrossproduct command algebra.outercrossproduct(X_0:bat[:any_1], X_1:bat[:any_2], X_2:bat[:oid], X_3:bat[:oid], X_4:bit) (X_5:bat[:oid], X_6:bat[:oid]) ALGoutercrossproduct3 Compute the outer cross product of both input bats @@ -729,7 +730,6 @@ algebra select command algebra.select(X_ algebra select command algebra.select(X_0:bat[:any_1], X_1:any_1, X_2:any_1, X_3:bit, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect1nil With unknown set, each nil != nil algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid], X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect2 Select all head values of the first input BAT for which the tail value is in range and for which the head value occurs in the tail of the second input BAT. The first input is a dense-headed BAT, the second input is a dense-headed BAT with sorted tail, output is a dense-headed BAT with in the tail the head value of the input BAT for which the tail value is between the values low and high (inclusive if li respectively hi is set). The output BAT is sorted on the tail value. If low or high is nil, the boundary is not considered (effectively - and + infinity). If anti is set, the result is the complement. Nil values in the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or anti=1. Note that the output is suitable as second input for this functi on. algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid], X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit):bat[:oid] ALGselect2nil With unknown set, each nil != nil -algebra selectNotFalse command algebra.selectNotFalse(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit]) ALGselectNotFalse Return (gid, mark&&pred), if mark&&pred != FALSE. If 'aggr', group on gid, return aggregated (gid, mark&&pred) algebra selectNotNil command algebra.selectNotNil(X_0:bat[:any_1]):bat[:any_1] ALGselectNotNil Select all not-nil values algebra semijoin command algebra.semijoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:bit, X_6:lng) (X_7:bat[:oid], X_8:bat[:oid]) ALGsemijoin Semi join with candidate lists algebra single command algebra.single(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid] ALGsingle Check for single result ids. 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 @@ -599,6 +599,7 @@ algebra likeselect command algebra.likes algebra markjoin command algebra.markjoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng) (X_6:bat[:oid], X_7:bat[:bit]) ALGmark2join Mark join with candidate lists algebra markjoin command algebra.markjoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:lng) (X_6:bat[:oid], X_7:bat[:oid], X_8:bat[:bit]) ALGmark3join Mark join with candidate lists algebra markselect command algebra.markselect(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit]) ALGmarkselect Group on group-ids, return aggregated anyequal or allnotequal +algebra markselect command algebra.markselect(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:bit]) ALGmarkselect2 Return (gid, mark&&pred). If 'aggr', group on gid, return aggregated (gid, mark&&pred). If 'outer', return a row for each (grouped) gid; otherwise, return only the rows where mark&&pred != FALSE. algebra not_like command algebra.not_like(X_0:str, X_1:str, X_2:str, X_3:bit):bit PCREnotlike (empty) algebra orderidx command algebra.orderidx(X_0:bat[:any_1], X_1:bit):bat[:any_1] OIDXorderidx Create an order index algebra outercrossproduct command algebra.outercrossproduct(X_0:bat[:any_1], X_1:bat[:any_2], X_2:bat[:oid], X_3:bat[:oid], X_4:bit) (X_5:bat[:oid], X_6:bat[:oid]) ALGoutercrossproduct3 Compute the outer cross product of both input bats @@ -616,7 +617,6 @@ algebra select command algebra.select(X_ algebra select command algebra.select(X_0:bat[:any_1], X_1:any_1, X_2:any_1, X_3:bit, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect1nil With unknown set, each nil != nil algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid], X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ALGselect2 Select all head values of the first input BAT for which the tail value is in range and for which the head value occurs in the tail of the second input BAT. The first input is a dense-headed BAT, the second input is a dense-headed BAT with sorted tail, output is a dense-headed BAT with in the tail the head value of the input BAT for which the tail value is between the values low and high (inclusive if li respectively hi is set). The output BAT is sorted on the tail value. If low or high is nil, the boundary is not considered (effectively - and + infinity). If anti is set, the result is the complement. Nil values in the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or anti=1. Note that the output is suitable as second input for this functi on. algebra select command algebra.select(X_0:bat[:any_1], X_1:bat[:oid], X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit):bat[:oid] ALGselect2nil With unknown set, each nil != nil -algebra selectNotFalse command algebra.selectNotFalse(X_0:bat[:oid], X_1:bat[:bit], X_2:bat[:bit], X_3:bit) (X_4:bat[:oid], X_5:bat[:bit]) ALGselectNotFalse Return (gid, mark&&pred), if mark&&pred != FALSE. If 'aggr', group on gid, return aggregated (gid, mark&&pred) algebra selectNotNil command algebra.selectNotNil(X_0:bat[:any_1]):bat[:any_1] ALGselectNotNil Select all not-nil values algebra semijoin command algebra.semijoin(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bat[:oid], X_4:bit, X_5:bit, X_6:lng) (X_7:bat[:oid], X_8:bat[:oid]) ALGsemijoin Semi join with candidate lists algebra single command algebra.single(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid] ALGsingle Check for single result ids. 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 @@ -1618,7 +1618,7 @@ int pl_register(const char *name, pl_add void pl_unregister(const char *name); void pp_cleanup(backend *ba, int var); void pqc_close(pqc_file *pq); -pqc_file *pqc_copy(pqc_file *pq); +pqc_file *pqc_copy(pqc_file *pq, int wid); pqc_file *pqc_dup(pqc_file *pq); const char *pqc_get_error(pqc_reader_t *r); int pqc_get_field(char *in, int *fieldid, int *type); diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c --- a/clients/odbc/driver/SQLConnect.c +++ b/clients/odbc/driver/SQLConnect.c @@ -134,7 +134,7 @@ makeNulTerminated(const SQLCHAR **argume *scratch = value; } - return value; + return value != NULL; } char* diff --git a/common/stream/rw.c b/common/stream/rw.c --- a/common/stream/rw.c +++ b/common/stream/rw.c @@ -11,6 +11,7 @@ #include "monetdb_config.h" #include "stream.h" #include "stream_internal.h" +#include "mswap.h" @@ -55,7 +56,7 @@ mnstr_readSht(stream *restrict s, int16_ switch (s->read(s, val, sizeof(*val), 1)) { case 1: if (s->swapbytes) - *val = short_int_SWAP(*val); + *val = (int16_t) swap_int16((uint16_t) *val); return 1; case 0: return 0; @@ -71,7 +72,7 @@ mnstr_writeSht(stream *s, int16_t val) return 0; assert(s->binary); if (s->swapbytes) - val = short_int_SWAP(val); + val = (int16_t) swap_int16((uint16_t) val); return s->write(s, &val, sizeof(val), 1) == 1; } @@ -84,7 +85,7 @@ mnstr_readInt(stream *restrict s, int *r switch (s->read(s, val, sizeof(*val), 1)) { case 1: if (s->swapbytes) - *val = normal_int_SWAP(*val); + *val = (int32_t) swap_int32((uint32_t) *val); return 1; case 0: return 0; @@ -100,7 +101,7 @@ mnstr_writeInt(stream *s, int val) return 0; assert(s->binary); if (s->swapbytes) - val = normal_int_SWAP(val); + val = (int32_t) swap_int32((uint32_t) val); return s->write(s, &val, sizeof(val), 1) == 1; } @@ -136,7 +137,7 @@ mnstr_readLng(stream *restrict s, int64_ switch (s->read(s, val, sizeof(*val), 1)) { case 1: if (s->swapbytes) - *val = long_int_SWAP(*val); + *val = (int64_t) swap_int64((uint64_t) *val); return 1; case 0: return 0; @@ -152,7 +153,7 @@ mnstr_writeLng(stream *s, int64_t val) return 0; assert(s->binary); if (s->swapbytes) - val = long_int_SWAP(val); + val = (int64_t) swap_int64((uint64_t) val); return s->write(s, &val, sizeof(val), 1) == 1; } @@ -185,7 +186,7 @@ mnstr_readHge(stream *restrict s, int128 switch (s->read(s, val, sizeof(*val), 1)) { case 1: if (s->swapbytes) - *val = huge_int_SWAP(*val); + *val = (int128_t) swap_int128((uint128_t) *val); return 1; case 0: return 0; @@ -201,7 +202,7 @@ mnstr_writeHge(stream *s, int128_t val) return 0; assert(s->binary); if (s->swapbytes) - val = huge_int_SWAP(val); + val = (int128_t) swap_int128((uint128_t) val); return s->write(s, &val, sizeof(val), 1) == 1; } #endif @@ -242,7 +243,7 @@ mnstr_readShtArray(stream *restrict s, i } if (s->swapbytes) { for (size_t i = 0; i < cnt; i++, val++) - *val = short_int_SWAP(*val); + *val = (int16_t) swap_int16((uint16_t) *val); } return 1; } @@ -275,7 +276,7 @@ mnstr_readIntArray(stream *restrict s, i } if (s->swapbytes) { for (size_t i = 0; i < cnt; i++, val++) - *val = normal_int_SWAP(*val); + *val = (int32_t) swap_int32((uint32_t) *val); } return 1; } @@ -308,7 +309,7 @@ mnstr_readLngArray(stream *restrict s, i } if (s->swapbytes) { for (size_t i = 0; i < cnt; i++, val++) - *val = long_int_SWAP(*val); + *val = (int64_t) swap_int64((uint64_t) *val); } return 1; } @@ -342,7 +343,7 @@ mnstr_readHgeArray(stream *restrict s, i } if (s->swapbytes) { for (size_t i = 0; i < cnt; i++, val++) - *val = huge_int_SWAP(*val); + *val = (int128_t) swap_int128((uint128_t) *val); } return 1; } diff --git a/common/stream/stream_internal.h b/common/stream/stream_internal.h --- a/common/stream/stream_internal.h +++ b/common/stream/stream_internal.h @@ -90,55 +90,6 @@ #define UTF8BOM "\xEF\xBB\xBF" /* UTF-8 encoding of Unicode BOM */ #define UTF8BOMLENGTH 3 /* length of above */ -#ifdef _MSC_VER -/* use intrinsic functions on Windows */ -#define short_int_SWAP(s) ((int16_t) _byteswap_ushort((uint16_t) (s))) -/* on Windows, long is the same size as int */ -#define normal_int_SWAP(i) ((int) _byteswap_ulong((unsigned long) (i))) -#define long_int_SWAP(l) ((int64_t) _byteswap_uint64((unsigned __int64) (l))) -#else -#define short_int_SWAP(s) \ - ((int16_t) (((0x00ff & (uint16_t) (s)) << 8) | \ - ((0xff00 & (uint16_t) (s)) >> 8))) - -#define normal_int_SWAP(i) \ - ((int) (((((unsigned) 0xff << 0) & (unsigned) (i)) << 24) | \ - ((((unsigned) 0xff << 8) & (unsigned) (i)) << 8) | \ - ((((unsigned) 0xff << 16) & (unsigned) (i)) >> 8) | \ - ((((unsigned) 0xff << 24) & (unsigned) (i)) >> 24))) - -#define long_int_SWAP(l) \ - ((int64_t) (((((uint64_t) 0xff << 0) & (uint64_t) (l)) << 56) | \ - ((((uint64_t) 0xff << 8) & (uint64_t) (l)) << 40) | \ - ((((uint64_t) 0xff << 16) & (uint64_t) (l)) << 24) | \ - ((((uint64_t) 0xff << 24) & (uint64_t) (l)) << 8) | \ - ((((uint64_t) 0xff << 32) & (uint64_t) (l)) >> 8) | \ - ((((uint64_t) 0xff << 40) & (uint64_t) (l)) >> 24) | \ - ((((uint64_t) 0xff << 48) & (uint64_t) (l)) >> 40) | \ - ((((uint64_t) 0xff << 56) & (uint64_t) (l)) >> 56))) -#endif - -#ifdef HAVE_HGE -#define huge_int_SWAP(h) \ - ((int128_t) (((((uint128_t) 0xff << 0) & (uint128_t) (h)) << 120) | \ - ((((uint128_t) 0xff << 8) & (uint128_t) (h)) << 104) | \ - ((((uint128_t) 0xff << 16) & (uint128_t) (h)) << 88) | \ - ((((uint128_t) 0xff << 24) & (uint128_t) (h)) << 72) | \ - ((((uint128_t) 0xff << 32) & (uint128_t) (h)) << 56) | \ - ((((uint128_t) 0xff << 40) & (uint128_t) (h)) << 40) | \ - ((((uint128_t) 0xff << 48) & (uint128_t) (h)) << 24) | \ - ((((uint128_t) 0xff << 56) & (uint128_t) (h)) << 8) | \ - ((((uint128_t) 0xff << 64) & (uint128_t) (h)) >> 8) | \ - ((((uint128_t) 0xff << 72) & (uint128_t) (h)) >> 24) | \ - ((((uint128_t) 0xff << 80) & (uint128_t) (h)) >> 40) | \ - ((((uint128_t) 0xff << 88) & (uint128_t) (h)) >> 56) | \ - ((((uint128_t) 0xff << 96) & (uint128_t) (h)) >> 72) | \ - ((((uint128_t) 0xff << 104) & (uint128_t) (h)) >> 88) | \ - ((((uint128_t) 0xff << 112) & (uint128_t) (h)) >> 104) | \ - ((((uint128_t) 0xff << 120) & (uint128_t) (h)) >> 120))) -#endif - - struct stream { char *name; /* name of the stream */ struct stream *inner; /* if this stream is a wrapper around another one */ diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/common/utils/CMakeLists.txt +++ b/common/utils/CMakeLists.txt @@ -22,6 +22,7 @@ target_sources(mutils mprompt.h msabaoth.c msabaoth.h mstring.c + mswap.h mutf8.c mutf8.h mutils.c mutils.h muuid.c muuid.h diff --git a/common/utils/copybinary_support.h b/common/utils/copybinary_support.h --- a/common/utils/copybinary_support.h +++ b/common/utils/copybinary_support.h @@ -13,6 +13,7 @@ #include <stdint.h> #include "copybinary.h" +#include "mswap.h" // According to Godbolt, these code sequences are recognized by // GCC at least back to 6.2 and Clang at least back to 6.0.0. @@ -25,87 +26,11 @@ // uint16_t swapped = copy_binary_byteswap16(value); -#ifdef _MSC_VER - _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
