MonetDB: Aug2024 - Fix #7595 SQLTestCase
Changeset: 2425186649f0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2425186649f0 Modified Files: sql/test/sysmon/vacuum/Tests/test_vacuum.SQL.py testing/sqltest.py Branch: Aug2024 Log Message: Fix #7595 SQLTestCase diffs (69 lines): diff --git a/sql/test/sysmon/vacuum/Tests/test_vacuum.SQL.py b/sql/test/sysmon/vacuum/Tests/test_vacuum.SQL.py --- a/sql/test/sysmon/vacuum/Tests/test_vacuum.SQL.py +++ b/sql/test/sysmon/vacuum/Tests/test_vacuum.SQL.py @@ -20,8 +20,3 @@ with SQLTestCase() as tc: #print(f'{heap_init}', file=sys.stderr) #print(f'{heap_small} < {heap_large}', file=sys.stderr) assert(heap_small < heap_large) - - - - - diff --git a/testing/sqltest.py b/testing/sqltest.py --- a/testing/sqltest.py +++ b/testing/sqltest.py @@ -586,10 +586,12 @@ class SQLTestCase(): self.err_file = err_file self.test_results = [] self._conn_ctx = None +self._conn_trash = [] self.in_memory = False self.client = 'pymonetdb' def __enter__(self): +self.connect() return self def __exit__(self, exc_type, exc_value, traceback): @@ -599,6 +601,9 @@ class SQLTestCase(): if self._conn_ctx: self._conn_ctx.close() self._conn_ctx = None +for ctx in self._conn_trash: +ctx.close() +self._conn_trash = [] def exit(self): self.close() @@ -617,8 +622,9 @@ class SQLTestCase(): def connect(self, username='monetdb', password='monetdb', port=MAPIPORT, hostname='localhost', database=TSTDB, language='sql'): -if self._conn_ctx: -self.close() +old = self._conn_ctx +if old: +self._conn_trash.append(old) if database == 'in-memory' \ or database == ':memory:': # backward compatibility import monetdbe @@ -634,18 +640,9 @@ class SQLTestCase(): port=port, database=database or 'in-memory', language=language) -return self._conn_ctx - -def default_conn_ctx(self): -if self.in_memory: -return monetdbe.connect('in-memory', autocommit=True) -ctx = PyMonetDBConnectionContext() -return ctx @property def conn_ctx(self): -if self._conn_ctx is None: -self._conn_ctx = self.default_conn_ctx() return self._conn_ctx def execute(self, query:str, *args, client='pymonetdb', stdin=None, result_id=None): ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - put default InstrRecord size on f...
Changeset: 2884c10a99b0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2884c10a99b0 Modified Files: monetdb5/mal/mal_instruction.c Branch: resource_management Log Message: put default InstrRecord size on freelist only diffs (25 lines): diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -479,7 +479,9 @@ freeInstruction(InstrPtr p) { if (p && p->blk && p->blk->ma) { // size_t sz = (p->maxarg - 1)*(sizeof(p->argv[0])) + (sizeof(InstrRecord)); - sa_free(p->blk->ma, p); + // only free default size + if (p->maxarg == 8) + sa_free(p->blk->ma, p); } //GDKfree(p); } @@ -489,7 +491,9 @@ freeInstructionX(InstrPtr p, MalBlkPtr m { if (p && mb && mb->ma) { // size_t sz = (p->maxarg - 1)*(sizeof(p->argv[0])) + (sizeof(InstrRecord)); - sa_free(mb->ma, p); + // only free default size + if (p->maxarg == 8) + sa_free(mb->ma, p); } } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: 8bc02416eb30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8bc02416eb30 Branch: resource_management Log Message: merge with default diffs (296 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -833,3 +833,4 @@ cde7d8f7c99540a8c95856df052a9f123b0c1643 ae474f7fda0a3f2ebefc6c0b2cd969ef0854fad1 Aug2024_1 dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_3 dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_release +ab5d60be21cd1c65e9de476d71a86c2995f70785 Aug2024_5 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/MonetDB-%{version}.tar.bz2 +Source: https://www.monetdb.org/downloads/sources/Aug2024-SP1/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,57 @@ rm "${RPM_BUILD_ROOT}"%{_unitdir}/monetd %endif %changelog +* Thu Oct 24 2024 Sjoerd Mullender - 11.51.5-20241024 +- Rebuilt. +- GH#7281: UDFs defined at compile time in a user schema should not become + system functions +- GH#7563: Unexpected result when using `IS DISTINCT FROM` in `VIEW` +- GH#7567: creating remote table from subquery crashes the server +- GH#7569: Column of temporary table changes when another is updated +- GH#7570: BUG in the "str_to_timestamp" function +- GH#7571: Crash when integer overflow in `ORDER BY` +- GH#7572: column max length is not stored as specified and accepted at + creation time +- GH#7575: Incorrect BAT properties after mmapped BAT "leaks" to disk with + restart. +- GH#7576: unescaping UTF-16 code units goes wrong in json.text +- GH#7577: Crash when using `CHECK` constraint +- GH#7580: statistics optimizer handles date difference incorrectly +- GH#7582: SIGSEGV when creating a SQL function with RETURN CASE WHEN + EXISTS (..) +- GH#7583: Query slowdown after deleting rows from large table +- GH#7584: SO_KEEPALIVE should be configured sensibly +- GH#7585: rel2bin_join: Assertion `sql->session->status == -10' failed. +- GH#7587: Line/row numbers get out of sync with COPY INTO .. BEST EFFORT + +* Mon Oct 21 2024 Lucas Pereira - 11.51.5-20241024 +- sql: Improve casting to generic decimal type by choosing a better fit for + precision and scale instead of defaulting to 18 and 3, respectively. + +* Thu Oct 17 2024 Sjoerd Mullender - 11.51.5-20241024 +- sql: When for whatever reason the upgrade code produces an error, we now + exit the server. Before the server would limp on with what is basically + a broken database. + +* Mon Oct 14 2024 stefanos mavros - 11.51.5-20241024 +- monetdb5: The server prints out an informative message for the case of a graceful + termination. + +* Mon Oct 7 2024 Joeri van Ruth - 11.51.5-20241024 +- merovingian: Tweak socket parameters to simulate network activity on client connections. + This prevents firewalls from killing connections that seem idle but are + actually waiting for a long-running query. Can be controlled with a new + 'keepalive' option to monetdbd. + +* Thu Sep 26 2024 Martin van Dinther - 11.51.5-20241024 +- sql: Improved the violation message of CHECK constraints when violated. It + now includes the schema name of the constraint and the check clause. + +* Fri Aug 23 2024 Joeri van Ruth - 11.51.5-20241024 +- sql: Increase the buffer size used by hot snapshot from 64kiB to 1MiB, + and make it configurable through setting 'hot_snapshot_buffer_size'. + It must be a multiple of 512. + * Mon Aug 19 2024 Sjoerd Mullender - 11.51.3-20240819 - Rebuilt. - GH#7562: Assertion failure when comparing `INTERVAL` value diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake --- a/cmake/monetdb-versions.cmake +++ b/cmake/monetdb-versions.cmake @@ -44,20 +44,20 @@ 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 "0") +set(GDK_VERSION_PATCH "1") set(GDK_VERSION "${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}") # version of the MAPI library (subdirectory clients/mapilib) set(MAPI_VERSION_MAJOR "27") set(MAPI_VERSION_MINOR "0") -set(MAPI_VERSION_PATCH "0") +set(MAPI_VERSION_PATCH "1") set(MAPI_VERSION "${MAPI_VERSION_MAJOR}.${MAPI_VERSION_MINOR}.${MAPI_VERSION_PATCH}") # version of the MONETDB5 library (subdirectory monetdb5, not including # extras, and tools/utils/msabaoth.[ch]) set(MONETDB5_VERSION_MAJOR "36") set(MONETDB5_VERSION_MINOR "0") -set(MONETDB5_VERSION_PATCH "1") +set(MONETDB5_VERSION_PATCH "2") 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_VERSI
MonetDB: resource_management - make clang happy
Changeset: 1b4de4e13cc8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1b4de4e13cc8 Modified Files: sql/server/rel_exp.c sql/server/rel_optimize_proj.c Branch: resource_management Log Message: make clang happy diffs (50 lines): diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -3962,5 +3962,7 @@ free_exp(allocator *sa, sql_exp *e) case e_aggr: case e_convert: case e_psm: + // TODO + ; } } 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 @@ -537,14 +537,15 @@ rel_push_project_up_(visitor *v, sql_rel exps = new_exp_list(v->sql->sa); for (n = l->exps->h; n; n = n->next) { sql_exp *e = n->data; - sql_exp *e_copy = exp_copy(v->sql, e); /* we cannot rewrite projection with atomic values from outer joins */ if (is_column(e->type) && exp_is_atom(e) && !(is_right(rel->op) || is_full(rel->op))) { + sql_exp *e_copy = exp_copy(v->sql, e); list_append(exps, e_copy); } else if (e->type == e_column) { if (has_label(e)) return rel; + sql_exp *e_copy = exp_copy(v->sql, e); list_append(exps, e_copy); } else { return rel; @@ -561,15 +562,16 @@ rel_push_project_up_(visitor *v, sql_rel for (n = r->exps->h; n; n = n->next) { sql_exp *e = n->data; - sql_exp *e_copy = exp_copy(v->sql, e); /* we cannot rewrite projection with atomic values from outer joins */ if (is_column(e->type) && exp_is_atom(e) && !(is_left(rel->op) || is_full(rel->op))) { + sql_exp *e_copy = exp_copy(v->sql, e); list_append(exps, e_copy); } else if (e->type == e_column) { if (has_label(e)) return rel; - list_append(exps, e_copy); + // sql_exp *e_copy = exp_copy(v->sql, e); + list_append(exps, e); } else { return rel; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: c4905d3b2c19 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c4905d3b2c19 Modified Files: monetdb5/mal/mal_parser.c monetdb5/mal/mal_session.c Branch: resource_management Log Message: merge with default diffs (255 lines): diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -48,7 +48,12 @@ jobs: ref: ${{ github.ref }} - name: install pymonetdb cryptography +run: pip3 install --user --upgrade pymonetdb cryptography +if: runner.os != 'macOS' + + - name: install pymonetdb cryptography run: pip3 install --user --break-system-packages --upgrade pymonetdb cryptography +if: runner.os == 'macOS' - name: make MonetDB on linux run: | diff --git a/ChangeLog.Aug2024 b/ChangeLog.Aug2024 --- a/ChangeLog.Aug2024 +++ b/ChangeLog.Aug2024 @@ -1,10 +1,3 @@ # ChangeLog file for devel # This file is updated with Maddlog -* Thu Oct 17 2024 Niels Nes -- Changed generic Decimal handling (ie without digits/scale), old cased - mapped always into dec(18,3) now this is only done in case of create of - a column. In other cases the coercion to the correct decimal type is - based on the input data type. For *api (LANG*PY/C(pp)/R) we no longer - allow generic decimal type in the function definitions. - diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -407,7 +407,7 @@ MALlookahead(Client cntxt, str kw, int l !isdigit((unsigned char) (CURRENT(cntxt)[length]))) { return 1; } - /* check for captialized versions */ + /* check for capitalized versions */ for (i = 0; i < length; i++) if (tolower(CURRENT(cntxt)[i]) != kw[i]) return 0; @@ -901,7 +901,7 @@ typeElm(Client cntxt, int def) * The Parser * The client is responsible to collect the * input for parsing in a single string before calling the parser. - * Once the input is available parsing runs in a critial section for + * Once the input is available parsing runs in a critical section for * a single client thread. * * The parser uses the rigid structure of the language to speedup diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -376,8 +376,6 @@ MSscheduleClient(str command, str peer, mnstr_settimeout(c->fdin->s, 50, is_exiting, NULL); msg = MSserveClient(c); if (msg != MAL_SUCCEED) { - mnstr_printf(fout, "!could not serve client\n"); - exit_streams(fin, fout); freeException(msg); } } diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -862,7 +862,7 @@ SQLinsert_val(READERtask *task, int col, adt = fmt->frstr(fmt, fmt->adt, s); } - lng row = BATcount(fmt->c) + 1; + lng row = task->cnt + idx + 1; if (adt == NULL) { if (task->rowerror) { err = SQLload_error(task, idx, task->as->nr_attrs); diff --git a/sql/test/BugTracker-2024/Tests/7587-rejectmismatch.csv.gz b/sql/test/BugTracker-2024/Tests/7587-rejectmismatch.csv.gz new file mode 100644 index ..ba884da429e0896ea00398b55b869a49390c83c6 GIT binary patch literal 78495 zc%1FseOSx;{|E4MNDY-nW=$cKmW^aNx%oy%cGyG`t)ZK_$(oyRQs{=ZlvW4bj5CKN zts<$+lyfMH9g>N4=j(@BlABQKP^;v3eYVc`x?<;iPn+*`_G%72kg?++OCx`sPS~qk$o@)?3(u zH+6SwX1`Yo-d}p({XjfB;$>?@(W8j&juG#}CvyM_Aji zSK$aw!>&rs81n=JJA6l=vdZ-K<+3<${39uM*A_QSb+&my@$39CW%%~I+_noTm~e4( z&67xadu4G`n@MbqOKmW^Tm5kRO1Hs9^pNmLnNdE(i%ugdigPdz1%m?=o`VHt1H{c) zQBCTFH6tSFS1ZSc`=A2Qp4{BYdg7R@dG|-pFpYSAdGyS>!Oq0G0JJhH1+zsQ)A6kv zw}9>vVVOB^C6Q5RQZe=nCQrRE#Ai^zK~HX17(R2JH&I?_S}`^U^Gy9<+~naAu6v3y zu1_8yzMeI&>QE%TzH)3Q)tT55aIjUFg4rRy{?6Tvdy!t>Npa);Os{B~=uCVbu;guW z3MNQw^Ir9!N2pciyj4WoBKNLK*4+$I;n0fIGnh)BfdNZAx%?bGac0)Mm!6UIiptc7 z)sghyDpMnT1_#{nS1$SktB_ z4)Nsr*9@zuTSYt;vDl3pEDm}74`<@T%DTtu&{G|H_k^wL@MW9nw8ntfg7=+G{ck6r zh(oh$vhfG1hEN*)^V0+Av*%?|jAKTUdj#-}JBUc$|&DTs4Hz=$W5xw_4`$gXTn-lI#sL0@i z$;0}EQ|c!?oA4q-FTy<{GJ?`I;cFYcOwMlk?tXhHrZ#3a=9zkt?veMzE`H8N*xznt z zXXuzaGxO8e5B%xr(K1u_iaGOC*==>U`_9aKYvmTx?pZg)F2~768`Li`U0rmPy6ApY z(K+)~3*FL!ot8Sf_aCp$64WoaK>dQk;7zVAFeyCh{e4)`zb;eX@)704!^$RX)y3enVUaKrWTRk*tro-iO)%$p%F50DDxM$~+ zsZq`jV=7dc`Eylf`bL$-tBcN87fpM3!J(w=VQX|#j@6*U0S8X18c?fV82bEZnd!Hc zb3D}V@sui?Q>n^MtBbBw7tK=_rC-{{O30Yi&buadvGg?hUL9USuExjVt18t(!$#G@ zICWN{Ubs$uH6ry}q^n;q8|j<9i9r8np3V9!$$6wVD~v9x7b?^Xx2hLjP%m7i{uIxs zKgDX*>)lkp-itT4vKNfPJ)*7-30T-tg&jSz^8vr^!juB!Ss_~tUm;~jS+I8@1%t2E zdNiC=M>e$S_pn9fY;{B{EmykA=M}_{X^`+@4+Pi@T({ zIMtF=tH2!9#TBS8?!NlsURA!1I`y(qiG^#IfBmFnRHDZ|eB{$6Fjc zW<}fX7?M0BwQinANn&Q`u;KetDc?FRze}FA|3=%A zcY
MonetDB: resource_management - wip free in sql layer
Changeset: 741e2fcf7992 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/741e2fcf7992 Modified Files: gdk/gdk_utils.c sql/backends/monet5/sql.c sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_statement.c sql/server/rel_basetable.c sql/server/rel_distribute.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_optimize_others.c sql/server/rel_optimize_proj.c sql/server/rel_optimize_sel.c sql/server/rel_optimizer.c sql/server/rel_prop.c sql/server/rel_prop.h sql/server/rel_propagate.c sql/server/rel_rel.c sql/server/rel_rel.h sql/server/rel_rewriter.c sql/server/rel_rewriter.h sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_statistics.c sql/server/rel_unnest.c sql/server/rel_updates.c sql/server/sql_atom.c sql/server/sql_atom.h sql/server/sql_var.c Branch: resource_management Log Message: wip free in sql layer diffs (truncated from 1679 to 300 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2098,7 +2098,6 @@ typedef struct freed_t { static void sa_free_obj(allocator *pa, void *obj, size_t sz) { - assert(sz > 0); size_t i; char *obj_start = (char *) obj; @@ -2169,6 +2168,7 @@ sa_use_freed_obj(allocator *pa, size_t s pa->freelist = curr->n; } pa->freelist_hits += 1; + pa->inuse += 1; return curr; } else { prev = curr; @@ -2240,7 +2240,6 @@ static void * #undef sa_realloc -#undef sa_alloc void * sa_realloc( allocator *sa, void *p, size_t sz, size_t oldsz ) { @@ -2315,6 +2314,7 @@ static void * return r; } +#undef sa_alloc void * sa_alloc( allocator *sa, size_t sz ) { @@ -2380,7 +2380,6 @@ void sa_destroy( allocator *sa ) if (sa->pa) { sa_reset(sa); sa_free_blk(sa->pa, sa->blks[0]); - sa_free_obj(sa->pa, sa, sizeof(allocator)); return; } // root allocator diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -360,7 +360,7 @@ create_table_or_view(mvc *sql, char *sna if (!r || !is_project(r->op) || !r->exps || list_length(r->exps) != 1 || exp_check_type(sql, &c->type, r, r->exps->h->data, type_equal) == NULL) { if (r) - rel_destroy(r); + rel_destroy(sql, r); sa_destroy(nsa); sql->sa = osa; if (strlen(sql->errstr) > 6 && sql->errstr[5] == '!') diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -699,7 +699,7 @@ RAstatement(Client c, MalBlkPtr mb, MalS resetMalBlk(c->curprg->def); SQLremoveQueryFromCache(c); } - rel_destroy(rel); + rel_destroy(m, rel); } return RAcommit_statement(be, msg); } @@ -932,7 +932,7 @@ RAstatement2(Client cntxt, MalBlkPtr mb, } if (!msg && monet5_create_relational_function(m, mod, nme, rel, NULL, ops, 0) < 0) msg = createException(SQL, "RAstatement2", "%s", m->errstr); - rel_destroy(rel); + rel_destroy(m, rel); return RAstatement2_return(be, m, nlevels, gvars, gentries, msg); } diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -4376,7 +4376,7 @@ stmt_func(backend *be, stmt *ops, const goto bailout; if ((p = find_prop(rel->p, PROP_REMOTE))) - rel->p = prop_remove(rel->p, p); + rel->p = prop_remove(be->mvc->sa, rel->p, p); /* sql_processrelation may split projections, so make sure the topmost relation only contains references */ rel = rel_project(be->mvc->sa, rel, rel_projections(be->mvc, rel, NULL, 1, 1)); if (!(rel = sql_processrelation(be->mvc, rel, 0, 0, 1, 1))) diff --git a/sql/server/rel_basetable.c b/sql/server/rel_basetable.c --- a/sql/server/rel_basetable.c +++ b/sql/server/rel_basetable.c @@ -398,7 +398,7 @@ rel_base_add_columns( mvc *sql, sql_rel r->exps = new_exp_list(sql->sa); if(!r->exps) { - rel_destroy(r); + rel_destroy(sql, r); return NULL; } @@ -413,7 +413,7 @@ rel_base_add_columns( mvc *s
MonetDB: resource_management - merge with default
Changeset: 7496a03e60d1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7496a03e60d1 Modified Files: gdk/gdk.h gdk/gdk_batop.c monetdb5/mal/mal_function.c monetdb5/mal/mal_profiler.c monetdb5/modules/mal/mal_mapi.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_statement.c sql/server/rel_optimizer.c sql/server/sql_parser.y sql/storage/store.c Branch: resource_management Log Message: merge with default diffs (truncated from 3864 to 300 lines): diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -48,12 +48,7 @@ jobs: ref: ${{ github.ref }} - name: install pymonetdb cryptography -run: pip3 install --user --upgrade pymonetdb cryptography -if: runner.os != 'macOS' - - - name: install pymonetdb cryptography run: pip3 install --user --break-system-packages --upgrade pymonetdb cryptography -if: runner.os == 'macOS' - name: make MonetDB on linux run: | diff --git a/ChangeLog.Aug2024 b/ChangeLog.Aug2024 --- a/ChangeLog.Aug2024 +++ b/ChangeLog.Aug2024 @@ -1,3 +1,10 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Thu Oct 17 2024 Niels Nes +- Changed generic Decimal handling (ie without digits/scale), old cased + mapped always into dec(18,3) now this is only done in case of create of + a column. In other cases the coercion to the correct decimal type is + based on the input data type. For *api (LANG*PY/C(pp)/R) we no longer + allow generic decimal type in the function definitions. + 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 @@ -49539,6 +49539,11 @@ pattern sql.rank(X_0:any_1, X_1:bit, X_2 SQLrank; return the ranked groups sql +read_dump_rel +pattern sql.read_dump_rel(X_0:str):str +SQLread_dump_rel; +Reads sql_rel string into sql_rel object and then writes it to the return value +sql register unsafe pattern sql.register(X_0:str, X_1:str, X_2:str, X_3:str):int RAstatement2; 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 @@ -37969,6 +37969,11 @@ pattern sql.rank(X_0:any_1, X_1:bit, X_2 SQLrank; return the ranked groups sql +read_dump_rel +pattern sql.read_dump_rel(X_0:str):str +SQLread_dump_rel; +Reads sql_rel string into sql_rel object and then writes it to the return value +sql register unsafe pattern sql.register(X_0:str, X_1:str, X_2:str, X_3:str):int RAstatement2; diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -519,7 +519,7 @@ * zero is returned upon encountering an error or when the database value * is NULL; this can be analyzed in using @code{mapi\_error()}. * - * @item size_t mapi_fetch_fiels_len(MapiHdl hdl, int fnr) + * @item size_t mapi_fetch_field_len(MapiHdl hdl, int fnr) * * Return the length of the C-string representation excluding trailing NULL * byte of the value. Zero is returned upon encountering an error, when the diff --git a/documentation/source/manual_pages/monetdbd.rst.in b/documentation/source/manual_pages/monetdbd.rst.in --- a/documentation/source/manual_pages/monetdbd.rst.in +++ b/documentation/source/manual_pages/monetdbd.rst.in @@ -251,6 +251,17 @@ using the **set** command. The following use redirects instead of proxies. Changing this property takes effect immediately at runtime. +**keepalive** + Specifies the keepalive interval for incoming connections. If this is + set to a positive number, *monetdbd* configures the system to send + automatic periodic keepalive probes on all client connections. This + can help keep firewalls from killing connections that seem idle but + are in fact waiting for a long running query to finish. The default + is 60 seconds. When 127 consecutive probes have failed, the + connection is closed. With the default setting of 60 seconds this + means the connection is closed when the client has been unreachable + for more than two hours. + REMOTE DATABASES diff --git a/documentation/source/manual_pages/mserver5.rst.in b/documentation/source/manual_pages/mserver5.rst.in --- a/documentation/source/manual_pages/mserver5.rst.in +++ b/documentation/source/manual_pages/mserver5.rst.in @@ -167,13 +167,16 @@ MSERVER5 OPTIONS **268435456** (HEAPMASK) trace/debug HEAPextend; used only for development & - debugging **536870912** (FORCEMITOMASK) forcefully activate - mitosis even on small tables, i.e., split small tables in as many - (tiny) pieces as there are cores (threads) available; this allows - us to test mitosis functio
MonetDB: resource_management - use freeInstructionX to fix sqlan...
Changeset: 50a3ab950875 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/50a3ab950875 Modified Files: monetdb5/optimizer/opt_evaluate.c Branch: resource_management Log Message: use freeInstructionX to fix sqlancer19 diffs (30 lines): diff --git a/monetdb5/optimizer/opt_evaluate.c b/monetdb5/optimizer/opt_evaluate.c --- a/monetdb5/optimizer/opt_evaluate.c +++ b/monetdb5/optimizer/opt_evaluate.c @@ -81,7 +81,7 @@ OPTremoveUnusedBlocks(Client cntxt, MalB if (blockExit(p) && block == getArg(p, 0)) { block = -1; skip = 0; - freeInstruction(p); + freeInstructionX(p, mb); mb->stmt[i] = 0; continue; } @@ -99,7 +99,7 @@ OPTremoveUnusedBlocks(Client cntxt, MalB block = getArg(p, 0); skip = 0; action++; - freeInstruction(p); + freeInstructionX(p, mb); mb->stmt[i] = 0; continue; } @@ -108,7 +108,7 @@ OPTremoveUnusedBlocks(Client cntxt, MalB && getArgType(mb, p, 1) == TYPE_bit && multipass == 0) multipass++; if (skip) { - freeInstruction(p); + freeInstructionX(p, mb); mb->stmt[i] = 0; } else mb->stmt[j++] = p; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - fix wrong header arithmetic
Changeset: 076fb8fea0e4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/076fb8fea0e4 Modified Files: gdk/gdk_utils.c Branch: resource_management Log Message: fix wrong header arithmetic diffs (32 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2256,8 +2256,9 @@ sa_realloc( allocator *sa, void *p, size static void * _sa_alloc_internal( allocator *sa, size_t sz ) { + assert(sz > 0); sz = round16(sz); - char *r = sa_use_freed(sa, sz - SA_HEADER_SIZE); + char *r = sa_use_freed(sa, sz); if (r) return r; /* we don't want super large allocs for temp storage */ @@ -2321,7 +2322,7 @@ sa_alloc( allocator *sa, size_t sz ) char* r = (char*) _sa_alloc_internal(sa, nsize); if (r) { // store size in header - *((size_t *) r) = nsize - SA_HEADER_SIZE; + *((size_t *) r) = nsize; return r + SA_HEADER_SIZE; } return NULL; @@ -2460,7 +2461,7 @@ sa_free(allocator *sa, void *obj) char* ptr = (char *) obj - SA_HEADER_SIZE; size_t sz = *((size_t *) ptr); if (sz < SA_BLOCK_SIZE) { - sa_free_obj(sa, obj, sz); + sa_free_obj(sa, ptr, sz); } else { sa_free_blk(sa, ptr); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - store size infront of each slot
Changeset: 614dc6d74aeb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/614dc6d74aeb Modified Files: gdk/gdk.h gdk/gdk_utils.c monetdb5/mal/mal_instruction.c Branch: resource_management Log Message: store size infront of each slot diffs (truncated from 320 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -625,7 +625,7 @@ gdk_export char *sa_strconcat( allocator gdk_export size_t sa_size( allocator *sa ); gdk_export void sa_open( allocator *sa ); /* open new frame of tempory allocations */ gdk_export void sa_close( allocator *sa ); /* close temporary frame, reset to old state */ -gdk_export void sa_free( allocator *sa, void *, size_t sz); +gdk_export void sa_free( allocator *sa, void *); #define ma_create(pa) sa_create(pa) #define ma_destroy(ma) sa_destroy(ma) @@ -633,6 +633,7 @@ gdk_export void sa_free( allocator *sa, #define ma_zalloc(ma, sz) (void*)sa_zalloc(ma, sz) #define ma_open(ma)sa_open(ma) #define ma_close(ma) sa_close(ma) +#define ma_free(ma, obj) sa_free(ma, obj) #define MA_NEW( sa, type ) ((type*)sa_alloc( sa, sizeof(type))) #define MA_ZNEW( sa, type )((type*)sa_zalloc( sa, sizeof(type))) diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2051,6 +2051,7 @@ GDKprintinfo(void) printf("SIGUSR1 info end\n"); } + exception_buffer * eb_init(exception_buffer *eb) { @@ -2077,6 +2078,7 @@ eb_error( exception_buffer *eb, char *ms #define SA_NUM_BLOCKS 64 #define SA_BLOCK_SIZE (64*1024) +#define SA_HEADER_SIZE 2*(sizeof(size_t)) typedef struct freed_t { struct freed_t *n; @@ -2097,7 +2099,6 @@ static void sa_free_obj(allocator *pa, void *obj, size_t sz) { assert(sz > 0); - assert(!pa->pa); // must be root allocator size_t i; char *obj_start = (char *) obj; @@ -2123,6 +2124,9 @@ sa_free_obj(allocator *pa, void *obj, si static void sa_free_blk(allocator *pa, void *blk) { + // free blks are maintained on the root allocator + if (pa->pa) + return sa_free_blk(pa->pa, blk); assert(!pa->pa); // must be root allocator size_t i; @@ -2142,29 +2146,23 @@ sa_free_blk(allocator *pa, void *blk) freed_t *f = blk; f->n = pa->freelist_blks; f->sz = sz; - pa->freelist_blks = f; } } /* - * Returns first that match size + * Return first slot that will fit the size */ static void * sa_use_freed_obj(allocator *pa, size_t sz) { - if (pa->pa) - return sa_use_freed_obj(pa->pa, sz); freed_t *prev = NULL; freed_t *curr = pa->freelist; - // size_t objects = pa->objects; - // size_t inuse = pa->inuse; - // size_t nr_free_objects = objects - inuse; int MAX_ITERATIONS = 100; int cntr = 0; - while(curr && (cntr <= MAX_ITERATIONS)) { - if (sz == curr->sz) { + while(curr && (cntr < MAX_ITERATIONS)) { + if (sz <= curr->sz) { if (prev) { prev->n = curr->n; } else { @@ -2206,41 +2204,6 @@ sa_use_freed(allocator *pa, size_t sz) return NULL; } -allocator * -sa_create(allocator *pa) -{ - allocator *sa = (pa)?(allocator*)sa_alloc(pa, sizeof(allocator)):(allocator*)GDKmalloc(sizeof(allocator)); - if (sa == NULL) - return NULL; - eb_init(&sa->eb); - sa->pa = pa; - sa->size = SA_NUM_BLOCKS; - sa->nr = 1; - sa->blks = pa?(char**)sa_alloc(pa, sizeof(char*) * sa->size):(char**)GDKmalloc(sizeof(char*) * sa->size); - if (sa->blks == NULL) { - if (!pa) - GDKfree(sa); - return NULL; - } - sa->blks[0] = pa?(char*)sa_alloc(pa, SA_BLOCK_SIZE):(char*)GDKmalloc(SA_BLOCK_SIZE); - sa->usedmem = SA_BLOCK_SIZE; - if (sa->blks[0] == NULL) { - if (!pa) - GDKfree(sa->blks); - if (!pa) - GDKfree(sa); - return NULL; - } - sa->freelist = NULL; - sa->freelist_blks = NULL; - sa->used = 0; - sa->objects = 0; - sa->inuse = 0; - sa->freelist_hits = 0; - sa->tmp_active = 0; - sa->tmp_used = 0; - return sa; -} allocator *sa_reset( allocator *sa ) { @@ -2252,8 +2215,8 @@ allocator *sa_reset( allocator *sa ) else sa_free_blk(sa->pa, sa->blks[i]); } - if (!sa->pa) - sa->freelist_blks = NULL; + //if (!sa->pa) + sa->freelist_blks = NULL; sa->nr = 1; sa->used = 0; sa->freelist = NULL; @@ -2263,6 +2226,19 @@ allocator *sa_reset( allocator *sa ) return sa; } +stati
MonetDB: resource_management - merge default
Changeset: 828777a0ed76 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/828777a0ed76 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h sql/backends/monet5/UDF/pyapi3/pyapi3.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/storage/store.c Branch: resource_management Log Message: merge default diffs (truncated from 1831 to 300 lines): 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 @@ -49879,6 +49879,11 @@ unsafe pattern sql.transaction_rollback( SQLtransaction_rollback; A transaction statement (type can be commit,release,rollback or start) sql +unclosed_result_sets +pattern sql.unclosed_result_sets() (X_0:bat[:oid], X_1:bat[:int]) +sql_unclosed_result_sets; +return query_id/res_id of unclosed result sets +sql unionfunc pattern sql.unionfunc(X_0:str, X_1:str, X_2:any...):any... SQLunionfunc; 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 @@ -38274,6 +38274,11 @@ unsafe pattern sql.transaction_rollback( SQLtransaction_rollback; A transaction statement (type can be commit,release,rollback or start) sql +unclosed_result_sets +pattern sql.unclosed_result_sets() (X_0:bat[:oid], X_1:bat[:int]) +sql_unclosed_result_sets; +return query_id/res_id of unclosed result sets +sql unionfunc pattern sql.unionfunc(X_0:str, X_1:str, X_2:any...):any... SQLunionfunc; 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 @@ -351,6 +351,7 @@ void *GDKzalloc(size_t size) __attribute void HASHdestroy(BAT *b); BUN HASHlist(Hash *h, BUN i); BUN HASHprobe(const Hash *h, const void *v); +size_t HASHsize(BAT *b); void HEAP_free(Heap *heap, var_t block); gdk_return HEAP_initialize(Heap *heap, size_t nbytes, size_t nprivate, int alignment); var_t HEAP_malloc(BAT *b, size_t nbytes); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -874,7 +874,6 @@ typedef struct { /* assert that atom width is power of 2, i.e., width == 1twidth < SIZEOF_VAR_T) { - size_t taillen = strlen(path) - 1; - char tailsave = path[taillen]; - path[taillen] = 0; - if (MT_stat(path, &statb) < 0) { - GDKsyserror("cannot stat file %s%c or %s (expected size %zu)\n", - path, tailsave, path, b->theap->free); - GDKfree(path); - return GDK_FAIL; - } - } else -#endif - { - GDKsyserror("cannot stat file %s (expected size %zu)\n", - path, b->theap->free); - GDKfree(path); - return GDK_FAIL; - } + GDKsyserror("cannot stat file %s (expected size %zu)\n", + path, b->theap->free); + GDKfree(path); + return GDK_FAIL; } if ((size_t) statb.st_size < b->theap->free) { GDKerror("file %s too small (expected %zu, actual %zu)\n", path, b->theap->free, (size_t) statb.st_size); @@ -1007,8 +991,7 @@ BBPheader(FILE *fp, int *lineno, bat *bb bbpversion != GDKLIBRARY_STATUS && bbpversion != GDKLIBRARY_JSON && bbpversion != GDKLIBRARY_HSIZE && - bbpversion != GDKLIBRARY_HASHASH && - bbpversion != GDKLIBRARY_TAILN) { + bbpversion != GDKLIBRARY_HASHASH) { TRC_CRITICAL(GDK, "incompatible BBP version: expected 0%o, got 0%o. " "This database was probably created by a %s version of MonetDB.", GDKLIBRARY, bbpversion, @@ -1424,56 +1407,6 @@ fixhashash(bat *hashbats, bat nhashbats) } #endif -#ifdef GDKLIBRARY_TAILN -static gdk_return -movestrbats(void) -{ - for (bat bid = 1, nbat = (bat) ATOMIC_GET(&BBPsize); bid < nbat; bid++) { - BAT *b = BBP_desc(bid); - if (b->batCacheid == 0) { - /* not a valid BAT */ - continue; - } - if (b->ttype != TYPE_str || b->twidth == SIZEOF_VAR_T || b->batCou
MonetDB: resource_management - fix failing ctest
Changeset: 2be7c40f0258 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2be7c40f0258 Modified Files: sql/backends/monet5/sql_scenario.c tools/monetdbe/monetdbe.c Branch: resource_management Log Message: fix failing ctest diffs (33 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1570,7 +1570,6 @@ SQLparser_body(Client c, backend *be) if (be->q) { int res = 0; - be->result_id = be->q->id; if (!err && (res = mvc_export_prepare(be, c->fdout)) < 0) { msg = createException(PARSE, "SQLparser", SQLSTATE(45000) "Export operation failed: %s", mvc_export_error(be, c->fdout, res)); err = 1; @@ -1578,7 +1577,10 @@ SQLparser_body(Client c, backend *be) if (err) { be->q->name = NULL; /* later remove cleanup from mal from qc code */ qc_delete(m->qc, be->q); + be->q = NULL; } + if (be->q) + be->result_id = be->q->id; be->q = NULL; } if (err) diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -1722,6 +1722,7 @@ monetdbe_bind(monetdbe_statement *stmt, return stmt_internal->mdbe->msg; } VALset(&stmt_internal->data[i], tpe, val); + // FIX this leaks no free for val } else { VALset(&stmt_internal->data[i], tpe, data); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - cannot use temp allocator for glo...
Changeset: 0d83403cb429 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0d83403cb429 Modified Files: gdk/gdk_utils.c monetdb5/mal/mal_profiler.c monetdb5/optimizer/opt_emptybind.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_inline.c monetdb5/optimizer/opt_pipes.c Branch: resource_management Log Message: cannot use temp allocator for globals diffs (170 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2217,8 +2217,6 @@ sa_create(allocator *pa) sa->size = SA_NUM_BLOCKS; sa->nr = 1; sa->blks = pa?(char**)sa_alloc(pa, sizeof(char*) * sa->size):(char**)GDKmalloc(sizeof(char*) * sa->size); - sa->freelist = NULL; - sa->freelist_blks = NULL; if (sa->blks == NULL) { if (!pa) GDKfree(sa); @@ -2233,6 +2231,8 @@ sa_create(allocator *pa) GDKfree(sa); return NULL; } + sa->freelist = NULL; + sa->freelist_blks = NULL; sa->used = 0; sa->objects = 0; sa->inuse = 0; @@ -2354,6 +2354,8 @@ void sa_destroy( allocator *sa ) if (sa->pa) { sa_reset(sa); sa_free_blk(sa->pa, sa->blks[0]); + // TODO free sa object from parent + sa_free_obj(sa->pa, sa, sizeof(allocator)); return; } // root allocator diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -266,9 +266,9 @@ format_val2json(const Client c, const Va return buf; ValRecord val; - /* TODO use ta */ - ma_open(c->ta); - if (VALinit(c->ta, &val, TYPE_str, buf) == NULL) { + /* NOTE c->ta maybe active from caller */ + allocator *ta = (c->ta && c->ta->tmp_active) ? c->ta : NULL; + if (VALinit(ta, &val, TYPE_str, buf) == NULL) { GDKfree(buf); return NULL; } @@ -278,7 +278,6 @@ format_val2json(const Client c, const Va char *buf2; buf2 = VALformat(&val); VALclear(&val); - ma_close(c->ta); return buf2; } diff --git a/monetdb5/optimizer/opt_emptybind.c b/monetdb5/optimizer/opt_emptybind.c --- a/monetdb5/optimizer/opt_emptybind.c +++ b/monetdb5/optimizer/opt_emptybind.c @@ -71,8 +71,10 @@ OPTemptybindImplementation(Client cntxt, // empty = (int *) GDKzalloc((mb->vsize + extras) * sizeof(int)); ma_open(cntxt->ta); empty = (int *) ma_zalloc(cntxt->ta, (mb->vsize + extras) * sizeof(int)); - if (empty == NULL) + if (empty == NULL) { + ma_close(cntxt->ta); throw(MAL, "optimizer.emptybind", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } // updated = (InstrPtr *) GDKzalloc(esize * sizeof(InstrPtr)); size_t updated_size = esize * sizeof(InstrPtr); diff --git a/monetdb5/optimizer/opt_generator.c b/monetdb5/optimizer/opt_generator.c --- a/monetdb5/optimizer/opt_generator.c +++ b/monetdb5/optimizer/opt_generator.c @@ -208,12 +208,12 @@ OPTgeneratorImplementation(Client cntxt, } for (; i < limit; i++) pushInstruction(mb, old[i]); - ma_close(cntxt->ta); bailout: for (; i < slimit; i++) { if (old[i]) pushInstruction(mb, old[i]); } + ma_close(cntxt->ta); //GDKfree(old); /* Defense line against incorrect plans */ diff --git a/monetdb5/optimizer/opt_inline.c b/monetdb5/optimizer/opt_inline.c --- a/monetdb5/optimizer/opt_inline.c +++ b/monetdb5/optimizer/opt_inline.c @@ -31,6 +31,7 @@ inlineMALblock(Client cntxt, MalBlkPtr m nv = (int *) ma_alloc(cntxt->ta, mc->vtop * sizeof(int)); if (nv == 0) { //GDKfree(ns); + ma_close(cntxt->ta); return -1; } diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -306,11 +306,10 @@ addPipeDefinition(Client cntxt, const ch SQLSTATE(42000) "No overwrite of built in allowed"); } - ma_open(cntxt->ta); /* save old value */ oldpipe = pipes[i]; pipes[i] = (struct pipeline) { - .name = MA_STRDUP(cntxt->ta, name), + .name = GDKstrdup(name), }; if (pipes[i].name == NULL) goto bailout; @@ -319,7 +318,7 @@ addPipeDefinition(Client cntxt, const ch p++; n++; } - if ((pipes[i].def = ma_alloc(cntxt->ta, n * sizeof(char *))) == NULL) + if ((pipes[i].def = GDKmalloc(n * sizeof(char *))) == NULL) goto bailout; n = 0; while ((p = strchr(pipe, ';')) != NULL) { @@ -334,7 +333,7 @@ addPipeDefinition(Cl
MonetDB: resource_management - merge with default
Changeset: ee4e65a72a95 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ee4e65a72a95 Modified Files: gdk/gdk_batop.c Branch: resource_management Log Message: merge with default diffs (167 lines): diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -2284,16 +2284,11 @@ do_sort(void *restrict h, void *restrict if (nilslast == reverse && (stable || n > 100)) return GDKrsort(h, t, n, hs, ts, reverse, false); break; -#ifdef WORDS_BIGENDIAN - /* only use radix sort for UUID on big-endian architectures since -* the bytes need to be sorted in the opposite order from -* little-endian */ case TYPE_uuid: assert(base == NULL); if (nilslast == reverse && (stable || n > 100)) return GDKrsort(h, t, n, hs, ts, reverse, true); break; -#endif default: break; } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -151,7 +151,7 @@ gdk_return GDKremovedir(int farmid, cons gdk_return GDKsave(int farmid, const char *nme, const char *ext, void *buf, size_t size, storage_t mode, bool dosync) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); -gdk_return GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool nosign) +gdk_return GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool isuuid) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); gdk_return GDKssort_rev(void *restrict h, void *restrict t, const void *restrict base, size_t n, int hs, int ts, int tpe) diff --git a/gdk/gdk_rsort.c b/gdk/gdk_rsort.c --- a/gdk/gdk_rsort.c +++ b/gdk/gdk_rsort.c @@ -18,10 +18,9 @@ #define NBUCKETS (1 << RADIX) gdk_return -GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool nosign) +GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool isuuid) { - const size_t niters = (8 * hs + RADIX - 1) / RADIX; - size_t *counts = GDKmalloc(niters * NBUCKETS * sizeof(size_t)); + size_t *counts = GDKmalloc(hs * NBUCKETS * sizeof(size_t)); size_t pos[NBUCKETS]; uint8_t *h1 = h; uint8_t *h2; @@ -58,25 +57,32 @@ GDKrsort(void *restrict h, void *restric ts = 0; } - memset(counts, 0, niters * NBUCKETS * sizeof(size_t)); - for (size_t i = 0, o = 0; i < n; i++, o += hs) { - for (size_t j = 0; j < niters; j++) { -#ifdef WORDS_BIGENDIAN - uint8_t v = h1[o + hs - j - 1]; -#else - uint8_t v = h1[o + j]; + memset(counts, 0, hs * NBUCKETS * sizeof(size_t)); +#ifndef WORDS_BIGENDIAN + if (isuuid /* UUID, treat like big-endian */) #endif - counts[(j << RADIX) + v]++; + for (size_t i = 0, o = 0; i < n; i++, o += hs) { + for (size_t j = 0, k = hs - 1; j < hs; j++, k--) { + uint8_t v = h1[o + k]; + counts[(j << RADIX) + v]++; + } } - } - +#ifndef WORDS_BIGENDIAN + else + for (size_t i = 0, o = 0; i < n; i++, o += hs) { + for (size_t j = 0; j < hs; j++) { + uint8_t v = h1[o + j]; + counts[(j << RADIX) + v]++; + } + } +#endif /* When sorting in ascending order, the negative numbers occupy * the second half of the buckets in the last iteration; when * sorting in descending order, the negative numbers occupy the * first half. In either case, at the end we need to put the * second half first and the first half after. */ size_t negpos = 0; - for (size_t j = 0, b = 0; j < niters; j++, b += NBUCKETS) { + for (size_t j = 0, b = 0, k = hs - 1; j < hs; j++, b += NBUCKETS, k--) { size_t nb = counts[b] > 0; if (reverse) { pos[NBUCKETS - 1] = 0; @@ -100,16 +106,24 @@ GDKrsort(void *restrict h, void *restric continue; } /* note, this loop changes the pos array */ - for (size_t i = 0, ho = 0, to = 0; i < n; i++, ho += hs, to += ts) { -#ifdef WORDS_BIGENDIAN - uint8_t v = h1[ho + hs - j - 1]; -#else - uint8_t v = h1[ho + j]; +#ifndef WORDS_BIGENDIAN + if (isuuid /* UUID, treat like big-endian */) #endif - if (t) - memcpy(t2 + ts * pos[v], t1 + to, ts); - memcpy(h2 + h
MonetDB: resource_management - clean up
Changeset: 63f8121fed7c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/63f8121fed7c Modified Files: sql/server/rel_basetable.c sql/server/rel_exp.c Branch: resource_management Log Message: clean up diffs (34 lines): diff --git a/sql/server/rel_basetable.c b/sql/server/rel_basetable.c --- a/sql/server/rel_basetable.c +++ b/sql/server/rel_basetable.c @@ -173,19 +173,6 @@ rel_basetable(mvc *sql, sql_table *t, co rel->op = op_basetable; rel->card = CARD_MULTI; rel->nrcols = nrcols; - /* - if (t->pkey) { - prop *p = rel->p = prop_create(sql->sa, PROP_HASHCOL, rel->p); - p->value.pval = t->pkey; - } - */ - for (node *in = ol_first_node(t->idxs); in; in = in->next){ - sql_idx *li = in->data; - if (li->type == join_idx) { - rel->p = prop_create(sql->sa, PROP_JOINIDX, rel->p); - break; - } - } return rel; } diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -150,6 +150,7 @@ exp_create(allocator *sa, int type) return NULL; *e = (sql_exp) { .type = (expression_type) type, + .p = NULL }; return e; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: d016aefdad9b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d016aefdad9b Modified Files: gdk/gdk_batop.c sql/backends/monet5/rel_bin.c sql/storage/bat/bat_storage.c Branch: resource_management Log Message: merge with default diffs (truncated from 861 to 300 lines): diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -64,6 +64,7 @@ target_sources(bat gdk_string.c gdk_qsort.c gdk_qsort_impl.h + gdk_rsort.c gdk_storage.c gdk_bat.c gdk_delta.c gdk_delta.h diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -2269,6 +2269,34 @@ do_sort(void *restrict h, void *restrict { if (n <= 1) /* trivially sorted */ return GDK_SUCCEED; + switch (tpe) { + case TYPE_bte: + case TYPE_sht: + case TYPE_int: + case TYPE_lng: +#ifdef HAVE_HGE + case TYPE_hge: +#endif + case TYPE_date: + case TYPE_daytime: + case TYPE_timestamp: + assert(base == NULL); + if (nilslast == reverse && (stable || n > 100)) + return GDKrsort(h, t, n, hs, ts, reverse, false); + break; +#ifdef WORDS_BIGENDIAN + /* only use radix sort for UUID on big-endian architectures since +* the bytes need to be sorted in the opposite order from +* little-endian */ + case TYPE_uuid: + assert(base == NULL); + if (nilslast == reverse && (stable || n > 100)) + return GDKrsort(h, t, n, hs, ts, reverse, true); + break; +#endif + default: + break; + } if (stable) { if (reverse) return GDKssort_rev(h, t, base, n, hs, ts, tpe); diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -2429,6 +2429,8 @@ do_flush_range_cleanup(logger *lg) logged_range *frange = lg->flush_ranges; logged_range *first = frange; + if (frange == NULL) + return NULL; while (frange->next) { if (ATOMIC_GET(&frange->refcount) > 1) break; @@ -2532,6 +2534,7 @@ log_create(int debug, const char *fn, co }; lg->current = &dummy; if (log_open_output(lg) != GDK_SUCCEED) { + lg->current = NULL; log_destroy(lg); return NULL; } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -151,6 +151,9 @@ gdk_return GDKremovedir(int farmid, cons gdk_return GDKsave(int farmid, const char *nme, const char *ext, void *buf, size_t size, storage_t mode, bool dosync) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); +gdk_return GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool nosign) + __attribute__((__warn_unused_result__)) + __attribute__((__visibility__("hidden"))); gdk_return GDKssort_rev(void *restrict h, void *restrict t, const void *restrict base, size_t n, int hs, int ts, int tpe) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); diff --git a/gdk/gdk_rsort.c b/gdk/gdk_rsort.c new file mode 100644 --- /dev/null +++ b/gdk/gdk_rsort.c @@ -0,0 +1,160 @@ +/* + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 2024 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. + */ + +#include "monetdb_config.h" +#include "gdk.h" +#include "gdk_private.h" + +#define RADIX 8/* one char at a time */ +#define NBUCKETS (1 << RADIX) + +gdk_return +GDKrsort(void *restrict h, void *restrict t, size_t n, size_t hs, size_t ts, bool reverse, bool nosign) +{ + const size_t niters = (8 * hs + RADIX - 1) / RADIX; + size_t *counts = GDKmalloc(niters * NBUCKETS * sizeof(size_t)); + size_t pos[NBUCKETS]; + uint8_t *h1 = h; + uint8_t *h2; + uint8_t *t1 = NULL; + uint8_t *t2 = NULL; + Heap tmph, tmpt; + + if (counts == NULL) + return GDK_FAIL; + + tmph = tmpt = (Heap) { + .farmid = 1, + }; + + snprintf(tmph.filename, sizeof(tmph.filename), "%s%crsort%zuh", +TEMPDIR_NAME, DIR_SEP, (size_t) MT_getpid()); + if (HEAPalloc(&tmph, n, hs) != GDK_SUCCEED) { + GDKfree(counts); + return GDK_FAIL; + } + h2 = (uint8_t *) tmph.base; + + if (t) { + snprintf(tmpt.filename, sizeof(tmpt.filename), "%s%crsort%zut", +
MonetDB: resource_management - small sanitizer fix
Changeset: cd567507dfe3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cd567507dfe3 Modified Files: gdk/gdk_utils.c sql/backends/monet5/sql_scenario.c Branch: resource_management Log Message: small sanitizer fix diffs (43 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2252,8 +2252,11 @@ allocator *sa_reset( allocator *sa ) else sa_free_blk(sa->pa, sa->blks[i]); } + if (!sa->pa) + sa->freelist_blks = NULL; sa->nr = 1; sa->used = 0; + sa->freelist = NULL; sa->usedmem = SA_BLOCK_SIZE; sa->objects = 0; sa->inuse = 0; @@ -2268,7 +2271,7 @@ sa_realloc( allocator *sa, void *p, size void *r = sa_alloc(sa, sz); if (r) - memcpy(r, p, oldsz); + memmove(r, p, oldsz); return r; } diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1570,6 +1570,7 @@ SQLparser_body(Client c, backend *be) if (be->q) { int res = 0; + be->result_id = be->q->id; if (!err && (res = mvc_export_prepare(be, c->fdout)) < 0) { msg = createException(PARSE, "SQLparser", SQLSTATE(45000) "Export operation failed: %s", mvc_export_error(be, c->fdout, res)); err = 1; @@ -1578,7 +1579,6 @@ SQLparser_body(Client c, backend *be) be->q->name = NULL; /* later remove cleanup from mal from qc code */ qc_delete(m->qc, be->q); } - be->result_id = be->q->id; be->q = NULL; } if (err) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: afa242acb760 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/afa242acb760 Branch: resource_management Log Message: merge with default diffs (28 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -4027,6 +4027,7 @@ def main(argv) : testdirs = [] testlist = [] dirlist = [] +cli_test_count = 0 if len(args) == 1 and not os.path.isdir(args[0]): head, tail = os.path.split(args[0]) if os.path.isfile(args[0]): @@ -4090,6 +4091,7 @@ def main(argv) : #else: # ERROR/WARNING i = i + 1 +cli_test_count = len(testlist) else: if i < len(args) and args[i] == "All": i = i + 1 @@ -4125,6 +4127,8 @@ def main(argv) : else: testdirs.extend(test_dirs) test_count += cnt +if cli_test_count: +test_count = cli_test_count if len(testdirs) > 1 and testlist: testlist = [] ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - fix test count when tests are specified on co...
Changeset: 0f45b8daee7d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0f45b8daee7d Modified Files: testing/Mtest.py.in Branch: default Log Message: fix test count when tests are specified on command line diffs (28 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -4027,6 +4027,7 @@ def main(argv) : testdirs = [] testlist = [] dirlist = [] +cli_test_count = 0 if len(args) == 1 and not os.path.isdir(args[0]): head, tail = os.path.split(args[0]) if os.path.isfile(args[0]): @@ -4090,6 +4091,7 @@ def main(argv) : #else: # ERROR/WARNING i = i + 1 +cli_test_count = len(testlist) else: if i < len(args) and args[i] == "All": i = i + 1 @@ -4125,6 +4127,8 @@ def main(argv) : else: testdirs.extend(test_dirs) test_count += cnt +if cli_test_count: +test_count = cli_test_count if len(testdirs) > 1 and testlist: testlist = [] ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - align size based on sa_alloc when...
Changeset: d3089be71c6d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d3089be71c6d Modified Files: gdk/gdk.h gdk/gdk_utils.c Branch: resource_management Log Message: align size based on sa_alloc when freeing objects diffs (41 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -604,6 +604,7 @@ typedef struct allocator { size_t usedmem; /* used memory */ size_t objects; /* number of objects */ size_t inuse; /* number of objects in use*/ + size_t freelist_hits; /* number of object reuse*/ void *freelist; /* list of freed objects */ void *freelist_blks;/* list of freed blks */ diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2170,6 +2170,7 @@ sa_use_freed_obj(allocator *pa, size_t s } else { pa->freelist = curr->n; } + pa->freelist_hits += 1; return curr; } else { prev = curr; @@ -2235,6 +2236,7 @@ sa_create(allocator *pa) sa->used = 0; sa->objects = 0; sa->inuse = 0; + sa->freelist_hits = 0; sa->tmp_active = 0; sa->tmp_used = 0; return sa; @@ -2424,7 +2426,10 @@ sa_close( allocator *sa ) void sa_free(allocator *sa, void *obj, size_t sz) { + sz = round16(sz); // allign size as per sa_alloc if (sz < SA_BLOCK_SIZE) { sa_free_obj(sa, obj, sz); + } else { + sa_free_blk(sa, obj); } } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: 0a0ee486af33 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0a0ee486af33 Branch: resource_management Log Message: merge with default diffs (27 lines): diff --git a/sql/test/rel-optimizers/Tests/merge-ors-multi-col-eq-to-cmp_in.test b/sql/test/rel-optimizers/Tests/merge-ors-multi-col-eq-to-cmp_in.test --- a/sql/test/rel-optimizers/Tests/merge-ors-multi-col-eq-to-cmp_in.test +++ b/sql/test/rel-optimizers/Tests/merge-ors-multi-col-eq-to-cmp_in.test @@ -114,9 +114,9 @@ plan select * from b where (m = 40 and k project ( | select ( -| | table("sys"."b") [ "b"."n", "b"."m", "b"."k" UNIQUE ] -| ) [ (( [ "b"."m", "b"."k" UNIQUE ]) in ( [ int(8) "20", int(11) "200" ], [ int(8) "60", int(11) "600" ])) or (("b"."m") = (int(8) "40"), ("b"."k" UNIQUE) > (int(11) "0")) ] -) [ "b"."n", "b"."m", "b"."k" UNIQUE ] +| | table("sys"."b") [ "b"."n" NOT NULL, "b"."m" NOT NULL, "b"."k" NOT NULL ] +| ) [ (( [ "b"."m" NOT NULL, "b"."k" NOT NULL ]) in ( [ int(8) "20", int(11) "200" ], [ int(8) "60", int(11) "600" ])) or (("b"."m" NOT NULL) = (int(8) "40"), ("b"."k" NOT NULL) > (int(11) "0")) ] +) [ "b"."n" NOT NULL, "b"."m" NOT NULL, "b"."k" NOT NULL ] query II rowsort select m, k from b where (m = 40) or (m = 20 and k = 200) or (m = 0) or (m = 60 and k = 600) or (m = 180) @@ -148,7 +148,7 @@ plan select m, k from b where (m = 40) o project ( | select ( -| | table("sys"."b") [ "b"."m", "b"."k" UNIQUE ] -| ) [ (("b"."m") in (int(8) "40", int(8) "0", int(8) "180")) or (( [ "b"."m", "b"."k" UNIQUE ]) in ( [ int(8) "20", int(11) "200" ], [ int(8) "60", int(11) "600" ])) ] -) [ "b"."m", "b"."k" UNIQUE ] +| | table("sys"."b") [ "b"."m" NOT NULL, "b"."k" NOT NULL ] +| ) [ (("b"."m" NOT NULL) in (int(8) "40", int(8) "0", int(8) "180")) or (( [ "b"."m" NOT NULL, "b"."k" NOT NULL ]) in ( [ int(8) "20", int(11) "200" ], [ int(8) "60", int(11) "600" ])) ] +) [ "b"."m" NOT NULL, "b"."k" NOT NULL ] ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - keep track of allocated/freed obj...
Changeset: b7be015fa060 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b7be015fa060 Modified Files: gdk/gdk.h gdk/gdk_utils.c Branch: resource_management Log Message: keep track of allocated/freed objects diffs (88 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -597,11 +597,13 @@ gdk_export _Noreturn void eb_error(excep typedef struct allocator { struct allocator *pa; - size_t size; - size_t nr; + size_t size;/* size of the allocator in terms of blocks */ + size_t nr; /* number of blocks allocated */ char **blks; size_t used;/* memory used in last block */ size_t usedmem; /* used memory */ + size_t objects; /* number of objects */ + size_t inuse; /* number of objects in use*/ void *freelist; /* list of freed objects */ void *freelist_blks;/* list of freed blks */ diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2099,6 +2099,7 @@ sa_free_obj(allocator *pa, void *obj, si assert(sz > 0); assert(!pa->pa); // must be root allocator size_t i; + char *obj_start = (char *) obj; char *obj_end = obj_start + sz; @@ -2115,6 +2116,8 @@ sa_free_obj(allocator *pa, void *obj, si f->n = pa->freelist; f->sz = sz; pa->freelist = f; + if (pa->inuse > 0) + pa->inuse -= 1; } static void @@ -2155,7 +2158,12 @@ sa_use_freed_obj(allocator *pa, size_t s return sa_use_freed_obj(pa->pa, sz); freed_t *prev = NULL; freed_t *curr = pa->freelist; - while(curr) { + // size_t objects = pa->objects; + // size_t inuse = pa->inuse; + // size_t nr_free_objects = objects - inuse; + int MAX_ITERATIONS = 100; + int cntr = 0; + while(curr && (cntr <= MAX_ITERATIONS)) { if (sz == curr->sz) { if (prev) { prev->n = curr->n; @@ -2167,6 +2175,7 @@ sa_use_freed_obj(allocator *pa, size_t s prev = curr; curr = curr->n; } + cntr += 1; } return NULL; } @@ -2224,6 +2233,8 @@ sa_create(allocator *pa) return NULL; } sa->used = 0; + sa->objects = 0; + sa->inuse = 0; sa->tmp_active = 0; sa->tmp_used = 0; return sa; @@ -2242,6 +2253,8 @@ allocator *sa_reset( allocator *sa ) sa->nr = 1; sa->used = 0; sa->usedmem = SA_BLOCK_SIZE; + sa->objects = 0; + sa->inuse = 0; return sa; } @@ -2316,6 +2329,8 @@ sa_alloc( allocator *sa, size_t sz ) r = sa->blks[sa->nr-1] + sa->used; sa->used += sz; } + sa->objects += 1; + sa->inuse += 1; return r; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: c39d991f786f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c39d991f786f Branch: resource_management Log Message: merge with default diffs (truncated from 704 to 300 lines): diff --git a/sql/test/rel-optimizers/Tests/groupby-cse.test b/sql/test/rel-optimizers/Tests/groupby-cse.test --- a/sql/test/rel-optimizers/Tests/groupby-cse.test +++ b/sql/test/rel-optimizers/Tests/groupby-cse.test @@ -41,9 +41,9 @@ GROUP BY project ( | group by ( -| | table("sys"."foo") [ "foo"."c1", "foo"."c3" ] -| ) [ "foo"."c1" ] [ "foo"."c1", "sys"."count" no nil ("foo"."c3") NOT NULL as "%1"."%1" ] -) [ "foo"."c1" UNIQUE, "foo"."c1" UNIQUE, "%1"."%1" NOT NULL ] +| | table("sys"."foo") [ "foo"."c1" NOT NULL ] +| ) [ "foo"."c1" NOT NULL ] [ "foo"."c1" NOT NULL, "sys"."count"() NOT NULL as "%1"."%1" ] +) [ "foo"."c1" NOT NULL UNIQUE, "foo"."c1" NOT NULL UNIQUE, "%1"."%1" NOT NULL ] query III rowsort SELECT @@ -78,9 +78,9 @@ GROUP BY project ( | group by ( -| | table("sys"."foo") [ "foo"."c1", "foo"."c3" ] -| ) [ "foo"."c1" as "c1_alias1" ] [ "c1_alias1", "c1_alias1" as "c1_alias2", "sys"."count" no nil ("foo"."c3") NOT NULL as "%1"."%1" ] -) [ "c1_alias1" UNIQUE, "c1_alias2", "%1"."%1" NOT NULL ] +| | table("sys"."foo") [ "foo"."c1" NOT NULL ] +| ) [ "foo"."c1" NOT NULL as "c1_alias1" ] [ "c1_alias1" NOT NULL, "c1_alias1" NOT NULL as "c1_alias2", "sys"."count"() NOT NULL as "%1"."%1" ] +) [ "c1_alias1" NOT NULL UNIQUE, "c1_alias2" NOT NULL, "%1"."%1" NOT NULL ] query III rowsort gb-over-bt SELECT @@ -126,10 +126,10 @@ GROUP BY project ( | group by ( | | project ( -| | | table("sys"."foo") [ "foo"."c1", "foo"."c3" ] -| | ) [ "foo"."c1" as "%1"."a1", "foo"."c3" as "%1"."a3" ] -| ) [ "%1"."a1" ] [ "%1"."a1", "sys"."count" no nil ("%1"."a3") NOT NULL as "%2"."%2" ] -) [ "%1"."a1" UNIQUE, "%1"."a1" UNIQUE, "%2"."%2" NOT NULL ] +| | | table("sys"."foo") [ "foo"."c1" NOT NULL, "foo"."c3" NOT NULL ] +| | ) [ "foo"."c1" NOT NULL as "%1"."a1", "foo"."c3" NOT NULL as "%1"."a3" ] +| ) [ "%1"."a1" NOT NULL ] [ "%1"."a1" NOT NULL, "sys"."count" no nil ("%1"."a3" NOT NULL) NOT NULL as "%2"."%2" ] +) [ "%1"."a1" NOT NULL UNIQUE, "%1"."a1" NOT NULL UNIQUE, "%2"."%2" NOT NULL ] query III rowsort SELECT @@ -177,10 +177,10 @@ GROUP BY project ( | group by ( | | project ( -| | | table("sys"."foo") [ "foo"."c1", "foo"."c2" ] -| | ) [ "foo"."c1" as "sq"."c1_alias1", "sq"."c1_alias1" as "sq"."c1_alias2", "foo"."c2" as "sq"."c2" ] -| ) [ "sq"."c1_alias1", "sq"."c2" ] [ "sq"."c1_alias1", "sq"."c1_alias1" as "sq"."c1_alias2", "sq"."c2", "sys"."count" no nil ("sq"."c1_alias2") NOT NULL as "%1"."%1" ] -) [ "sq"."c1_alias1", "sq"."c1_alias2", "sq"."c2", "%1"."%1" NOT NULL ] +| | | table("sys"."foo") [ "foo"."c1" NOT NULL, "foo"."c2" NOT NULL ] +| | ) [ "foo"."c1" NOT NULL as "sq"."c1_alias1", "foo"."c2" NOT NULL as "sq"."c2" ] +| ) [ "sq"."c1_alias1" NOT NULL, "sq"."c2" NOT NULL ] [ "sq"."c1_alias1" NOT NULL, "sq"."c1_alias1" NOT NULL as "sq"."c1_alias2", "sq"."c2" NOT NULL, "sys"."count"() NOT NULL as "%1"."%1" ] +) [ "sq"."c1_alias1" NOT NULL, "sq"."c1_alias2" NOT NULL, "sq"."c2" NOT NULL, "%1"."%1" NOT NULL ] query III rowsort gb-over-pr SELECT @@ -233,10 +233,10 @@ GROUP BY project ( | group by ( | | project ( -| | | table("sys"."foo") [ "foo"."c1", "foo"."c2", "foo"."c3" ] -| | ) [ "foo"."c1" as "sq"."c1", "foo"."c2" as "sq"."c2", "foo"."c3" as "sq"."c3" ] -| ) [ "sq"."c1" as "c1_alias_1", "sq"."c2" ] [ "c1_alias_1", "c1_alias_1" as "c1_alias_2", "sys"."count" no nil ("sq"."c3") NOT NULL as "%1"."%1" ] -) [ "c1_alias_1", "c1_alias_2", "%1"."%1" NOT NULL ] +| | | table("sys"."foo") [ "foo"."c1" NOT NULL, "foo"."c2" NOT NULL ] +| | ) [ "foo"."c1" NOT NULL as "sq"."c1", "foo"."c2" NOT NULL as "sq"."c2" ] +| ) [ "sq"."c1" NOT NULL as "c1_alias_1", "sq"."c2" NOT NULL ] [ "c1_alias_1" NOT NULL, "c1_alias_1" NOT NULL as "c1_alias_2", "sys"."count"() NOT NULL as "%1"."%1" ] +) [ "c1_alias_1" NOT NULL, "c1_alias_2" NOT NULL, "%1"."%1" NOT NULL ] query III rowsort gb-over-pr SELECT @@ -291,10 +291,10 @@ GROUP BY project ( | group by ( | | project ( -| | | table("sys"."foo") [ "foo"."c1", "foo"."c2", "foo"."c3" ] -| | ) [ "foo"."c1" as "sq"."c1_in_alias_1", "foo"."c2" as "sq"."c2", "foo"."c3" as "sq"."c3" ] -| ) [ "sq"."c1_in_alias_1" as "c1_out_alias_1", "sq"."c2" ] [ "c1_out_alias_1", "c1_out_alias_1" as "c1_out_alias_2", "sys"."count" no nil ("sq"."c3") NOT NULL as "%1"."%1" ] -) [ "c1_out_alias_1", "c1_out_alias_2", "%1"."%1" NOT NULL ] +| | | table("sys"."foo") [ "foo"."c1" NOT NULL, "foo"."c2" NOT NULL ] +| | ) [ "foo"."c1" NOT NULL as "sq"."c1_in_alias_1", "foo"."c2" NOT NULL as "sq"."c2" ] +| ) [ "sq"."c1_in_alias_1" NOT NULL as "c1_out_alias_1", "sq"."c2" NOT NULL ] [ "c1_out_alias_1" NOT NULL, "c1_out_alias_1" NOT NULL as "c1_out_alias_2", "sys"."count"() NOT NULL as "%1"."%1" ] +) [ "c1_out_alias_1" NOT NULL, "c1_out_alias_2" NOT NULL, "%1"."%1" NOT NULL ] qu
MonetDB: resource_management - sanotizer fixes
Changeset: 1b9ae8272033 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1b9ae8272033 Modified Files: monetdb5/mal/mal_parser.c Branch: resource_management Log Message: sanotizer fixes diffs (106 lines): diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -2039,8 +2039,8 @@ parseAssign(Client cntxt, int cntrl) l = idLength(cntxt); i = cstToken(cntxt, curBlk, &cst); if (l == 0 || i) { + freeInstructionX(curInstr, curBlk); parseError(cntxt, " or expected\n"); - freeInstructionX(curInstr, curBlk); return; } GETvariable(freeInstructionX(curInstr, curBlk)); @@ -2153,8 +2153,8 @@ parseAssign(Client cntxt, int cntrl) /* continue with parsing a function/operator call */ arg = putNameLen(CURRENT(cntxt), l); if (arg == NULL) { + freeInstructionX(curInstr, curBlk); parseError(cntxt, SQLSTATE(HY013) MAL_MALLOC_FAIL); - freeInstructionX(curInstr, curBlk); return; } advance(cntxt, l + 1); /* skip '.' too */ @@ -2166,20 +2166,20 @@ parseAssign(Client cntxt, int cntrl) if (i) { setFunctionId(curInstr, putNameLen(((char *) CURRENT(cntxt)), i)); if (getFunctionId(curInstr) == NULL) { + freeInstructionX(curInstr, curBlk); parseError(cntxt, SQLSTATE(HY013) MAL_MALLOC_FAIL); - freeInstructionX(curInstr, curBlk); return; } advance(cntxt, i); } else { + freeInstructionX(curInstr, curBlk); parseError(cntxt, " expected\n"); - freeInstructionX(curInstr, curBlk); return; } skipSpace(cntxt); if (currChar(cntxt) != '(') { + freeInstructionX(curInstr, curBlk); parseError(cntxt, "'(' expected\n"); - freeInstructionX(curInstr, curBlk); return; } advance(cntxt, 1); @@ -2204,15 +2204,15 @@ parseAssign(Client cntxt, int cntrl) /* simple arithmetic operator expression */ setFunctionId(curInstr, putNameLen(((char *) CURRENT(cntxt)), i)); if (getFunctionId(curInstr) == NULL) { + freeInstructionX(curInstr, curBlk); parseError(cntxt, SQLSTATE(HY013) MAL_MALLOC_FAIL); - freeInstructionX(curInstr, curBlk); return; } advance(cntxt, i); curInstr->modname = putName("calc"); if (curInstr->modname == NULL) { + freeInstructionX(curInstr, curBlk); parseError(cntxt, SQLSTATE(HY013) MAL_MALLOC_FAIL); - freeInstructionX(curInstr, curBlk); return; } if ((l = idLength(cntxt)) @@ -2227,18 +2227,18 @@ parseAssign(Client cntxt, int cntrl) case 3: goto part3; } + freeInstructionX(curInstr, curBlk); parseError(cntxt, " expected\n"); - freeInstructionX(curInstr, curBlk); return; } else { skipSpace(cntxt); if (currChar(cntxt) == '(') { + freeInstructionX(curInstr, curBlk); parseError(cntxt, "module name missing\n"); - freeInstructionX(curInstr, curBlk); return; } else if (currChar(cntxt) != ';' && currChar(cntxt) != '#') { + freeInstructionX(curInstr, curBlk); parseError(cntxt, "operator expected\n"); - freeInstructionX(curInstr, curBlk); return; } pushInstruction(curBlk, curInstr); @@ -2247,16 +2247,16 @@ parseAssign(Client cntxt, int cntrl) part3: skipSpace(cntxt); if (currChar(cntxt) != ';') { + freeInstructionX(curInstr, curBlk); parseError(cntxt, "';' expected\n"); skipToEnd(cntxt); - freeInstructionX(curInstr, curBlk); return; } skipToEnd(cntxt); if (cntrl == RETURNsymbol && !(curInstr->token == ASSIGNsymbo
MonetDB: resource_management - merge with default
Changeset: d7d1962ffa2c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d7d1962ffa2c Branch: resource_management Log Message: merge with default diffs (91 lines): diff --git a/testing/tlstester.py b/testing/tlstester.py --- a/testing/tlstester.py +++ b/testing/tlstester.py @@ -416,6 +416,32 @@ class TLSTester: for t in threads: t.join() +def spawn_server(self, name, server_class, addr, port, handler): +fam = server_class.address_family.name +try: +server = server_class((addr, port), handler) +except Exception as e: +log.debug(f"Could not bind {name} to {fam} = {addr} port {port}: {e}") +raise +bound_addr, bound_port = server.server_address[:2] +log.debug(f"Bound {name}: {fam} = {bound_addr} port {bound_port}") +self.portmap[name] = bound_port +self.workers.append(server.serve_forever) +return bound_port + +def spawn_servers(self, name, server_classes, addr, port, handler): +exceptions = [] +for server_class in server_classes: +try: +# update 'port' so all servers use the same port number +port = self.spawn_server(name, server_class, addr, port, handler) +except OSError as e: +exceptions.append(e) +if len(exceptions) == len(server_classes): +e = exceptions[0] +log.error(f"Could not spawn any listener for {name} on {addr}: {e}") +raise e + def spawn_http(self, name: str, only_preassigned: bool): if only_preassigned and name not in self.preassigned: return @@ -425,11 +451,7 @@ class TLSTester: handler = lambda req, addr, server: WebHandler( req, addr, server, self.certs, self.portmap ) -server = http.server.HTTPServer((self.listen_addr, port), handler) -port = server.server_address[1] -log.debug(f"Bound port {name} to {port}") -self.portmap[name] = port -self.workers.append(server.serve_forever) +self.spawn_servers(name, [MyHTTPServer, MyHTTP6Server], self.listen_addr, port, handler) def spawn_mapi(self, name: str, only_preassigned, ctx: SSLContext, check_alpn=None, redirect_to=None): if only_preassigned and name not in self.preassigned: @@ -438,11 +460,7 @@ class TLSTester: return port = self.allocate_port(name) handler = lambda req, addr, server: MapiHandler(req, addr, server, self, name, ctx, check_alpn, redirect_to) -server = MyTCPServer((self.listen_addr, port), handler) -port = server.server_address[1] -log.debug(f"Bound port {name} to {port}") -self.portmap[name] = port -self.workers.append(server.serve_forever) +self.spawn_servers(name, [MyTCPServer, MyTCP6Server], self.listen_addr, port, handler) def spawn_forward(self, name, ctx: SSLContext): if name in self.portmap: @@ -451,11 +469,8 @@ class TLSTester: handler = lambda req, addr, server: ForwardHandler( req, addr, server, name, ctx, self.forward_to ) -server = MyTCPServer((self.listen_addr, local_port), handler) -port = server.server_address[1] -log.debug(f"Bound port {name} to {port}") -self.portmap[name] = port -self.workers.append(server.serve_forever) +self.spawn_servers(name, [MyTCPServer, MyTCP6Server], self.listen_addr, local_port, handler) + def allocate_port(self, name): if name in self.preassigned: @@ -551,6 +566,14 @@ class MyTCPServer(socketserver.Threading allow_reuse_address = True pass +class MyTCP6Server(MyTCPServer): +address_family = socket.AF_INET6 + +class MyHTTPServer(http.server.HTTPServer): +pass + +class MyHTTP6Server(MyHTTPServer): +address_family = socket.AF_INET6 class MapiHandler(socketserver.BaseRequestHandler): tlstester: TLSTester ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - fix sanitizer error
Changeset: 2807b3b6063b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2807b3b6063b Modified Files: gdk/gdk_utils.c sql/backends/monet5/sql.c Branch: resource_management Log Message: fix sanitizer error diffs (39 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2395,15 +2395,15 @@ sa_close( allocator *sa ) { assert(sa->tmp_active); sa->tmp_active = 0; - //sa_reset(sa); - while (sa->tmp_used) { - assert(sa->used >= sa->tmp_used); - if (sa->used >= sa->tmp_used) { - sa->used -= sa->tmp_used; - sa->usedmem -= sa->tmp_used; - sa->tmp_used = 0; - } - } + sa_reset(sa); + //while (sa->tmp_used) { + // assert(sa->used >= sa->tmp_used); + // if (sa->used >= sa->tmp_used) { + // sa->used -= sa->tmp_used; + // sa->usedmem -= sa->tmp_used; + // sa->tmp_used = 0; + // } + //} } void diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -193,6 +193,7 @@ sqlcleanup(backend *be, int err) be->mvc->label = 0; be->mvc->nid = 1; be->no_mitosis = 0; + be->client->query = NULL; scanner_query_processed(&(be->mvc->scanner)); return err; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: 4f8836d5ed0f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4f8836d5ed0f Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c monetdb5/mal/mal.h monetdb5/mal/mal_profiler.c sql/backends/monet5/sql.c sql/server/sql_parser.y sql/storage/store.c Branch: resource_management Log Message: merge with default diffs (truncated from 6329 to 300 lines): diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Mon Sep 16 2024 Joeri van Ruth +- Hot snapshot: allow member files larger than 64 GiB. By member files we mean + the files inside the resulting .tar file, not the tar file itself. Huge member + files are written using a GNU tar extension to the original tar format, which + doesn't support more than 8 GiB. + 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 @@ -3782,7 +3782,7 @@ bat getSize command bat.getSize(X_0:bat[:any_1]):lng BKCgetSize; -Calculate the actual size of the BAT descriptor, heaps, hashes and imprint indices in bytes@rounded to the memory page size (see bbp.getPageSize()). +Calculate the actual size of the BAT descriptor, heaps, hashes in bytes@rounded to the memory page size (see bbp.getPageSize()). bat getVHeapSize command bat.getVHeapSize(X_0:bat[:any_1]):lng @@ -3799,76 +3799,6 @@ pattern bat.hasorderidx(X_0:bat[:any_1]) OIDXhasorderidx; Return true if order index exists bat -imprints -command bat.imprints(X_0:bat[:bte]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:dbl]):void -CMDBATimprints; -Check for existence or create an imprint index on the BAT. -bat -imprints -command bat.imprints(X_0:bat[:flt]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:hge]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:int]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:lng]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:sht]):void -CMDBATimprints; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:bte]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:dbl]):lng -CMDBATimprintsize; -Return the storage size of the imprints index structure. -bat -imprintsize -command bat.imprintsize(X_0:bat[:flt]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:hge]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:int]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:lng]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:sht]):lng -CMDBATimprintsize; -(empty) -bat info command bat.info(X_0:bat[:any_1]) (X_1:bat[:str], X_2:bat[:str]) BKCinfo; @@ -4019,11 +3949,6 @@ command bat.setHash(X_0:bat[:any_1]):bit BKCsetHash; Create a hash structure on the column bat -setImprints -command bat.setImprints(X_0:bat[:any_1]):bit -BKCsetImprints; -Create an imprints structure on the column -bat setName command bat.setName(X_0:bat[:any_1], X_1:str):void BKCsetName; 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 @@ -3217,7 +3217,7 @@ bat getSize command bat.getSize(X_0:bat[:any_1]):lng BKCgetSize; -Calculate the actual size of the BAT descriptor, heaps, hashes and imprint indices in bytes@rounded to the memory page size (see bbp.getPageSize()). +Calculate the actual size of the BAT descriptor, heaps, hashes in bytes@rounded to the memory page size (see bbp.getPageSize()). bat getVHeapSize command bat.getVHeapSize(X_0:bat[:any_1]):lng @@ -3234,66 +3234,6 @@ pattern bat.hasorderidx(X_0:bat[:any_1]) OIDXhasorderidx; Return true if order index exists bat -imprints -command bat.imprints(X_0:bat[:bte]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:dbl]):void -CMDBATimprints; -Check for existence or create an imprint index on the BAT. -bat -imprints -command bat.imprints(X_0:bat[:flt]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:int]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:lng]):void -CMDBATimprints; -(empty) -bat -imprints -command bat.imprints(X_0:bat[:sht]):void -CMDBATimprints; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:bte]):lng -CMDBATimprintsize; -(empty) -bat -imprintsize -command bat.imprintsize(X_0:bat[:dbl]):lng -CMDBATimprintsize; -Return the storage size of the imprints index structure. -bat -imprintsize -command bat.imprintsize(X_0:bat[:flt]):lng -CMDBATimpr
MonetDB: resource_management - merge default
Changeset: 09e7c70aa288 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/09e7c70aa288 Branch: resource_management Log Message: merge default diffs (41 lines): diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -302,17 +302,16 @@ bool BATcheckimprints(BAT *b) { bool ret; - BATiter bi = bat_iterator(b); if (VIEWtparent(b)) { assert(b->timprints == NULL); b = BATdescriptor(VIEWtparent(b)); if (b == NULL) { - bat_iterator_end(&bi); return false; } } + BATiter bi = bat_iterator(b); MT_lock_set(&b->batIdxLock); if (b->timprints == (Imprints *) 1) { Imprints *imprints; diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -2335,6 +2335,7 @@ BATselect(BAT *b, BAT *s, const void *tl */ Imprints *imprints = NULL; if (!equi && + /* DISABLES CODE */ (0) && imprintable(bi.type) && (!bi.transient || (pb != NULL && !pbi.transient)) && @@ -2699,6 +2700,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT cnt = BATcount(r1); assert(r2 == NULL || BATcount(r1) == BATcount(r2)); } else if (!anti && !symmetric && + /* DISABLES CODE */ (0) && imprintable(li.type) && (BATcount(rl) > 2 || !li.transient || ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - small fix
Changeset: fb28f2a40014 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/fb28f2a40014 Modified Files: monetdb5/optimizer/opt_pipes.c Branch: resource_management Log Message: small fix diffs (20 lines): diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -490,11 +490,11 @@ opt_pipes_reset(void) { for (int i = 0; i < MAXOPTPIPES; i++) if (pipes[i].name && !pipes[i].builtin) { - GDKfree(pipes[i].name); - if (pipes[i].def) - for (int n = 0; pipes[i].def[n]; n++) - GDKfree(pipes[i].def[n]); - GDKfree(pipes[i].def); + //GDKfree(pipes[i].name); + //if (pipes[i].def) + // for (int n = 0; pipes[i].def[n]; n++) + // GDKfree(pipes[i].def[n]); + //GDKfree(pipes[i].def); pipes[i] = (struct pipeline) { .name = NULL, }; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - use temp allocator in emptybind o...
Changeset: c933deb2964c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c933deb2964c Modified Files: monetdb5/mal/mal_instruction.c monetdb5/mal/mal_parser.c monetdb5/optimizer/opt_emptybind.c Branch: resource_management Log Message: use temp allocator in emptybind optimizer further propagate extended freeInstructionX api diffs (270 lines): diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -201,7 +201,8 @@ resetMalBlk(MalBlkPtr mb) int i; for (i = 1/*MALCHUNK*/; i < mb->ssize; i++) { - //freeInstruction(mb->stmt[i]); + // ss + freeInstructionX(mb->stmt[i], mb); mb->stmt[i] = NULL; } #if 0 @@ -420,6 +421,7 @@ newInstructionArgs(MalBlkPtr mb, const c /* Flow of control instructions are always marked as an assignment * with modifier */ .token = ASSIGNsymbol, + .blk = NULL, }; memset(p->argv, 0, args * sizeof(p->argv[0])); p->argv[0] = -1; @@ -475,10 +477,9 @@ clrInstruction(InstrPtr p) void freeInstruction(InstrPtr p) { - MalBlkPtr mb_ptr = p->blk; - if (mb_ptr && mb_ptr->ma) { + if (p && p->blk && p->blk->ma) { size_t sz = (p->maxarg - 1)*(sizeof(p->argv[0])) + (sizeof(InstrRecord)); - sa_free(mb_ptr->ma, p, sz); + sa_free(p->blk->ma, p, sz); } //GDKfree(p); } @@ -486,10 +487,9 @@ freeInstruction(InstrPtr p) void freeInstructionX(InstrPtr p, MalBlkPtr mb) { - MalBlkPtr mb_ptr = (mb != NULL) ? mb : p->blk; - if (mb_ptr && mb_ptr->ma) { + if (p && mb && mb->ma) { size_t sz = (p->maxarg - 1)*(sizeof(p->argv[0])) + (sizeof(InstrRecord)); - sa_free(mb_ptr->ma, p, sz); + sa_free(mb->ma, p, sz); } } @@ -1163,18 +1163,18 @@ pushInstruction(MalBlkPtr mb, InstrPtr p for (i = 1; i < mb->stop; i++) { q = getInstrPtr(mb, i); if (q->token == REMsymbol) { - freeInstruction(q); + freeInstructionX(q, mb); mb->stmt[i] = p; return; } } - freeInstruction(getInstrPtr(mb, 0)); + freeInstructionX(getInstrPtr(mb, 0), mb); mb->stmt[0] = p; return; } } if (mb->stmt[mb->stop]) - freeInstruction(mb->stmt[mb->stop]); + freeInstructionX(mb->stmt[mb->stop], mb); p->pc = mb->stop; mb->stmt[mb->stop++] = p; } diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -2040,10 +2040,10 @@ parseAssign(Client cntxt, int cntrl) i = cstToken(cntxt, curBlk, &cst); if (l == 0 || i) { parseError(cntxt, " or expected\n"); - freeInstruction(curInstr); + freeInstructionX(curInstr, curBlk); return; } - GETvariable(freeInstruction(curInstr)); + GETvariable(freeInstructionX(curInstr, curBlk)); if (currChar(cntxt) == ':') { type = typeElm(cntxt, getVarType(curBlk, varid)); if (type < 0) @@ -2079,7 +2079,7 @@ parseAssign(Client cntxt, int cntrl) cntrl == RETURNsymbol || cntrl == EXITsymbol) { curInstr->argv[0] = getBarrierEnvelop(curBlk); if (currChar(cntxt) != ';') { - freeInstruction(curInstr); + freeInstructionX(curInstr, curBlk); parseError(cntxt, " or expected in control statement\n"); return; @@ -2088,7 +2088,7 @@ parseAssign(Client cntxt, int cntrl) return; } getArg(curInstr, 0) = newTmpVariable(curBlk, TYPE_any); - freeInstruction(curInstr); + freeInstructionX(curInstr, curBlk); parseError(cntxt, " or expected\n"); return; } @@ -2099,7 +2099,7 @@ parseAssign(Client cntxt, int cntrl) } /* Get target v
MonetDB: resource_management - reuse freed objects/blks
Changeset: 7969513d2479 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7969513d2479 Modified Files: gdk/gdk.h gdk/gdk_utils.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_instruction.h monetdb5/mal/mal_session.c monetdb5/optimizer/opt_inline.c monetdb5/optimizer/opt_mergetable.c Branch: resource_management Log Message: reuse freed objects/blks diffs (283 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -623,7 +623,7 @@ gdk_export char *sa_strconcat( allocator gdk_export size_t sa_size( allocator *sa ); gdk_export void sa_open( allocator *sa ); /* open new frame of tempory allocations */ gdk_export void sa_close( allocator *sa ); /* close temporary frame, reset to old state */ -gdk_export void sa_free( allocator *sa, void *); +gdk_export void sa_free( allocator *sa, void *, size_t sz); #define ma_create(pa) sa_create(pa) #define ma_destroy(ma) sa_destroy(ma) diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2083,36 +2083,33 @@ typedef struct freed_t { size_t sz; } freed_t; -static void -sa_destroy_freelist( freed_t *f ) -{ - while(f) { - freed_t *n = f->n; - GDKfree(f); - f = n; - } -} +//static void +//sa_destroy_freelist( freed_t *f ) +//{ +// while(f) { +// freed_t *n = f->n; +// GDKfree(f); +// f = n; +// } +//} static void -sa_free_obj(allocator *pa, void *obj) +sa_free_obj(allocator *pa, void *obj, size_t sz) { - assert(!pa->pa); // why ? - size_t sz = GDKmallocated(obj); - assert(sz < SA_BLOCK_SIZE); + assert(sz > 0); + assert(!pa->pa); // must be root allocator size_t i; + char *obj_start = (char *) obj; + char *obj_end = obj_start + sz; - // find the block this objects belongs + // find the block this object belongs to for(i = 0; i < pa->nr; i++) { - if (((char *) obj >= (char *) pa->blks[i]) && ((char *)obj < (char *) pa->blks[i] + - SA_BLOCK_SIZE)) + char * blk_start = (char *) pa->blks[i]; + char * blk_end = blk_start + SA_BLOCK_SIZE; + if ((obj_start >= blk_start) && (obj_end <= blk_end)) break; } assert (i < pa->nr); - if (i >= pa->nr) { - // obj does not beong to any - // block in this allocator - return; - } // put on the freelist freed_t *f = obj; f->n = pa->freelist; @@ -2123,7 +2120,7 @@ sa_free_obj(allocator *pa, void *obj) static void sa_free_blk(allocator *pa, void *blk) { - assert(!pa->pa); // why ? + assert(!pa->pa); // must be root allocator size_t i; for(i = 0; i < pa->nr; i++) { @@ -2131,18 +2128,13 @@ sa_free_blk(allocator *pa, void *blk) break; } assert (i < pa->nr); - if (i >= pa->nr) { - // blk does not belong to this allocator - return; - } - for (; i < pa->nr-1; i++) - pa->blks[i] = pa->blks[i+1]; - pa->nr--; size_t sz = GDKmallocated(blk); - // what is the magic 32 ? - if (sz > (SA_BLOCK_SIZE + 32)) { + if (sz > (SA_BLOCK_SIZE)) { GDKfree(blk); + for (; i < pa->nr-1; i++) + pa->blks[i] = pa->blks[i+1]; + pa->nr--; } else { freed_t *f = blk; f->n = pa->freelist_blks; @@ -2154,15 +2146,17 @@ sa_free_blk(allocator *pa, void *blk) /* - * Returns first suitable block for the size + * Returns first that match size */ static void * sa_use_freed_obj(allocator *pa, size_t sz) { + if (pa->pa) + return sa_use_freed_obj(pa->pa, sz); freed_t *prev = NULL; freed_t *curr = pa->freelist; while(curr) { - if (sz <= curr->sz) { + if (sz == curr->sz) { if (prev) { prev->n = curr->n; } else { @@ -2178,9 +2172,11 @@ sa_use_freed_obj(allocator *pa, size_t s } static void * -sa_use_freed_blk(allocator *pa) +sa_use_freed_blk(allocator *pa, size_t sz) { - if (pa->freelist_blks) { + if (pa->pa) + return sa_use_freed_blk(pa->pa, sz); + if (pa->freelist_blks && (sz == SA_BLOCK_SIZE)) { freed_t *f = pa->freelist_blks; pa->freelist_blks = f->n; return f; @@ -2191,10 +2187,12 @@ sa_use_freed_blk(allocator *pa) static void * sa_use_freed(allocator *pa, size_t sz) { - if (sz < SA_BLOCK_SIZE && pa->freelist) + if ((sz < SA_BLOCK_SIZE) && pa->freelist) { return sa_use_freed_obj(pa, sz); - if (sz <= SA_BLOCK_SIZ
MonetDB: resource_management - merge with default
Changeset: 726203c34c74 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/726203c34c74 Modified Files: gdk/gdk.h gdk/gdk_bat.c sql/server/sql_var.c Branch: resource_management Log Message: merge with default diffs (truncated from 31463 to 300 lines): diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c --- a/clients/mapiclient/mhelp.c +++ b/clients/mapiclient/mhelp.c @@ -68,7 +68,7 @@ SQLhelp sqlhelp1[] = { {"ALTER TABLE", "", "ALTER TABLE [ IF EXISTS ] qname ADD [ COLUMN ] column_def\n" -"ALTER TABLE [ IF EXISTS ] qname ADD table_constraint\n" +"ALTER TABLE [ IF EXISTS ] qname ADD [ CONSTRAINT ident ] table_constraint\n" "ALTER TABLE [ IF EXISTS ] qname ALTER [ COLUMN ] ident SET DEFAULT value\n" "ALTER TABLE [ IF EXISTS ] qname ALTER [ COLUMN ] ident SET [NOT] NULL\n" "ALTER TABLE [ IF EXISTS ] qname ALTER [ COLUMN ] ident DROP DEFAULT\n" @@ -910,9 +910,10 @@ SQLhelp sqlhelp2[] = { NULL,}, {"table_constraint", NULL, -"[ CONSTRAINT ident ] { PRIMARY KEY column_list | UNIQUE column_list |\n" +"[ CONSTRAINT ident ] { CHECK '(' search_condition ')' |\n" +"PRIMARY KEY column_list | UNIQUE column_list |\n" "FOREIGN KEY column_list REFERENCES qname [ column_list ] [ match_options ] [ reference_action ] }", -"column_list,match_options,reference_action", +"column_list,search_condition,match_options,reference_action", "See also https://www.monetdb.org/documentation/user-guide/sql-manual/data-definition/table-elements/"}, {"table_element", NULL, diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1217,7 +1217,7 @@ mapi_log_header(Mapi mid, const char *fu if (firstcall == 0) firstcall = now; double seconds = (double)(now - firstcall) / 1e6; - mnstr_printf(mid->tracelog, "\342\226\266 [%u] t=%.3fs %s%s %s(), line %ld\n", mid->index, seconds, mark1, mark2, funcname, line); /* U+25B6: right-pointing triangle */ + mnstr_printf(mid->tracelog, "\n** [%u] t=%.3fs %s%s %s(), line %ld\n", mid->index, seconds, mark1, mark2, funcname, line); } void diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c --- a/clients/mapilib/msettings.c +++ b/clients/mapilib/msettings.c @@ -477,7 +477,6 @@ msetting_set_string(msettings *mp, mparm mp->lang_is_mal = true; else if (strstr(value, "sql") == value) mp->lang_is_sql = true; - else if (strcmp(value, "`")) break; default: break; diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -931,6 +931,7 @@ typedef struct BAT { MT_Lock theaplock; /* lock protecting heap reference changes */ MT_RWLock thashlock;/* lock specifically for hash management */ MT_Lock batIdxLock; /* lock to manipulate other indexes/properties */ + MT_Sema imprsema; /* semaphore to synchronize imprints creation */ Heap *oldtail; /* old tail heap, to be destroyed after commit */ } BAT; diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -209,6 +209,7 @@ VIEWcreate(oid seq, BAT *b, BUN l, BUN h MT_lock_destroy(&bn->theaplock); MT_lock_destroy(&bn->batIdxLock); MT_rwlock_destroy(&bn->thashlock); + MT_sema_destroy(&bn->imprsema); GDKfree(bn); return NULL; } diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -144,6 +144,8 @@ BATcreatedesc(oid hseq, int tt, bool hea MT_lock_init(&bn->batIdxLock, name); snprintf(name, sizeof(name), "hashlock%d", bn->batCacheid); /* fits */ MT_rwlock_init(&bn->thashlock, name); + snprintf(name, sizeof(name), "imprsema%d", bn->batCacheid); /* fits */ + MT_sema_init(&bn->imprsema, 1, name); return bn; } @@ -715,6 +717,7 @@ BATdestroy(BAT *b) MT_lock_destroy(&b->theaplock); MT_lock_destroy(&b->batIdxLock); MT_rwlock_destroy(&b->thashlock); + MT_sema_destroy(&b->imprsema); if (b->theap) { GDKfree(b->theap); } @@ -1200,6 +1203,9 @@ BUNappendmulti(BAT *b, const void *value maxvalp = t; } } + } else { + b->tnil = true; + b->tnonil = false; } p++; } @@ -1219,6 +1225,8
MonetDB: resource_management - use freelist for smaller than BLO...
Changeset: bb8f7a06aa70 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bb8f7a06aa70 Modified Files: gdk/gdk.h gdk/gdk_utils.c monetdb5/mal/mal_instruction.c Branch: resource_management Log Message: use freelist for smaller than BLOCK_SIZE objects diffs (223 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -604,6 +604,7 @@ typedef struct allocator { size_t used;/* memory used in last block */ size_t usedmem; /* used memory */ void *freelist; /* list of freed objects */ + void *freelist_blks;/* list of freed blks */ size_t tmp_used; /* keeps total of tmp allocated bytes */ bool tmp_active; /* currently only one level of temp usage */ @@ -622,6 +623,7 @@ gdk_export char *sa_strconcat( allocator gdk_export size_t sa_size( allocator *sa ); gdk_export void sa_open( allocator *sa ); /* open new frame of tempory allocations */ gdk_export void sa_close( allocator *sa ); /* close temporary frame, reset to old state */ +gdk_export void sa_free( allocator *sa, void *); #define ma_create(pa) sa_create(pa) #define ma_destroy(ma) sa_destroy(ma) diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2094,9 +2094,36 @@ sa_destroy_freelist( freed_t *f ) } static void -sa_free(allocator *pa, void *blk) +sa_free_obj(allocator *pa, void *obj) { - assert(!pa->pa); + assert(!pa->pa); // why ? + size_t sz = GDKmallocated(obj); + assert(sz < SA_BLOCK_SIZE); + size_t i; + + // find the block this objects belongs + for(i = 0; i < pa->nr; i++) { + if (((char *) obj >= (char *) pa->blks[i]) && ((char *)obj < (char *) pa->blks[i] + + SA_BLOCK_SIZE)) + break; + } + assert (i < pa->nr); + if (i >= pa->nr) { + // obj does not beong to any + // block in this allocator + return; + } + // put on the freelist + freed_t *f = obj; + f->n = pa->freelist; + f->sz = sz; + pa->freelist = f; +} + +static void +sa_free_blk(allocator *pa, void *blk) +{ + assert(!pa->pa); // why ? size_t i; for(i = 0; i < pa->nr; i++) { @@ -2104,6 +2131,10 @@ sa_free(allocator *pa, void *blk) break; } assert (i < pa->nr); + if (i >= pa->nr) { + // blk does not belong to this allocator + return; + } for (; i < pa->nr-1; i++) pa->blks[i] = pa->blks[i+1]; pa->nr--; @@ -2114,21 +2145,57 @@ sa_free(allocator *pa, void *blk) GDKfree(blk); } else { freed_t *f = blk; - f->n = pa->freelist; + f->n = pa->freelist_blks; f->sz = sz; - pa->freelist = f; + pa->freelist_blks = f; } } + +/* + * Returns first suitable block for the size + */ +static void * +sa_use_freed_obj(allocator *pa, size_t sz) +{ + freed_t *prev = NULL; + freed_t *curr = pa->freelist; + while(curr) { + if (sz <= curr->sz) { + if (prev) { + prev->n = curr->n; + } else { + pa->freelist = curr->n; + } + return curr; + } else { + prev = curr; + curr = curr->n; + } + } + return NULL; +} + +static void * +sa_use_freed_blk(allocator *pa) +{ + if (pa->freelist_blks) { + freed_t *f = pa->freelist_blks; + pa->freelist_blks = f->n; + return f; + } + return NULL; +} + static void * sa_use_freed(allocator *pa, size_t sz) { - (void)sz; - - freed_t *f = pa->freelist; - pa->freelist = f->n; - return f; + if (sz < SA_BLOCK_SIZE && pa->freelist) + return sa_use_freed_obj(pa, sz); + if (sz <= SA_BLOCK_SIZE && pa->freelist_blks) + return sa_use_freed_blk(pa); + return NULL; } allocator * @@ -2143,6 +2210,7 @@ sa_create(allocator *pa) sa->nr = 1; sa->blks = pa?(char**)sa_alloc(pa, sizeof(char*) * sa->size):(char**)GDKmalloc(sizeof(char*) * sa->size); sa->freelist = NULL; + sa->freelist_blks = NULL; if (sa->blks == NULL) { if (!pa) GDKfree(sa); @@ -2167,11 +2235,11 @@ allocator *sa_reset( allocator *sa ) { size_t i ; - for (i = 1; inr; i++) { + for (i = 1; i < sa->nr; i++) { if (!sa->pa) GDKfree(sa->blks[i]); else - sa_free(sa->pa, sa->blks[i]); + sa_free_blk(sa->pa, sa->blks[i]); }
MonetDB: resource_management - merge default
Changeset: 82b748170bbe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/82b748170bbe Modified Files: clients/Tests/exports.stable.out gdk/gdk.h monetdb5/extras/rapi/rapi.c monetdb5/mal/mal.h monetdb5/mal/mal_function.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_parser.c monetdb5/mal/mal_session.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/remote.c monetdb5/optimizer/opt_coercion.c monetdb5/optimizer/opt_commonTerms.c monetdb5/optimizer/opt_constants.c monetdb5/optimizer/opt_costModel.c monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_deadcode.c monetdb5/optimizer/opt_emptybind.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_inline.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_mitosis.c monetdb5/optimizer/opt_projectionpath.c monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_remap.c monetdb5/optimizer/opt_reorder.c monetdb5/optimizer/opt_support.h sql/backends/monet5/generator/generator.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/server/rel_optimizer.c sql/server/sql_var.c sql/storage/bat/bat_storage.c sql/storage/store.c Branch: resource_management Log Message: merge default diffs (truncated from 21312 to 300 lines): diff --git a/.hgeol b/.hgeol --- a/.hgeol +++ b/.hgeol @@ -13,8 +13,10 @@ **.gz = BIN **.ico = BIN **.jpg = BIN +**.lz4 = BIN **.pdf = BIN **.png = BIN +**.xz = BIN **.zip = BIN # all the rest is text diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ monetdb_default_compiler_options() include(monetdb-defines) -# required for symbol existance tests +# required for symbol existence tests if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-D_XOPEN_SOURCE -D_GNU_SOURCE) set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -36,7 +36,7 @@ # for Enterprise Linux (EPEL) repository is not available, you can # disable its use by providing rpmbuild or mock with the "--without # epel" option. -# If the EPEL repository is availabe, or if building for Fedora, most +# If the EPEL repository is available, or if building for Fedora, most # optional sub packages can be built. We indicate that here by # setting the macro fedpkgs to 1. If the EPEL repository is not # available and we are not building for Fedora, we set fedpkgs to 0. @@ -815,7 +815,6 @@ developer, but if you do want to test, t %files testing-python %defattr(-,root,root) -%{_bindir}/Mconvert.py %{_bindir}/Mtest.py %{_bindir}/Mz.py %{_bindir}/mktest.py @@ -976,6 +975,7 @@ fi rm "${RPM_BUILD_ROOT}"%{_bindir}/{M{convert.py,test.py,z.py},bincopydata,example_proxy,m{alsample.pl,client,ktest.py,onetdb{,d},s{erver5,qldump},urltest},s{ample{0,1,4},hutdowntest,mack0{0,1},ql{logictest.py,sample.p{hp,l}},treamcat},testcondvar} rm -r "${RPM_BUILD_ROOT}"%{_datadir}/doc/MonetDB* rm "${RPM_BUILD_ROOT}"%{_datadir}/selinux/*/monetdb.pp +rm -r "${RPM_BUILD_ROOT}"%{_datadir}/monetdb rm -r "${RPM_BUILD_ROOT}"%{_includedir}/monetdb rm "${RPM_BUILD_ROOT}"%{_libdir}/*.so "${RPM_BUILD_ROOT}"%{_libdir}/libmonetdbe.so.* rm -r "${RPM_BUILD_ROOT}"%{_libdir}/pkgconfig diff --git a/clients/ChangeLog-Archive b/clients/ChangeLog-Archive --- a/clients/ChangeLog-Archive +++ b/clients/ChangeLog-Archive @@ -242,7 +242,7 @@ - The tool mnc was removed from installations * Wed Nov 7 2012 Sjoerd Mullender - 11.15.1-20130212 -- msqldump: Implmented an option (--table/-t) to dump a single table. +- msqldump: Implemented an option (--table/-t) to dump a single table. - Changed msqdump's trace option to be in line with mclient. In both cases, the long option is --Xdebug and the short option is -X. @@ -251,7 +251,7 @@ * Thu Jul 19 2012 Gijs Molenaar - 11.13.1-20121010 - all strings returned by python2 are unicode, removed use_unicode option -- python2 and 3 type convertion speed improvements +- python2 and 3 type conversion speed improvements - python2 uses new styl objects now (bug #3104) - split python2 and python3 @@ -260,7 +260,7 @@ returned by the SQL-server. * Fri Jun 29 2012 Sjoerd Mullender - 11.11.1-20120706 -- ODBC: Fixed a bug where SQLNativeSql expected a statment handle instead +- ODBC: Fixed a bug where SQLNativeSql expected a statement handle instead of a connection handle. * Wed May 23 2012 Fabian Groffen - 11.9.7-20120607 @@ -411,7 +411,7 @@ * Mon Apr 18 2011 Fabian Groffe
MonetDB: resource_management - merge with default
Changeset: fa37c78ca7db for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/fa37c78ca7db Branch: resource_management Log Message: merge with default diffs (truncated from 4265 to 300 lines): diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -8,9 +8,9 @@ # Copyright August 2008 - 2023 MonetDB B.V.; # Copyright 1997 - July 2008 CWI. -# python mksqlwxs.py VERSION BITS PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs -# "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs -# "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB5-SQL-Installer.wixobj +# python mksqlwxs.py VERSION BITS PREFIX > PREFIX/MonetDB-SQL-Installer.wxs +# "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-SQL-Installer.wxs +# "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB-SQL-Installer.wixobj import sys, os @@ -76,8 +76,8 @@ def main(): pyapi3 = [] print(r'') print(r'http://schemas.microsoft.com/wix/2006/wi";>') -print(r' '.format(upgradecode[arch], version)) -print(r''.format(arch)) +print(r' '.format(upgradecode[arch], version)) +print(r''.format(arch)) print(r''.format(geomupgradecode[arch])) # up to and including 11.29.3, the geom module can not be # uninstalled if MonetDB/SQL is not installed; this somehow also @@ -123,7 +123,7 @@ def main(): print(r'') print(r' '.format(geomupgradecode[arch])) print(r'') -print(r'') +print(r'') print(r' NOT OLDGEOMINSTALLED') print(r'') print(r'') @@ -140,7 +140,7 @@ def main(): print(r' '.format(msvc, d, fn)) print(r' '.format(folder)) print(r'') -print(r' ') +print(r' ') print(r'') print(r' ') print(r'') diff --git a/clients/mapilib/Tests/tlssecurity.py b/clients/mapilib/Tests/tlssecurity.py --- a/clients/mapilib/Tests/tlssecurity.py +++ b/clients/mapilib/Tests/tlssecurity.py @@ -24,7 +24,7 @@ if sys.platform == 'win32': log_level=logging.DEBUG if '-v' in sys.argv: log_level = logging.DEBUG -#level = logging.DEBUG +# log_level = logging.DEBUG logging.basicConfig(level=log_level,format=log_format) @@ -49,10 +49,14 @@ def attempt(experiment: str, portname: s url += '?' + '&'.join(f"{k}={v}" for k, v in params.items()) logging.debug(f" START TEST {experiment}") logging.debug(f"Connecting to {url}, expected_error={expected_error_regex}") -cmd = ['mclient', '-d', url] +test_log_file = os.path.join(scratchdir, portname + '.log') +cmd = ['mclient', '-d', url, '-L', test_log_file] logging.debug(f"cmd={cmd}") proc = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) logging.debug(f"mclient exited with code {proc.returncode}, err={proc.stderr}") +with open(test_log_file, 'r') as f: +for line in f: +logging.debug(f'mclient log: {line.rstrip()}') if proc.returncode != 2: msg = str(proc.stderr, 'utf-8') print(f"mclient is supposed to exit with status 2, not {proc.returncode}.\n--- stderr ---\n{msg}\n---end stderr ---", file=sys.stderr) diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -616,6 +616,7 @@ NAME##_##TYPE(BATiter *bi, struct candit if (!li) { \ /* open range on left */\ if (vl == MAXVALUE##TYPE) { \ + *algo = "select: empty range"; \ return 0; \ } \ /* vl < x === vl+1 <= x */ \ @@ -633,6 +634,7 @@ NAME##_##TYPE(BATiter *bi, struct candit if (!hi) { \ /* open range on right */ \ if (vh == MINVALUE##TYPE) { \ + *algo = "select: empty range"; \ return 0; \ } \ /* x < vh === x <= vh-1 */ \ @@ -646,6 +648,7 @@ NAME##_##TYPE(BATiter *bi, struct candit hval = true;\ } \ if (vl > vh) {
MonetDB: resource_management - small fix
Changeset: a2272830d4b8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a2272830d4b8 Modified Files: monetdb5/optimizer/opt_mergetable.c Branch: resource_management Log Message: small fix diffs (19 lines): 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 @@ -2276,13 +2276,13 @@ OPTmergetableImplementation(Client cntxt char *group_input; str msg = MAL_SUCCEED; + ma_open(cntxt->ta); + if (isOptimizerUsed(mb, pci, mitosisRef) <= 0) goto cleanup2; old = mb->stmt; oldtop = mb->stop; - ma_open(cntxt->ta); - vars = (int *) ma_alloc(cntxt->ta, sizeof(int) * mb->vtop); //maxvars = mb->vtop; group_input = (char *) ma_alloc(cntxt->ta, sizeof(char) * mb->vtop); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: 9556ac2e8241 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9556ac2e8241 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h monetdb5/extras/rapi/rapi.c monetdb5/mal/mal_instruction.c monetdb5/optimizer/opt_pushselect.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_scenario.c sql/server/rel_basetable.c sql/server/sql_parser.y sql/storage/bat/bat_storage.c sql/storage/store.c sql/test/Tests/sessioncontrol.test Branch: resource_management Log Message: merge with default diffs (truncated from 22926 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -830,3 +830,6 @@ 9a694c41042503a22d6c92aeab5bc4ca1912b62e e1e9e22bf3d734dc50b56151c657a57c18f56561 Aug2024_root cde7d8f7c99540a8c95856df052a9f123b0c1643 Dec2023_11 cde7d8f7c99540a8c95856df052a9f123b0c1643 Dec2023_SP4_release +ae474f7fda0a3f2ebefc6c0b2cd969ef0854fad1 Aug2024_1 +dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_3 +dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_release diff --git a/ChangeLog-Archive b/ChangeLog-Archive --- a/ChangeLog-Archive +++ b/ChangeLog-Archive @@ -1,6 +1,24 @@ # DO NOT EDIT THIS FILE -- MAINTAINED AUTOMATICALLY # This file contains past ChangeLog entries +* Tue Aug 6 2024 Sjoerd Mullender - 11.51.1-20240812 +- The CMake configuration files for building extensions have now been + included in the various MonetDB development RPMs and debs. + +* Tue Jun 25 2024 Sjoerd Mullender - 11.51.1-20240812 +- Removed upgrade code for versions before Jul2021. + +* Wed May 8 2024 Sjoerd Mullender - 11.51.1-20240812 +- The shared library (.dll aka .so files) now have the version number + as part of the name. This should allow the building of compatibility + versions that can be installed in parallel to the latest version. +- Some of the Debian/Ubuntu packages have been renamed. The old monetdb5 + names have been changed to plain monetdb, and libmonetdb5-server-* + packages have been renamed monetdb-*. +- The names of some of the provided RPM files have been changed. + References to the old MonetDB5 name have been removed. All packages + are now just MonetDB. + * Thu Jan 11 2024 Sjoerd Mullender - 11.49.3-20240304 - The copyright for the MonetDB software has been transferred to the newly established MonetDB Foundation, a not-for-profit foundation with the diff --git a/ChangeLog.Aug2024 b/ChangeLog.Aug2024 --- a/ChangeLog.Aug2024 +++ b/ChangeLog.Aug2024 @@ -1,17 +1,3 @@ # ChangeLog file for devel # This file is updated with Maddlog -* Tue Jun 25 2024 Sjoerd Mullender -- Removed upgrade code for versions before Jul2021. - -* Wed May 8 2024 Sjoerd Mullender -- The shared library (.dll aka .so files) now have the version number - as part of the name. This should allow the building of compatibility - versions that can be installed in parallel to the latest version. -- Some of the Debian/Ubuntu packages have been renamed. The old monetdb5 - names have been changed to plain monetdb, and libmonetdb5-server-* - packages have been renamed monetdb-*. -- The names of some of the provided RPM files have been changed. - References to the old MonetDB5 name have been removed. All packages - are now just MonetDB. - diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023 deleted file mode 100644 --- a/ChangeLog.Dec2023 +++ /dev/null @@ -1,7 +0,0 @@ -# ChangeLog file for devel -# This file is updated with Maddlog - -* Tue Aug 6 2024 Sjoerd Mullender -- The CMake configuration files for building extensions have now been - included in the various MonetDB development RPMs and debs. - 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/Dec2023-SP4/MonetDB-%{version}.tar.bz2 +Source: https://www.monetdb.org/downloads/sources/Aug2024/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 @@ -711,6 +711,9 @@ Group: Applications/Databases Requires: %{name}-SQL%{?_isa} = %{version}-%{release} Requires: %{name}-server-devel%{?_isa} = %{version}-%{release} Requires: %{name}-embedded-devel%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-SQL-server5-devel < 11.50.0 +Provides: %{name}-SQL-server5-devel = %{version}-%{release} +Provides: %{name}-SQL-server5-devel%{?_isa} = %{version}-%{release} %description SQL-devel MonetDB is a database management system that is developed from a @@ -986,6 +989,267 @@ rm "${RPM_BUILD_ROOT}"%{_unitdir}/monetd %endif %changelog +* Mon Aug 19 2024 Sjoerd Mullender - 11.51.3-20240819 +- Rebuilt. +- GH#7562: Assertion failure when comparing `INTERVAL` value +- GH#7566:
MonetDB: resource_management - experiment with potential BM slow...
Changeset: f10878869fa7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f10878869fa7 Modified Files: gdk/gdk_utils.c Branch: resource_management Log Message: experiment with potential BM slowness diffs (26 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2328,13 +2328,13 @@ sa_close( allocator *sa ) { assert(sa->tmp_active); sa->tmp_active = 0; - sa_reset(sa); - //while (sa->tmp_used) { - // assert(sa->used >= sa->tmp_used); - // if (sa->used >= sa->tmp_used) { - // sa->used -= sa->tmp_used; - // sa->usedmem -= sa->tmp_used; - // sa->tmp_used = 0; - // } - //} + //sa_reset(sa); + while (sa->tmp_used) { + assert(sa->used >= sa->tmp_used); + if (sa->used >= sa->tmp_used) { + sa->used -= sa->tmp_used; + sa->usedmem -= sa->tmp_used; + sa->tmp_used = 0; + } + } } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: d086133190d6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d086133190d6 Modified Files: clients/Tests/exports.stable.out gdk/gdk_batop.c monetdb5/mal/mal_client.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_session.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_remap.c monetdb5/optimizer/opt_support.h sql/backends/monet5/sql.c Branch: resource_management Log Message: merge with default diffs (truncated from 1710 to 300 lines): diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023 --- a/ChangeLog.Dec2023 +++ b/ChangeLog.Dec2023 @@ -1,3 +1,7 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Tue Aug 6 2024 Sjoerd Mullender +- The CMake configuration files for building extensions have now been + included in the various MonetDB development RPMs and debs. + diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -211,6 +211,12 @@ functionality of MonetDB. %{_includedir}/monetdb/monet*.h %{_libdir}/libbat*.so %{_libdir}/pkgconfig/monetdb-gdk.pc +%dir %{_datadir}/monetdb +%dir %{_datadir}/monetdb/cmake +%{_datadir}/monetdb/cmake/gdkTargets*.cmake +%{_datadir}/monetdb/cmake/matomicTargets.cmake +%{_datadir}/monetdb/cmake/mstringTargets.cmake +%{_datadir}/monetdb/cmake/monetdb_config_headerTargets.cmake %endif %package stream @@ -258,6 +264,7 @@ library. %{_includedir}/monetdb/stream.h %{_includedir}/monetdb/stream_socket.h %{_libdir}/pkgconfig/monetdb-stream.pc +%{_datadir}/monetdb/cmake/streamTargets*.cmake %endif %package client-lib @@ -338,6 +345,7 @@ This package contains the files needed t %{_includedir}/monetdb/mapi*.h %{_includedir}/monetdb/msettings.h %{_libdir}/pkgconfig/monetdb-mapi.pc +%{_datadir}/monetdb/cmake/mapiTargets*.cmake %endif %if %{without compat} @@ -644,6 +652,7 @@ used from the MAL level. %{_includedir}/monetdb/mel.h %{_libdir}/libmonetdb5*.so %{_libdir}/pkgconfig/monetdb5.pc +%{_datadir}/monetdb/cmake/monetdb5Targets*.cmake %endif %package SQL @@ -701,6 +710,7 @@ Summary: MonetDB SQL server modules deve Group: Applications/Databases Requires: %{name}-SQL%{?_isa} = %{version}-%{release} Requires: %{name}-server-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-embedded-devel%{?_isa} = %{version}-%{release} %description SQL-devel MonetDB is a database management system that is developed from a @@ -716,6 +726,8 @@ This package contains files needed to de %{_includedir}/monetdb/rel_*.h %{_includedir}/monetdb/sql*.h %{_includedir}/monetdb/store_*.h +%{_datadir}/monetdb/cmake/MonetDBConfig*.cmake +%{_datadir}/monetdb/cmake/sqlTargets*.cmake %endif %if %{without compat} @@ -759,6 +771,7 @@ program that uses MonetDB as an embeddab %{_libdir}/libmonetdbe.so %{_includedir}/monetdb/monetdbe.h %{_libdir}/pkgconfig/monetdbe.pc +%{_datadir}/monetdb/cmake/monetdbeTargets*.cmake %package embedded-tests Summary: MonetDBe tests package @@ -938,7 +951,6 @@ rm -f "${RPM_BUILD_ROOT}"%{_libdir}/mone rm -f "${RPM_BUILD_ROOT}"%{_libdir}/monetdb5*/lib_microbenchmark*.so rm -f "${RPM_BUILD_ROOT}"%{_libdir}/monetdb5*/lib_udf*.so rm -f "${RPM_BUILD_ROOT}"%{_bindir}/monetdb_mtest.sh -rm -rf "${RPM_BUILD_ROOT}"%{_datadir}/monetdb # /cmake if [ -x /usr/sbin/hardlink ]; then /usr/sbin/hardlink -cv "${RPM_BUILD_ROOT}"%{_datadir}/selinux 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 @@ -1325,6 +1325,7 @@ void trimMalVariables(MalBlkPtr mb, MalS void trimMalVariables_(MalBlkPtr mb, MalStkPtr glb); void typeChecker(Module scope, MalBlkPtr mb, InstrPtr p, int p_idx, int silent); const char *umaskRef; +const char *unionfuncRef; const char *uniqueRef; const char *unlockRef; const char *updateRef; diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2251,14 +2251,10 @@ dump_table(Mapi mid, const char *schema, goto doreturn; } for (int64_t i = 0; i < rows; i++) { - if (mapi_fetch_row(hdl) == 0) { - mapi_close_handle(hdl); - fprintf(stderr, "unexepcted error\n"); - goto doreturn; - } - tables[i].schema = strdup(mapi_fetch_field(hdl, 0)); - tables[i].table = strdup(mapi_fetch_field(hdl, 1)); - if (tables[i].schema == NULL || tables[i].table == NULL) { + tables[i].schema = tables[i].table = NULL; + if (mapi_fetch_row(hdl) == 0 || + (t
MonetDB: resource_management - patch mssing allocations in opt_m...
Changeset: d5c9d44569af for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d5c9d44569af Modified Files: monetdb5/optimizer/opt_mergetable.c Branch: resource_management Log Message: patch mssing allocations in opt_mergetable diffs (truncated from 360 to 300 lines): 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 @@ -195,7 +195,7 @@ mat_pack(MalBlkPtr mb, matlist_t *ml, in } static int -checksize(matlist_t *ml, int v) +checksize(Client c, matlist_t *ml, int v) { if (v >= ml->vsize) { int sz = ml->vsize, i, *nhorigin, *ntorigin, *nvars; @@ -204,15 +204,15 @@ checksize(matlist_t *ml, int v) assert(v < nvsize); if (v >= nvsize) nvsize = v + 10; - nhorigin = (int *) GDKrealloc(ml->horigin, sizeof(int) * nvsize); + nhorigin = (int *) MA_RENEW_ARRAY(c->ta, int, ml->horigin, nvsize, sz); if (nhorigin == NULL) return -1; ml->horigin = nhorigin; - ntorigin = (int *) GDKrealloc(ml->torigin, sizeof(int) * nvsize); + ntorigin = (int *) MA_RENEW_ARRAY(c->ta, int, ml->torigin, nvsize, sz); if (ntorigin == NULL) return -1; ml->torigin = ntorigin; - nvars = (int *) GDKrealloc(ml->vars, sizeof(int) * nvsize); + nvars = (int *) MA_RENEW_ARRAY(c->ta, int, ml->vars, nvsize, sz); if (nvars == NULL) return -1; ml->vars = nvars; @@ -227,11 +227,11 @@ checksize(matlist_t *ml, int v) } static int -setPartnr(matlist_t *ml, int ivar, int ovar, int pnr) +setPartnr(Client c, matlist_t *ml, int ivar, int ovar, int pnr) { int tpnr = -1; - if (checksize(ml, ivar) || checksize(ml, ovar)) + if (checksize(c, ml, ivar) || checksize(c, ml, ovar)) return -1; if (ivar >= 0) tpnr = ml->torigin[ivar]; @@ -244,12 +244,12 @@ setPartnr(matlist_t *ml, int ivar, int o } static int -propagatePartnr(matlist_t *ml, int ivar, int ovar, int pnr) +propagatePartnr(Client c, matlist_t *ml, int ivar, int ovar, int pnr) { /* prop head ids to tail */ int tpnr = -1; - if (checksize(ml, ivar) || checksize(ml, ovar)) + if (checksize(c, ml, ivar) || checksize(c, ml, ovar)) return -1; if (ivar >= 0) tpnr = ml->horigin[ivar]; @@ -262,12 +262,12 @@ propagatePartnr(matlist_t *ml, int ivar, } static int -propagateMirror(matlist_t *ml, int ivar, int ovar) +propagateMirror(Client c, matlist_t *ml, int ivar, int ovar) { /* prop head ids to head and tail */ int tpnr; - if (checksize(ml, ivar) || checksize(ml, ovar)) + if (checksize(c, ml, ivar) || checksize(c, ml, ovar)) return -1; tpnr = ml->horigin[ivar]; if (tpnr >= 0) { @@ -279,11 +279,11 @@ propagateMirror(matlist_t *ml, int ivar, } static int -overlap(matlist_t *ml, int lv, int rv, int lnr, int rnr, int ontails) +overlap(Client c, matlist_t *ml, int lv, int rv, int lnr, int rnr, int ontails) { int lpnr, rpnr; - if (checksize(ml, lv) || checksize(ml, rv)) + if (checksize(c, ml, lv) || checksize(c, ml, rv)) return -1; lpnr = ml->torigin[lv]; rpnr = (ontails) ? ml->torigin[rv] : ml->horigin[rv]; @@ -298,15 +298,15 @@ overlap(matlist_t *ml, int lv, int rv, i } static int -mat_set_prop(matlist_t *ml, MalBlkPtr mb, InstrPtr p) +mat_set_prop(Client c, matlist_t *ml, MalBlkPtr mb, InstrPtr p) { int k, tpe = getArgType(mb, p, 0); tpe = getBatType(tpe); for (k = 1; k < p->argc; k++) { - if (setPartnr(ml, -1, getArg(p, k), k)) + if (setPartnr(c, ml, -1, getArg(p, k), k)) return -1; - if (tpe == TYPE_oid && propagateMirror(ml, getArg(p, k), getArg(p, k))) + if (tpe == TYPE_oid && propagateMirror(c, ml, getArg(p, k), getArg(p, k))) return -1; } return 0; @@ -334,7 +334,7 @@ mat_delta(Client c, matlist_t *ml, MalBl for (k = 1; k < mat[e].mi->argc; k++) { for (j = 1; j < mat[m].mi->argc; j++) { InstrPtr q; - switch (overlap(ml, getArg(mat[e].mi, k), getArg(mat[m].mi, j), k, j, 0)) { + switch (overlap(c, ml, getArg(mat[e].mi, k), getArg(mat[m].mi, j), k, j, 0)) { case 0: continue; case -1: @@ -355,7 +355,7 @@ mat_delta(Client c, matlist_t *ml, MalBl freeInstruction(r);
MonetDB: resource_management - use allocator in opt_pipes
Changeset: 6f2783323ed8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6f2783323ed8 Modified Files: gdk/gdk.h monetdb5/optimizer/opt_pipes.c Branch: resource_management Log Message: use allocator in opt_pipes diffs (67 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -636,6 +636,7 @@ gdk_export void sa_close( allocator *sa #define MA_ZNEW_ARRAY( sa, type, size ) (type*)sa_zalloc( sa, ((size)*sizeof(type))) #define MA_RENEW_ARRAY( sa, type, ptr, sz, osz ) (type*)sa_realloc( sa, ptr, ((sz)*sizeof(type)), ((osz)*sizeof(type))) #define MA_STRDUP( sa, s) sa_strdup(sa, s) +#define MA_STRNDUP( sa, s, l) sa_strndup(sa, s, l) #if !defined(NDEBUG) && !defined(__COVERITY__) && defined(__GNUC__) diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -306,10 +306,11 @@ addPipeDefinition(Client cntxt, const ch SQLSTATE(42000) "No overwrite of built in allowed"); } + ma_open(cntxt->ta); /* save old value */ oldpipe = pipes[i]; pipes[i] = (struct pipeline) { - .name = GDKstrdup(name), + .name = MA_STRDUP(cntxt->ta, name), }; if (pipes[i].name == NULL) goto bailout; @@ -318,7 +319,7 @@ addPipeDefinition(Client cntxt, const ch p++; n++; } - if ((pipes[i].def = GDKmalloc(n * sizeof(char *))) == NULL) + if ((pipes[i].def = ma_alloc(cntxt->ta, n * sizeof(char *))) == NULL) goto bailout; n = 0; while ((p = strchr(pipe, ';')) != NULL) { @@ -333,7 +334,7 @@ addPipeDefinition(Client cntxt, const ch goto bailout; } if (q > pipe) { - if ((pipes[i].def[n++] = GDKstrndup(pipe, q - pipe)) == NULL) + if ((pipes[i].def[n++] = MA_STRNDUP(cntxt->ta, pipe, q - pipe)) == NULL) goto bailout; } pipe = p + 1; @@ -353,14 +354,16 @@ addPipeDefinition(Client cntxt, const ch for (n = 0; oldpipe.def[n]; n++) GDKfree(oldpipe.def[n]); GDKfree(oldpipe.def); + ma_close(cntxt->ta); return msg; bailout: - GDKfree(pipes[i].name); - if (pipes[i].def) - for (n = 0; pipes[i].def[n]; n++) - GDKfree(pipes[i].def[n]); - GDKfree(pipes[i].def); + //GDKfree(pipes[i].name); + //if (pipes[i].def) + // for (n = 0; pipes[i].def[n]; n++) + // GDKfree(pipes[i].def[n]); + //GDKfree(pipes[i].def); + ma_close(cntxt->ta); pipes[i] = oldpipe; MT_lock_unset(&pipeLock); if (msg) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - use tmp allocator in mergetable o...
Changeset: 3e0c978b0eaf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3e0c978b0eaf Modified Files: gdk/gdk_utils.c monetdb5/optimizer/opt_mergetable.c Branch: resource_management Log Message: use tmp allocator in mergetable optimizer diffs (truncated from 756 to 300 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2328,12 +2328,13 @@ sa_close( allocator *sa ) { assert(sa->tmp_active); sa->tmp_active = 0; - while (sa->tmp_used) { - assert(sa->used >= sa->tmp_used); - if (sa->used >= sa->tmp_used) { - sa->used -= sa->tmp_used; - sa->usedmem -= sa->tmp_used; - sa->tmp_used = 0; - } - } + sa_reset(sa); + //while (sa->tmp_used) { + // assert(sa->used >= sa->tmp_used); + // if (sa->used >= sa->tmp_used) { + // sa->used -= sa->tmp_used; + // sa->usedmem -= sa->tmp_used; + // sa->tmp_used = 0; + // } + //} } 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 @@ -98,16 +98,16 @@ nr_of_nilbats(MalBlkPtr mb, InstrPtr p) /* some mat's have intermediates (with intermediate result variables), * therefore we pass the old output mat variable */ inline static int -mat_add_var(matlist_t *ml, InstrPtr q, InstrPtr p, int var, mat_type_t type, +mat_add_var(Client c, matlist_t *ml, InstrPtr q, InstrPtr p, int var, mat_type_t type, int inputmat, int parentmat, int pushed) { if (ml->top == ml->size) { int s = ml->size * 2; - mat_t *v = (mat_t *) GDKzalloc(s * sizeof(mat_t)); + mat_t *v = (mat_t *) ma_zalloc(c->ta, s * sizeof(mat_t)); if (!v) return -1; memcpy(v, ml->v, ml->top * sizeof(mat_t)); - GDKfree(ml->v); + // GDKfree(ml->v); ml->size = s; ml->v = v; } @@ -131,11 +131,11 @@ mat_add_var(matlist_t *ml, InstrPtr q, I } inline static int -mat_add(matlist_t *ml, InstrPtr q, mat_type_t type, const char *func) +mat_add(Client c, matlist_t *ml, InstrPtr q, mat_type_t type, const char *func) { (void) func; //printf (" ml.top %d %s\n", ml.top, func); - return mat_add_var(ml, q, NULL, getArg(q, 0), type, -1, -1, 0); + return mat_add_var(c, ml, q, NULL, getArg(q, 0), type, -1, -1, 0); } static void @@ -313,7 +313,7 @@ mat_set_prop(matlist_t *ml, MalBlkPtr mb } static InstrPtr -mat_delta(matlist_t *ml, MalBlkPtr mb, InstrPtr p, mat_t *mat, int m, int n, +mat_delta(Client c, matlist_t *ml, MalBlkPtr mb, InstrPtr p, mat_t *mat, int m, int n, int o, int e, int mvar, int nvar, int ovar, int evar) { int tpe, k, j, is_subdelta = (getFunctionId(p) == subdeltaRef), @@ -408,7 +408,7 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I r = q; } } - if (mat_add_var(ml, r, NULL, getArg(r, 0), mat_type(mat, m), -1, -1, pushed)) { + if (mat_add_var(c, ml, r, NULL, getArg(r, 0), mat_type(mat, m), -1, -1, pushed)) { freeInstruction(r); return NULL; } @@ -418,7 +418,7 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I } static InstrPtr -mat_assign(MalBlkPtr mb, InstrPtr p, matlist_t *ml) +mat_assign(Client c, MalBlkPtr mb, InstrPtr p, matlist_t *ml) { InstrPtr r = NULL; mat_t *mat = ml->v; @@ -438,7 +438,7 @@ mat_assign(MalBlkPtr mb, InstrPtr p, mat return NULL; } } - if (mat_add(ml, r, mat_none, getFunctionId(p))) { + if (mat_add(c, ml, r, mat_none, getFunctionId(p))) { freeInstruction(r); return NULL; } @@ -447,7 +447,7 @@ mat_assign(MalBlkPtr mb, InstrPtr p, mat } static int -mat_apply1(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int var) +mat_apply1(Client c, MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int var) { int tpe, k, is_select = isSelect(p), is_mirror = (getFunctionId(p) == mirrorRef); @@ -535,7 +535,7 @@ mat_apply1(MalBlkPtr mb, InstrPtr p, mat freeInstruction(r); return -1; } - if (!r || mat_add(ml, r, mat_type(ml->v, m), getFunctionId(p))) { + if (!r || mat_add(c, ml, r, mat_type(ml->v, m), getFunctionId(p))) { freeInstruction(r); return -1; } @@ -543,14 +543,14 @@ mat_apply1(MalBlkPtr mb, InstrPtr p, mat } static int -mat_apply(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int nrmats) +mat_apply(Client c, MalBlkPtr mb, InstrPtr p, ma
MonetDB: resource_management - use tmp allocator in profiler
Changeset: 2c374699cec6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c374699cec6 Modified Files: monetdb5/mal/mal_profiler.c Branch: resource_management Log Message: use tmp allocator in profiler diffs (39 lines): diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -232,7 +232,7 @@ prepareNonMalEvent(Client cntxt, enum ev } static inline str -format_val2json(const ValPtr res) +format_val2json(const Client c, const ValPtr res) { char *buf = NULL; size_t sz = 0; @@ -267,7 +267,8 @@ format_val2json(const ValPtr res) ValRecord val; /* TODO use ta */ - if (VALinit(NULL, &val, TYPE_str, buf) == NULL) { + ma_open(c->ta); + if (VALinit(c->ta, &val, TYPE_str, buf) == NULL) { GDKfree(buf); return NULL; } @@ -277,6 +278,7 @@ format_val2json(const ValPtr res) char *buf2; buf2 = VALformat(&val); VALclear(&val); + ma_close(c->ta); return buf2; } @@ -503,7 +505,7 @@ prepareMalEvent(Client cntxt, MalBlkPtr GDKfree(tname); if (!ok) goto cleanup_and_exit; - cv = format_val2json(&stk->stk[getArg(pci, j)]); + cv = format_val2json(cntxt, &stk->stk[getArg(pci, j)]); if (cv) ok = logadd(&logbuf, ",\"value\":%s", cv); GDKfree(cv); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: 8bb4a9ab371c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8bb4a9ab371c Modified Files: clients/Tests/exports.stable.out gdk/gdk_utils.c monetdb5/mal/mal_interpreter.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/remote.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/sql.c sql/backends/monet5/sql_rank.c sql/backends/monet5/sql_scenario.c sql/storage/store.c Branch: resource_management Log Message: merge with default diffs (truncated from 3662 to 300 lines): 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 @@ -46584,11 +46584,6 @@ pattern io.printf(X_0:streams, X_1:str, IOprintfStream; Select default format io -setmallocsuccesscount -command io.setmallocsuccesscount(X_0:lng):void -IOsetmallocsuccesscount; -Set number of mallocs that are allowed to succeed. -io stdin pattern io.stdin():bstream io_stdin; @@ -47362,7 +47357,7 @@ mmath atan2 command mmath.atan2(X_0:dbl, X_1:dbl):dbl MATHbinary_ATAN2dbl; -The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). +The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). mmath atan2 command mmath.atan2(X_0:flt, X_1:flt):flt @@ -47402,7 +47397,7 @@ mmath cosh command mmath.cosh(X_0:dbl):dbl MATHunary_COSHdbl; -The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. +The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. mmath cosh command mmath.cosh(X_0:flt):flt @@ -47442,7 +47437,7 @@ mmath fabs command mmath.fabs(X_0:dbl):dbl MATHunary_FABSdbl; -The fabs(x) function returns the absolute value of the @floating-point number x. +The fabs(x) function returns the absolute value of the floating-point number x. mmath finite command mmath.finite(X_0:dbl):bit @@ -47522,12 +47517,12 @@ mmath nextafter command mmath.nextafter(X_0:dbl, X_1:dbl):dbl MATHbinary_NEXTAFTERdbl; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath nextafter command mmath.nextafter(X_0:flt, X_1:flt):flt MATHbinary_NEXTAFTERflt; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath pi command mmath.pi():dbl @@ -47537,7 +47532,7 @@ mmath pow command mmath.pow(X_0:dbl, X_1:dbl):dbl MATHbinary_POWdbl; -The pow(x,y) function returns the value of x raised to the power of y. +The pow(x,y) function returns the value of x raised to the power of y. mmath pow command mmath.pow(X_0:flt, X_1:flt):flt @@ -47587,7 +47582,7 @@ mmath sinh command mmath.sinh(X_0:dbl):dbl MATHunary_SINHdbl; -The sinh() function returns the hyperbolic sine of x, which @is defined mathematically as (exp(x) - exp(-x)) / 2. +The sinh() function returns the hyperbolic sine of x, which is @defined mathematically as (exp(x) - exp(-x)) / 2. mmath sinh command mmath.sinh(X_0:flt):flt 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 @@ -35074,11 +35074,6 @@ pattern io.printf(X_0:streams, X_1:str, IOprintfStream; Select default format io -setmallocsuccesscount -command io.setmallocsuccesscount(X_0:lng):void -IOsetmallocsuccesscount; -Set number of mallocs that are allowed to succeed. -io stdin pattern io.stdin():bstream io_stdin; @@ -35832,7 +35827,7 @@ mmath atan2 command mmath.atan2(X_0:dbl, X_1:dbl):dbl MATHbinary_ATAN2dbl; -The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). +The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used
MonetDB: resource_management - merge with default'
Changeset: 29cbb3a2d07c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/29cbb3a2d07c Modified Files: gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_string.c monetdb5/mal/mal_interpreter.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/remote.c Branch: resource_management Log Message: merge with default' diffs (truncated from 1883 to 300 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -3730,8 +3730,7 @@ mapi_query_abort(MapiHdl hdl, int reason mapi_hdl_check(hdl); mid = hdl->mid; assert(mid->active == NULL || mid->active == hdl); - if (mid->oobintr && !hdl->aborted) { - mnstr_putoob(mid->to, reason); + if (mid->oobintr && !hdl->aborted && mnstr_putoob(mid->to, reason) == 0) { hdl->aborted = true; return MOK; } diff --git a/common/stream/Tests/urlstream.py b/common/stream/Tests/urlstream.py --- a/common/stream/Tests/urlstream.py +++ b/common/stream/Tests/urlstream.py @@ -9,25 +9,6 @@ import time OUTPUT = io.StringIO() -def wait_for_server(timeout): -deadline = time.time() + timeout -while time.time() < deadline: -if port == 0: -time.sleep(0.25) -continue -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.settimeout(0.1) -try: -s.connect(('localhost', port)) -break -except ConnectionRefusedError: -time.sleep(0.1) -finally: -s.close() -else: -print(f'Warning: waited {timeout} seconds for the server to start but could still not connect', file=OUTPUT) - - class Handler(http.server.BaseHTTPRequestHandler): def log_message(self, format, *args): # add a # at the beginning of the line to not mess up Mtest diffs @@ -66,19 +47,23 @@ class Handler(http.server.BaseHTTPReques self.end_headers() self.wfile.write(b'NOT FOUND\n') +b = threading.Barrier(2) + def runserver(): global port addr = ('127.0.0.1', 0) srv = http.server.HTTPServer(addr, Handler) port = srv.server_port print(f"Listening on {port}", file=OUTPUT) +b.wait() srv.serve_forever() # Start the http server port = 0 t = threading.Thread(target=lambda: runserver(), daemon=True) t.start() -wait_for_server(5.0) +# and wait for it to fill in the port +b.wait() url = f'http://localhost:{port}' diff --git a/common/stream/socket_stream.c b/common/stream/socket_stream.c --- a/common/stream/socket_stream.c +++ b/common/stream/socket_stream.c @@ -18,11 +18,160 @@ #ifdef HAVE_SYS_TIME_H #include #endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif /* -- */ /* streams working on a socket */ +static int +socket_getoob(const stream *s) +{ + SOCKET fd = s->stream_data.s; +#ifdef HAVE_POLL + struct pollfd pfd = (struct pollfd) { + .fd = fd, + .events = POLLPRI, + }; + if (poll(&pfd, 1, 0) > 0) +#else + fd_set fds; + struct timeval t = (struct timeval) { + .tv_sec = 0, + .tv_usec = 0, + }; +#ifdef FD_SETSIZE + if (fd >= FD_SETSIZE) + return 0; +#endif + FD_ZERO(&fds); + FD_SET(fd, &fds); + if (select( +#ifdef _MSC_VER + 0, /* ignored on Windows */ +#else + fd + 1, +#endif + NULL, NULL, &fds, &t) > 0) +#endif + { +#ifdef HAVE_POLL + if (pfd.revents & (POLLHUP | POLLNVAL)) + return -1; + if ((pfd.revents & POLLPRI) == 0) + return -1; +#else + if (!FD_ISSET(fd, &fds)) + return 0; +#endif + /* discard regular data until OOB mark */ + for (;;) { + int atmark = 0; + char flush[100]; + if (ioctlsocket(fd, SIOCATMARK, &atmark) < 0) { + perror("ioctl"); + break; + } + if (atmark) + break; + if (recv(fd, flush, sizeof(flush), 0) < 0) { + perror("recv"); + break; + } + } + char b = 0; + switch (recv(fd, &b, 1, MSG_OOB)) { + case 0: + /* unexpectedly didn't receive a byte */ + break; + case 1: + return b; + case -1: + perror("recv OOB"); + return -1; + } + } + return 0; +} + +stati
MonetDB: resource_management - revert multiple of block size all...
Changeset: 1421bc899b97 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1421bc899b97 Modified Files: gdk/gdk_utils.c Branch: resource_management Log Message: revert multiple of block size allocations diffs (20 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2234,12 +2234,13 @@ sa_alloc( allocator *sa, size_t sz ) // assert(0); if (sz > (SA_BLOCK_SIZE - sa->used)) { if (sa->pa) - r = (char*)sa_alloc(sa->pa, sz); + r = (char*)sa_alloc(sa->pa, sz > SA_BLOCK_SIZE ? + sz : SA_BLOCK_SIZE); else if (sz <= SA_BLOCK_SIZE && sa->freelist) { r = sa_use_freed(sa, SA_BLOCK_SIZE); } else { - sz = round_block_size(sz); - r = GDKmalloc(sz); + r = GDKmalloc(sz > SA_BLOCK_SIZE ? + sz : SA_BLOCK_SIZE); } if (r == NULL) { if (sa->eb.enabled) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - fix block size rounding
Changeset: 8493b8dc16a0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8493b8dc16a0 Modified Files: gdk/gdk_utils.c Branch: resource_management Log Message: fix block size rounding diffs (30 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2223,7 +2223,7 @@ sa_realloc( allocator *sa, void *p, size } #define round16(sz) ((sz+15)&~15) -#define round_block_size(sz) ((sz+SA_BLOCK_SIZE)&~SA_BLOCK_SIZE) +#define round_block_size(sz) ((sz + (SA_BLOCK_SIZE - 1))&~(SA_BLOCK_SIZE - 1)) void * sa_alloc( allocator *sa, size_t sz ) { @@ -2233,13 +2233,14 @@ sa_alloc( allocator *sa, size_t sz ) //if (sa->tmp_active && sz >= SA_BLOCK_SIZE) // assert(0); if (sz > (SA_BLOCK_SIZE - sa->used)) { - sz = round_block_size(sz); if (sa->pa) r = (char*)sa_alloc(sa->pa, sz); - else if (sz == SA_BLOCK_SIZE && sa->freelist) { + else if (sz <= SA_BLOCK_SIZE && sa->freelist) { r = sa_use_freed(sa, SA_BLOCK_SIZE); - } else + } else { + sz = round_block_size(sz); r = GDKmalloc(sz); + } if (r == NULL) { if (sa->eb.enabled) eb_error(&sa->eb, "out of memory", 1000); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - allocate multiple of block size
Changeset: 3bb8e66afa0e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3bb8e66afa0e Modified Files: gdk/gdk_utils.c Branch: resource_management Log Message: allocate multiple of block size diffs (100 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2106,7 +2106,8 @@ eb_error( exception_buffer *eb, char *ms #endif } -#define SA_BLOCK (64*1024) +#define SA_NUM_BLOCKS 64 +#define SA_BLOCK_SIZE (64*1024) typedef struct freed_t { struct freed_t *n; @@ -2139,7 +2140,8 @@ sa_free(allocator *pa, void *blk) pa->nr--; size_t sz = GDKmallocated(blk); - if (sz > (SA_BLOCK + 32)) { + // what is the magic 32 ? + if (sz > (SA_BLOCK_SIZE + 32)) { GDKfree(blk); } else { freed_t *f = blk; @@ -2168,7 +2170,7 @@ sa_create(allocator *pa) return NULL; eb_init(&sa->eb); sa->pa = pa; - sa->size = 64; + sa->size = SA_NUM_BLOCKS; sa->nr = 1; sa->blks = pa?(char**)sa_alloc(pa, sizeof(char*) * sa->size):(char**)GDKmalloc(sizeof(char*) * sa->size); sa->freelist = NULL; @@ -2177,8 +2179,8 @@ sa_create(allocator *pa) GDKfree(sa); return NULL; } - sa->blks[0] = pa?(char*)sa_alloc(pa, SA_BLOCK):(char*)GDKmalloc(SA_BLOCK); - sa->usedmem = SA_BLOCK; + sa->blks[0] = pa?(char*)sa_alloc(pa, SA_BLOCK_SIZE):(char*)GDKmalloc(SA_BLOCK_SIZE); + sa->usedmem = SA_BLOCK_SIZE; if (sa->blks[0] == NULL) { if (!pa) GDKfree(sa->blks); @@ -2204,7 +2206,7 @@ allocator *sa_reset( allocator *sa ) } sa->nr = 1; sa->used = 0; - sa->usedmem = SA_BLOCK; + sa->usedmem = SA_BLOCK_SIZE; return sa; } @@ -2221,21 +2223,23 @@ sa_realloc( allocator *sa, void *p, size } #define round16(sz) ((sz+15)&~15) +#define round_block_size(sz) ((sz+SA_BLOCK_SIZE)&~SA_BLOCK_SIZE) void * sa_alloc( allocator *sa, size_t sz ) { char *r; sz = round16(sz); /* we don't want super large allocs for temp storage */ - //if (sa->tmp_active && sz >= SA_BLOCK) + //if (sa->tmp_active && sz >= SA_BLOCK_SIZE) // assert(0); - if (sz > (SA_BLOCK-sa->used)) { + if (sz > (SA_BLOCK_SIZE - sa->used)) { + sz = round_block_size(sz); if (sa->pa) - r = (char*)sa_alloc(sa->pa, (sz > SA_BLOCK ? sz : SA_BLOCK)); - else if (sz <= SA_BLOCK && sa->freelist) { - r = sa_use_freed(sa, SA_BLOCK); + r = (char*)sa_alloc(sa->pa, sz); + else if (sz == SA_BLOCK_SIZE && sa->freelist) { + r = sa_use_freed(sa, SA_BLOCK_SIZE); } else - r = GDKmalloc(sz > SA_BLOCK ? sz : SA_BLOCK); + r = GDKmalloc(sz); if (r == NULL) { if (sa->eb.enabled) eb_error(&sa->eb, "out of memory", 1000); @@ -2259,7 +2263,7 @@ sa_alloc( allocator *sa, size_t sz ) } sa->blks = tmp; } - if (sz > SA_BLOCK) { + if (sz > SA_BLOCK_SIZE) { sa->blks[sa->nr] = sa->blks[sa->nr-1]; sa->blks[sa->nr-1] = r; sa->nr ++; @@ -2268,7 +2272,7 @@ sa_alloc( allocator *sa, size_t sz ) sa->blks[sa->nr] = r; sa->nr ++; sa->used = sz; - sa->usedmem += SA_BLOCK; + sa->usedmem += SA_BLOCK_SIZE; } } else { r = sa->blks[sa->nr-1] + sa->used; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: resource_management - merge with default
Changeset: c27e21d8f775 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c27e21d8f775 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h monetdb5/mal/mal_client.c monetdb5/mal/mal_parser.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_remap.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/generator/generator.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statement.c sql/storage/bat/bat_storage.c sql/storage/store.c Branch: resource_management Log Message: merge with default diffs (truncated from 14636 to 300 lines): diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,34 +0,0 @@ -name: Bug report -about: Create a report to help us improve the sytem -title: '' -labels: '' -assignees: '' - - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Create a setting with minimal input for an external user to demonstrate the buggy behavior. -This includes the relevant part of the database schema description. -Performance trace of the rogue query (using the TRACE command) - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Software versions** - - MonetDB version number [a milestone label] - - OS and version: [e.g. Ubuntu 18.04] - - Installed from release package or self-installed and compiled - - -**Issue labeling ** -Make liberal use of the labels to characterise the issue topics. e.g. identify severity, version, etc.. - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,61 @@ +name: Bug report +description: Use this template to report bugs in MonetDB +labels: ["needs triage"] +body: + - type: textarea +id: summary +attributes: + label: Describe the bug + description: | +Clear and concise description of what the bug is. +validations: + required: true + - type: textarea +id: reproduction +attributes: + label: Reproduction steps + description: | +Create a setting with minimal input for an external user to demonstrate the buggy behavior. +This includes the relevant part of the database schema description. +Performance trace of the rogue query (using the TRACE command). +validations: + required: false + - type: textarea +id: expected +attributes: + label: Expected behavior + description: | +Clear and concise description of what you expected to happen. +validations: + required: false + - type: input +id: mdbversion +attributes: + label: MonetDB release + placeholder: e.g., Dec2023_SP1, 11.49.1 +validations: + required: true + - type: dropdown +id: binsource +attributes: + label: Executables source + options: +- "Release packages" +- "Self compiled and installed" +validations: + required: true + - type: input +id: osversion +attributes: + label: Operating System + placeholder: e.g., Fedora Linux 39 (Workstation Edition) +validations: + required: true + - type: textarea +id: additional +attributes: + label: Additional context + description: | +Add any other context or screenshots about the problem here. +validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,36 @@ +name: Feature request +description: Use this template for feature requests
MonetDB: resource_management - merge with default
Changeset: f29755ac7db0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f29755ac7db0 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_calc_convert.c gdk/gdk_string.c gdk/gdk_utils.c monetdb5/extras/rapi/rapi.c monetdb5/mal/mal_client.c monetdb5/mal/mal_client.h monetdb5/mal/mal_instruction.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_session.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/remote.c monetdb5/optimizer/opt_commonTerms.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_mergetable.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/generator/generator.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_rank.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/server/rel_basetable.c sql/server/rel_optimizer.c sql/server/sql_parser.y sql/storage/bat/bat_storage.c sql/storage/sql_catalog.c sql/storage/store.c Branch: resource_management Log Message: merge with default diffs (truncated from 69230 to 300 lines): diff --git a/.bumpversion.cfg b/.bumpversion.cfg --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 11.50.0 +current_version = 11.52.0 commit = False tag = False diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -48,7 +48,12 @@ jobs: ref: ${{ github.ref }} - name: install pymonetdb cryptography -run: pip3 install pymonetdb cryptography +run: pip3 install --user --upgrade pymonetdb cryptography +if: runner.os != 'macOS' + + - name: install pymonetdb cryptography +run: pip3 install --user --break-system-packages --upgrade pymonetdb cryptography +if: runner.os == 'macOS' - name: make MonetDB on linux run: | @@ -83,7 +88,23 @@ jobs: -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \ -DCMAKE_SUMMARY=ON make install -j3 -if: runner.os == 'macOS' +if: runner.os == 'macOS' && runner.arch == 'x64' + + - name: make MonetDB on macos +run: | + mkdir build + cd build + cmake .. \ +-DCMAKE_INSTALL_PREFIX=$HOME/MDB \ +-DPY3INTEGRATION=OFF \ +-DRINTEGRATION=OFF \ +-DCMAKE_BUILD_TYPE=Release \ +-DASSERT=OFF \ +-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ +-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \ +-DCMAKE_SUMMARY=ON + make install -j3 +if: runner.os == 'macOS' && runner.arch == 'arm64' - name: choco packages run: | diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -44,6 +44,7 @@ GPATH GRTAGS TAGS tags +cscope.* *.pyo *.rej *.orig diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -824,3 +824,7 @@ 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7 +d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release +9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9 +9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_SP3_release +e1e9e22bf3d734dc50b56151c657a57c18f56561 Aug2024_root diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,8 +118,14 @@ if(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/unistd.h) endif() -add_library(monetdb_config_header - INTERFACE) +add_library(monetdb_config_header INTERFACE) + +if (CTAGS_PATH) + add_dependencies(monetdb_config_header tags) +endif() +if (CSCOPE_PATH) + add_dependencies(monetdb_config_header cscope) +endif() target_include_directories(monetdb_config_header INTERFACE diff --git a/ChangeLog b/ChangeLog.Aug2024 copy from ChangeLog copy to ChangeLog.Aug2024 --- a/ChangeLog +++ b/ChangeLog.Aug2024 @@ -1,3 +1,14 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Wed May 8 2024 Sjoerd Mullender +- The shared library (.dll aka .so files) now have the version number + as part of the name. This should allow the building of compatibility + versions that can be installed in parallel to the latest version. +- Some of the Debian/Ubuntu packages have been renamed. The old monetdb5 + names have been changed to plain monetdb, and libmonetdb5-server-* + packages have been renamed monetdb-*. +- The names of s
MonetDB: default - handle usr1 in server output for Mz
Changeset: 18003379f5bc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/18003379f5bc Modified Files: testing/Mtest.py.in Branch: default Log Message: handle usr1 in server output for Mz diffs (34 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -1524,14 +1524,22 @@ def PerformDir(env, testdir, testlist, t o.write('{}\n\n\n'.format('(nothing to see here)' if empty else '')) o.close() else: -for line in openutf8(os.path.join(TSTTRGDIR, 'SingleServer.out')): -if line != '\n' and not line.startswith('#'): -ssout = F_ERROR -break -for line in openutf8(os.path.join(TSTTRGDIR, 'SingleServer.err')): -if line != '\n' and not line.startswith('#'): -sserr = F_ERROR -break +for ext in ['out', 'err']: +sigusr1 = False +for line in openutf8(os.path.join(TSTTRGDIR, f'SingleServer.{ext}')): +if 'SIGUSR1 info start' in line: +sigusr1 = True +continue +elif 'SIGUSR1 info end' in line: +sigusr1 = False +continue +if (sigusr1 is False) and (line != '\n') and (not line.startswith('#')): +if ext == 'out': +ssout = F_ERROR +else: +sserr = F_ERROR +break + TIMES.append((TSTDIR, '', "%7.3f" % td, td, FdOut, FdErr, None)) if testweb: os.chdir(TSTTRGDIR) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - merge default
Changeset: dbd21f996a6f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dbd21f996a6f Modified Files: testing/Mz.py.in Branch: default Log Message: merge default diffs (36 lines): diff --git a/testing/Mz.py.in b/testing/Mz.py.in --- a/testing/Mz.py.in +++ b/testing/Mz.py.in @@ -1,14 +1,28 @@ #!@PYTHON@ -# SPDX-License-Identifier: MPL-2.0 -# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. -import Mtest +#TODO: +#= +# - check all TODO's below +# - tidy -up HTML-generation by "keeping in mind" during testing, +# which OUT/ERR differ or not and which tests were skipped. +# dump HTML-stuff only at end +# print an ascii summary at end, too +# - use sorting in .explain.functions_histogram +# - if no diffs, but warnings, say so at end +# - produce, keep & reference LOG +# - add a "grep-like" function and replace "inlined" grep +# contains(,) +# - do multi-level prompting? +# - normalize all path's used +# - Python 3? (or do a full rewrite?) + +import os import sys if __name__ == '__main__': Mtest.main(sys.argv) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: monetdbe_static - cmake compile static options
Changeset: 05823446265c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/05823446265c Modified Files: clients/CMakeLists.txt clients/mapilib/CMakeLists.txt clients/odbc/driver/CMakeLists.txt cmake/monetdb-options.cmake common/options/CMakeLists.txt common/stream/CMakeLists.txt common/utils/CMakeLists.txt gdk/CMakeLists.txt monetdb5/extras/mal_optimizer_template/CMakeLists.txt monetdb5/mal/mal_runtime.c monetdb5/modules/kernel/CMakeLists.txt monetdb5/tools/CMakeLists.txt sql/backends/monet5/CMakeLists.txt sql/backends/monet5/generator/CMakeLists.txt sql/backends/monet5/vaults/csv/CMakeLists.txt sql/common/CMakeLists.txt sql/server/CMakeLists.txt sql/storage/CMakeLists.txt sql/storage/bat/CMakeLists.txt tools/CMakeLists.txt tools/monetdbe/CMakeLists.txt Branch: monetdbe_static Log Message: cmake compile static options diffs (truncated from 623 to 300 lines): diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt --- a/clients/CMakeLists.txt +++ b/clients/CMakeLists.txt @@ -9,7 +9,9 @@ #]] add_subdirectory(mapilib) -add_subdirectory(mapiclient) +if(WITH_MAPI_CLIENT) + add_subdirectory(mapiclient) +endif() add_subdirectory(odbc) if(TESTING) add_subdirectory(examples) diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -8,9 +8,11 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] -add_library(mapi - SHARED) - +if(MONETDB_STATIC) + add_library(mapi STATIC) +else() + add_library(mapi SHARED) +endif() # We need to add the public library twice to the target sources, once for # the build interface and once for the install interface. This is because @@ -88,11 +90,13 @@ install(TARGETS COMPONENT clientdev INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +if(NOT DEFINED MONETDB_STATIC) install(EXPORT mapiTargets FILE mapiTargets.cmake NAMESPACE MonetDB:: DESTINATION ${EXPORT_TARGET_PATH} COMPONENT clientdev) +endif() if(WIN32) install(FILES diff --git a/clients/odbc/driver/CMakeLists.txt b/clients/odbc/driver/CMakeLists.txt --- a/clients/odbc/driver/CMakeLists.txt +++ b/clients/odbc/driver/CMakeLists.txt @@ -12,8 +12,11 @@ if (${HAVE_ODBCINST}) add_compile_definitions(HAVE_SQLGETPRIVATEPROFILESTRING) endif() -add_library(MonetODBC - MODULE) +if(MONETDB_STATIC) + add_library(MonetODBC STATIC) +else() +add_library(MonetODBC MODULE) +endif() target_sources(MonetODBC PRIVATE diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake --- a/cmake/monetdb-options.cmake +++ b/cmake/monetdb-options.cmake @@ -154,3 +154,27 @@ option(CMAKE_SUMMARY option(CMAKE_UNITTESTS "Build and run the unittest for the build system" OFF) + +option(MONETDB_STATIC + "Enable static compilation mode" + OFF) + +option(WITH_UDF + "Include UDF support" + ON) + +option(WITH_VAULTS + "Include UDF support" + ON) + +option(WITH_MEROVINGIAN + "Build merovingian and friends" + ON) + +option(WITH_MSERVER5 + "Build mserver5" + ON) + +option(WITH_MAPI_CLIENT + "Build mapi clients(mclient, msqldump)" + ON) diff --git a/common/options/CMakeLists.txt b/common/options/CMakeLists.txt --- a/common/options/CMakeLists.txt +++ b/common/options/CMakeLists.txt @@ -33,10 +33,12 @@ target_link_libraries(moptions monetdb_config_header $<$:${GETOPT_LIB}>) +if(NOT DEFINED MONETDB_STATIC) set_target_properties(moptions PROPERTIES POSITION_INDEPENDENT_CODE ON PUBLIC_HEADER "${moptions_public_headers}") +endif() install(FILES monet_options.h @@ -44,3 +46,18 @@ install(FILES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb COMPONENT monetdbdev) + +if(MONETDB_STATIC) +install(TARGETS + moptions + COMPONENT monetdbdev + RUNTIME + DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endif() diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -14,8 +14,11 @@ set(stream_public_headers $ $) -add_library(stream - SHARED) +if(MONETDB_STATIC) + add_library(stream STATIC) +else() + add_library(stream SHARED) +endif() target_sources(stream PRIVATE @@ -137,11 +140,13 @@ install(TARGETS COMPONENT streamdev INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +if(NOT DEFINED MONETDB_STATIC) install(EXPORT streamTargets FILE streamTargets.cmake NAMESPACE MonetDB:: DESTINATION ${EXPORT_TARGET_PATH} COMPONENT streamdev) +endif() if(WIN32) install(FILES diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/co
MonetDB: default - merge heads
Changeset: b2be6bb6012a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b2be6bb6012a Modified Files: sql/ChangeLog Branch: default Log Message: merge heads diffs (truncated from 487052 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -785,3 +785,10 @@ 47675351fec22d5d5dc81eec03dfa08f505afc99 47675351fec22d5d5dc81eec03dfa08f505afc99 Sep2022_release 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_23 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_SP5_release +43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25 +43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_SP6_release +5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9 +41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11 +41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_SP1_release +e8b0e5558313f4d98bc48316368299decc55ed4e Sep2022_13 +e8b0e5558313f4d98bc48316368299decc55ed4e Sep2022_SP2_release diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] cmake_minimum_required(VERSION 3.12) diff --git a/Config.cmake.in b/Config.cmake.in --- a/Config.cmake.in +++ b/Config.cmake.in @@ -1,9 +1,11 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] @PACKAGE_INIT@ diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -1,8 +1,10 @@ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. %global name MonetDB %global version 11.46.0 @@ -84,10 +86,10 @@ Summary: MonetDB - Monet Database Manage Vendor: MonetDB BV Group: Applications/Databases -License: MPLv2.0 +License: MPL-2.0 URL: https://www.monetdb.org/ BugURL: https://bugs.monetdb.org/ -Source: https://www.monetdb.org/downloads/sources/Sep2022/%{name}-%{version}.tar.bz2 +Source: https://www.monetdb.org/downloads/sources/Sep2022-SP2/%{name}-%{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 @@ -128,6 +130,7 @@ BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(liblz4) >= 1.8 %if %{with py3integration} BuildRequires: pkgconfig(python3) >= 3.5 +# cannot use python3dist(numpy) because of CentOS 7 BuildRequires: python3-numpy %endif %if %{with rintegration} @@ -343,7 +346,6 @@ Recommends: perl-DBD-monetdb >= 1.0 Recommends: php-monetdb >= 1.0 %endif Requires: MonetDB5-server%{?_isa} = %{version}-%{release} -Requires: python3-pymonetdb >= 1.0.6 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7 Recommends: python3dist(lz4) Recommends: python3dist(scipy) @@ -690,6 +692,7 @@ package. You probably don't need this, Summary: MonetDB - Monet Database Management System Group: Applications/Databases Requires: %{name}-client-tests = %{version}-%{release} +Requires: python3dist(pymonetdb) >= 1.0.6 BuildArch: noarch %description testing-python @@ -855,6 +858,103 @@ fi %endif %changelog +* Tue Jan 24 2023 Sjoerd Mullender - 11.45.13-20230124 +- Rebuilt. +- GH#7343: GDKmmap requesting 0 virtual memory +- GH#7347: A bug where an exception occurs even though it is a query with + normal syntax (Merge Table) + +* Mon Jan 23 2023 Sjoerd Mullender - 11.45.13-20230124 +- sql: Fixed a regression where when there are multiple concurrent + transactions, the dependencies weren't checked properly. + +* Mon Jan 16 2023 Sjoerd Mullender - 11.45.13-20230124 +- gdk: Fixed a race condition that could lead to a bat being added to the SQL + catalog but nog being made persistent, causing a subsequent restart + of the system to fail (and crash). + +* Wed Jan 4 2023 Sjoerd Mullender - 11.45.13-20230124 +- odbc: A crash in the ODBC driver was fixed when certain unsupported functions + where used in a {fn ...} escape. + +* Wed Dec 21 2022 Sjoerd Mullender - 11.45.13-20230124 +- odbc: Prepare of a query where the sum of the number of parameters (question + marks in the query) and the number of output columns is larger than + 100 could fail wi
MonetDB: default - escape sequences Changelog
Changeset: 406e14a7cc4b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/406e14a7cc4b Modified Files: sql/ChangeLog Branch: default Log Message: escape sequences Changelog diffs (14 lines): diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Wed Feb 15 2023 svetlin +- Added JDBC/ODBC escape sequences implementation to SQL layer. Now all + clients can forward them without further processing. + * Fri Sep 30 2022 Joeri van Ruth - When loading data using COPY BINARY INTO, apply default values instead of just inserting NULLs. ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - approve test
Changeset: 54590d5cfc69 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/54590d5cfc69 Modified Files: sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 Branch: escape-sequences Log Message: approve test diffs (172 lines): diff --git a/sql/test/emptydb/Tests/check.stable.out b/sql/test/emptydb/Tests/check.stable.out --- a/sql/test/emptydb/Tests/check.stable.out +++ b/sql/test/emptydb/Tests/check.stable.out @@ -1435,6 +1435,8 @@ select 'null in fkeys.delete_action', de [ "sys.functions", "sys", "atan", "SYSTEM", "atan", "mmath", "Internal C", "Scalar function", false, false, false, false, NULL, "res_0","real", 24, 0, "out", "arg_1","real", 24, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL] [ "sys.functions", "sys", "atan", "SYSTEM", "atan2", "mmath","Internal C", "Scalar function", false, false, false, false, NULL, "res_0","double", 53, 0, "out", "arg_1","double", 53, 0, "in", "arg_2", "double", 53, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "atan", "SYSTEM", "atan2", "mmath","Internal C", "Scalar function", false, false, false, false, NULL, "res_0","real", 24, 0, "out", "arg_1", "real", 24, 0, "in", "arg_2","real", 24, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL] +[ "sys.functions", "sys", "atan2","SYSTEM", "atan2", "mmath","Internal C", "Scalar function", false, false, false, false, NULL, "res_0","double", 53, 0, "out", "arg_1","double", 53, 0, "in", "arg_2", "double", 53, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] +[ "sys.functions", "sys", "atan2","SYSTEM", "atan2", "mmath","Internal C", "Scalar function", false, false, false, false, NULL, "res_0","real", 24, 0, "out", "arg_1", "real", 24, 0, "in", "arg_2","real", 24, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL] [ "sys.functions", "sys", "avg", "SYSTEM", "avg", "aggr", "Internal C", "Aggregate function", false, false, false, false, NULL, "res_0","day_interval", 4,
MonetDB: escape-sequences - merge default
Changeset: 0df834b5dde0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0df834b5dde0 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test Branch: escape-sequences Log Message: merge default diffs (truncated from 431686 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -790,3 +790,5 @@ 43d4a717410d6f6692a16a878640fc7e0f248725 5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_SP1_release +e8b0e5558313f4d98bc48316368299decc55ed4e Sep2022_13 +e8b0e5558313f4d98bc48316368299decc55ed4e Sep2022_SP2_release diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -89,7 +89,7 @@ Group: Applications/Databases License: MPL-2.0 URL: https://www.monetdb.org/ BugURL: https://bugs.monetdb.org/ -Source: https://www.monetdb.org/downloads/sources/Sep2022-SP1/%{name}-%{version}.tar.bz2 +Source: https://www.monetdb.org/downloads/sources/Sep2022-SP2/%{name}-%{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 @@ -858,6 +858,54 @@ fi %endif %changelog +* Tue Jan 24 2023 Sjoerd Mullender - 11.45.13-20230124 +- Rebuilt. +- GH#7343: GDKmmap requesting 0 virtual memory +- GH#7347: A bug where an exception occurs even though it is a query with + normal syntax (Merge Table) + +* Mon Jan 23 2023 Sjoerd Mullender - 11.45.13-20230124 +- sql: Fixed a regression where when there are multiple concurrent + transactions, the dependencies weren't checked properly. + +* Mon Jan 16 2023 Sjoerd Mullender - 11.45.13-20230124 +- gdk: Fixed a race condition that could lead to a bat being added to the SQL + catalog but nog being made persistent, causing a subsequent restart + of the system to fail (and crash). + +* Wed Jan 4 2023 Sjoerd Mullender - 11.45.13-20230124 +- odbc: A crash in the ODBC driver was fixed when certain unsupported functions + where used in a {fn ...} escape. + +* Wed Dec 21 2022 Sjoerd Mullender - 11.45.13-20230124 +- odbc: Prepare of a query where the sum of the number of parameters (question + marks in the query) and the number of output columns is larger than + 100 could fail with an unexpected error. This has been fixed. + +* Fri Dec 16 2022 Sjoerd Mullender - 11.45.13-20230124 +- sql: Added some error checking to prevent crashes. Errors would mainly + occur under memory pressure. + +* Wed Dec 14 2022 Sjoerd Mullender - 11.45.13-20230124 +- gdk: Fixed a race condition where a hash could have been created on a + bat using the old bat count while in another thread the bat count + got updated. This would make the hash be based on too small a size, + causing failures later on. + +* Wed Dec 14 2022 Sjoerd Mullender - 11.45.13-20230124 +- sql: Fixed cleanup after a failed allocation where the data being cleaned + up was unitialized but still used as pointers to memory that also had + to be freed. + +* Thu Dec 8 2022 Sjoerd Mullender - 11.45.13-20230124 +- gdk: When extending a bat failed, the capacity had been updated already and + was therefore too large. This could then later cause a crash. This has + been fixed by only updating the capacity if the extend succeeded. + +* Wed Dec 7 2022 Sjoerd Mullender - 11.45.13-20230124 +- sql: Fixed a double cleanup after a failed allocation in COPY INTO. The + double cleanup could cause a crash due to a race condition it enabled. + * Mon Dec 05 2022 Sjoerd Mullender - 11.45.11-20221205 - Rebuilt. - GH#7342: column which datatype is double couldn't group or aggregation 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 @@ -30205,6 +30205,11 @@ SQLbatstr_cast; cast to string and check for overflow batcalc str +pattern batcalc.str(X_0:int, X_1:int, X_2:int, X_3:int, X_4:bat[:any_1], X_5:int):bat[:str] +SQLbatstr_cast; +cast to string and check for overflow, no candidate list +batcalc +str command batcalc.str(X_0:bat[:uuid], X_1:bat[:oid]):bat[:str] UUIDuuid2str_bulk; Coerce a uuid to a string type 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 @@ -21430,6 +21430,11 @@ SQLbatstr_cast; cast to string and check for overflow batcalc str +pattern batcalc.str(X_0:int, X_1:int, X_2:int, X_3:int, X_4:bat[:any_1], X_5:int):bat[:str] +SQLbatstr_cast; +cast to string and check for overflow, no candidate list +batcalc +str command batcalc.str(X_0:bat[:uuid], X_1:bat[:oid]):bat[:str] UUIDuuid2str_bulk; Coerce a uuid to a string type diff --git a/clients/examples/perl/malsample.pl b/clients/examples/perl/malsample.pl --- a/clients/examples/perl/malsample.pl +++ b/clients/examples/pe
MonetDB: triggers - fix memory leaks
Changeset: c33980c7288d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c33980c7288d Modified Files: sql/storage/store.c Branch: triggers Log Message: fix memory leaks diffs (64 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -6764,6 +6764,7 @@ sql_trans_drop_idx(sql_trans *tr, sql_sc return res; } + static int sql_trans_create_table_trigger(sql_trigger **tres, sql_trans *tr, sql_table *t, const char *name, sht time, sht orientation, sht event, const char *old_name, const char *new_name, @@ -6799,15 +6800,17 @@ sql_trans_create_table_trigger(sql_trigg if(t) { assert(isGlobal(t)); if ((res = ol_add(t->triggers, &nt->base)) || - (res = os_add(t->s->triggers, tr, nt->base.name, dup_base(&nt->base + (res = os_add(t->s->triggers, tr, nt->base.name, dup_base(&nt->base { return res; + } } oid tid = t? (oid) t->base.id : oid_nil; if ((res = store->table_api.table_insert(tr, systrigger, &nt->base.id, &nt->base.name, &tid, &nt->time, &nt->orientation, &nt->event, (nt->old_name)?&nt->old_name:&strnil, (nt->new_name)?&nt->new_name:&strnil, - (nt->condition)?&nt->condition:&strnil, &nt->statement))) - return res; + (nt->condition)?&nt->condition:&strnil, &nt->statement))) { + return res; + } *tres = nt; return res; } @@ -6824,6 +6827,7 @@ sql_trans_create_trigger(sql_trigger **t new_name, condition, statement); // triggers not bound to objects (e.g. table) + // are added to sys->triggers sqlstore *store = tr->store; sql_schema *syss = find_sql_schema(tr, "sys"); @@ -6846,14 +6850,19 @@ sql_trans_create_trigger(sql_trigger **t if (condition) nt->condition =_STRDUP(condition); nt->statement =_STRDUP(statement); - if ((res = os_add(syss->triggers, tr, nt->base.name, dup_base(&nt->base - return res; + if ((res = os_add(syss->triggers, tr, nt->base.name, &nt->base))) { + trigger_destroy(store, nt); + return res; + } oid tid = oid_nil; if ((res = store->table_api.table_insert(tr, systrigger, &nt->base.id, &nt->base.name, &tid, &nt->time, &nt->orientation, &nt->event, (nt->old_name)?&nt->old_name:&strnil, (nt->new_name)?&nt->new_name:&strnil, - (nt->condition)?&nt->condition:&strnil, &nt->statement))) - return res; + (nt->condition)?&nt->condition:&strnil, &nt->statement))) { + trigger_destroy(store, nt); + return res; + } + *tres = nt; return res; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - clean up in case of failure
Changeset: cb93c474b50e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cb93c474b50e Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql_scenario.c Branch: triggers Log Message: clean up in case of failure diffs (114 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -3011,7 +3011,8 @@ mvc_export_operation_wrap(Client cntxt, if ((msg = checkSQLContext(cntxt)) != NULL) return msg; b = cntxt->sqlcontext; - ok = mvc_export_operation(b, b->out, "", cntxt->qryctx.starttime, mb->optimize); + if (b->out) + ok = mvc_export_operation(b, b->out, "", cntxt->qryctx.starttime, mb->optimize); cntxt->qryctx.starttime = 0; mb->optimize = 0; if (ok < 0) diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -232,7 +232,7 @@ SQLepilogue(void *ret) static str SQLexecPostLoginTriggers(Client c) { - char *msg = NULL; + str msg = MAL_SUCCEED; backend *be = (backend *) c->sqlcontext; if (be) { mvc *m = be->mvc; @@ -248,6 +248,11 @@ SQLexecPostLoginTriggers(Client c) if (t->event == LOGIN_EVENT) { const char *stmt = t->statement; sql_rel *r = NULL; + // cache state + int oldvtop = c->curprg->def->vtop; + int oldstop = c->curprg->def->stop; + int oldvid = c->curprg->def->vid; + Symbol curprg = c->curprg; sql_allocator *sa = m->sa; if (!(m->sa = sa_create(m->pa))) { @@ -257,47 +262,46 @@ SQLexecPostLoginTriggers(Client c) r = rel_parse(m, sys, stmt, m_deps); if (r) r = sql_processrelation(m, r, 0, 0, 0, 0); - if (backend_dumpstmt(be, c->curprg->def, r, 1, 1, NULL) < 0) - throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(4200) "%s", "generating MAL failed"); - - if ((msg = SQLrun(c,m)) != MAL_SUCCEED) - return msg; - - sa_destroy(m->sa); - m->sa = sa; if (!r) { + sa_destroy(m->sa); + m->sa = sa; if (strlen(m->errstr) > 6 && m->errstr[5] == '!') throw(SQL, "sql.SQLexecPostLoginTriggers", "%s", m->errstr); else throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(42000) "%s", m->errstr); } - + setVarType(c->curprg->def, 0, 0); + if (backend_dumpstmt(be, c->curprg->def, r, 1, 1, NULL) < 0) { + freeVariables(c, c->curprg->def, NULL, oldvtop, oldvid); + c->curprg = curprg; + sa_destroy(m->sa); + m->sa = sa; + throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(4200) "%s", "generating MAL failed"); + } - //if ((err = SQLstatementIntern(c, stmt, "sql.SQLexecPostLoginTriggers", TRUE, FALSE, NULL))) { - // (void) sql_error(m, 02, SQLSTATE(42000) "%s", err); - // freeException(err); - // res = LOG_ERR; - // break; - //} + stream *out = be->out; + be->out = NULL; /* no output stream */ + if ((msg = SQLrun(c,m)) != MAL_SUCCEED) { + be->out = out; + freeVariables(c, c->curprg->def, NULL, oldvtop, oldvid); + sqlcl
MonetDB: triggers - merge heads
Changeset: 8f0a645cd41f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8f0a645cd41f Modified Files: sql/backends/monet5/sql_scenario.c Branch: triggers Log Message: merge heads diffs (truncated from 1163 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -343,6 +343,8 @@ #define gdk_export extern #endif +/* Only ever compare with GDK_SUCCEED, never with GDK_FAIL, and do not + * use as a Boolean. */ typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return; gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -56,6 +56,8 @@ * This function finds the minimum and maximum group id (and the * number of groups) and initializes the variables for candidates * selection. + * + * In case of error, returns an error message. */ const char * BATgroupaggrinit(BAT *b, BAT *g, BAT *e, BAT *s, diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -3403,6 +3403,8 @@ BBPprepare(bool subcommit) /* starting a subcommit. Make sure SUBDIR and DELDIR * are clean */ ret = BBPrecover_subdir(); + if (ret != GDK_SUCCEED) + return ret; } if (backup_files == 0) { backup_dir = 0; @@ -3435,7 +3437,7 @@ BBPprepare(bool subcommit) GDKfree(subdirpath); return GDK_FAIL; } - TRC_DEBUG(IO_, "mkdir %s = %d\n", subdirpath, (int) ret); + TRC_DEBUG(IO_, "mkdir %s\n", subdirpath); GDKfree(subdirpath); } if (backup_dir != set) { @@ -3943,6 +3945,7 @@ force_move(int farmid, const char *srcdi if (ret != GDK_SUCCEED) { char *srcpath; + GDKclrerr(); /* two legal possible causes: file exists or dir * doesn't exist */ if(!(dstpath = GDKfilepath(farmid, dstdir, name, NULL))) @@ -4112,10 +4115,10 @@ BBPrecover_subdir(void) if (dent->d_name[0] == '.') continue; ret = GDKmove(0, SUBDIR, dent->d_name, NULL, BAKDIR, dent->d_name, NULL, true); - if (ret == GDK_SUCCEED && strcmp(dent->d_name, "BBP.dir") == 0) - backup_dir = 1; if (ret != GDK_SUCCEED) break; + if (strcmp(dent->d_name, "BBP.dir") == 0) + backup_dir = 1; } closedir(dirp); diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -163,21 +163,28 @@ HEAPalloc(Heap *h, size_t nitems, size_t h->base = GDKmalloc(h->size); TRC_DEBUG(HEAP, "%s %zu %p\n", h->filename, h->size, h->base); } + + char *nme = NULL; if (!GDKinmemory(h->farmid) && h->base == NULL) { - char *nme; - nme = GDKfilepath(h->farmid, BATDIR, h->filename, NULL); if (nme == NULL) return GDK_FAIL; h->storage = STORE_MMAP; h->base = HEAPcreatefile(NOFARM, &h->size, nme); h->hasfile = true; - GDKfree(nme); } if (h->base == NULL) { + /* remove file we may just have created */ + if (nme != NULL) { + /* file may or may not exist, depending on what +* failed */ + (void) MT_remove(nme); + GDKfree(nme); + } GDKerror("Insufficient space for HEAP of %zu bytes.", h->size); return GDK_FAIL; } + GDKfree(nme); h->newstorage = h->storage; if (h->farmid == 1) { QryCtx *qc = MT_thread_get_qry_ctx(); diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c --- a/gdk/gdk_join.c +++ b/gdk/gdk_join.c @@ -3061,7 +3061,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B /* Count the number of unique values for the first half and the complete * set (the sample s of b) and return the two values in *cnt1 and * *cnt2. In case of error, both values are 0. */ -static void +static gdk_return count_unique(BAT *b, BAT *s, BUN *cnt1, BUN *cnt2) { struct canditer ci; @@ -3087,7 +3087,7 @@ count_unique(BAT *b, BAT *s, BUN *cnt1, /* trivial: already unique */ *cnt1 = half; *cnt2 = ci.ncand; - return; + return GDK_SUCCEED; } (void) BATordered(b); @@ -3098,7 +3098,7 @@ count_unique(BAT *b, BAT *s, BUN *cnt1, /* trivial: all values are the same */ *cnt1 = *cnt2 = 1; bat_iterator_end(&bi); - return; + return GDK_SUCCEED; } assert(bi.t
MonetDB: triggers - wip use SQLrun to run trigger stmt
Changeset: ea2ea53b04e4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ea2ea53b04e4 Modified Files: sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_execute.h sql/backends/monet5/sql_scenario.c sql/test/Triggers/Tests/auth-triggers.test Branch: triggers Log Message: wip use SQLrun to run trigger stmt diffs (77 lines): diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -284,7 +284,7 @@ SQLsetTrace(Client cntxt, MalBlkPtr mb) return msg; } -static str +str SQLrun(Client c, mvc *m) { str msg= MAL_SUCCEED; diff --git a/sql/backends/monet5/sql_execute.h b/sql/backends/monet5/sql_execute.h --- a/sql/backends/monet5/sql_execute.h +++ b/sql/backends/monet5/sql_execute.h @@ -18,5 +18,6 @@ sql5_export str RAstatement(Client cntxt sql5_export str RAstatement2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str RAstatementEnd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export void SQLdestroyResult(res_table *destroy); +char *SQLrun(Client c, mvc *m); #endif /* _SQL_EXECUTE_H_ */ diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -232,6 +232,7 @@ SQLepilogue(void *ret) static str SQLexecPostLoginTriggers(Client c) { + char *msg = NULL; backend *be = (backend *) c->sqlcontext; if (be) { mvc *m = be->mvc; @@ -256,14 +257,12 @@ SQLexecPostLoginTriggers(Client c) r = rel_parse(m, sys, stmt, m_deps); if (r) r = sql_processrelation(m, r, 0, 0, 0, 0); - if (r) { - list *blist = rel_dependencies(m, r); - if (mvc_create_dependencies(m, blist, t->base.id, TRIGGER_DEPENDENCY)) { - sa_destroy(m->sa); - m->sa = sa; - throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - } + if (backend_dumpstmt(be, c->curprg->def, r, 1, 1, NULL) < 0) + throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(4200) "%s", "generating MAL failed"); + + if ((msg = SQLrun(c,m)) != MAL_SUCCEED) + return msg; + sa_destroy(m->sa); m->sa = sa; if (!r) { @@ -835,7 +834,8 @@ SQLinitClient(Client c, str passwd, str throw(SQL, "SQLinitClient", SQLSTATE(42000) "Catalogue not available"); } if ((msg = SQLprepareClient(c, passwd, challenge, algo)) == MAL_SUCCEED) { - if (c->usermodule && (SQLexecPostLoginTriggers(c) != MAL_SUCCEED)) { + if (c->usermodule && (c->user != MAL_ADMIN) && (SQLexecPostLoginTriggers(c) != MAL_SUCCEED)) { + MT_lock_unset(&sql_contextLock); throw(SQL, "SQLinitClient", SQLSTATE(42000) "Failed to execute post login triggers"); } } diff --git a/sql/test/Triggers/Tests/auth-triggers.test b/sql/test/Triggers/Tests/auth-triggers.test --- a/sql/test/Triggers/Tests/auth-triggers.test +++ b/sql/test/Triggers/Tests/auth-triggers.test @@ -7,6 +7,9 @@ create user foo with password 'foo' name statement ok create trigger foo after login set role bar +statement ok +grant bar to foo; + @connection(id=1, username=foo, password=foo) query T rowsort select current_role ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - wip load none tbl related triggers from sys
Changeset: ac4b3d77cedb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ac4b3d77cedb Modified Files: sql/backends/monet5/sql_scenario.c sql/storage/store.c Branch: triggers Log Message: wip load none tbl related triggers from sys diffs (196 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -51,6 +51,8 @@ #include "opt_mitosis.h" #include #include "sql_upgrades.h" +#include "rel_semantic.h" +#include "rel_rel.h" #define MAX_SQL_MODULES 128 static int sql_modules = 0; @@ -227,38 +229,81 @@ SQLepilogue(void *ret) } -static int +static str SQLexecPostLoginTriggers(Client c) { - int res = LOG_OK; - char *err = NULL; backend *be = (backend *) c->sqlcontext; if (be) { mvc *m = be->mvc; sql_trans *tr = m->session->tr; int active = tr->active; if (active || mvc_trans(m) == 0) { - sqlstore *store = tr->store; - sql_table *triggers = find_sys_table(tr, TRIGGERS_TABLE_NAME); - sql_column *eventCol = find_sql_column(triggers, "event"); - sql_column *timeCol = find_sql_column(triggers, "time"); - sql_column *stmtCol = find_sql_column(triggers, "statement"); - int event = LOGIN_EVENT, time = 1; + sql_schema *sys = find_sql_schema(tr, "sys"); + struct os_iter oi; + // triggers not related to table should have been loaded in sys + os_iterator(&oi, sys->triggers, tr, NULL); + for (sql_base *b = oi_next(&oi); b; b = oi_next(&oi)) { + sql_trigger *t = (sql_trigger*) b; + if (t->event == LOGIN_EVENT) { + const char *stmt = t->statement; + sql_rel *r = NULL; + sql_allocator *sa = m->sa; - oid rid = store->table_api.column_find_row(tr, eventCol, &event, timeCol, &time, NULL); - if (!is_oid_nil(rid)) { - const char *stmt = store->table_api.column_find_value(tr, stmtCol, rid); - if ((err = SQLstatementIntern(c, stmt, "sql.init", TRUE, FALSE, NULL))) { - (void) sql_error(m, 02, SQLSTATE(42000) "%s", err); - freeException(err); - res = LOG_ERR; + if (!(m->sa = sa_create(m->pa))) { + m->sa = sa; + throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + r = rel_parse(m, sys, stmt, m_deps); + if (r) + r = sql_processrelation(m, r, 0, 0, 0, 0); + if (r) { + list *blist = rel_dependencies(m, r); + if (mvc_create_dependencies(m, blist, t->base.id, TRIGGER_DEPENDENCY)) { + sa_destroy(m->sa); + m->sa = sa; + throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + } + sa_destroy(m->sa); + m->sa = sa; + if (!r) { + if (strlen(m->errstr) > 6 && m->errstr[5] == '!') + throw(SQL, "sql.SQLexecPostLoginTriggers", "%s", m->errstr); + else + throw(SQL, "sql.SQLexecPostLoginTriggers", SQLSTATE(42000) "%s", m->errstr); + } + + + + //if ((err = SQLstatementIntern(c, stmt, "sql.SQLexecPostLoginTriggers", TRUE, FALSE, NULL))) { + // (void) sql_error(m, 02, SQLSTATE(42000) "%s", err); + // freeException(err); + // res = LOG_ERR; + // break; + //}
MonetDB: triggers - small fix
Changeset: 921906b0d277 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/921906b0d277 Modified Files: sql/backends/monet5/sql_scenario.c Branch: triggers Log Message: small fix diffs (12 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -496,7 +496,7 @@ SQLinit(Client c, const char *initpasswd const char *opt_pipe; master_password = NULL; - if (!GDKembedded()) { + if (!GDKembedded() && !GDKinmemory(0)) { msg = msab_pickSecret(&master_password); if (msg) return msg; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - remove assert
Changeset: 5baf07093df1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5baf07093df1 Modified Files: sql/backends/monet5/sql_scenario.c Branch: triggers Log Message: remove assert diffs (11 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -237,7 +237,6 @@ SQLexecPostLoginTriggers(Client c) mvc *m = be->mvc; sql_trans *tr = m->session->tr; int active = tr->active; - assert(active); if (active || mvc_trans(m) == 0) { sqlstore *store = tr->store; sql_table *triggers = find_sys_table(tr, TRIGGERS_TABLE_NAME); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - add test
Changeset: 5bdc740343eb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5bdc740343eb Added Files: sql/test/Triggers/Tests/auth-triggers.test Modified Files: sql/test/Triggers/Tests/All Branch: triggers Log Message: add test diffs (27 lines): diff --git a/sql/test/Triggers/Tests/All b/sql/test/Triggers/Tests/All --- a/sql/test/Triggers/Tests/All +++ b/sql/test/Triggers/Tests/All @@ -12,3 +12,4 @@ trigger_insert trigger_projection trigger_schema trigger-restart +auth-triggers diff --git a/sql/test/Triggers/Tests/auth-triggers.test b/sql/test/Triggers/Tests/auth-triggers.test new file mode 100644 --- /dev/null +++ b/sql/test/Triggers/Tests/auth-triggers.test @@ -0,0 +1,14 @@ +statement ok +create role bar + +statement ok +create user foo with password 'foo' name 'foo' + +statement ok +create trigger foo after login set role bar + +@connection(id=1, username=foo, password=foo) +query T rowsort +select current_role + +bar ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - remove trigger hooks from MAL
Changeset: c41b91037d4a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c41b91037d4a Modified Files: monetdb5/mal/mal_authorize.c monetdb5/mal/mal_authorize.h monetdb5/mal/mal_session.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_user.c sql/include/sql_catalog.h sql/storage/sql_catalog.c Branch: triggers Log Message: remove trigger hooks from MAL diffs (239 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -48,7 +48,6 @@ static AUTHCallbackCntx authCallbackCntx .get_user_name = NULL, .get_user_password = NULL, .get_user_oid = NULL, - .exec_post_login_triggers = NULL }; static str AUTHdeleteRemoteTableCredentialsLocked(const char *local_table); @@ -927,21 +926,3 @@ AUTHGeneratePasswordHash(str *res, const return AUTHcypherValue(res, value); } - -str -AUTHRegisterPostLoginTriggersHandler(post_login_triggers_handler callback) -{ - authCallbackCntx.exec_post_login_triggers = callback; - return MAL_SUCCEED; -} - - -str -AUTHexecPostLoginTriggers(Client c) -{ - if (c && authCallbackCntx.exec_post_login_triggers) { - if (authCallbackCntx.exec_post_login_triggers(c) < 0) - throw(MAL, "AUTHexecPostLoginTriggers", OPERATION_FAILED); - } - return MAL_SUCCEED; -} diff --git a/monetdb5/mal/mal_authorize.h b/monetdb5/mal/mal_authorize.h --- a/monetdb5/mal/mal_authorize.h +++ b/monetdb5/mal/mal_authorize.h @@ -48,20 +48,16 @@ mal_export str AUTHrequireAdmin(Client c typedef str (*get_user_name_handler)(Client c); typedef str (*get_user_password_handler)(Client c, const char *user); typedef oid (*get_user_oid_handler)(Client c, const char *user); -typedef int (*post_login_triggers_handler)(Client c); typedef struct AUTHCallbackCntx { get_user_name_handler get_user_name; get_user_password_handler get_user_password; get_user_oid_handler get_user_oid; - post_login_triggers_handler exec_post_login_triggers; } AUTHCallbackCntx; mal_export str AUTHRegisterGetUserNameHandler(get_user_name_handler callback); mal_export str AUTHRegisterGetPasswordHandler(get_user_password_handler callback); mal_export str AUTHRegisterGetUserOIDHandler(get_user_oid_handler callback); mal_export str AUTHGeneratePasswordHash(str *res, const char *value); -mal_export str AUTHRegisterPostLoginTriggersHandler(post_login_triggers_handler callback); -mal_export str AUTHexecPostLoginTriggers(Client c); #endif /* _MAL_AUTHORIZE_H */ diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -337,13 +337,6 @@ MSscheduleClient(str command, str challe cleanUpScheduleClient(c, scenario, fin, fout, &command, &msg); return; } - // post login triggers if any - if ((msg=AUTHexecPostLoginTriggers(c)) != MAL_SUCCEED) { - mnstr_printf(fout, "!%s\n", msg); - cleanUpScheduleClient(c, scenario, fin, fout, &command, &msg); - freeException(msg); - return; - } cleanUpScheduleClient(c, scenario, NULL, NULL, NULL, NULL); } diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -223,6 +223,44 @@ SQLepilogue(void *ret) return MAL_SUCCEED; } + +static int +SQLexecPostLoginTriggers(Client c) { + int res = LOG_OK; + char *err = NULL; + backend *be = (backend *) c->sqlcontext; + if (be) { + mvc *m = be->mvc; + sql_trans *tr = m->session->tr; + int active = tr->active; + if (active || mvc_trans(m) == 0) { + sqlstore *store = tr->store; + sql_table *triggers = find_sys_table(tr, TRIGGERS_TABLE_NAME); + sql_column *eventCol = find_sql_column(triggers, "event"); + sql_column *timeCol = find_sql_column(triggers, "time"); + sql_column *stmtCol = find_sql_column(triggers, "statement"); + rids *rs = store->table_api.rids_select(tr, eventCol, NULL, NULL); + for (oid rid = store->table_api.rids_next(rs); !is_oid_nil(rid); rid = store->table_api.rids_next(rs)) { + const int event = (int) store->table_api.column_find_sht(tr, eventCol, rid); + const int time = (int) store->table_api.column_find_sht(tr, timeCol, rid); +
MonetDB: triggers - log errors
Changeset: faa230adb96f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/faa230adb96f Modified Files: monetdb5/mal/mal_authorize.c monetdb5/mal/mal_session.c sql/backends/monet5/sql_user.c Branch: triggers Log Message: log errors diffs (43 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -939,9 +939,9 @@ AUTHRegisterPostLoginTriggersHandler(pos str AUTHexecPostLoginTriggers(Client c) { - if ( c && authCallbackCntx.exec_post_login_triggers) { - // TODO check for err - authCallbackCntx.exec_post_login_triggers(c); + if (c && authCallbackCntx.exec_post_login_triggers) { + if (authCallbackCntx.exec_post_login_triggers(c) < 0) + throw(MAL, "AUTHexecPostLoginTriggers", OPERATION_FAILED); } return MAL_SUCCEED; } diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -339,8 +339,10 @@ MSscheduleClient(str command, str challe } // post login triggers if any if ((msg=AUTHexecPostLoginTriggers(c)) != MAL_SUCCEED) { - // oh well + mnstr_printf(fout, "!%s\n", msg); + cleanUpScheduleClient(c, scenario, fin, fout, &command, &msg); freeException(msg); + return; } cleanUpScheduleClient(c, scenario, NULL, NULL, NULL, NULL); } diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c --- a/sql/backends/monet5/sql_user.c +++ b/sql/backends/monet5/sql_user.c @@ -255,7 +255,7 @@ execPostLoginTriggers(Client c) { const char *stmt = store->table_api.column_find_value(tr, stmtCol, rid); if ((err = SQLstatementIntern(c, stmt, "sql.init", TRUE, FALSE, NULL))) { (void) sql_error(m, 02, SQLSTATE(42000) "%s", err); - // TODO push err up? + freeException(err); res = LOG_ERR; }; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: triggers - invoke post login triggers from mal layer
Changeset: 7760cfc946bd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7760cfc946bd Modified Files: monetdb5/mal/mal_authorize.c monetdb5/mal/mal_authorize.h monetdb5/mal/mal_session.c sql/backends/monet5/sql.h sql/backends/monet5/sql_user.c sql/server/rel_psm.c sql/server/sql_tokens.h sql/storage/bat/bat_table.c sql/storage/sql_storage.h Branch: triggers Log Message: invoke post login triggers from mal layer diffs (222 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -47,7 +47,8 @@ static MT_RWLock rt_lock = MT_RWLOCK_INI static AUTHCallbackCntx authCallbackCntx = { .get_user_name = NULL, .get_user_password = NULL, - .get_user_oid = NULL + .get_user_oid = NULL, + .exec_post_login_triggers = NULL }; static str AUTHdeleteRemoteTableCredentialsLocked(const char *local_table); @@ -919,8 +920,28 @@ AUTHRegisterGetUserOIDHandler(get_user_o return MAL_SUCCEED; } + str AUTHGeneratePasswordHash(str *res, const char *value) { return AUTHcypherValue(res, value); } + + +str +AUTHRegisterPostLoginTriggersHandler(post_login_triggers_handler callback) +{ + authCallbackCntx.exec_post_login_triggers = callback; + return MAL_SUCCEED; +} + + +str +AUTHexecPostLoginTriggers(Client c) +{ + if ( c && authCallbackCntx.exec_post_login_triggers) { + // TODO check for err + authCallbackCntx.exec_post_login_triggers(c); + } + return MAL_SUCCEED; +} diff --git a/monetdb5/mal/mal_authorize.h b/monetdb5/mal/mal_authorize.h --- a/monetdb5/mal/mal_authorize.h +++ b/monetdb5/mal/mal_authorize.h @@ -48,16 +48,20 @@ mal_export str AUTHrequireAdmin(Client c typedef str (*get_user_name_handler)(Client c); typedef str (*get_user_password_handler)(Client c, const char *user); typedef oid (*get_user_oid_handler)(Client c, const char *user); +typedef int (*post_login_triggers_handler)(Client c); typedef struct AUTHCallbackCntx { get_user_name_handler get_user_name; get_user_password_handler get_user_password; get_user_oid_handler get_user_oid; + post_login_triggers_handler exec_post_login_triggers; } AUTHCallbackCntx; mal_export str AUTHRegisterGetUserNameHandler(get_user_name_handler callback); mal_export str AUTHRegisterGetPasswordHandler(get_user_password_handler callback); mal_export str AUTHRegisterGetUserOIDHandler(get_user_oid_handler callback); mal_export str AUTHGeneratePasswordHash(str *res, const char *value); +mal_export str AUTHRegisterPostLoginTriggersHandler(post_login_triggers_handler callback); +mal_export str AUTHexecPostLoginTriggers(Client c); #endif /* _MAL_AUTHORIZE_H */ diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -337,6 +337,11 @@ MSscheduleClient(str command, str challe cleanUpScheduleClient(c, scenario, fin, fout, &command, &msg); return; } + // post login triggers if any + if ((msg=AUTHexecPostLoginTriggers(c)) != MAL_SUCCEED) { + // oh well + freeException(msg); + } cleanUpScheduleClient(c, scenario, NULL, NULL, NULL, NULL); } diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h --- a/sql/backends/monet5/sql.h +++ b/sql/backends/monet5/sql.h @@ -296,6 +296,7 @@ extern str SQLuser_password(Client cntxt sql5_export str getBackendContext(Client cntxt, backend **be); #define USER_TABLE_NAME "db_user_info" +#define TRIGGERS_TABLE_NAME "triggers" #define SCHEMA_TABLE_NAME "schemas" #define USER_PASSWORD_COLUMN "password" diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c --- a/sql/backends/monet5/sql_user.c +++ b/sql/backends/monet5/sql_user.c @@ -24,6 +24,16 @@ #include "mal_interpreter.h" #include "mal_authorize.h" #include "mcrypt.h" +#include "sql_execute.h" + + +static inline sql_table* +getSysTbl(mvc *m, const char* tbl_name) +{ + sql_trans *tr = m->session->tr; + sql_schema *sys = find_sql_schema(tr, "sys"); + return find_sql_table(tr, sys, tbl_name); +} static inline sql_table* @@ -221,6 +231,42 @@ getUserOIDCallback(Client c, const char return oid_nil; } +static int +execPostLoginTriggers(Client c) { + int res = LOG_OK; + char *err = NULL; + backend *be = (backend *) c->sqlcontext; + if (be) { + mvc *m = be->mvc; + sql_table *triggers = getSysTbl(m, TRIGGERS_TABLE_NAME); + sql_trans *tr = m->session->tr; + int active = tr->active; + if (active
MonetDB: triggers - trigger without table obj ref wip
Changeset: 2c3e9cb8408d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c3e9cb8408d Modified Files: sql/backends/monet5/sql_cat.c sql/server/rel_psm.c sql/storage/store.c Branch: triggers Log Message: trigger without table obj ref wip diffs (157 lines): diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -523,19 +523,25 @@ create_trigger(mvc *sql, char *sname, ch { sql_trigger *tri = NULL, *other = NULL; sql_schema *s = NULL; - sql_table *t; + sql_table *t = NULL; const char *base = replace ? "CREATE OR REPLACE TRIGGER" : "CREATE TRIGGER"; - if (!(s = mvc_bind_schema(sql, sname))) - throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: no such schema '%s'", base, sname); - if (!mvc_schema_privs(sql, s)) - throw(SQL,"sql.create_trigger",SQLSTATE(42000) "%s: access denied for %s to schema '%s'", base, get_string_global_var(sql, "current_user"), s->base.name); + if (!strNil(sname) && !strNil(tname)) { + if (!(s = mvc_bind_schema(sql, sname))) + throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: no such schema '%s'", base, sname); + if (!mvc_schema_privs(sql, s)) + throw(SQL,"sql.create_trigger",SQLSTATE(42000) "%s: access denied for %s to schema '%s'", base, get_string_global_var(sql, "current_user"), s->base.name); + if (!(t = mvc_bind_table(sql, s, tname))) + throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: unknown table '%s'", base, tname); + if (isView(t)) + throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: cannot create trigger on view '%s'", base, tname); + } else { + if (!(s = mvc_bind_schema(sql, "sys"))) + throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: no such schema '%s'", base, sname); + } + if ((other = mvc_bind_trigger(sql, s, triggername)) && !replace) throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: name '%s' already in use", base, triggername); - if (!(t = mvc_bind_table(sql, s, tname))) - throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: unknown table '%s'", base, tname); - if (isView(t)) - throw(SQL,"sql.create_trigger",SQLSTATE(3F000) "%s: cannot create trigger on view '%s'", base, tname); if (replace && other) { if (other->t->base.id != t->base.id) /* defensive line */ diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -1241,8 +1241,8 @@ create_trigger(sql_query *query, dlist * mvc *sql = query->sql; const char *triggerschema = qname_schema(qname); const char *triggername = qname_schema_object(qname); - const char *sname = tqname? qname_schema(tqname) : NULL; - const char *tname = tqname? qname_schema_object(tqname) : NULL; + char *sname = tqname? qname_schema(tqname) : NULL; + char *tname = tqname? qname_schema_object(tqname) : NULL; int instantiate = (sql->emode == m_instantiate); int create = (!instantiate && sql->emode != m_deps), event, orientation; sql_schema *ss = cur_schema(sql), *old_schema = cur_schema(sql); @@ -1279,11 +1279,13 @@ create_trigger(sql_query *query, dlist * if (tname) { if (!(t = mvc_bind_table(sql, ss, tname))) return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42S02) "%s: no such table %s%s%s'%s'", base, sname ? "'":"", sname ? sname : "", sname ? "'.":"", tname); + if (isView(t)) + return sql_error(sql, 02, SQLSTATE(42000) "%s: cannot create trigger on view '%s'", base, tname); + sname = t->s->base.name; + tname = t->base.name; } if (!mvc_schema_privs(sql, ss)) return sql_error(sql, 02, SQLSTATE(42000) "%s: access denied for %s to schema '%s'", base, get_string_global_var(sql, "current_user"), ss->base.name); - if (isView(t)) - return sql_error(sql, 02, SQLSTATE(42000) "%s: cannot create trigger on view '%s'", base, tname); if (!replace && mvc_bind_trigger(sql, ss, triggername) != NULL) return sql_error(sql, 02, SQLSTATE(42000) "%s: name '%s' already in use", base, triggername); switch (trigger_event->token) { @@ -1311,6 +1313,9 @@ create_trigger(sql_query *query, dlist * return sql_error(sql, 02, SQLSTATE(42000) "%s: old and new names cannot be the same", base); event = 2; } break; +
MonetDB: triggers - wip trigger syntax
Changeset: d2e41cb5c673 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d2e41cb5c673 Modified Files: sql/server/rel_psm.c sql/server/sql_parser.y sql/server/sql_scan.c sql/server/sql_tokens.h Branch: triggers Log Message: wip trigger syntax diffs (113 lines): diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -1241,8 +1241,8 @@ create_trigger(sql_query *query, dlist * mvc *sql = query->sql; const char *triggerschema = qname_schema(qname); const char *triggername = qname_schema_object(qname); - const char *sname = qname_schema(tqname); - const char *tname = qname_schema_object(tqname); + const char *sname = tqname? qname_schema(tqname) : NULL; + const char *tname = tqname? qname_schema_object(tqname) : NULL; int instantiate = (sql->emode == m_instantiate); int create = (!instantiate && sql->emode != m_deps), event, orientation; sql_schema *ss = cur_schema(sql), *old_schema = cur_schema(sql); @@ -1276,8 +1276,10 @@ create_trigger(sql_query *query, dlist * if (create) { if (triggerschema) return sql_error(sql, 02, SQLSTATE(42000) "%s: a trigger will be placed on the respective table's schema, specify the schema on the table reference, ie ON clause instead", base); - if (!(t = mvc_bind_table(sql, ss, tname))) - return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42S02) "%s: no such table %s%s%s'%s'", base, sname ? "'":"", sname ? sname : "", sname ? "'.":"", tname); + if (tname) { + if (!(t = mvc_bind_table(sql, ss, tname))) + return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42S02) "%s: no such table %s%s%s'%s'", base, sname ? "'":"", sname ? sname : "", sname ? "'.":"", tname); + } if (!mvc_schema_privs(sql, ss)) return sql_error(sql, 02, SQLSTATE(42000) "%s: access denied for %s to schema '%s'", base, get_string_global_var(sql, "current_user"), ss->base.name); if (isView(t)) diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -529,6 +529,7 @@ int yydebug=1; XML_element_content_list XML_value_expression_list opt_schema_details_list +opt_qname %type _transaction_mode_list @@ -639,7 +640,7 @@ int yydebug=1; %token USER CURRENT_USER SESSION_USER LOCAL BEST EFFORT %token CURRENT_ROLE sqlSESSION CURRENT_SCHEMA CURRENT_TIMEZONE -%token sqlDELETE UPDATE SELECT INSERT MATCHED +%token sqlDELETE UPDATE SELECT INSERT MATCHED LOGIN %token LATERAL LEFT RIGHT FULL OUTER NATURAL CROSS JOIN INNER %token COMMIT ROLLBACK SAVEPOINT RELEASE WORK CHAIN NO PRESERVE ROWS %token START TRANSACTION READ WRITE ONLY ISOLATION LEVEL @@ -2536,19 +2537,25 @@ Define triggered SQL-statements. trigger_def: create_or_replace TRIGGER qname trigger_action_time trigger_event -ON qname opt_referencing_list triggered_action +opt_qname opt_referencing_list triggered_action { dlist *l = L(); append_list(l, $3); append_int(l, $4); append_symbol(l, $5); + append_list(l, $6); append_list(l, $7); append_list(l, $8); - append_list(l, $9); append_int(l, $1); $$ = _symbol_create_list(SQL_CREATE_TRIGGER, l); } ; +opt_qname: +/* empty */ { $$ = NULL; } +| ON qname { $$ = $2; } +; + + trigger_action_time: BEFORE { $$ = 0; } | AFTER { $$ = 1; } @@ -2561,6 +2568,7 @@ trigger_event: | TRUNCATE { $$ = _symbol_create_list(SQL_TRUNCATE, NULL); } | UPDATE { $$ = _symbol_create_list(SQL_UPDATE, NULL); } | UPDATE OF ident_commalist { $$ = _symbol_create_list(SQL_UPDATE, $3); } + | LOGIN { $$ = _symbol_create_list(SQL_LOGIN, NULL); } ; opt_referencing_list: @@ -6383,6 +6391,7 @@ char *token2string(tokens token) SQL(IS_NULL); SQL(JOIN); SQL(LIKE); + SQL(LOGIN); SQL(MAXVALUE); SQL(MERGE); SQL(MERGE_MATCH); diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c --- a/sql/server/sql_scan.c +++ b/sql/server/sql_scan.c @@ -522,6 +522,7 @@ scanner_init_keywords(void) failed += keywords_insert("MULTILINESTRINGZM", GEOMETRYSUBTYPE); failed += keywords_insert("MULTIPOLYGONZM", GEOMETRYSUBTYPE); failed += keywords_insert("GEOMETRYCOLLECTIONZM", GEOMETRYSUBTYPE); + failed += keywords_insert("LOGIN", LOGIN); return failed; } diff --git a/sql/server/sql_tokens.h b/sql/server/sql_tokens.h --- a/sql/server/sql_tokens.h +++ b/sql/server/sql_tokens.h @@ -98,6 +98,7 @@ typedef enum tokens { SQL_IS_NULL, SQL_JOIN, SQL_LIKE, + SQL_LO
MonetDB: escape-sequences - merge default
Changeset: da966ea3e67a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/da966ea3e67a Modified Files: clients/odbc/driver/ODBCUtil.c clients/odbc/driver/SQLExecDirect.c clients/odbc/driver/SQLNativeSql.c clients/odbc/driver/SQLPrepare.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/mtime.h monetdb5/modules/mal/inspect.c sql/common/sql_types.c sql/scripts/25_debug.sql sql/server/sql_datetime.c sql/server/sql_datetime.h sql/server/sql_parser.y sql/server/sql_scan.c Branch: escape-sequences Log Message: merge default diffs (truncated from 21302 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] cmake_minimum_required(VERSION 3.12) diff --git a/Config.cmake.in b/Config.cmake.in --- a/Config.cmake.in +++ b/Config.cmake.in @@ -5,7 +5,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] @PACKAGE_INIT@ diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. %global name MonetDB %global version 11.46.0 diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. # python mkodbcwxs.py VERSION BITS PREFIX > PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-ODBC-Installer.wxs diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. # python mksqlwxs.py VERSION BITS PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -147,4 +147,4 @@ This Source Code Form is subject to the License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. diff --git a/buildtools/CMakeLists.txt b/buildtools/CMakeLists.txt --- a/buildtools/CMakeLists.txt +++ b/buildtools/CMakeLists.txt @@ -5,7 +5,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] add_subdirectory(conf) diff --git a/buildtools/conf/CMakeLists.txt b/buildtools/conf/CMakeLists.txt --- a/buildtools/conf/CMakeLists.txt +++ b/buildtools/conf/CMakeLists.txt @@ -5,7 +5,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. #]] if(WIN32) diff --git a/buildtools/conf/Maddlog b/buildtools/conf/Maddlog --- a/buildtools/conf/Maddlog +++ b/buildtools/conf/Maddlog @@ -7,7 +7,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. +# Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. usage() { cat >&2 <<-EOF diff --git a/buildtools/conf/website.html b/buildtools/conf/website.html --- a/buildtools/conf/website.html +++ b/buildtools/conf/website.html @@ -5,7 +5,7 @@ This Source Code Form is subject to the Lice
MonetDB: escape-sequences - merge with default
Changeset: 8a58b57240f0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8a58b57240f0 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test clients/odbc/driver/ODBCUtil.c clients/odbc/driver/SQLExecDirect.c clients/odbc/driver/SQLNativeSql.c clients/odbc/driver/SQLPrepare.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/mtime.h monetdb5/modules/mal/inspect.c sql/common/sql_types.c sql/scripts/25_debug.sql sql/server/sql_datetime.c sql/server/sql_datetime.h sql/server/sql_parser.y sql/server/sql_scan.c Branch: escape-sequences Log Message: merge with default diffs (truncated from 13096 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/Config.cmake.in b/Config.cmake.in --- a/Config.cmake.in +++ b/Config.cmake.in @@ -1,4 +1,6 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -84,7 +86,7 @@ Summary: MonetDB - Monet Database Manage Vendor: MonetDB BV Group: Applications/Databases -License: MPLv2.0 +License: MPL-2.0 URL: https://www.monetdb.org/ BugURL: https://bugs.monetdb.org/ Source: https://www.monetdb.org/downloads/sources/Sep2022-SP1/%{name}-%{version}.tar.bz2 @@ -128,6 +130,7 @@ BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(liblz4) >= 1.8 %if %{with py3integration} BuildRequires: pkgconfig(python3) >= 3.5 +# cannot use python3dist(numpy) because of CentOS 7 BuildRequires: python3-numpy %endif %if %{with rintegration} @@ -343,7 +346,6 @@ Recommends: perl-DBD-monetdb >= 1.0 Recommends: php-monetdb >= 1.0 %endif Requires: MonetDB5-server%{?_isa} = %{version}-%{release} -Requires: python3-pymonetdb >= 1.0.6 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7 Recommends: python3dist(lz4) Recommends: python3dist(scipy) @@ -690,6 +692,7 @@ package. You probably don't need this, Summary: MonetDB - Monet Database Management System Group: Applications/Databases Requires: %{name}-client-tests = %{version}-%{release} +Requires: python3dist(pymonetdb) >= 1.0.6 BuildArch: noarch %description testing-python diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -141,6 +141,8 @@ Please note that we do not accept github Copyright Notice +SPDX-License-Identifier: MPL-2.0 + This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/buildtools/CMakeLists.txt b/buildtools/CMakeLists.txt --- a/buildtools/CMakeLists.txt +++ b/buildtools/CMakeLists.txt @@ -1,4 +1,6 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/buildtools/conf/CMakeLists.txt b/buildtools/conf/CMakeLists.txt --- a/buildtools/conf/CMakeLists.txt +++ b/buildtools/conf/CMakeLists.txt @@ -1,4 +1,6 @@ #[[ +# SPDX-License-Identifier: MPL-2.0 +# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/buildtools/conf/Maddlog b/buildtools/conf/Maddlog --- a/buildtools/conf/Maddlog +++
MonetDB: escape-sequences - approve test
Changeset: 0d6b5b201b83 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0d6b5b201b83 Modified Files: clients/Tests/MAL-signatures.test Branch: escape-sequences Log Message: approve test diffs (truncated from 976 to 300 lines): 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 @@ -23334,6 +23334,96 @@ pattern batmtime.month(X_0:bat[:timestam MTIMEtimestamp_month_bulk; (empty) batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:bat[:int]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:bat[:int], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:daytime, X_1:bat[:int]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:daytime, X_1:bat[:int], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:int):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:int, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:bat[:lng], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:date, X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:date, X_1:bat[:lng], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:lng):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:lng, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:bat[:lng], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:daytime, X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:daytime, X_1:bat[:lng], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:lng):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:lng, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2; +(empty) +batmtime quarter pattern batmtime.quarter(X_0:bat[:date]):bat[:bte] MTIMEdate_extract_quarter_bulk; @@ -23714,6 +23804,726 @@ pattern batmtime.timestamp_to_str(X_0:ba MTIMEtimestamp_to_str_bulk_p2; (empty) batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:bat[:timestamp], X_1:bat[:timestamp]):bat[:int] +MTIMEtimestampdiff_day_bulk; +(empty) +batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:bat[:timestamp], X_1:bat[:timestamp], X_2:bat[:oid], X_3:bat[:oid]):bat[:int] +MTIMEtimestampdiff_day_bulk; +(empty) +batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:timestamp, X_1:bat[:timestamp]):bat[:int] +MTIMEtimestampdiff_day_bulk_p1; +(empty) +batmtime +timestampdiff_day +pattern batmtime.timestampdiff_da
MonetDB: escape-sequences - fix test
Changeset: 0095cf9b877b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0095cf9b877b Modified Files: clients/Tests/MAL-signatures-hge.test Branch: escape-sequences Log Message: fix test diffs (truncated from 976 to 300 lines): 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 @@ -32139,6 +32139,96 @@ pattern batmtime.month(X_0:bat[:timestam MTIMEtimestamp_month_bulk; (empty) batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:bat[:int]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:bat[:int], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:daytime, X_1:bat[:int]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:daytime, X_1:bat[:int], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:int):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_month_time +pattern batmtime.odbc_timestamp_add_month_time(X_0:bat[:daytime], X_1:int, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_month_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:bat[:lng], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:date, X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:date, X_1:bat[:lng], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:lng):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_date +pattern batmtime.odbc_timestamp_add_msec_date(X_0:bat[:date], X_1:lng, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:bat[:lng], X_2:bat[:oid], X_3:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:daytime, X_1:bat[:lng]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:daytime, X_1:bat[:lng], X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:lng):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2; +(empty) +batmtime +odbc_timestamp_add_msec_time +pattern batmtime.odbc_timestamp_add_msec_time(X_0:bat[:daytime], X_1:lng, X_2:bat[:oid]):bat[:timestamp] +MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2; +(empty) +batmtime quarter pattern batmtime.quarter(X_0:bat[:date]):bat[:bte] MTIMEdate_extract_quarter_bulk; @@ -32519,6 +32609,726 @@ pattern batmtime.timestamp_to_str(X_0:ba MTIMEtimestamp_to_str_bulk_p2; (empty) batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:bat[:timestamp], X_1:bat[:timestamp]):bat[:int] +MTIMEtimestampdiff_day_bulk; +(empty) +batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:bat[:timestamp], X_1:bat[:timestamp], X_2:bat[:oid], X_3:bat[:oid]):bat[:int] +MTIMEtimestampdiff_day_bulk; +(empty) +batmtime +timestampdiff_day +pattern batmtime.timestampdiff_day(X_0:timestamp, X_1:bat[:timestamp]):bat[:int] +MTIMEtimestampdiff_day_bulk_p1; +(empty) +batmtime +timestampdiff_day +pattern batmtime.
MonetDB: escape-sequences - merge default
Changeset: b4b234573dda for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b4b234573dda Branch: escape-sequences Log Message: merge default diffs (6 lines): diff --git a/sql/test/concurrent/Tests/segments-corruption.timeout b/sql/test/concurrent/Tests/segments-corruption.timeout new file mode 100644 --- /dev/null +++ b/sql/test/concurrent/Tests/segments-corruption.timeout @@ -0,0 +1,1 @@ +4 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - clean up
Changeset: e7845def2f56 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e7845def2f56 Modified Files: sql/common/sql_types.c sql/server/sql_parser.y Branch: escape-sequences Log Message: clean up diffs (30 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1350,14 +1350,13 @@ sqltypeinit( sql_allocator *sa) sql_create_func(sa, "sql_add", "mtime", "time_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TME, 2, TME, SECINT); sql_create_func(sa, "sql_add", "mtime", "time_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMETZ, 2, TMETZ, SECINT); - // odbc timestampadd + // odbc timestampadd variants sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, SECINT); sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, DAYINT); sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, MONINT); sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, SECINT); sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, DAYINT); sql_create_func(sa, "timestampadd", "mtime", "timestamp_add_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, MONINT); - // corner cases as described in microsoft odbc timestampadd spec sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_msec_time", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TME, DAYINT); sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_month_time", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TME, MONINT); sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_msec_date", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, DTE, SECINT); diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6488,7 +6488,6 @@ odbc_datetime_func: | TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' search_condition ',' search_condition ')' { dlist *l = L(); switch($3) { -// TODO implement other cases case iyear: append_list( l, append_string(L(), sa_strdup(SA, "timestampdiff_year"))); break; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - timestampdiff quarter, year variants
Changeset: 207c50dbc42e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/207c50dbc42e Modified Files: monetdb5/modules/atoms/mtime.c sql/common/sql_types.c sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: timestampdiff quarter, year variants diffs (233 lines): diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -1188,6 +1188,50 @@ timestampdiff_month_timestamp_time(times return timestampdiff_month(ts, timestamp_create(today, t)); } +static inline int +timestampdiff_quarter(timestamp t1, timestamp t2) +{ + date d1 = timestamp_date(t1); + date d2 = timestamp_date(t2); + return ((date_year(d1) - date_year(d2)) * 4) + (date_quarter(d1) - date_quarter(d2)); +} + +static inline int +timestampdiff_quarter_time_timestamp(daytime t, timestamp ts) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_quarter(timestamp_create(today, t), ts); +} + +static inline int +timestampdiff_quarter_timestamp_time(timestamp ts, daytime t) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_quarter(ts, timestamp_create(today, t)); +} + +static inline int +timestampdiff_year(timestamp t1, timestamp t2) +{ + date d1 = timestamp_date(t1); + date d2 = timestamp_date(t2); + return date_year(d1) - date_year(d2); +} + +static inline int +timestampdiff_year_time_timestamp(daytime t, timestamp ts) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_year(timestamp_create(today, t), ts); +} + +static inline int +timestampdiff_year_timestamp_time(timestamp ts, daytime t) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_year(ts, timestamp_create(today, t)); +} + // odbc timestampdiff variants func2(MTIMEtimestampdiff_sec, "timestampdiff_sec", timestamp, timestamp, lng, timestampdiff_sec, func2_noexcept, @@ -1297,6 +1341,42 @@ func2(MTIMEtimestampdiff_month_ts_t, "ti INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_quarter, "timestampdiff_quarter", + timestamp, timestamp, int, timestampdiff_quarter, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_quarter_t_ts, "timestampdiff_quarter_time_timestamp", + daytime, timestamp, int, timestampdiff_quarter_time_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_quarter_ts_t, "timestampdiff_quarter_timestamp_time", + timestamp, daytime, int, timestampdiff_quarter_timestamp_time, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_year, "timestampdiff_year", + timestamp, timestamp, int, timestampdiff_year, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_year_t_ts, "timestampdiff_year_time_timestamp", + daytime, timestamp, int, timestampdiff_year_time_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_year_ts_t, "timestampdiff_year_timestamp_time", + timestamp, daytime, int, timestampdiff_year_timestamp_time, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) @@ -1738,6 +1818,54 @@ static mel_func mtime_init_funcs[] = { pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))), pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))), pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",tim
MonetDB: escape-sequences - timestampdiff day, week, month variants
Changeset: 6af3fc1225a3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6af3fc1225a3 Modified Files: monetdb5/modules/atoms/mtime.c sql/common/sql_types.c sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: timestampdiff day, week, month variants diffs (truncated from 389 to 300 lines): diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -1126,6 +1126,68 @@ timestampdiff_hour_timestamp_date(timest return timestampdiff_hour(ts, timestamp_fromdate(d)); } +static inline int +timestampdiff_day(timestamp t1, timestamp t2) +{ + return date_diff(timestamp_date(t1), timestamp_date(t2)); +} + +static inline int +timestampdiff_day_time_timestamp(daytime t, timestamp ts) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_day(timestamp_create(today, t), ts); +} + +static inline int +timestampdiff_day_timestamp_time(timestamp ts, daytime t) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_day(ts, timestamp_create(today, t)); +} + +static inline int +timestampdiff_week(timestamp t1, timestamp t2) +{ + return date_diff(timestamp_date(t1), timestamp_date(t2))/ 7; +} + +static inline int +timestampdiff_week_time_timestamp(daytime t, timestamp ts) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_week(timestamp_create(today, t), ts); +} + +static inline int +timestampdiff_week_timestamp_time(timestamp ts, daytime t) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_week(ts, timestamp_create(today, t)); +} + +static inline int +timestampdiff_month(timestamp t1, timestamp t2) +{ + date d1 = timestamp_date(t1); + date d2 = timestamp_date(t2); + return ((date_year(d1) - date_year(d2)) * 12) + (date_month(d1) - date_month(d2)); +} + +static inline int +timestampdiff_month_time_timestamp(daytime t, timestamp ts) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_month(timestamp_create(today, t), ts); +} + +static inline int +timestampdiff_month_timestamp_time(timestamp ts, daytime t) +{ + date today = timestamp_date(timestamp_current()); + return timestampdiff_month(ts, timestamp_create(today, t)); +} + // odbc timestampdiff variants func2(MTIMEtimestampdiff_sec, "timestampdiff_sec", timestamp, timestamp, lng, timestampdiff_sec, func2_noexcept, @@ -1181,6 +1243,60 @@ func2(MTIMEtimestampdiff_hour_ts_d, "tim INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_day, "timestampdiff_day", + timestamp, timestamp, int, timestampdiff_day, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_day_t_ts, "timestampdiff_day_time_timestamp", + daytime, timestamp, int, timestampdiff_day_time_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_day_ts_t, "timestampdiff_day_timestamp_time", + timestamp, daytime, int, timestampdiff_day_timestamp_time, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_week, "timestampdiff_week", + timestamp, timestamp, int, timestampdiff_week, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_week_t_ts, "timestampdiff_week_t_ts", + daytime, timestamp, int, timestampdiff_week_time_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_week_ts_t, "timestampdiff_week_ts_t", + timestamp, daytime, int, timestampdiff_week_timestamp_time, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_month, "timestampdiff_month", + timestamp, timestamp, int, timestampdiff_month, func2_noexcept, +
MonetDB: escape-sequences - timestampdiff sec, min, hour variants
Changeset: 2bba00a1d158 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2bba00a1d158 Modified Files: monetdb5/modules/atoms/mtime.c sql/common/sql_types.c sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: timestampdiff sec, min, hour variants diffs (truncated from 350 to 300 lines): diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -1068,6 +1068,122 @@ func2(MTIMEtimestamp_to_str, "timestamp_ GET_NEXT_VAR, GET_NEXT_ITER, APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI) + +static inline lng +timestampdiff_sec(timestamp t1, timestamp t2) +{ + return TSDIFF(t1, t2)/ 1000; +} + + +static inline lng +timestampdiff_sec_date_timestamp(date d, timestamp ts) +{ + return timestampdiff_sec(timestamp_fromdate(d), ts); +} + + +static inline lng +timestampdiff_sec_timestamp_date(timestamp ts, date d) +{ + return timestampdiff_sec(ts, timestamp_fromdate(d)); +} + + +static inline lng +timestampdiff_min(timestamp t1, timestamp t2) +{ + return TSDIFF(t1, t2)/ 1000 / 60; +} + +static inline lng +timestampdiff_min_date_timestamp(date d, timestamp ts) +{ + return timestampdiff_min(timestamp_fromdate(d), ts); +} + +static inline lng +timestampdiff_min_timestamp_date(timestamp ts, date d) +{ + return timestampdiff_min(ts, timestamp_fromdate(d)); +} + +static inline lng +timestampdiff_hour(timestamp t1, timestamp t2) +{ + return TSDIFF(t1, t2)/ 1000 / 60/ 60; +} + +static inline lng +timestampdiff_hour_date_timestamp(date d, timestamp ts) +{ + return timestampdiff_hour(timestamp_fromdate(d), ts); +} + +static inline lng +timestampdiff_hour_timestamp_date(timestamp ts, date d) +{ + return timestampdiff_hour(ts, timestamp_fromdate(d)); +} + +// odbc timestampdiff variants +func2(MTIMEtimestampdiff_sec, "timestampdiff_sec", + timestamp, timestamp, lng, timestampdiff_sec, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_sec_d_ts, "timestampdiff_sec_date_timestamp", + date, timestamp, lng, timestampdiff_sec_date_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_sec_ts_d, "timestampdiff_sec_timestamp_date", + timestamp, date, lng, timestampdiff_sec_timestamp_date, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_min, "timestampdiff_min", + timestamp, timestamp, lng, timestampdiff_min, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_min_d_ts, "timestampdiff_min_date_timestamp", + date, timestamp, lng, timestampdiff_min_date_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_min_ts_d, "timestampdiff_min_timestamp_date", + timestamp, date, lng, timestampdiff_min_timestamp_date, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_hour, "timestampdiff_hour", + timestamp, timestamp, lng, timestampdiff_hour, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_hour_d_ts, "timestampdiff_hour_date_timestamp", + date, timestamp, lng, timestampdiff_hour_date_timestamp, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEtimestampdiff_hour_ts_d, "timestampdiff_hour_timestamp_date", + timestamp, date, lng, timestampdiff_hour_timestamp_date, func2_noexcept, + DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING
MonetDB: escape-sequences - got timestampdiff all wrong
Changeset: fac694788097 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/fac694788097 Modified Files: sql/common/sql_types.c sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: got timestampdiff all wrong diffs (80 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1323,6 +1323,8 @@ sqltypeinit( sql_allocator *sa) sql_create_func(sa, "sql_sub", "mtime", "diff", FALSE, FALSE, SCALE_FIX, 0, SECINT, 2, TME, TME); sql_create_func(sa, "sql_sub", "mtime", "diff", FALSE, FALSE, SCALE_NONE, 0, SECINT, 2, TMESTAMPTZ, TMESTAMPTZ); sql_create_func(sa, "sql_sub", "mtime", "diff", FALSE, FALSE, SCALE_FIX, 0, SECINT, 2, TMESTAMP, TMESTAMP); + sql_create_func(sa, "timestampdiff", "mtime", "diff", FALSE, FALSE, SCALE_NONE, 0, SECINT, 2, TMESTAMPTZ, TMESTAMPTZ); + sql_create_func(sa, "timestampdiff", "mtime", "diff", FALSE, FALSE, SCALE_FIX, 0, SECINT, 2, TMESTAMP, TMESTAMP); sql_create_func(sa, "sql_sub", "mtime", "date_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, DTE, 2, DTE, SECINT); sql_create_func(sa, "sql_sub", "mtime", "date_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, DTE, 2, DTE, DAYINT); @@ -1360,12 +1362,8 @@ sqltypeinit( sql_allocator *sa) sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_month_time", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TME, MONINT); sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_msec_date", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, DTE, SECINT); // odbc timestampdiff - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, SECINT); - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, DAYINT); - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, MONINT); - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, SECINT); - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, DAYINT); - sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, MONINT); + sql_create_func(sa, "odbc_timestampdiff_sec", "mtime", "diff", FALSE, FALSE, SCALE_NONE, 0, SECINT, 2, TMESTAMPTZ, TMESTAMPTZ); + sql_create_func(sa, "odbc_timestampdiff_sec", "mtime", "diff", FALSE, FALSE, SCALE_FIX, 0, SECINT, 2, TMESTAMP, TMESTAMP); // TODO corner cases as described in microsoft odbc timestampdiff spec // end odbc diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6485,19 +6485,24 @@ odbc_datetime_func: append_symbol(l, _newAtomNode(atom_int(SA, &t, i))); $$ = _symbol_create_list( SQL_BINOP, l ); } -| TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' intval ',' search_condition ')' +| TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' search_condition ',' search_condition ')' { dlist *l = L(); - append_list( l, append_string(L(), sa_strdup(SA, "timestampdiff"))); + switch($3) { +// TODO implement other cases +case iyear: +case iquarter: +case imonth: +case iweek: +case iday: +case ihour: +case imin: +case isec: +default: + append_list( l, append_string(L(), sa_strdup(SA, "odbc_timestampdiff_sec"))); + } append_int(l, FALSE); /* ignore distinct */ - sql_subtype t; - lng i = 0; - if (process_odbc_interval(m, $3, $5, &t, &i) < 0) { - yyerror(m, "incorrect interval"); - $$ = NULL; - YYABORT; - } append_symbol(l, $7); - append_symbol(l, _newAtomNode(atom_int(SA, &t, i))); + append_symbol(l, $5); $$ = _symbol_create_list( SQL_BINOP, l ); } ; diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -108,9 +108,9 @@ select { fn timestampadd(SQL_TSI_HOUR, 1 2022-11-14 13:12:12 query T rowsort -select { fn timestampdiff(SQL_TSI_HOUR, 1, timestamp'2022
MonetDB: escape-sequences - timestampdiff common cases
Changeset: 524d1cb77dfd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/524d1cb77dfd Modified Files: sql/common/sql_types.c sql/server/sql_parser.y Branch: escape-sequences Log Message: timestampdiff common cases diffs (31 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1360,6 +1360,14 @@ sqltypeinit( sql_allocator *sa) sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_month_time", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TME, MONINT); sql_create_func(sa, "timestampadd", "mtime", "odbc_timestamp_add_msec_date", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, DTE, SECINT); // odbc timestampdiff + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, SECINT); + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, DAYINT); + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMP, 2, TMESTAMP, MONINT); + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, SECINT); + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_msec_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, DAYINT); + sql_create_func(sa, "timestampdiff", "mtime", "timestamp_sub_month_interval", FALSE, FALSE, SCALE_NONE, 0, TMESTAMPTZ, 2, TMESTAMPTZ, MONINT); + // TODO corner cases as described in microsoft odbc timestampdiff spec + // end odbc sql_create_func(sa, "local_timezone", "mtime", "local_timezone", FALSE, FALSE, SCALE_FIX, 0, SECINT, 0); diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6487,8 +6487,7 @@ odbc_datetime_func: } | TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' intval ',' search_condition ')' { dlist *l = L(); - // TODO sql_diff or custom func ? - append_list( l, append_string(L(), sa_strdup(SA, "sql_sub"))); + append_list( l, append_string(L(), sa_strdup(SA, "timestampdiff"))); append_int(l, FALSE); /* ignore distinct */ sql_subtype t; lng i = 0; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - timestampadd corner cases
Changeset: 21a1e0080451 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/21a1e0080451 Modified Files: monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/mtime.h sql/common/sql_types.c sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: timestampadd corner cases diffs (188 lines): diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -523,6 +523,26 @@ func2(MTIMEtimestamp_add_msec_interval, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEodbc_timestamp_add_msec_interval_time, "odbc_timestamp_add_msec_interval_time", + daytime, lng, timestamp, odbc_timestamp_add_msec_interval_time, func2_except, + DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEodbc_timestamp_add_month_interval_time, "odbc_timestamp_add_month_interval_time", + daytime, int, timestamp, odbc_timestamp_add_month_interval_time, func2_except, + DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) +func2(MTIMEodbc_timestamp_add_msec_interval_date, "odbc_timestamp_add_msec_interval_date", + date, lng, timestamp, odbc_timestamp_add_msec_interval_date, func2_except, + DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, + INIT_VARIN, INIT_VARIN, INIT_VAROUT, + GET_NEXT_VAR, GET_NEXT_VAR, + APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING) + + func2(MTIMEtimestamp_sub_month_interval, "timestamp_sub_month_interval", timestamp, int, timestamp, timestamp_sub_month_interval, func2_except, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, @@ -1101,6 +1121,7 @@ static mel_func mtime_init_funcs[] = { pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))), pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))), pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))), + // -- command("mtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval, false, "Add months to a timestamp", args(1,3, arg("",timestamp),arg("t",timestamp),arg("s",int))), pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",int))), pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("s",int))), @@ -1108,6 +1129,31 @@ static mel_func mtime_init_funcs[] = { pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))), pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))), pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))), +// odbc timestampadd corner cases + command("mtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time, false, "", args(1,3, arg("",timestamp),arg("t", daytime),arg("ms",lng))), + pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),batarg("ms",lng))), + pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",daytime),batarg("ms",lng))), + pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),arg("ms",lng))), + pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",daytime), batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))), + pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_t
MonetDB: escape-sequences - small fix
Changeset: d3157aea0268 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d3157aea0268 Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: small fix diffs (28 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6609,7 +6609,7 @@ odbc_data_type: | SQL_TIME { sql_find_subtype(&$$, "time", 0, 0); } | SQL_TIMESTAMP -{ sql_find_subtype(&$$, "timestamp", 0, 0); } +{ sql_find_subtype(&$$, "timestamp", 6, 0); } | SQL_TINYINT { sql_find_subtype(&$$, "tinyint", 0, 0); } | SQL_VARBINARY diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -107,6 +107,12 @@ select { fn timestampadd(SQL_TSI_HOUR, 1 2022-11-14 13:12:12 +# corner case +query T rowsort +select { fn timestampadd(SQL_TSI_DAY, 1, time'12:12:12') } + +2022-11-14 13:12:12 + query T rowsort select { fn timestampdiff(SQL_TSI_HOUR, 1, timestamp'2022-11-14 12:12:12') } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - better way of pass through escape se...
Changeset: 5970f9e88c5e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5970f9e88c5e Modified Files: clients/odbc/driver/ODBCUtil.c clients/odbc/driver/SQLExecDirect.c clients/odbc/driver/SQLNativeSql.c clients/odbc/driver/SQLPrepare.c Branch: escape-sequences Log Message: better way of pass through escape sequences diffs (110 lines): diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c --- a/clients/odbc/driver/ODBCUtil.c +++ b/clients/odbc/driver/ODBCUtil.c @@ -892,6 +892,9 @@ ODBCTranslateSQL(ODBCDbc *dbc, const SQL * plenty long enough */ char buf[128], buf2[128]; + if (dbc->minor >= 46) + noscan = SQL_NOSCAN_ON; + if (noscan != SQL_NOSCAN_ON) { char *nquery; bool quoted = false, rawstring = false, dquoted = false; diff --git a/clients/odbc/driver/SQLExecDirect.c b/clients/odbc/driver/SQLExecDirect.c --- a/clients/odbc/driver/SQLExecDirect.c +++ b/clients/odbc/driver/SQLExecDirect.c @@ -56,14 +56,8 @@ ODBCExecDirect(ODBCStmt *stmt, const SQL stmt->Dbc->qtimeout = stmt->qtimeout; } - if (stmt->Dbc->minor >= 46) - query = (char *) StatementText; - else - query = ODBCTranslateSQL( - stmt->Dbc, - StatementText, - (size_t) TextLength, - stmt->noScan); + query = ODBCTranslateSQL(stmt->Dbc, StatementText, (size_t) TextLength, +stmt->noScan); if (query == NULL) { /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); @@ -89,8 +83,7 @@ ODBCExecDirect(ODBCStmt *stmt, const SQL stmt->Dbc->cachelimit = 100; } ret = mapi_query_handle(hdl, query); - if (query != (char *) StatementText) - free(query); + free(query); switch (ret) { case MOK: break; diff --git a/clients/odbc/driver/SQLNativeSql.c b/clients/odbc/driver/SQLNativeSql.c --- a/clients/odbc/driver/SQLNativeSql.c +++ b/clients/odbc/driver/SQLNativeSql.c @@ -50,13 +50,9 @@ MNDBNativeSql(ODBCDbc *dbc, #ifdef ODBCDEBUG ODBCLOG("\"%.*s\"\n", (int) TextLength1, (char *) InStatementText); #endif - if (dbc->minor >= 46) - query = (char *) InStatementText; - else - query = ODBCTranslateSQL(dbc, - InStatementText, - (size_t) TextLength1, - SQL_NOSCAN_OFF); + + query = ODBCTranslateSQL(dbc, InStatementText, (size_t) TextLength1, +SQL_NOSCAN_OFF); if (query == NULL) { /* Memory allocation error */ addDbcError(dbc, "HY001", NULL, 0); @@ -65,8 +61,7 @@ MNDBNativeSql(ODBCDbc *dbc, copyString(query, strlen(query), OutStatementText, BufferLength, TextLength2Ptr, SQLINTEGER, addDbcError, dbc, free(query); return SQL_ERROR); - if (query != (char *) InStatementText) - free(query); + free(query); return dbc->Error ? SQL_SUCCESS_WITH_INFO : SQL_SUCCESS; } diff --git a/clients/odbc/driver/SQLPrepare.c b/clients/odbc/driver/SQLPrepare.c --- a/clients/odbc/driver/SQLPrepare.c +++ b/clients/odbc/driver/SQLPrepare.c @@ -74,13 +74,8 @@ MNDBPrepare(ODBCStmt *stmt, } fixODBCstring(StatementText, TextLength, SQLINTEGER, addStmtError, stmt, return SQL_ERROR); - if (stmt->Dbc->minor >= 46) - query = (char *) StatementText; - else - query = ODBCTranslateSQL(stmt->Dbc, - StatementText, - (size_t) TextLength, - stmt->noScan); + query = ODBCTranslateSQL(stmt->Dbc, StatementText, (size_t) TextLength, +stmt->noScan); if (query == NULL) { /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); @@ -92,15 +87,13 @@ MNDBPrepare(ODBCStmt *stmt, size_t querylen = strlen(query) + 9; s = malloc(querylen); if (s == NULL) { - if (query != (char *) StatementText) - free(query); + free(query); /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); return SQL_ERROR; } strconcat_len(s, querylen, "prepare ", query, NULL); - if (query != (char *) StatementText) - free(query); + free(query); ODBCResetStmt(stmt); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - merge with default
Changeset: 194e2e9cdf80 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/194e2e9cdf80 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test clients/odbc/driver/SQLExecDirect.c Branch: escape-sequences Log Message: merge with default diffs (truncated from 830 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -788,3 +788,4 @@ 44e45c9a451f6afd933773094ec25723f713d3be 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_SP6_release 5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9 +41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11 diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -855,6 +855,11 @@ fi %endif %changelog +* Mon Dec 05 2022 Sjoerd Mullender - 11.45.11-20221205 +- Rebuilt. +- GH#7342: column which datatype is double couldn't group or aggregation + in version 11.45.7 + * Mon Nov 28 2022 Sjoerd Mullender - 11.45.9-20221128 - Rebuilt. - GH#7330: Creating temporary table fails after reconnect 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 @@ -43895,11 +43895,6 @@ CLTsetPrintTimeout; Print running query every so many seconds. clients setquerytimeout -unsafe pattern clients.setquerytimeout(X_0:bte, X_1:int):void -CLTqueryTimeout; -(empty) -clients -setquerytimeout unsafe pattern clients.setquerytimeout(X_0:int):void CLTqueryTimeout; (empty) @@ -43909,22 +43904,12 @@ unsafe pattern clients.setquerytimeout(X CLTqueryTimeout; A query is aborted after q seconds (q=0 means run undisturbed). clients -setquerytimeout -unsafe pattern clients.setquerytimeout(X_0:sht, X_1:int):void -CLTqueryTimeout; -(empty) -clients setsession unsafe pattern clients.setsession(X_0:lng):void CLTsetSessionTimeout; Abort a session after n seconds. clients setsessiontimeout -unsafe pattern clients.setsessiontimeout(X_0:bte, X_1:int):void -CLTsessionTimeout; -(empty) -clients -setsessiontimeout unsafe pattern clients.setsessiontimeout(X_0:int):void CLTsessionTimeout; (empty) @@ -43934,11 +43919,6 @@ unsafe pattern clients.setsessiontimeout CLTsessionTimeout; Set the session timeout for a particulat session id clients -setsessiontimeout -unsafe pattern clients.setsessiontimeout(X_0:sht, X_1:int):void -CLTsessionTimeout; -(empty) -clients settimeout unsafe pattern clients.settimeout(X_0:lng):void CLTsetTimeout; @@ -43970,12 +43950,12 @@ CLTsha2sum; Return hex string representation of the SHA-2 hash with bits of the given string clients shutdown -unsafe pattern clients.shutdown(X_0:int):str +unsafe pattern clients.shutdown(X_0:bte):str CLTshutdown; (empty) clients shutdown -unsafe pattern clients.shutdown(X_0:int, X_1:bit):str +unsafe pattern clients.shutdown(X_0:bte, X_1:bit):str CLTshutdown; Close all other client connections. Return if it succeeds.@If forced is set then always stop the system the hard way clients @@ -43985,20 +43965,10 @@ CLTstop; Stop the query execution at the next eligble statement. clients stopsession -unsafe pattern clients.stopsession(X_0:bte):void -CLTstopSession; -(empty) -clients -stopsession unsafe pattern clients.stopsession(X_0:int):void CLTstopSession; Stop a particular session clients -stopsession -unsafe pattern clients.stopsession(X_0:sht):void -CLTstopSession; -(empty) -clients suspend unsafe pattern clients.suspend(X_0:int):void CLTsuspend; 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 @@ -32390,11 +32390,6 @@ CLTsetPrintTimeout; Print running query every so many seconds. clients setquerytimeout -unsafe pattern clients.setquerytimeout(X_0:bte, X_1:int):void -CLTqueryTimeout; -(empty) -clients -setquerytimeout unsafe pattern clients.setquerytimeout(X_0:int):void CLTqueryTimeout; (empty) @@ -32404,22 +32399,12 @@ unsafe pattern clients.setquerytimeout(X CLTqueryTimeout; A query is aborted after q seconds (q=0 means run undisturbed). clients -setquerytimeout -unsafe pattern clients.setquerytimeout(X_0:sht, X_1:int):void -CLTqueryTimeout; -(empty) -clients setsession unsafe pattern clients.setsession(X_0:lng):void CLTsetSessionTimeout; Abort a session after n seconds. clients setsessiontimeout -unsafe pattern clients.setsessiontimeout(X_0:bte, X_1:int):void -CLTsessionTimeout; -(empty) -clients -setsessiontimeout unsafe pattern clients.setsessiontimeout(X_0:int):void CLTsessionTimeout; (empty) @@ -32429,11 +32414,6 @@ unsafe pattern clients.setsessiontimeout CLTsessionTimeout; Set the session timeout for a particulat session id clients -setsessiontimeout -unsafe pattern clients.setsessiontimeout(X_0:sht, X_1:int):void -CLTsessionTimeout; -(empty) -clients settimeout unsafe patt
MonetDB: escape-sequences - let odbc pass through escape sequences
Changeset: ee29cddffdd0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ee29cddffdd0 Modified Files: clients/odbc/driver/SQLExecDirect.c clients/odbc/driver/SQLNativeSql.c clients/odbc/driver/SQLPrepare.c Branch: escape-sequences Log Message: let odbc pass through escape sequences diffs (97 lines): diff --git a/clients/odbc/driver/SQLExecDirect.c b/clients/odbc/driver/SQLExecDirect.c --- a/clients/odbc/driver/SQLExecDirect.c +++ b/clients/odbc/driver/SQLExecDirect.c @@ -54,8 +54,14 @@ ODBCExecDirect(ODBCStmt *stmt, const SQL stmt->Dbc->qtimeout = stmt->qtimeout; } - query = ODBCTranslateSQL(stmt->Dbc, StatementText, (size_t) TextLength, -stmt->noScan); + if (stmt->Dbc->minor >= 46) + query = (char *) StatementText; + else + query = ODBCTranslateSQL( + stmt->Dbc, + StatementText, + (size_t) TextLength, + stmt->noScan); if (query == NULL) { /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); @@ -81,7 +87,8 @@ ODBCExecDirect(ODBCStmt *stmt, const SQL stmt->Dbc->cachelimit = 100; } ret = mapi_query_handle(hdl, query); - free(query); + if (query != (char *) StatementText) + free(query); switch (ret) { case MOK: break; diff --git a/clients/odbc/driver/SQLNativeSql.c b/clients/odbc/driver/SQLNativeSql.c --- a/clients/odbc/driver/SQLNativeSql.c +++ b/clients/odbc/driver/SQLNativeSql.c @@ -50,9 +50,13 @@ MNDBNativeSql(ODBCDbc *dbc, #ifdef ODBCDEBUG ODBCLOG("\"%.*s\"\n", (int) TextLength1, (char *) InStatementText); #endif - - query = ODBCTranslateSQL(dbc, InStatementText, (size_t) TextLength1, -SQL_NOSCAN_OFF); + if (dbc->minor >= 46) + query = (char *) InStatementText; + else + query = ODBCTranslateSQL(dbc, + InStatementText, + (size_t) TextLength1, + SQL_NOSCAN_OFF); if (query == NULL) { /* Memory allocation error */ addDbcError(dbc, "HY001", NULL, 0); @@ -61,7 +65,8 @@ MNDBNativeSql(ODBCDbc *dbc, copyString(query, strlen(query), OutStatementText, BufferLength, TextLength2Ptr, SQLINTEGER, addDbcError, dbc, free(query); return SQL_ERROR); - free(query); + if (query != (char *) InStatementText) + free(query); return dbc->Error ? SQL_SUCCESS_WITH_INFO : SQL_SUCCESS; } diff --git a/clients/odbc/driver/SQLPrepare.c b/clients/odbc/driver/SQLPrepare.c --- a/clients/odbc/driver/SQLPrepare.c +++ b/clients/odbc/driver/SQLPrepare.c @@ -74,8 +74,13 @@ MNDBPrepare(ODBCStmt *stmt, } fixODBCstring(StatementText, TextLength, SQLINTEGER, addStmtError, stmt, return SQL_ERROR); - query = ODBCTranslateSQL(stmt->Dbc, StatementText, (size_t) TextLength, -stmt->noScan); + if (stmt->Dbc->minor >= 46) + query = (char *) StatementText; + else + query = ODBCTranslateSQL(stmt->Dbc, + StatementText, + (size_t) TextLength, + stmt->noScan); if (query == NULL) { /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); @@ -87,13 +92,15 @@ MNDBPrepare(ODBCStmt *stmt, size_t querylen = strlen(query) + 9; s = malloc(querylen); if (s == NULL) { - free(query); + if (query != (char *) StatementText) + free(query); /* Memory allocation error */ addStmtError(stmt, "HY001", NULL, 0); return SQL_ERROR; } strconcat_len(s, querylen, "prepare ", query, NULL); - free(query); + if (query != (char *) StatementText) + free(query); ODBCResetStmt(stmt); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - add ifnull
Changeset: 2c9dd318b743 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c9dd318b743 Modified Files: sql/server/sql_parser.y sql/server/sql_scan.c sql/test/odbc-escape-sequences/Tests/system-functions.test Branch: escape-sequences Log Message: add ifnull diffs (56 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -724,7 +724,7 @@ SQLCODE SQLERROR UNDER WHENEVER %token X_BODY %token MAX_MEMORY MAX_WORKERS OPTIMIZER /* odbc tokens */ -%token DAYNAME MONTHNAME TIMESTAMPADD TIMESTAMPDIFF +%token DAYNAME MONTHNAME TIMESTAMPADD TIMESTAMPDIFF IFNULL /* odbc data type tokens */ %token SQL_BIGINT @@ -5683,6 +5683,7 @@ non_reserved_word: | MONTHNAME { $$ = sa_strdup(SA, "monthname"); } | TIMESTAMPADD { $$ = sa_strdup(SA, "timestampadd"); } | TIMESTAMPDIFF { $$ = sa_strdup(SA, "timestampdiff"); } +| IFNULL { $$ = sa_strdup(SA, "ifnull"); } ; lngval: @@ -6531,6 +6532,12 @@ odbc_scalar_func: append_symbol(l, $5); $$ = _symbol_create_list( SQL_BINOP, l ); } +| IFNULL '(' search_condition ',' search_condition ')' +{ dlist *l = L(); + append_symbol( l, $3); + append_symbol( l, $5); + $$ = _symbol_create_list(SQL_COALESCE, l); +} ; odbc_data_type: diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c --- a/sql/server/sql_scan.c +++ b/sql/server/sql_scan.c @@ -528,6 +528,7 @@ scanner_init_keywords(void) failed += keywords_insert("fn", ODBC_FUNC_ESCAPE_PREFIX); failed += keywords_insert("oj", ODBC_OJ_ESCAPE_PREFIX); failed += keywords_insert("DAYNAME", DAYNAME); + failed += keywords_insert("IFNULL", IFNULL); failed += keywords_insert("MONTHNAME", MONTHNAME); failed += keywords_insert("TIMESTAMPADD", TIMESTAMPADD); failed += keywords_insert("TIMESTAMPDIFF", TIMESTAMPDIFF); diff --git a/sql/test/odbc-escape-sequences/Tests/system-functions.test b/sql/test/odbc-escape-sequences/Tests/system-functions.test --- a/sql/test/odbc-escape-sequences/Tests/system-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/system-functions.test @@ -7,3 +7,8 @@ query I rowsort select length((select { fn database() })) > 0 1 + +query I rowsort +select { fn ifnull(NULL, 1) } + +1 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - timestampdiff partial case
Changeset: 3f2e70112dfd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3f2e70112dfd Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: timestampdiff partial case diffs (38 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6485,6 +6485,22 @@ odbc_datetime_func: append_symbol(l, $7); $$ = _symbol_create_list( SQL_BINOP, l ); } +| TIMESTAMPDIFF '(' odbc_tsi_qualifier ',' intval ',' search_condition ')' + { dlist *l = L(); + // TODO sql_diff or custom func ? + append_list( l, append_string(L(), sa_strdup(SA, "sql_sub"))); + append_int(l, FALSE); /* ignore distinct */ + sql_subtype t; + lng i = 0; + if (process_odbc_interval(m, $3, $5, &t, &i) < 0) { + yyerror(m, "incorrect interval"); + $$ = NULL; + YYABORT; + } + append_symbol(l, $7); + append_symbol(l, _newAtomNode(atom_int(SA, &t, i))); + $$ = _symbol_create_list( SQL_BINOP, l ); + } ; diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -106,3 +106,8 @@ query T rowsort select { fn timestampadd(SQL_TSI_HOUR, 1, timestamp'2022-11-14 12:12:12') } 2022-11-14 13:12:12 + +query T rowsort +select { fn timestampdiff(SQL_TSI_HOUR, 1, timestamp'2022-11-14 12:12:12') } + +2022-11-14 11:12:12 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - partial case for timestampadd add
Changeset: d148562e8a06 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d148562e8a06 Modified Files: sql/server/sql_datetime.c sql/server/sql_datetime.h sql/server/sql_parser.y sql/server/sql_scan.c sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: partial case for timestampadd add diffs (233 lines): diff --git a/sql/server/sql_datetime.c b/sql/server/sql_datetime.c --- a/sql/server/sql_datetime.c +++ b/sql/server/sql_datetime.c @@ -329,10 +329,13 @@ int inttype2digits( int sk, int ek ) if(ek == iyear) return 1; return 2; + case iquarter: case imonth: return 3; + case iweek: case iday: switch(ek) { + case iweek: case iday: return 4; case ihour: @@ -473,3 +476,59 @@ get_timestamp_precision(const char* val) parse_timestamp(val, &yr, &mt, &dy, &hr, &mn, &sc, &fr, &pr); return pr; } + + +int +process_odbc_interval(mvc *sql, itype interval, int val, sql_subtype *t, lng *i) +{ + assert(sql); + int mul = 1; + int d = inttype2digits(interval, interval); + switch (interval) { + case iyear: + mul *= 12; + /* fall through */ + case iquarter: + mul *= 3; + /* fall through */ + case imonth: + break; + case iweek: + mul *= 7; + /* fall through */ + case iday: + mul *= 24; + /* fall through */ + case ihour: + mul *= 60; + /* fall through */ + case imin: + mul *= 6; + /* fall through */ + case isec: + break; + default: + snprintf(sql->errstr, ERRSIZE, _("Internal error: bad interval qualifier (%d)\n"), interval); + return -1; + } + + // check for overflow + if (((lng) abs(val) * mul) > GDK_lng_max) { + snprintf(sql->errstr, ERRSIZE, _("Overflow\n")); + return -1; + } + // compute value month or sec interval + *i += val * mul; + + int r = 0; + if (d < 4){ + r = sql_find_subtype(t, "month_interval", d, 0); + } else if (d == 4) { + r = sql_find_subtype(t, "day_interval", d, 0); + } else { + r = sql_find_subtype(t, "sec_interval", d, 0); + } + if (!r) + return -1; + return 0; +} diff --git a/sql/server/sql_datetime.h b/sql/server/sql_datetime.h --- a/sql/server/sql_datetime.h +++ b/sql/server/sql_datetime.h @@ -25,7 +25,8 @@ typedef enum inttype { idoy, icentury, idecade, - iepoch + iepoch, + insec } itype; int parse_interval_qualifier(mvc *sql, struct dlist *pers, int *sk, int *ek, int *sp, int *ep); @@ -74,5 +75,7 @@ parse_timestamp(const char* val, unsigned int* pr); unsigned int get_timestamp_precision(const char* val); +int +process_odbc_interval(mvc *sql, itype interval, int val, sql_subtype *t, lng *i); #endif /*_SQL_DATETIME_H_*/ diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -724,7 +724,7 @@ SQLCODE SQLERROR UNDER WHENEVER %token X_BODY %token MAX_MEMORY MAX_WORKERS OPTIMIZER /* odbc tokens */ -%token DAYNAME MONTHNAME +%token DAYNAME MONTHNAME TIMESTAMPADD TIMESTAMPDIFF /* odbc data type tokens */ %token SQL_BIGINT @@ -775,7 +775,10 @@ SQLCODE SQLERROR UNDER WHENEVER SQL_TSI_YEAR %type - odbc_data_type + odbc_data_type + +%type +odbc_tsi_qualifier /* odbc escape prefix tokens */ %token @@ -796,6 +799,7 @@ SQLCODE SQLERROR UNDER WHENEVER odbc_scalar_func_escape odbc_scalar_func odbc_datetime_func + %% sqlstmt: @@ -5677,6 +5681,8 @@ non_reserved_word: | ODBC_OJ_ESCAPE_PREFIX { $$ = sa_strdup(SA, "oj"); } | DAYNAME { $$ = sa_strdup(SA, "dayname"); } | MONTHNAME { $$ = sa_strdup(SA, "monthname"); } +| TIMESTAMPADD { $$ = sa_strdup(SA, "timestampadd"); } +| TIMESTAMPDIFF { $$ = sa_strdup(SA, "timestampdiff"); } ; lngval: @@ -6463,6 +6469,22 @@ odbc_datetime_func: append_symbol(l, $3); $$ = _symbol_create_list( SQL_UNOP, l ); } +| TIMESTAMPADD '(' odbc_tsi_qualifier ',' intval ',' search_condition ')' + { dlist *l = L(); + // TODO sql_add or custom func ? + append_list( l, append_string(L(), sa_strdup(SA, "sql_add"))); + append_int
MonetDB: escape-sequences - move convert hge test
Changeset: d23014af5104 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d23014af5104 Added Files: sql/test/odbc-escape-sequences/Tests/convert-func-hge.test Modified Files: sql/test/odbc-escape-sequences/Tests/All sql/test/odbc-escape-sequences/Tests/convert-functions.test Branch: escape-sequences Log Message: move convert hge test diffs (33 lines): diff --git a/sql/test/odbc-escape-sequences/Tests/All b/sql/test/odbc-escape-sequences/Tests/All --- a/sql/test/odbc-escape-sequences/Tests/All +++ b/sql/test/odbc-escape-sequences/Tests/All @@ -1,5 +1,6 @@ call-procedures convert-functions +HAVE_HGE?convert-func-hge literals like-sequences numeric-functions diff --git a/sql/test/odbc-escape-sequences/Tests/convert-func-hge.test b/sql/test/odbc-escape-sequences/Tests/convert-func-hge.test new file mode 100644 --- /dev/null +++ b/sql/test/odbc-escape-sequences/Tests/convert-func-hge.test @@ -0,0 +1,4 @@ +query I rowsort +select { fn convert(1, SQL_HUGEINT) } + +1 diff --git a/sql/test/odbc-escape-sequences/Tests/convert-functions.test b/sql/test/odbc-escape-sequences/Tests/convert-functions.test --- a/sql/test/odbc-escape-sequences/Tests/convert-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/convert-functions.test @@ -44,10 +44,6 @@ select { fn convert('a338a15d-0422-4242- a338a15d-0422-4242-a7f0-65316edae19a -query I rowsort -select { fn convert(1, SQL_HUGEINT) } - -1 query I rowsort select { fn convert(1, SQL_INTEGER) } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - more odbc keywords
Changeset: 6f41e4efa9ae for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6f41e4efa9ae Modified Files: sql/server/sql_parser.y Branch: escape-sequences Log Message: more odbc keywords diffs (19 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -764,6 +764,15 @@ SQLCODE SQLERROR UNDER WHENEVER SQL_WCHAR SQL_WLONGVARCHAR SQL_WVARCHAR +SQL_TSI_FRAC_SECOND +SQL_TSI_SECOND +SQL_TSI_MINUTE +SQL_TSI_HOUR +SQL_TSI_DAY +SQL_TSI_WEEK +SQL_TSI_MONTH +SQL_TSI_QUARTER +SQL_TSI_YEAR %type odbc_data_type ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - merge with default
Changeset: ea5530c7f951 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ea5530c7f951 Modified Files: sql/common/sql_types.c Branch: escape-sequences Log Message: merge with default diffs (truncated from 7162 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -785,3 +785,4 @@ 47675351fec22d5d5dc81eec03dfa08f505afc99 47675351fec22d5d5dc81eec03dfa08f505afc99 Sep2022_release 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_23 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_SP5_release +43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25 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 @@ -30620,13 +30620,13 @@ CLRbatycc; Converts an YCC triplets to a color atom batgeom AsEWKT -function batgeom.AsEWKT(w:bat[:wkb]):bat[:str]; -(empty) +command batgeom.AsEWKT(X_0:bat[:wkb]):bat[:str] +batgeom_AsEWKT_wkb; (empty) batgeom AsText -function batgeom.AsText(w:bat[:wkb]):bat[:str]; -(empty) +command batgeom.AsText(X_0:bat[:wkb]):bat[:str] +batgeom_AsText_wkb; (empty) batgeom Boundary @@ -30685,23 +30685,23 @@ wkbFromText_bat; (empty) batgeom GeomCollFromText -function batgeom.GeomCollFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.GeomCollFromText(X_0:bat[:str]):bat[:wkb] +batgeom_GeomCollFromText_str; (empty) batgeom GeomCollFromText -function batgeom.GeomCollFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.GeomCollFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_GeomCollFromText_str_int; (empty) batgeom GeomFromText -function batgeom.GeomFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.GeomFromText(X_0:bat[:str]):bat[:wkb] +batgeom_GeomFromText_str; (empty) batgeom GeomFromText -function batgeom.GeomFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.GeomFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_GeomFromText_str_int; (empty) batgeom GeometryN @@ -30715,13 +30715,13 @@ wkbGeometryType_bat; (empty) batgeom GeometryType1 -function batgeom.GeometryType1(w:bat[:wkb]):bat[:str]; -(empty) +command batgeom.GeometryType1(X_0:bat[:wkb]):bat[:str] +batgeom_GeometryType1_wkb; (empty) batgeom GeometryType2 -function batgeom.GeometryType2(w:bat[:wkb]):bat[:str]; -(empty) +command batgeom.GeometryType2(X_0:bat[:wkb]):bat[:str] +batgeom_GeometryType2_wkb; (empty) batgeom GetCoordinate @@ -30755,43 +30755,43 @@ wkbIsValid_bat; (empty) batgeom LineFromText -function batgeom.LineFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.LineFromText(X_0:bat[:str]):bat[:wkb] +batgeom_LineFromText_str; (empty) batgeom LineFromText -function batgeom.LineFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.LineFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_LineFromText_str_int; (empty) batgeom MLineFromText -function batgeom.MLineFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.MLineFromText(X_0:bat[:str]):bat[:wkb] +batgeom_MLineFromText_str; (empty) batgeom MLineFromText -function batgeom.MLineFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.MLineFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_MLineFromText_str_int; (empty) batgeom MPointFromText -function batgeom.MPointFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.MPointFromText(X_0:bat[:str]):bat[:wkb] +batgeom_MPointFromText_str; (empty) batgeom MPointFromText -function batgeom.MPointFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.MPointFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_MPointFromText_str_int; (empty) batgeom MPolyFromText -function batgeom.MPolyFromText(wkt:bat[:str]):bat[:wkb]; -(empty) +command batgeom.MPolyFromText(X_0:bat[:str]):bat[:wkb] +batgeom_MPolyFromText_str; (empty) batgeom MPolyFromText -function batgeom.MPolyFromText(wkt:bat[:str], srid:int):bat[:wkb]; -(empty) +command batgeom.MPolyFromText(X_0:bat[:str], X_1:int):bat[:wkb] +batgeom_MPolyFromText_str_int; (empty) batgeom MakeBox2D @@ -30805,23 +30805,23 @@ wkbMakeLine_bat; Gets two BATS of point or linestring geometries and returns a bat with linestring geometries batgeom MakePoint -function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl]):bat[:wkb]; -(empty) +command batgeom.MakePoint(X_0:bat[:dbl], X_1:bat[:dbl]):bat[:wkb] +batgeom_MakePoint_dbl_dbl; (empty) batgeom MakePoint -function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl], z:bat[:dbl]):bat[:wkb]; -(empty) +command batgeom.MakePoint(X_0:bat[:dbl], X_1:bat[:dbl], X_2:bat[:dbl]):bat[:wkb] +batgeom_MakePoint_dbl_dbl_dbl; (empty) batgeom MakePoint -function batgeom.MakePoint(x:bat[:dbl], y:bat[:dbl], z:bat[:dbl], m:bat[:dbl]):bat[:wkb]; -(empty) +command batgeom.MakePoint(X_0:bat[:dbl], X_1:bat[:dbl], X_2:bat[:dbl], X_3:bat[:dbl]):bat[:wkb] +batgeom_MakePoint_dbl_dbl_dbl_dbl; (empty) batgeom MakePointM -fun
MonetDB: escape-sequences - fix compilation
Changeset: a42559e66fbe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a42559e66fbe Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/literals.test Branch: escape-sequences Log Message: fix compilation diffs (36 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6577,7 +6577,7 @@ static inline symbol* makeAtomNode(mvc *m, const char* typename, const char* val, unsigned int digits, unsigned int scale, bool bind) { sql_subtype sub_t; atom *a; -int r; +int sub_t_found = 0; if (bind) { sql_type* t = NULL; if (!(t = mvc_bind_type(m, typename))) { @@ -6586,9 +6586,9 @@ makeAtomNode(mvc *m, const char* typenam } sql_init_subtype(&sub_t, t, 0, 0); } else { -r = sql_find_subtype(&sub_t, typename, digits, scale); +sub_t_found = sql_find_subtype(&sub_t, typename, digits, scale); } -if (!r || (a = atom_general(m->sa, &sub_t, val)) == NULL) { +if ((!bind && !sub_t_found) || (a = atom_general(m->sa, &sub_t, val)) == NULL) { sqlformaterror(m, SQLSTATE(22007) "Incorrect %s value (%s)", typename, val); return NULL; } diff --git a/sql/test/odbc-escape-sequences/Tests/literals.test b/sql/test/odbc-escape-sequences/Tests/literals.test --- a/sql/test/odbc-escape-sequences/Tests/literals.test +++ b/sql/test/odbc-escape-sequences/Tests/literals.test @@ -26,7 +26,7 @@ select {ts '2022-02-17 02:08:12'} 2022-02-17 02:08:12 query T rowsort -select {guid 'e751f9e0-2cee-4eca-b0c2-1cf108cebd18'} +select { guid 'e751f9e0-2cee-4eca-b0c2-1cf108cebd18' } e751f9e0-2cee-4eca-b0c2-1cf108cebd18 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - add odbc monthname func
Changeset: abe87b0ad2cf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/abe87b0ad2cf Modified Files: sql/server/sql_parser.y sql/server/sql_scan.c sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: add odbc monthname func diffs (65 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -724,7 +724,7 @@ SQLCODE SQLERROR UNDER WHENEVER %token X_BODY %token MAX_MEMORY MAX_WORKERS OPTIMIZER /* odbc tokens */ -%token DAYNAME +%token DAYNAME MONTHNAME /* odbc data type tokens */ %token SQL_BIGINT @@ -5667,6 +5667,7 @@ non_reserved_word: | ODBC_FUNC_ESCAPE_PREFIX { $$ = sa_strdup(SA, "fn"); } | ODBC_OJ_ESCAPE_PREFIX { $$ = sa_strdup(SA, "oj"); } | DAYNAME { $$ = sa_strdup(SA, "dayname"); } +| MONTHNAME { $$ = sa_strdup(SA, "monthname"); } ; lngval: @@ -6431,6 +6432,14 @@ odbc_datetime_func: append_symbol(l, makeAtomNode(m, "char", "%A", 2, 0, false)); $$ = _symbol_create_list( SQL_BINOP, l ); } +| MONTHNAME '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "date_to_str"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + append_symbol(l, makeAtomNode(m, "char", "%B", 2, 0, false)); + $$ = _symbol_create_list( SQL_BINOP, l ); + } | MONTH '(' search_condition ')' { dlist *l = L(); append_list( l, append_string(L(), sa_strdup(SA, "month"))); diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c --- a/sql/server/sql_scan.c +++ b/sql/server/sql_scan.c @@ -528,6 +528,7 @@ scanner_init_keywords(void) failed += keywords_insert("fn", ODBC_FUNC_ESCAPE_PREFIX); failed += keywords_insert("oj", ODBC_OJ_ESCAPE_PREFIX); failed += keywords_insert("DAYNAME", DAYNAME); + failed += keywords_insert("MONTHNAME", MONTHNAME); failed += keywords_insert("SQL_BIGINT", SQL_BIGINT); failed += keywords_insert("SQL_BINARY", SQL_BINARY); failed += keywords_insert("SQL_BIT", SQL_BIT); diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -58,11 +58,10 @@ select { fn month(date'2022-11-14') } 11 -# TODO not implemented -# query T rowsort -# select { fn monthname(date'2022-11-14') } -# -# November +query T rowsort +select { fn monthname(date'2022-11-14') } + +November query I rowsort select length(cast((select { fn now() }) as varchar(100))) > 0 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - add dayname odbc func
Changeset: ce9d00d6af1b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ce9d00d6af1b Modified Files: sql/server/sql_parser.y sql/server/sql_scan.c sql/test/odbc-escape-sequences/Tests/All sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: add dayname odbc func diffs (73 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -723,6 +723,8 @@ SQLCODE SQLERROR UNDER WHENEVER %token X_BODY %token MAX_MEMORY MAX_WORKERS OPTIMIZER +/* odbc tokens */ +%token DAYNAME /* odbc data type tokens */ %token SQL_BIGINT @@ -5664,6 +5666,7 @@ non_reserved_word: | ODBC_GUID_ESCAPE_PREFIX { $$ = sa_strdup(SA, "guid"); } | ODBC_FUNC_ESCAPE_PREFIX { $$ = sa_strdup(SA, "fn"); } | ODBC_OJ_ESCAPE_PREFIX { $$ = sa_strdup(SA, "oj"); } +| DAYNAME { $$ = sa_strdup(SA, "dayname"); } ; lngval: @@ -6420,6 +6423,14 @@ odbc_datetime_func: append_symbol(l, $3); $$ = _symbol_create_list( SQL_UNOP, l ); } +| DAYNAME '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "date_to_str"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + append_symbol(l, makeAtomNode(m, "char", "%A", 2, 0, false)); + $$ = _symbol_create_list( SQL_BINOP, l ); + } | MONTH '(' search_condition ')' { dlist *l = L(); append_list( l, append_string(L(), sa_strdup(SA, "month"))); diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c --- a/sql/server/sql_scan.c +++ b/sql/server/sql_scan.c @@ -527,6 +527,7 @@ scanner_init_keywords(void) failed += keywords_insert("guid", ODBC_GUID_ESCAPE_PREFIX); failed += keywords_insert("fn", ODBC_FUNC_ESCAPE_PREFIX); failed += keywords_insert("oj", ODBC_OJ_ESCAPE_PREFIX); + failed += keywords_insert("DAYNAME", DAYNAME); failed += keywords_insert("SQL_BIGINT", SQL_BIGINT); failed += keywords_insert("SQL_BINARY", SQL_BINARY); failed += keywords_insert("SQL_BIT", SQL_BIT); diff --git a/sql/test/odbc-escape-sequences/Tests/All b/sql/test/odbc-escape-sequences/Tests/All --- a/sql/test/odbc-escape-sequences/Tests/All +++ b/sql/test/odbc-escape-sequences/Tests/All @@ -6,3 +6,4 @@ numeric-functions string-functions time-date-interval-functions join +system-functions diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -18,11 +18,10 @@ select length(cast((select { fn curtime( 1 -# TODO not implemented -# query T rowsort -# select { fn dayname('2022-11-11') } -# -# Friday +query T rowsort +select { fn dayname('2022-11-11') } + +Friday query I rowsort select { fn dayofmonth('2022-11-11') } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - add truncate
Changeset: 51b04d589bf9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/51b04d589bf9 Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/numeric-functions.test sql/test/odbc-escape-sequences/Tests/string-functions.test Branch: escape-sequences Log Message: add truncate diffs (39 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6456,6 +6456,14 @@ odbc_scalar_func: append_symbol(l, $3); $$ = _symbol_create_list( SQL_UNOP, l ); } +| TRUNCATE '(' search_condition ',' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "ms_trunc"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + append_symbol(l, $5); + $$ = _symbol_create_list( SQL_BINOP, l ); + } ; odbc_data_type: diff --git a/sql/test/odbc-escape-sequences/Tests/numeric-functions.test b/sql/test/odbc-escape-sequences/Tests/numeric-functions.test --- a/sql/test/odbc-escape-sequences/Tests/numeric-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/numeric-functions.test @@ -92,4 +92,4 @@ 3.142 query R select { fn truncate((select pi()), 3) } -3.142 +3.141 diff --git a/sql/test/odbc-escape-sequences/Tests/string-functions.test b/sql/test/odbc-escape-sequences/Tests/string-functions.test --- a/sql/test/odbc-escape-sequences/Tests/string-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/string-functions.test @@ -3,7 +3,7 @@ select { fn ascii('d') } 100 -# TODO +# TODO not implemented # query I # select { fn bit_length('a') } # ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - add keyword daytime funcs
Changeset: cf3bf4e0b654 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cf3bf4e0b654 Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: add keyword daytime funcs diffs (136 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -784,6 +784,7 @@ SQLCODE SQLERROR UNDER WHENEVER odbc_interval_escape odbc_scalar_func_escape odbc_scalar_func +odbc_datetime_func %% sqlstmt: @@ -6396,10 +6397,51 @@ odbc_scalar_func_escape: '{' ODBC_FUNC_ESCAPE_PREFIX odbc_scalar_func '}' {$$ = $3;} ; + +odbc_datetime_func: +HOUR '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "hour"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + $$ = _symbol_create_list( SQL_UNOP, l ); + } +| MINUTE '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "minute"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + $$ = _symbol_create_list( SQL_UNOP, l ); + } +| SECOND '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "second"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + $$ = _symbol_create_list( SQL_UNOP, l ); + } +| MONTH '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "month"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + $$ = _symbol_create_list( SQL_UNOP, l ); + } +| YEAR '(' search_condition ')' + { dlist *l = L(); + append_list( l, append_string(L(), sa_strdup(SA, "year"))); + append_int(l, FALSE); /* ignore distinct */ + append_symbol(l, $3); + $$ = _symbol_create_list( SQL_UNOP, l ); + } +; + + odbc_scalar_func: func_ref { $$ = $1;} | string_funcs { $$ = $1;} | datetime_funcs { $$ = $1;} +| odbc_datetime_func { $$ = $1;} | CONVERT '(' search_condition ',' odbc_data_type ')' { dlist *l = L(); append_symbol(l, $3); diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -18,7 +18,7 @@ select length(cast((select { fn curtime( 1 -# TODO +# TODO not implemented # query T rowsort # select { fn dayname('2022-11-11') } # @@ -44,21 +44,20 @@ select { fn extract(day from date'2022-0 1 -# TODO "hour" ? -#query T rowsort -#select { fn hour(time'12:00:00') } -# -#12 +query T rowsort +select { fn hour(time'12:00:00') } + +12 -# query I rowsort -# select { fn minute(time'12:15:00') } -# -# 15 +query I rowsort +select { fn minute(time'12:15:00') } + +15 -# query I rowsort -# select { fn month(date'2022-11-14') } -# -# 11 +query I rowsort +select { fn month(date'2022-11-14') } + +11 # TODO not implemented # query T rowsort @@ -76,10 +75,10 @@ select { fn quarter(date'2022-11-14') } 4 -# query I rowsort -# select { fn second(time'12:30:33') } -# -# 33 +query I rowsort +select { fn second(time'12:30:33') } + +33 # TODO not implemented @@ -100,7 +99,7 @@ select { fn week(date'2022-11-14') } 46 -# query I rowsort -# select { fn year(date'2022-11-14') } -# -# 2022 +query I rowsort +select { fn year(date'2022-11-14') } + +2022 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - numeric functions tests
Changeset: 0c9c2a4bcb73 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0c9c2a4bcb73 Modified Files: sql/test/odbc-escape-sequences/Tests/numeric-functions.test Branch: escape-sequences Log Message: numeric functions tests diffs (100 lines): diff --git a/sql/test/odbc-escape-sequences/Tests/numeric-functions.test b/sql/test/odbc-escape-sequences/Tests/numeric-functions.test --- a/sql/test/odbc-escape-sequences/Tests/numeric-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/numeric-functions.test @@ -1,10 +1,95 @@ -# this function maps 1:1 query I rowsort select { fn abs(-3) } 3 +query R rowsort +select { fn acos(0.5) } + +1.047 + +query R rowsort +select { fn asin(0.5) } + +0.524 + +query R rowsort +select { fn atan(0.5) } + +0.464 + query R select { fn atan2(1,2) } 0.464 + +query I +select { fn ceiling(0.55) } + +1 + +query I +select { fn cos(0) } + +1 + +query R +select { fn cot(0.5) } + +1.830 + +query I +select { fn degrees(3.14159265359*1) } + +180 + +query R +select { fn exp(1) } + +2.718 + +query I +select { fn floor(1.45) } + +1 + +query R +select { fn log(2.718) } + +1.000 + +query I +select { fn log10(10) } + +1 + +query I +select { fn mod(3, 2) } + +1 + +query R +select { fn pi() } + +3.142 + +query I +select { fn power(2, 2) } + +4 + +query I +select { fn radians(180/(select pi())) } + +1 + +query R +select { fn round((select pi()), 3) } + +3.142 + + +query R +select { fn truncate((select pi()), 3) } + +3.142 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - time and date tests
Changeset: a93aae7290da for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a93aae7290da Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test Branch: escape-sequences Log Message: time and date tests diffs (121 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6399,6 +6399,7 @@ odbc_scalar_func_escape: odbc_scalar_func: func_ref { $$ = $1;} | string_funcs { $$ = $1;} +| datetime_funcs { $$ = $1;} | CONVERT '(' search_condition ',' odbc_data_type ')' { dlist *l = L(); append_symbol(l, $3); diff --git a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test --- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test @@ -0,0 +1,106 @@ +query I rowsort +select length((select { fn current_date() })) > 0 + +1 + +query I rowsort +select length((select { fn curdate() })) > 0 + +1 + +query I rowsort +select length(cast((select { fn current_time() }) as varchar(100))) > 0 + +1 + +query I rowsort +select length(cast((select { fn curtime() }) as varchar(100))) > 0 + +1 + +# TODO +# query T rowsort +# select { fn dayname('2022-11-11') } +# +# Friday + +query I rowsort +select { fn dayofmonth('2022-11-11') } + +11 + +query I rowsort +select { fn dayofweek('2022-11-11') } + +5 + +query I rowsort +select { fn dayofyear('2022-01-01') } + +1 + +query I rowsort +select { fn extract(day from date'2022-01-01') } + +1 + +# TODO "hour" ? +#query T rowsort +#select { fn hour(time'12:00:00') } +# +#12 + +# query I rowsort +# select { fn minute(time'12:15:00') } +# +# 15 + +# query I rowsort +# select { fn month(date'2022-11-14') } +# +# 11 + +# TODO not implemented +# query T rowsort +# select { fn monthname(date'2022-11-14') } +# +# November + +query I rowsort +select length(cast((select { fn now() }) as varchar(100))) > 0 + +1 + +query I rowsort +select { fn quarter(date'2022-11-14') } + +4 + +# query I rowsort +# select { fn second(time'12:30:33') } +# +# 33 + + +# TODO not implemented +# query T rowsort +# select { fn timestampadd(hour, 1, timestamp'2022-11-14 09:26:30') } +# +# 2022-11-14 10:26:30 + + +# TODO not implemented +# query I rowsort +# select { fn timestampdiff(hour, timestamp'2022-11-14 10:26:30', timestamp'2022-11-14 09:26:30') } +# +# 1 + +query I rowsort +select { fn week(date'2022-11-14') } + +46 + +# query I rowsort +# select { fn year(date'2022-11-14') } +# +# 2022 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: escape-sequences - str funcs tests
Changeset: 568c0b1524ba for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/568c0b1524ba Modified Files: sql/server/sql_parser.y sql/test/odbc-escape-sequences/Tests/string-functions.test Branch: escape-sequences Log Message: str funcs tests diffs (125 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6398,6 +6398,7 @@ odbc_scalar_func_escape: odbc_scalar_func: func_ref { $$ = $1;} +| string_funcs { $$ = $1;} | CONVERT '(' search_condition ',' odbc_data_type ')' { dlist *l = L(); append_symbol(l, $3); diff --git a/sql/test/odbc-escape-sequences/Tests/string-functions.test b/sql/test/odbc-escape-sequences/Tests/string-functions.test --- a/sql/test/odbc-escape-sequences/Tests/string-functions.test +++ b/sql/test/odbc-escape-sequences/Tests/string-functions.test @@ -1,4 +1,110 @@ +query I +select { fn ascii('d') } + +100 + +# TODO +# query I +# select { fn bit_length('a') } +# +# 8 + query T select { fn char(100) } d + +query I +select { fn char_length('abc') } + +3 + +query I +select { fn character_length('abc') } + +3 + +query T +select { fn concat('ab', 'cd') } + +abcd + +query I +select { fn difference('abc', 'ab') } + +1 + +query T +select { fn insert('ab', 2, 2, 'cd') } + +abcd + +query T +select { fn lcase('ABCD') } + +abcd + +query T +select { fn left('abcd', 2) } + +ab + +query I +select { fn length('abcd ') } + +5 + +query I +select { fn locate('cd', 'abcd') } + +3 + +query T +select { fn ltrim(' abcd') } + +abcd + +query I +select { fn octet_length('abc') } + +3 + +query I +select { fn position('bc' in 'abcd') } + +2 + +query T +select { fn repeat('abc', 2) } + +abcabc + +query T +select { fn replace('abcdef', 'bcd', 'xxx') } + +axxxef + +query T +select { fn right('abcdef', 3) } + +def + +query T +select { fn rtrim('abc ') } + +abc + +query T +select { fn soundex('abc') } + +A120 + +query T +select { fn substring('abcdef', 1, 3) } + +abc + +query T +select { fn ucase('abc') } + +ABC ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org