MonetDB: default - Compilation fix
Changeset: e5d1f8d5b5b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e5d1f8d5b5b2 Modified Files: monetdb5/optimizer/opt_garbageCollector.c Branch: default Log Message: Compilation fix diffs (13 lines): diff --git a/monetdb5/optimizer/opt_garbageCollector.c b/monetdb5/optimizer/opt_garbageCollector.c --- a/monetdb5/optimizer/opt_garbageCollector.c +++ b/monetdb5/optimizer/opt_garbageCollector.c @@ -87,7 +87,9 @@ OPTgarbageCollectorImplementation(Client /* A good MAL plan should end with an END instruction */ if( p && p->token != ENDsymbol){ +#ifndef NDEBUG GDKfree(used); +#endif throw(MAL, "optimizer.garbagecollector", SQLSTATE(42000) "Incorrect MAL plan encountered"); } #ifndef NDEBUG ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Reduce the cost of the deadcode analysis.
Changeset: 50b1a3eed485 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=50b1a3eed485 Modified Files: monetdb5/optimizer/opt_deadcode.c Branch: default Log Message: Reduce the cost of the deadcode analysis. diffs (52 lines): diff --git a/monetdb5/optimizer/opt_deadcode.c b/monetdb5/optimizer/opt_deadcode.c --- a/monetdb5/optimizer/opt_deadcode.c +++ b/monetdb5/optimizer/opt_deadcode.c @@ -57,12 +57,6 @@ OPTdeadcodeImplementation(Client cntxt, if( p == 0) continue; //left behind by others? - /* catched by the hasSideEffects - if( getModuleId(p)== sqlRef && getFunctionId(p)== assertRef ){ - varused[getArg(p,0)]++; // force keeping - continue; - } -*/ if ( getModuleId(p) == batRef && isUpdateInstruction(p) && !p->barrier){ /* bat.append and friends are intermediates that need not be retained * unless they are not used outside of an update */ @@ -110,17 +104,6 @@ OPTdeadcodeImplementation(Client cntxt, freeInstruction(p); actions ++; } - /* Enable when bugTracker-2012/Tests/mal_errors survives it - if ( getModuleId(p) == groupRef && p->retc == 3 && varused[getArg(p,2)] == 0 && - (getFunctionId(p) == groupRef || -getFunctionId(p) == subgroupRef || -getFunctionId(p) == groupdoneRef || -getFunctionId(p) == subgroupdoneRef)){ - // remove the histogram unless needed - delArgument(p,2); - actions++; - } - */ } } for(; i 0){ -msg = chkTypes(cntxt->usermodule, mb, FALSE); -if (!msg) - msg = chkFlow(mb); +// no type change msg = chkTypes(cntxt->usermodule, mb, FALSE); +if( actions > 0){ + msg = chkFlow(mb); if (!msg) msg = chkDeclarations(mb); -//} +} /* keep all actions taken as a post block comment */ usec = GDKusec()- usec; snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " usec","deadcode",actions, usec); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Make name of temporary hash file not dependen...
Changeset: ae92119ae369 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae92119ae369 Modified Files: gdk/gdk_join.c Branch: Jun2020 Log Message: Make name of temporary hash file not dependent on bat id, but thread id. Multiple threads could be creating/using their own temporary hash files on the same bat. diffs (12 lines): diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c --- a/gdk/gdk_join.c +++ b/gdk/gdk_join.c @@ -2553,7 +2553,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B r->thash ? " ignoring existing hash" : "", swapped ? " (swapped)" : ""); if (snprintf(ext, sizeof(ext), "thshjn%x", -(unsigned) rci->s->batCacheid) >= (int) sizeof(ext)) +(unsigned) THRgettid()) >= (int) sizeof(ext)) goto bailout; if ((hsh = BAThash_impl(r, rci, ext)) == NULL) { goto bailout; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Merge with Jun2020 branch.
Changeset: 1fcd0d34c7e3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1fcd0d34c7e3 Modified Files: gdk/gdk_join.c Branch: Oct2020 Log Message: Merge with Jun2020 branch. diffs (12 lines): diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c --- a/gdk/gdk_join.c +++ b/gdk/gdk_join.c @@ -2569,7 +2569,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B r->thash ? " ignoring existing hash" : "", swapped ? " (swapped)" : ""); if (snprintf(ext, sizeof(ext), "thshjn%x", -(unsigned) rci->s->batCacheid) >= (int) sizeof(ext)) +(unsigned) THRgettid()) >= (int) sizeof(ext)) goto bailout; if ((hsh = BAThash_impl(r, rci, ext)) == NULL) { goto bailout; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Embed rel_remove_empty_select optimizer chang...
Changeset: 8c4d80b0600e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c4d80b0600e Modified Files: sql/server/rel_optimizer.c sql/server/rel_rewriter.c sql/server/rel_rewriter.h Branch: default Log Message: Embed rel_remove_empty_select optimizer changes on the optimizers it runs on to avoid an extra AST iteration whenever empty selects/joins are generated diffs (267 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -4468,6 +4468,9 @@ rel_push_groupby_down(visitor *v, sql_re /* * Push select down, pushes the selects through (simple) projections. Also * it cleans up the projections which become useless. + * + * WARNING - Make sure to call try_remove_empty_select macro before returning so we ensure + * possible generated empty selects will get removed without the need to call rel_remove_empty_select optimizer */ static sql_rel * rel_push_select_down(visitor *v, sql_rel *rel) @@ -4490,8 +4493,8 @@ rel_push_select_down(visitor *v, sql_rel } /* don't make changes for empty selects */ - if (is_select(rel->op) && (!rel->exps || list_length(rel->exps) == 0)) - return rel; + if (is_select(rel->op) && list_empty(rel->exps)) + return try_remove_empty_select(v, rel); /* merge 2 selects */ r = rel->l; @@ -4500,7 +4503,7 @@ rel_push_select_down(visitor *v, sql_rel rel->l = NULL; rel_destroy(rel); v->changes++; - return rel_push_select_down(v, r); + return try_remove_empty_select(v, r); } /* * Push select through semi/anti join @@ -4534,8 +4537,7 @@ rel_push_select_down(visitor *v, sql_rel } exps = rel->exps; - if (rel->op == op_project && - r && r->op == op_project && !(rel_is_ref(r))) + if (rel->op == op_project && r && r->op == op_project && !(rel_is_ref(r))) return rel_merge_projects(v, rel); /* push select through join */ @@ -4592,38 +4594,35 @@ rel_push_select_down(visitor *v, sql_rel } n = next; } - return rel; } if (is_select(rel->op) && r && r->op == op_project && !(rel_is_ref(r))){ sql_rel *pl = r->l; /* we cannot push through rank (row_number etc) functions or projects with distinct */ - if (!pl || project_unsafe(r,1)) - return rel; - - /* introduce selects under the project (if needed) */ - set_processed(pl); - for (n = exps->h; n;) { - node *next = n->next; - sql_exp *e = n->data, *ne = NULL; - - if (e->type == e_cmp) { - ne = exp_push_down_prj(v->sql, e, r, pl); - - /* can we move it down */ - if (ne && ne != e && pl->exps) { - if (!is_select(pl->op) || rel_is_ref(pl)) - r->l = pl = rel_select(v->sql->sa, pl, NULL); - rel_select_add_exp(v->sql->sa, pl, ne); - list_remove_node(exps, NULL, n); - v->changes++; + if (pl && !project_unsafe(r, 1)) { + /* introduce selects under the project (if needed) */ + set_processed(pl); + for (n = exps->h; n;) { + node *next = n->next; + sql_exp *e = n->data, *ne = NULL; + + if (e->type == e_cmp) { + ne = exp_push_down_prj(v->sql, e, r, pl); + + /* can we move it down */ + if (ne && ne != e && pl->exps) { + if (!is_select(pl->op) || rel_is_ref(pl)) + r->l = pl = rel_select(v->sql->sa, pl, NULL); + rel_select_add_exp(v->sql->sa, pl, ne); + list_remove_node(exps, NULL, n); + v->changes++; + } } - } - n = next; - } - return rel; - } - return rel; + n = next; + } + } + } + return try_remove_empty_select(v, rel); } static sql_rel * @@ -4699,6 +4698,8 @@ rel_push_select_down_join(vis
MonetDB: default - Packing semi and anti join optimizers
Changeset: d3387ab7ba04 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d3387ab7ba04 Modified Files: sql/server/rel_optimizer.c sql/server/rel_unnest.c Branch: default Log Message: Packing semi and anti join optimizers diffs (218 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1520,7 +1520,7 @@ rel_push_func_down(visitor *v, sql_rel * return rel; if (exps_can_push_func(exps, rel, &push_left, &push_right) && exps_need_push_down(exps)) { sql_rel *nrel, *ol = l, *or = r; - visitor nv = { .sql = v->sql, .parent = v->parent, .value_based_opt = v->value_based_opt, .storage_based_opt = v->storage_based_opt }; + visitor nv = { .sql = v->sql, .parent = v->parent, .value_based_opt = v->value_based_opt, .storage_based_opt = v->storage_based_opt, .data = v->data }; /* we need a full projection, group by's and unions cannot be extended * with more expressions */ @@ -4815,17 +4815,22 @@ rel_push_join_down(visitor *v, sql_rel * * * in some cases the other way is usefull, ie push join down * semijoin. When the join reduces (ie when there are selects on it). + * + * At the moment, we only flag changes by this optimizer on the first level of optimization */ -static sql_rel * +static inline sql_rel * rel_push_semijoin_down_or_up(visitor *v, sql_rel *rel) { + int level = *(int*)v->data; + if (rel->op == op_join && rel->exps && rel->l) { sql_rel *l = rel->l, *r = rel->r; if (is_semi(l->op) && !rel_is_ref(l) && is_select(r->op) && !rel_is_ref(r)) { rel->l = l->l; l->l = rel; - v->changes++; + if (level <= 0) + v->changes++; return l; } } @@ -4840,7 +4845,8 @@ rel_push_semijoin_down_or_up(visitor *v, if (is_semi(ll->op) && !rel_is_ref(ll)) { l->l = ll->l; ll->l = rel; - v->changes++; + if (level <= 0) + v->changes++; return ll; } } @@ -4859,7 +4865,8 @@ rel_push_semijoin_down_or_up(visitor *v, } rel_select_add_exp(v->sql->sa, rel->l, e); list_remove_node(rel->exps, NULL, n); - v->changes++; + if (level <= 0) + v->changes++; } n = next; } @@ -4927,7 +4934,8 @@ rel_push_semijoin_down_or_up(visitor *v, l->exps = njexps; rel_destroy(rel); rel = l; - v->changes++; + if (level <= 0) + v->changes++; } return rel; } @@ -8466,10 +8474,11 @@ is_identity_of(sql_exp *e, sql_rel *l) return 1; } -static sql_rel * +static inline sql_rel * rel_rewrite_semijoin(visitor *v, sql_rel *rel) { - if (is_semi(rel->op)) { + assert(is_semi(rel->op)); + { sql_rel *l = rel->l; sql_rel *r = rel->r; sql_rel *rl = (r->l)?r->l:NULL; @@ -8499,7 +8508,7 @@ rel_rewrite_semijoin(visitor *v, sql_rel v->changes++; } } - if (is_semi(rel->op)) { + { sql_rel *l = rel->l, *rl = NULL; sql_rel *r = rel->r, *or = r; @@ -8583,36 +8592,49 @@ rel_rewrite_semijoin(visitor *v, sql_rel } /* antijoin(a, union(b,c)) -> antijoin(antijoin(a,b), c) */ -static sql_rel * +static inline sql_rel * rel_rewrite_antijoin(visitor *v, sql_rel *rel) { - if (rel->op == op_anti) { - sql_rel *l = rel->l; - sql_rel *r = rel->r; - - if (l && !rel_is_ref(l) && - r && !rel_is_ref(r) && is_union(r->op) && !is_single(r)) { - sql_rel *rl = rel_dup(r->l), *nl; - sql_rel *rr = rel_dup(r->r); - - if (!is_project(rl->op)) - rl = rel_project(v->sql->sa, rl, - rel_projections(v->sql, rl, NULL, 1, 1)); - if (!is_project(rr->op)) - rr = rel_project(v->sql->sa, rr, - rel_projections(v->sql, rr, NULL, 1, 1)); - rel_rename_exps(v->sql, r->exps, rl->exps); - rel_r
MonetDB: default - rel_reduce_groupby_exps has to clear the hash...
Changeset: adaddc5b4ba9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=adaddc5b4ba9 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: rel_reduce_groupby_exps has to clear the hashes because rel_groupby_distinct runs right after before returning to the iterator diffs (28 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5769,7 +5769,7 @@ rel_groupby_order(visitor *v, sql_rel *r GDKqsort(scores, exps, NULL, ngbe, sizeof(int), sizeof(void *), TYPE_int, true, true); /* second sorting step, give priority to strings with lower number of digits */ - for (i = ngbe - 1; i && !scores[i]; i--); /* find epressions with no score from the first round */ + for (i = ngbe - 1; i && !scores[i]; i--); /* find expressions with no score from the first round */ if (scores[i]) i++; if (ngbe - i > 1) { @@ -5909,6 +5909,7 @@ rel_reduce_groupby_exps(visitor *v, sql_ /* new reduced aggr expression list */ assert(list_length(rel->exps)>0); /* only one reduction at a time */ + list_hash_clear(rel->exps); v->changes++; return rel; } @@ -5962,6 +5963,7 @@ rel_reduce_groupby_exps(visitor *v, sql_ } n->data = e; } + list_hash_clear(rel->exps); v->changes++; } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Packing union optimizers
Changeset: f8646b6bb711 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8646b6bb711 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing union optimizers diffs (107 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3332,7 +3332,7 @@ exps_has_predicate( list *l ) return 0; } -static sql_rel * +static inline sql_rel * rel_merge_union(visitor *v, sql_rel *rel) { sql_rel *l = rel->l; @@ -5056,7 +5056,7 @@ rel_join_push_exps_down(visitor *v, sql_ * Push (semi)joins down unions, this is basically for merge tables, where * we know that the fk-indices are split over two clustered merge tables. */ -static sql_rel * +static inline sql_rel * rel_push_join_down_union(visitor *v, sql_rel *rel) { if ((is_join(rel->op) && !is_outerjoin(rel->op) && !is_single(rel)) || is_semi(rel->op)) { @@ -5628,7 +5628,7 @@ rel_push_project_down(visitor *v, sql_re return rel; } -static sql_rel * +static inline sql_rel * rel_push_project_down_union(visitor *v, sql_rel *rel) { /* first remove distinct if already unique */ @@ -9598,7 +9598,7 @@ statistics, similarly to the merge table select * from a where x between 1 and 2 union all select * from b where x between 1 and 2 -> select * from b where x between 1 and 2 [assuming a has no rows with 1<=x<=2] */ -static sql_rel * +static inline sql_rel * rel_remove_union_partitions(visitor *v, sql_rel *rel) { if (!is_union(rel->op)) @@ -9627,6 +9627,25 @@ rel_remove_union_partitions(visitor *v, } static sql_rel * +rel_optimize_unions_bottomup(visitor *v, sql_rel *rel) +{ + if (!is_union(rel->op)) + return rel; + rel = rel_remove_union_partitions(v, rel); + rel = rel_merge_union(v, rel); + return rel; +} + +static sql_rel * +rel_optimize_unions_topdown(visitor *v, sql_rel *rel) +{ + rel = rel_push_select_down_union(v, rel); + rel = rel_push_project_down_union(v, rel); + rel = rel_push_join_down_union(v, rel); + return rel; +} + +static sql_rel * optimize_rel(mvc *sql, sql_rel *rel, int *g_changes, int level, bool value_based_opt, bool storage_based_opt) { visitor v = { .sql = sql, .value_based_opt = value_based_opt, .storage_based_opt = storage_based_opt, .data = &level }; @@ -9688,7 +9707,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_project_reduce_casts(&v, rel); if (gp.cnt[op_union]) - rel = rel_visitor_bottomup(&v, rel, &rel_merge_union); + rel = rel_visitor_bottomup(&v, rel, &rel_optimize_unions_bottomup); if (gp.cnt[op_select] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_anti] || gp.cnt[op_join] || gp.cnt[op_semi]) @@ -9714,11 +9733,8 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_join]) rel = rel_visitor_topdown(&v, rel, &rel_push_select_down_join); - if (gp.cnt[op_union]) { - rel = rel_visitor_bottomup(&v, rel, &rel_remove_union_partitions); - if (gp.cnt[op_select]) - rel = rel_visitor_topdown(&v, rel, &rel_push_select_down_union); - } + if (gp.cnt[op_union]) + rel = rel_visitor_topdown(&v, rel, &rel_optimize_unions_topdown); if (gp.cnt[op_groupby]) rel = rel_visitor_topdown(&v, rel, &rel_optimize_group_by); @@ -9734,8 +9750,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_visitor_bottomup(&v, rel, &rel_push_join_down_outer); if (!gp.cnt[op_update]) rel = rel_join_order(&v, rel); - if (gp.cnt[op_union]) - rel = rel_visitor_bottomup(&v, rel, &rel_push_join_down_union); if (level <= 0 && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti])) rel = rel_visitor_bottomup(&v, rel, &rel_join_push_exps_down); } @@ -9772,9 +9786,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_select] || gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) rel = rel_visitor_bottomup(&v, rel, &rel_optimize_select_and_index); - if (gp.cnt[op_project] && gp.cnt[op_union]) - rel = rel_visitor_topdown(&v, rel, &rel_push_project_down_union); - /* Remove unused expressions */ if (level <= 0) rel = rel_dce(sql, rel); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - rel_push_count_down optimizer can join the ot...
Changeset: c990d96ff45b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c990d96ff45b Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: rel_push_count_down optimizer can join the other group by optimizers diffs (61 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1593,17 +1593,13 @@ rel_push_func_down(visitor *v, sql_rel * * ) [ sql_mul(.., .. NOT NULL) ] * ) */ -static sql_rel * +static inline sql_rel * rel_push_count_down(visitor *v, sql_rel *rel) { - sql_rel *r; - - if (!is_groupby(rel->op)) - return rel; - - r = rel->l; - - if (is_groupby(rel->op) && !rel_is_ref(rel) && list_empty(rel->r) && + sql_rel *r = rel->l; + + assert(is_groupby(rel->op)); + if (!rel_is_ref(rel) && list_empty(rel->r) && r && !r->exps && r->op == op_join && !(rel_is_ref(r)) && /* currently only single count aggregation is handled, no other projects or aggregation */ list_length(rel->exps) == 1 && exp_aggr_is_count(rel->exps->h->data)) { @@ -6183,6 +6179,7 @@ rel_optimize_group_by(visitor *v, sql_re rel = rel_groupby_order(v, rel); rel = rel_reduce_groupby_exps(v, rel); rel = rel_groupby_distinct(v, rel); + rel = rel_push_count_down(v, rel); return rel; } @@ -9754,21 +9751,12 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_visitor_bottomup(&v, rel, &rel_join_push_exps_down); } + /* push_join_down introduces semijoins */ + /* rewrite semijoin (A, join(A,B)) into semijoin (A,B) */ + if (level <= 0 && gp.cnt[op_groupby] && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left])) + rel = rel_visitor_topdown(&v, rel, &rel_push_join_down); + /* Important -> Re-write semijoins after rel_join_order */ - if ((gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left] || gp.cnt[op_right]) && gp.cnt[op_groupby]) { - if (gp.cnt[op_join]) - rel = rel_visitor_topdown(&v, rel, &rel_push_count_down); - if (level <= 0) { - if (gp.cnt[op_select]) - rel = rel_visitor_topdown(&v, rel, &rel_push_select_down); - if (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left]) { - /* push_join_down introduces semijoins */ - /* rewrite semijoin (A, join(A,B)) into semijoin (A,B) */ - rel = rel_visitor_topdown(&v, rel, &rel_push_join_down); /* rel_rewrite_semijoin will run in the next iteration */ - } - } - } - if (gp.cnt[op_anti] || gp.cnt[op_semi]) { rel = rel_visitor_bottomup(&v, rel, &rel_optimize_semi_and_anti); if (level <= 0) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Packing join optimizers
Changeset: 36ef23e58a9c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36ef23e58a9c Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing join optimizers diffs (74 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5242,7 +5242,7 @@ rel_push_join_down_union(visitor *v, sql return rel; } -static sql_rel * +static inline sql_rel * rel_push_join_down_outer(visitor *v, sql_rel *rel) { if (is_join(rel->op) && !is_outerjoin(rel->op) && !is_single(rel) && !list_empty(rel->exps) && !rel_is_ref(rel)) { @@ -5467,7 +5467,7 @@ rel_uses_exp_outside_subrel(sql_rel *rel return 1; } -static sql_rel * +static inline sql_rel * rel_join2semijoin(visitor *v, sql_rel *rel) { if ((is_simple_project(rel->op) || is_groupby(rel->op)) && rel->l) { @@ -9352,8 +9352,10 @@ rel_merge_table_rewrite(visitor *v, sql_ return rel; } -static bool is_non_trivial_select_applied_to_outer_join(sql_rel *rel) { -return is_select(rel->op) && rel->exps && is_outerjoin(((sql_rel*) rel->l)->op); +static inline bool +is_non_trivial_select_applied_to_outer_join(sql_rel *rel) +{ + return is_select(rel->op) && rel->exps && is_outerjoin(((sql_rel*) rel->l)->op); } extern list *list_append_before(list *l, node *n, void *data); @@ -9474,7 +9476,7 @@ out2inner(visitor *v, sql_rel* sel, sql_ return sel; } -static sql_rel * +static inline sql_rel * rel_out2inner(visitor *v, sql_rel *rel) { if (!is_non_trivial_select_applied_to_outer_join(rel)) { @@ -9517,6 +9519,15 @@ rel_out2inner(visitor *v, sql_rel *rel) } } +static sql_rel * +rel_optimize_joins(visitor *v, sql_rel *rel) +{ + rel = rel_out2inner(v, rel); + rel = rel_join2semijoin(v, rel); + rel = rel_push_join_down_outer(v, rel); + return rel; +} + static sql_rel* exp_skip_output_parts(sql_rel *rel) { @@ -9738,13 +9749,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti]) { rel = rel_remove_empty_join(&v, rel); - - if ((gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) && gp.cnt[op_select]) - rel = rel_visitor_topdown(&v, rel, &rel_out2inner); - if (gp.cnt[op_join]) - rel = rel_visitor_bottomup(&v, rel, &rel_join2semijoin); - if ((gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) && gp.cnt[op_join]) - rel = rel_visitor_bottomup(&v, rel, &rel_push_join_down_outer); + rel = rel_visitor_bottomup(&v, rel, &rel_optimize_joins); if (!gp.cnt[op_update]) rel = rel_join_order(&v, rel); if (level <= 0 && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti])) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Put the optimizer packs together for easier m...
Changeset: 15a615add706 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=15a615add706 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Put the optimizer packs together for easier maintenance diffs (199 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -6167,22 +6167,6 @@ rel_groupby_distinct(visitor *v, sql_rel return rel; } -/* pack grouby optimizers into a single function to void iterations in the AST */ -static sql_rel * -rel_optimize_group_by(visitor *v, sql_rel *rel) -{ - if (!is_groupby(rel->op)) - return rel; - - rel = rel_push_aggr_down(v, rel); - rel = rel_push_groupby_down(v, rel); - rel = rel_groupby_order(v, rel); - rel = rel_reduce_groupby_exps(v, rel); - rel = rel_groupby_distinct(v, rel); - rel = rel_push_count_down(v, rel); - return rel; -} - static sql_exp *split_aggr_and_project(mvc *sql, list *aexps, sql_exp *e); static void @@ -7656,22 +7640,6 @@ rel_simplify_like_select(visitor *v, sql return rel; } -/* pack select optimizers into a single function to void iterations in the AST */ -static sql_rel * -rel_optimize_select_and_index(visitor *v, sql_rel *rel) -{ - if (rel->l && (is_select(rel->op) || is_join(rel->op))) - rel = rel_use_index(v, rel); - - if (!is_select(rel->op) || list_empty(rel->exps)) - return rel; - - if (v->value_based_opt) - rel = rel_simplify_like_select(v, rel); - rel = rel_select_order(v, rel); - return rel; -} - static sql_exp * rel_simplify_predicates(visitor *v, sql_rel *rel, sql_exp *e, int depth) { @@ -8449,20 +8417,6 @@ rel_reduce_casts(visitor *v, sql_rel *re return rel; } -/* pack join and select optimizers into a single function to void iterations in the AST */ -static sql_rel * -rel_optimize_select_and_joins(visitor *v, sql_rel *rel) -{ - if ((!is_join(rel->op) && !is_semi(rel->op) && !is_select(rel->op)) || list_empty(rel->exps)) - return rel; - - rel->exps = exp_merge_range(v, rel->exps); - if (v->value_based_opt) - rel = rel_reduce_casts(v, rel); - rel = rewrite_simplify(v, rel); - return rel; -} - static int is_identity_of(sql_exp *e, sql_rel *l) { @@ -8623,21 +8577,6 @@ rel_rewrite_antijoin(visitor *v, sql_rel } static sql_rel * -rel_optimize_semi_and_anti(visitor *v, sql_rel *rel) -{ - /* rewrite semijoin (A, join(A,B)) into semijoin (A,B) */ - if (is_semi(rel->op)) - rel = rel_rewrite_semijoin(v, rel); - /* push semijoin through join */ - if (is_semi(rel->op) || is_innerjoin(rel->op)) - rel = rel_push_semijoin_down_or_up(v, rel); - /* antijoin(a, union(b,c)) -> antijoin(antijoin(a,b), c) */ - if (rel->op == op_anti) - rel = rel_rewrite_antijoin(v, rel); - return rel; -} - -static sql_rel * rel_semijoin_use_fk(visitor *v, sql_rel *rel) { if (is_semi(rel->op) && rel->exps) { @@ -9519,15 +9458,6 @@ rel_out2inner(visitor *v, sql_rel *rel) } } -static sql_rel * -rel_optimize_joins(visitor *v, sql_rel *rel) -{ - rel = rel_out2inner(v, rel); - rel = rel_join2semijoin(v, rel); - rel = rel_push_join_down_outer(v, rel); - return rel; -} - static sql_rel* exp_skip_output_parts(sql_rel *rel) { @@ -9634,6 +9564,20 @@ rel_remove_union_partitions(visitor *v, return rel; } +/* pack optimizers into a single function call to avoid iterations in the AST */ +static sql_rel * +rel_optimize_select_and_joins(visitor *v, sql_rel *rel) +{ + if ((!is_join(rel->op) && !is_semi(rel->op) && !is_select(rel->op)) || list_empty(rel->exps)) + return rel; + + rel->exps = exp_merge_range(v, rel->exps); + if (v->value_based_opt) + rel = rel_reduce_casts(v, rel); + rel = rewrite_simplify(v, rel); + return rel; +} + static sql_rel * rel_optimize_unions_bottomup(visitor *v, sql_rel *rel) { @@ -9654,6 +9598,60 @@ rel_optimize_unions_topdown(visitor *v, } static sql_rel * +rel_optimize_group_by(visitor *v, sql_rel *rel) +{ + if (!is_groupby(rel->op)) + return rel; + + rel = rel_push_aggr_down(v, rel); + rel = rel_push_groupby_down(v, rel); + rel = rel_groupby_order(v, rel); + rel = rel_reduce_groupby_exps(v, rel); + rel = rel_groupby_distinct(v, rel); + rel = rel_push_count_down(v, rel); + return rel; +} + +static sql_rel * +rel_optimize_joins(visitor *v, sql_rel *rel) +{ + rel = rel_out2inner(v, rel); + rel = rel_join2semijoin(v, rel); + rel = rel_push_join_down_outer(v, rel); + return rel; +} + +static sql_rel * +rel_optimize_semi_and_anti(visitor *v, sql_rel *rel) +{ + /* rewrite semijoin (A, join(A,B))
MonetDB: default - Add missing grant.
Changeset: 2c761a3f0e91 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c761a3f0e91 Modified Files: sql/scripts/40_json.sql Branch: default Log Message: Add missing grant. diffs (11 lines): diff --git a/sql/scripts/40_json.sql b/sql/scripts/40_json.sql --- a/sql/scripts/40_json.sql +++ b/sql/scripts/40_json.sql @@ -47,6 +47,7 @@ GRANT EXECUTE ON FUNCTION json.isvalid(s create function json.isvalid(js json) returns bool begin return true; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; create function json.isobject(js json) returns bool external name json.isobject; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Add schema name to function grant list.
Changeset: 6a74d4287eba for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6a74d4287eba Modified Files: sql/test/emptydb/Tests/check.SQL.py sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 Branch: default Log Message: Add schema name to function grant list. diffs (truncated from 1450 to 300 lines): diff --git a/sql/test/emptydb/Tests/check.SQL.py b/sql/test/emptydb/Tests/check.SQL.py --- a/sql/test/emptydb/Tests/check.SQL.py +++ b/sql/test/emptydb/Tests/check.SQL.py @@ -148,7 +148,7 @@ select 'grant on table', t.name, a.name, -- columns select 'grant on column', t.name, c.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys._tables t, sys._columns c, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where c.id = p.obj_id and c.table_id = t.id and p.auth_id = a.id order by t.name, c.name, a.name; -- functions -select 'grant on function', f.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys.functions f, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where f.id = p.obj_id and p.auth_id = a.id order by f.name, a.name; +select 'grant on function', s.name, f.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys.functions f left outer join sys.schemas s on f.schema_id = s.id, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where f.id = p.obj_id and p.auth_id = a.id order by s.name, f.name, a.name; -- sequences select 'sys.sequences', s.name, q.name, q.start, q.minvalue, q.maxvalue, q.increment, q.cacheinc, q.cycle from sys.sequences q left outer join sys.schemas s on q.schema_id = s.id order by s.name, q.name; -- statistics (expect empty) 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 @@ -1548,7 +1548,7 @@ select 'grant on table', t.name, a.name, -- columns select 'grant on column', t.name, c.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys._tables t, sys._columns c, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where c.id = p.obj_id and c.table_id = t.id and p.auth_id = a.id order by t.name, c.name, a.name; -- functions -select 'grant on function', f.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys.functions f, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where f.id = p.obj_id and p.auth_id = a.id order by f.name, a.name; +select 'grant on function', s.name, f.name, a.name, pc.privilege_code_name, g.name, p.grantable from sys.functions f left outer join sys.schemas s on f.schema_id = s.id, sys.privileges p left outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = pc.privilege_code_id, sys.auths a where f.id = p.obj_id and p.auth_id = a.id order by s.name, f.name, a.name; -- sequences select 'sys.sequences', s.name, q.name, q.start, q.minvalue, q.maxvalue, q.increment, q.cacheinc, q.cycle from sys.sequences q left outer join sys.schemas s on q.schema_id = s.id order by s.name, q.name; -- statistics (expect empty) @@ -5363,346 +5363,347 @@ drop function pcre_replace(string, strin % %1, name, name, name, privilege_code_name,name, grantable # name % char,varchar,varchar,varchar,varchar, varchar,int # type % 15, 0, 0, 0, 0, 0, 1 # length -% .%1, sys.f, sys.a, .pc,.g, .p # table_name -% %1, name, name, privilege_code_name,name, grantable # name -% char,varchar,varchar,varchar,varchar, int # type -% 17, 24, 9, 7, 7, 1 # length -[ "grant on function", "abbrev", "public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "alpha","public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "broadcast","public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "compinfo", "public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "contains", "public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "corr", "public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "corr", "public", "EXECUTE", "monetdb", 0 ] -[ "grant on function", "corr", "pu
MonetDB: default - Some more system tables contain ids that had ...
Changeset: e6bca6fcfd72 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e6bca6fcfd72 Modified Files: sql/storage/bat/bat_logger.c Branch: default Log Message: Some more system tables contain ids that had to be mapped. diffs (180 lines): diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c --- a/sql/storage/bat/bat_logger.c +++ b/sql/storage/bat/bat_logger.c @@ -1268,6 +1268,31 @@ struct table { {0} }; +/* more system tables with schema/table/column ids that need to be remapped */ +struct mapids { + // const char *schema; /* always "sys" */ + const char *table; + const char *column; +} mapids[] = { + { + .table = "comments", + .column = "id", + }, + { + .table = "db_user_info", + .column = "default_schema", + }, + { + .table = "privileges", + .column = "obj_id", + }, + { + .table = "statistics", + .column = "column_id", + }, + {0} +}; + static gdk_return upgrade(old_logger *lg) { @@ -1486,6 +1511,33 @@ upgrade(old_logger *lg) } BBPretain(orig->batCacheid); BBPretain(b->batCacheid); + switch (tables[i].newid) { + case 2002: /* sys.schemas.id */ + bat_destroy(bats[0].idbat); + bats[0].idbat = b; + BBPfix(b->batCacheid); + break; + case 2068: /* sys._tables.id */ + bat_destroy(bats[1].idbat); + bats[1].idbat = b; + BBPfix(b->batCacheid); + break; + case 2070: /* sys._tables.schema_id */ + bat_destroy(bats[1].parbat); + bats[1].parbat = b; + BBPfix(b->batCacheid); + break; + case 2077: /* sys._columns.id */ + bat_destroy(bats[2].idbat); + bats[2].idbat = b; + BBPfix(b->batCacheid); + break; + case 2082: /* sys._columns.table_id */ + bat_destroy(bats[2].parbat); + bats[2].parbat = b; + BBPfix(b->batCacheid); + break; + } bat_destroy(orig); } /* now b contains the updated values for the column in tables[i] */ @@ -1538,6 +1590,8 @@ upgrade(old_logger *lg) bat_destroy(cands); bat_destroy(b); + /* convert deleted rows bats (catalog id equals table id) from list +* of deleted rows to mask of deleted rows */ BAT *tabs; tabs = BATselect(lg->lg->catalog_id, NULL, &(int){2165}, &int_nil, true, true, false); if (tabs == NULL) @@ -1617,6 +1671,101 @@ upgrade(old_logger *lg) bat_destroy(b1); bat_destroy(b4); + /* map schema/table/column ids in other system tables */ + if (mapold) { + /* select tables in sys schema */ + b1 = BATselect(bats[1].parbat, bats[1].cands, &(int){2000}, NULL, true, true, false); + if (b1 == NULL) + goto bailout; + bids = Tloc(lg->lg->catalog_bid, 0); + for (int i = 0; mapids[i].column != NULL; i++) { + /* row ids for table in sys schema */ + BAT *b2 = BATselect(bats[1].nmbat, b1, mapids[i].table, NULL, true, true, false); + if (b2 == NULL) { + bat_destroy(b1); + goto bailout; + } + /* table ids for table */ + b3 = BATproject(b2, bats[1].idbat); + bat_destroy(b2); + if (b3 == NULL) { + bat_destroy(b1); + goto bailout; + } + /* row ids for columns of table */ + b2 = BATintersect(bats[2].parbat, b3, NULL, NULL, false, false, BUN_NONE); + bat_destroy(b3); + if (b2 == NULL
MonetDB: default - Packing more join and select optimizers
Changeset: fb3db00a8818 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb3db00a8818 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing more join and select optimizers diffs (77 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3694,7 +3694,7 @@ merge_cmp_or_null(mvc *sql, list *exps, return exps; } -static sql_rel * +static inline sql_rel * rel_select_cse(visitor *v, sql_rel *rel) { if (is_select(rel->op) && rel->exps) @@ -3954,7 +3954,7 @@ rel_merge_project_rse(visitor *v, sql_re * -> * x in (a, b, c, d, e, f) * */ -static sql_rel * +static inline sql_rel * rel_merge_select_rse(visitor *v, sql_rel *rel) { /* only execute once per select */ @@ -9570,10 +9570,14 @@ rel_optimize_select_and_joins(visitor *v { if ((!is_join(rel->op) && !is_semi(rel->op) && !is_select(rel->op)) || list_empty(rel->exps)) return rel; + int level = *(int*) v->data; rel->exps = exp_merge_range(v, rel->exps); if (v->value_based_opt) rel = rel_reduce_casts(v, rel); + rel = rel_select_cse(v, rel); + if (level == 1) + rel = rel_merge_select_rse(v, rel); rel = rewrite_simplify(v, rel); return rel; } @@ -9703,11 +9707,11 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_join] && gp.cnt[op_project] && /* DISABLES CODE */ (0)) rel = rel_visitor_bottomup(&v, rel, &rel_remove_join); - if (gp.cnt[op_join] || - gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || - gp.cnt[op_semi] || gp.cnt[op_anti] || - gp.cnt[op_select]) + if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_select]) { rel = rel_visitor_bottomup(&v, rel, &rel_optimize_select_and_joins); + if (level == 1) + rel = rel_visitor_bottomup(&v, rel, &rewrite_reset_used); /* reset used flag, used by rel_merge_select_rse */ + } if (value_based_opt) rel = rel_project_reduce_casts(&v, rel); @@ -9715,24 +9719,12 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_union]) rel = rel_visitor_bottomup(&v, rel, &rel_optimize_unions_bottomup); - if (gp.cnt[op_select] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || - gp.cnt[op_anti] || gp.cnt[op_join] || gp.cnt[op_semi]) - rel = rel_visitor_bottomup(&v, rel, &rel_select_cse); - if (gp.cnt[op_project]) rel = rel_visitor_bottomup(&v, rel, &rel_project_cse); if ((gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) && /* DISABLES CODE */ (0)) rel = rel_visitor_topdown(&v, rel, &rel_split_outerjoin); - if ((gp.cnt[op_join] || - gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || - gp.cnt[op_semi] || gp.cnt[op_anti] || - gp.cnt[op_select]) && level == 1) { /* only once */ - rel = rel_visitor_bottomup(&v, rel, &rel_merge_select_rse); - rel = rel_visitor_bottomup(&v, rel, &rewrite_reset_used); /* reset used flag, used by rel_merge_select_rse */ - } - if (level <= 1 && gp.cnt[op_project]) rel = rel_exp_visitor_bottomup(&v, rel, &rel_merge_project_rse, false); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Packing join and select optimizers
Changeset: f8bac718cc65 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8bac718cc65 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing join and select optimizers diffs (59 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1797,7 +1797,7 @@ rel_simplify_count_fk_join(mvc *sql, sql * 2 project ( fk-pk-join () ) [ fk-column ] -> project (fk table)[ fk-column ] * 3 project ( fk1-pk1-join( fk2-pk2-join()) [ fk-column, pk1 column ] -> project (fk1-pk1-join)[ fk-column, pk1 column ] */ -static sql_rel * +static inline sql_rel * rel_simplify_fk_joins(visitor *v, sql_rel *rel) { sql_rel *r = NULL; @@ -9566,7 +9566,7 @@ rel_remove_union_partitions(visitor *v, /* pack optimizers into a single function call to avoid iterations in the AST */ static sql_rel * -rel_optimize_select_and_joins(visitor *v, sql_rel *rel) +rel_optimize_select_and_joins_bottomup(visitor *v, sql_rel *rel) { if ((!is_join(rel->op) && !is_semi(rel->op) && !is_select(rel->op)) || list_empty(rel->exps)) return rel; @@ -9641,11 +9641,13 @@ rel_optimize_semi_and_anti(visitor *v, s } static sql_rel * -rel_optimize_select_and_use_index(visitor *v, sql_rel *rel) +rel_optimize_select_and_joins_topdown(visitor *v, sql_rel *rel) { if (rel->l && (is_select(rel->op) || is_join(rel->op))) rel = rel_use_index(v, rel); + rel = rel_simplify_fk_joins(v, rel); + if (!is_select(rel->op) || list_empty(rel->exps)) return rel; @@ -9708,7 +9710,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_visitor_bottomup(&v, rel, &rel_remove_join); if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_select]) { - rel = rel_visitor_bottomup(&v, rel, &rel_optimize_select_and_joins); + rel = rel_visitor_bottomup(&v, rel, &rel_optimize_select_and_joins_bottomup); if (level == 1) rel = rel_visitor_bottomup(&v, rel, &rewrite_reset_used); /* reset used flag, used by rel_merge_select_rse */ } @@ -9763,11 +9765,8 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_select] && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left] || gp.cnt[op_right])) rel = rel_visitor_topdown(&v, rel, &rel_push_select_down); - if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti]) - rel = rel_visitor_topdown(&v, rel, &rel_simplify_fk_joins); - - if (gp.cnt[op_select] || gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) - rel = rel_visitor_bottomup(&v, rel, &rel_optimize_select_and_use_index); + if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_select]) + rel = rel_visitor_topdown(&v, rel, &rel_optimize_select_and_joins_topdown); /* Remove unused expressions */ if (level <= 0) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - More upgrade improvements.
Changeset: 49790620d563 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=49790620d563 Modified Files: sql/backends/monet5/sql_upgrades.c sql/storage/bat/bat_logger.c sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message: More upgrade improvements. diffs (truncated from 6706 to 300 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1022,7 +1022,6 @@ sql_update_nov2019(Client c, mvc *sql, c "create aggregate median_avg(val DOUBLE) returns DOUBLE\n" " external name \"aggr\".\"median_avg\";\n" "GRANT EXECUTE ON AGGREGATE median_avg(DOUBLE) TO PUBLIC;\n" - "\n" "create aggregate quantile_avg(val TINYINT, q DOUBLE) returns DOUBLE\n" " external name \"aggr\".\"quantile_avg\";\n" "GRANT EXECUTE ON AGGREGATE quantile_avg(TINYINT, DOUBLE) TO PUBLIC;\n" @@ -2261,7 +2260,6 @@ sql_update_oct2020(Client c, mvc *sql, c "DROP AGGREGATE corr(INTERVAL MONTH,INTERVAL MONTH);\n" "DROP WINDOW corr(INTERVAL SECOND,INTERVAL SECOND);\n" "DROP WINDOW corr(INTERVAL MONTH,INTERVAL MONTH);\n" - "\n" "create aggregate median(val INTERVAL DAY) returns INTERVAL DAY\n" " external name \"aggr\".\"median\";\n" "GRANT EXECUTE ON AGGREGATE median(INTERVAL DAY) TO PUBLIC;\n" @@ -2548,19 +2546,16 @@ sql_update_default(Client c, mvc *sql, c "END\n" "END;\n" "END;\n" - "\n" "CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || sys.replace(s,,'') || ''' '; END;\n" "CREATE FUNCTION sys.DQ (s STRING) RETURNS STRING BEGIN RETURN '\"' || sys.replace(s,'\"','\"\"') || '\"'; END; --TODO: Figure out why this breaks with the space\n" "CREATE FUNCTION sys.FQN(s STRING, t STRING) RETURNS STRING BEGIN RETURN sys.DQ(s) || '.' || sys.DQ(t); END;\n" "CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN RETURN 'ALTER TABLE ' || sys.FQN(s, t) || ' '; END;\n" - "\n" "--We need pcre to implement a header guard which means adding the schema of an object explicitely to its identifier.\n" "CREATE FUNCTION sys.replace_first(ori STRING, pat STRING, rep STRING, flg STRING) RETURNS STRING EXTERNAL NAME \"pcre\".\"replace_first\";\n" "CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS STRING BEGIN\n" "RETURN\n" "SELECT sys.replace_first(stmt, '(s*\"?' || sch || '\"?s*.|)s*\"?' || nme || '\"?s*', ' ' || sys.FQN(sch, nme) || ' ', 'imsx');\n" "END;\n" - "\n" "CREATE VIEW sys.describe_constraints AS\n" "SELECT\n" "s.name sch,\n" @@ -2575,7 +2570,6 @@ sql_update_default(Client c, mvc *sql, c "AND t.system = FALSE\n" "AND k.type in (0, 1)\n" "AND t.type IN (0, 6);\n" - "\n" "CREATE VIEW sys.describe_indices AS\n"
MonetDB: default - Approve 32 bit output.
Changeset: 230f620cb00b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=230f620cb00b Modified Files: sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit Branch: default Log Message: Approve 32 bit output. diffs (truncated from 2644 to 300 lines): diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit @@ -3770,19 +3770,16 @@ BEGIN END END; END; - CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || sys.replace(s,,'') || ''' '; END; CREATE FUNCTION sys.DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || sys.replace(s,'"','""') || '"'; END; --TODO: Figure out why this breaks with the space CREATE FUNCTION sys.FQN(s STRING, t STRING) RETURNS STRING BEGIN RETURN sys.DQ(s) || '.' || sys.DQ(t); END; CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN RETURN 'ALTER TABLE ' || sys.FQN(s, t) || ' '; END; - --We need pcre to implement a header guard which means adding the schema of an object explicitely to its identifier. CREATE FUNCTION sys.replace_first(ori STRING, pat STRING, rep STRING, flg STRING) RETURNS STRING EXTERNAL NAME "pcre"."replace_first"; CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS STRING BEGIN RETURN SELECT sys.replace_first(stmt, '(\\s*"?' || sch || '"?\\s*\\.|)\\s*"?' || nme || '"?\\s*', ' ' || sys.FQN(sch, nme) || ' ', 'imsx'); END; - CREATE VIEW sys.describe_constraints AS SELECT s.name sch, @@ -3797,7 +3794,6 @@ CREATE VIEW sys.describe_constraints AS AND t.system = FALSE AND k.type in (0, 1) AND t.type IN (0, 6); - CREATE VIEW sys.describe_indices AS WITH it (id, idx) AS (VALUES (0, 'INDEX'), (4, 'IMPRINTS INDEX'), (5, 'ORDERED INDEX')) --UNIQUE INDEX wraps to INDEX. SELECT @@ -3822,7 +3818,6 @@ CREATE VIEW sys.describe_indices AS AND k.type IS NULL AND i.type = it.id ORDER BY i.name, kc.nr; - CREATE VIEW sys.describe_column_defaults AS SELECT s.name sch, @@ -3836,7 +3831,6 @@ CREATE VIEW sys.describe_column_defaults s.name <> 'tmp' AND NOT t.system AND c."default" IS NOT NULL; - CREATE VIEW sys.describe_foreign_keys AS WITH action_type (id, act) AS (VALUES (0, 'NO ACTION'), @@ -3876,7 +3870,6 @@ CREATE VIEW sys.describe_foreign_keys AS AND (fkk."action" & 255) = od.id AND ((fkk."action" >> 8) & 255) = ou.id ORDER BY fkk.name, fkkc.nr; - --TODO: CRASHES when this function gets inlined into describe_tables CREATE FUNCTION sys.get_merge_table_partition_expressions(tid INT) RETURNS STRING BEGIN @@ -3899,12 +3892,10 @@ BEGIN END FROM (VALUES (tid)) t(id) LEFT JOIN sys.table_partitions tp ON t.id = tp.table_id; END; - --TODO: gives mergejoin errors when inlined CREATE FUNCTION sys.get_remote_table_expressions(s STRING, t STRING) RETURNS STRING BEGIN RETURN SELECT ' ON ' || sys.SQ(uri) || ' WITH USER ' || sys.SQ(username) || ' ENCRYPTED PASSWORD ' || sys.SQ("hash") FROM sys.remote_table_credentials(s ||'.' || t); END; - CREATE VIEW sys.describe_tables AS SELECT t.id o, @@ -3936,7 +3927,6 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; - CREATE VIEW sys.describe_triggers AS SELECT s.name sch, @@ -3945,7 +3935,6 @@ CREATE VIEW sys.describe_triggers AS tr.statement def FROM sys.schemas s, sys.tables t, sys.triggers tr WHERE s.id = t.schema_id AND t.id = tr.table_id AND NOT t.system; - CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -3954,32 +3943,20 @@ CREATE VIEW sys.describe_comments AS c.remark rem FROM ( SELECT id, 'SCHEMA', sys.DQ(name) FROM sys.schemas - UNION ALL - SELECT t.id, CASE WHEN ts.table_type_name = 'VIEW' THEN 'VIEW' ELSE 'TABLE' END, sys.FQN(s.name, t.name) FROM sys.schemas s JOIN sys.tables t ON s.id = t.schema_id JOIN sys.table_types ts ON t.type = ts.table_type_id WHERE NOT s.name <> 'tmp' - UNION ALL - SELECT c.id, 'COLUMN', sys.FQN(s.name, t.name) || '.' || sys.DQ(c.name) FROM sys.columns c, sys.tables t, sys.schemas s WHERE c.table_id = t.id AND t.schema_id = s.id - UNION ALL - SELECT idx.id, 'INDEX', sys.FQN(s.name, idx.n
MonetDB: default - make it compile
Changeset: 3fbde2a30f5d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fbde2a30f5d Modified Files: monetdb5/optimizer/opt_garbageCollector.c Branch: default Log Message: make it compile diffs (22 lines): diff --git a/monetdb5/optimizer/opt_garbageCollector.c b/monetdb5/optimizer/opt_garbageCollector.c --- a/monetdb5/optimizer/opt_garbageCollector.c +++ b/monetdb5/optimizer/opt_garbageCollector.c @@ -26,7 +26,7 @@ str OPTgarbageCollectorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - int i, limit, vlimit; + int i, limit; InstrPtr p; int actions = 0; char buf[1024]; @@ -61,8 +61,8 @@ OPTgarbageCollectorImplementation(Client } // Actual garbage collection stuff, just mark them for re-assessment - vlimit = mb->vtop; #ifndef NDEBUG + int vlimit = mb->vtop; used = (int *) GDKzalloc(vlimit * sizeof(int)); #endif p = NULL; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Approve ppc64 output.
Changeset: b7eeaac5e423 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b7eeaac5e423 Modified Files: sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 Branch: default Log Message: Approve ppc64 output. diffs (truncated from 1458 to 300 lines): diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 @@ -4365,19 +4365,16 @@ BEGIN END END; END; - CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || sys.replace(s,,'') || ''' '; END; CREATE FUNCTION sys.DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || sys.replace(s,'"','""') || '"'; END; --TODO: Figure out why this breaks with the space CREATE FUNCTION sys.FQN(s STRING, t STRING) RETURNS STRING BEGIN RETURN sys.DQ(s) || '.' || sys.DQ(t); END; CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN RETURN 'ALTER TABLE ' || sys.FQN(s, t) || ' '; END; - --We need pcre to implement a header guard which means adding the schema of an object explicitely to its identifier. CREATE FUNCTION sys.replace_first(ori STRING, pat STRING, rep STRING, flg STRING) RETURNS STRING EXTERNAL NAME "pcre"."replace_first"; CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS STRING BEGIN RETURN SELECT sys.replace_first(stmt, '(\\s*"?' || sch || '"?\\s*\\.|)\\s*"?' || nme || '"?\\s*', ' ' || sys.FQN(sch, nme) || ' ', 'imsx'); END; - CREATE VIEW sys.describe_constraints AS SELECT s.name sch, @@ -4392,7 +4389,6 @@ CREATE VIEW sys.describe_constraints AS AND t.system = FALSE AND k.type in (0, 1) AND t.type IN (0, 6); - CREATE VIEW sys.describe_indices AS WITH it (id, idx) AS (VALUES (0, 'INDEX'), (4, 'IMPRINTS INDEX'), (5, 'ORDERED INDEX')) --UNIQUE INDEX wraps to INDEX. SELECT @@ -4417,7 +4413,6 @@ CREATE VIEW sys.describe_indices AS AND k.type IS NULL AND i.type = it.id ORDER BY i.name, kc.nr; - CREATE VIEW sys.describe_column_defaults AS SELECT s.name sch, @@ -4431,7 +4426,6 @@ CREATE VIEW sys.describe_column_defaults s.name <> 'tmp' AND NOT t.system AND c."default" IS NOT NULL; - CREATE VIEW sys.describe_foreign_keys AS WITH action_type (id, act) AS (VALUES (0, 'NO ACTION'), @@ -4471,7 +4465,6 @@ CREATE VIEW sys.describe_foreign_keys AS AND (fkk."action" & 255) = od.id AND ((fkk."action" >> 8) & 255) = ou.id ORDER BY fkk.name, fkkc.nr; - --TODO: CRASHES when this function gets inlined into describe_tables CREATE FUNCTION sys.get_merge_table_partition_expressions(tid INT) RETURNS STRING BEGIN @@ -4494,12 +4487,10 @@ BEGIN END FROM (VALUES (tid)) t(id) LEFT JOIN sys.table_partitions tp ON t.id = tp.table_id; END; - --TODO: gives mergejoin errors when inlined CREATE FUNCTION sys.get_remote_table_expressions(s STRING, t STRING) RETURNS STRING BEGIN RETURN SELECT ' ON ' || sys.SQ(uri) || ' WITH USER ' || sys.SQ(username) || ' ENCRYPTED PASSWORD ' || sys.SQ("hash") FROM sys.remote_table_credentials(s ||'.' || t); END; - CREATE VIEW sys.describe_tables AS SELECT t.id o, @@ -4531,7 +4522,6 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; - CREATE VIEW sys.describe_triggers AS SELECT s.name sch, @@ -4540,7 +4530,6 @@ CREATE VIEW sys.describe_triggers AS tr.statement def FROM sys.schemas s, sys.tables t, sys.triggers tr WHERE s.id = t.schema_id AND t.id = tr.table_id AND NOT t.system; - CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -4549,32 +4538,20 @@ CREATE VIEW sys.describe_comments AS c.remark rem FROM ( SELECT id, 'SCHEMA', sys.DQ(name) FROM sys.schemas - UNION ALL - SELECT t.id, CASE WHEN ts.table_type_name = 'VIEW' THEN 'VIEW' ELSE 'TABLE' END, sys.FQN(s.name, t.name) FROM sys.schemas s JOIN sys.tables t ON s.id = t.schema_id JOIN sys.table_types ts ON t.type = ts.table_type_id WHERE NOT s.name <> 'tmp' - UNION ALL - SELECT c.id, 'COLUMN', sys.FQN(s.name, t.name) || '.' || sys.DQ(c.name) FROM sys.columns c, sys.tables t, sys.schemas s WHERE c.table_id = t.id AND t.schema_id = s.id - UNION ALL - SELECT idx.id, 'INDEX', sys.FQN(s.name, idx.name) FROM sys.idxs idx, sys._tables t, sys.sche
MonetDB: Oct2020 - one more java test got converted
Changeset: 72da67c6fd50 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=72da67c6fd50 Removed Files: sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh sql/jdbc/tests/Tests/SQLcopyinto.stable.err sql/jdbc/tests/Tests/SQLcopyinto.stable.out Modified Files: sql/jdbc/tests/Tests/All Branch: Oct2020 Log Message: one more java test got converted diffs (164 lines): diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All --- a/sql/jdbc/tests/Tests/All +++ b/sql/jdbc/tests/Tests/All @@ -1,5 +1,4 @@ HAVE_JDBCTESTS?JDBC_API_Tester -HAVE_JDBCTESTS?SQLcopyinto #HAVE_JDBCTESTS?Test_Csendthread # unfortunately has runtime-dependant output HAVE_JDBCTESTS&HAVE_HGE?Test_Int128 HAVE_JDBCCLIENT_JAR?Test_JdbcClient diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat b/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat deleted file mode 100755 --- a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat +++ /dev/null @@ -1,1 +0,0 @@ -@call "%TSTSRCDIR%\Test.SQL.bat" %* diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh b/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh deleted file mode 100755 --- a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$TSTSRCDIR/Test.SQL.sh $* diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.stable.err b/sql/jdbc/tests/Tests/SQLcopyinto.stable.err deleted file mode 100644 --- a/sql/jdbc/tests/Tests/SQLcopyinto.stable.err +++ /dev/null @@ -1,42 +0,0 @@ -stderr of test 'SQLcopyinto` in directory 'sql/jdbc/tests` itself: - - -# 12:51:59 > -# 12:51:59 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33746" "--set" "mapi_usock=/var/tmp/mtest-12494/.s.monetdb.33746" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" "--set" "embedded_r=yes" "--set" "embedded_py=true" "--set" "embedded_c=true" -# 12:51:59 > - -# builtin opt gdk_dbpath = /export/scratch1/dinther/INSTALL/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 33746 -# cmdline opt mapi_usock = /var/tmp/mtest-12494/.s.monetdb.33746 -# cmdline opt monet_prompt = -# cmdline opt gdk_dbpath = /export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests -# cmdline opt embedded_r = yes -# cmdline opt embedded_py = true -# cmdline opt embedded_c = true -# cmdline opt gdk_debug = 553648138 - -# 12:52:00 > -# 12:52:00 > "./SQLcopyinto.SQL.sh" "SQLcopyinto" -# 12:52:00 > - - -# 12:52:00 > -# 12:52:00 > java SQLcopyinto "jdbc:monetdb://catskill:33746/mTests_sql_jdbc_tests?user=monetdb&password=monetdb" -# 12:52:00 > - - -# 12:52:00 > -# 12:52:00 > "Done." -# 12:52:00 > - diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.stable.out b/sql/jdbc/tests/Tests/SQLcopyinto.stable.out deleted file mode 100644 --- a/sql/jdbc/tests/Tests/SQLcopyinto.stable.out +++ /dev/null @@ -1,89 +0,0 @@ -stdout of test 'SQLcopyinto` in directory 'sql/jdbc/tests` itself: - - -# 12:51:59 > -# 12:51:59 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33746" "--set" "mapi_usock=/var/tmp/mtest-12494/.s.monetdb.33746" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" "--set" "embedded_r=yes" "--set" "embedded_py=true" "--set" "embedded_c=true" -# 12:51:59 > - -# MonetDB 5 server v11.29.4 -# This is an unreleased version -# Serving database 'mTests_sql_jdbc_tests', using 4 threads -# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers -# Found 31.307 GiB available main-memory. -# Copyright (c) 1993 - July 2008 CWI. -# Copyright (c) August 2008 - 2018 MonetDB B.V., all rights reserved -# Visit https://www.monetdb.org/ for further information -# Listening for connection requests on mapi:monetdb://catskill.da.cwi.nl:33746/ -# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-12494/.s.monetdb.33746 -# MonetDB/GIS module loaded -# MonetDB/SQL module loaded -# MonetDB/Python2 module loaded -# MonetDB/R module loaded - - -# 12:52:00 > -# 12:52:00 > "./SQLcopyinto.SQL.sh" "SQLcopyinto" -# 12:52:00 > - - -# 12:52:00 > -# 12:52:00 > java SQLcopyinto "jdbc:monetdb://catskill:33746/mTests_sql_jdbc_tests?user=monetdb&password=monetdb" -# 12:52:00 > - -SQLcopyinto started -Connected to MonetDB server - -CopyInto STDIN begin -Before connecting to MonetDB server via MapiSocket -Connected to MonetDB server via MapiSocket -Before sending data to STDIN -Completed sending data via STDIN -CopyI
MonetDB: default - approved output
Changeset: b0dd003ff574 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b0dd003ff574 Modified Files: clients/Tests/MAL-signatures.stable.out Branch: default Log Message: approved output diffs (11 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -740,6 +740,7 @@ stdout of test 'MAL-signatures` in direc [ "bat", "isaKey", "command bat.isaKey(X_0:bat[:any_1]):bit ", "BKCgetKey;", "" ] [ "bat", "mergecand","command bat.mergecand(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid] ", "BKCmergecand;","" ] [ "bat", "mirror", "command bat.mirror(X_0:bat[:any_2]):bat[:oid] ", "BKCmirror;", "" ] +[ "bat", "new", "pattern bat.new(X_0:any_1, X_1:bat[:any_2]):bat[:any_1] ", "CMDBATdup;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1):bat[:any_1] ", "CMDBATnew;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1, X_1:int):bat[:any_1] ", "CMDBATnew;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1, X_1:int, X_2:bit):bat[:any_1] ","CMDBATnew;", "" ] ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - approve output
Changeset: 3cb0f81c1d20 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3cb0f81c1d20 Modified Files: clients/Tests/MAL-signatures.stable.out.int128 Branch: default Log Message: approve output diffs (11 lines): diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -859,6 +859,7 @@ stdout of test 'MAL-signatures` in direc [ "bat", "isaKey", "command bat.isaKey(X_0:bat[:any_1]):bit ", "BKCgetKey;", "" ] [ "bat", "mergecand","command bat.mergecand(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid] ", "BKCmergecand;","" ] [ "bat", "mirror", "command bat.mirror(X_0:bat[:any_2]):bat[:oid] ", "BKCmirror;", "" ] +[ "bat","new", "pattern bat.new(X_0:any_1, X_1:bat[:any_2]):bat[:any_1] ", "CMDBATdup;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1):bat[:any_1] ", "CMDBATnew;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1, X_1:int):bat[:any_1] ", "CMDBATnew;", "" ] [ "bat", "new", "pattern bat.new(X_0:any_1, X_1:int, X_2:bit):bat[:any_1] ","CMDBATnew;", "" ] ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - table->columns is now stored in a objlist.
Changeset: 70b99da8f9c5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=70b99da8f9c5 Added Files: sql/storage/objlist.c Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_optimizer.c sql/backends/monet5/sql_result.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statistics.c sql/backends/monet5/vaults/fits/fits.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_partition.c sql/server/rel_planner.c sql/server/rel_propagate.c sql/server/rel_psm.c sql/server/rel_rel.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_mvc.c sql/storage/CMakeLists.txt sql/storage/bat/bat_storage.c sql/storage/bat/bat_table.c sql/storage/sql_catalog.c sql/storage/store.c tools/monetdbe/monetdbe.c Branch: default Log Message: table->columns is now stored in a objlist. diffs (truncated from 1392 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -1657,14 +1657,14 @@ rel2bin_sql_table(backend *be, sql_table node *n; stmt *dels = stmt_tid(be, t, 0); - for (n = t->columns.set->h; n; n = n->next) { + for (n = ol_first_node(t->columns); n; n = n->next) { sql_column *c = n->data; stmt *sc = stmt_col(be, c, dels, dels->partition); list_append(l, sc); } /* TID column */ - if (t->columns.set->h) { + if (ol_first_node(t->columns)) { /* tid function sql.tid(t) */ const char *rnme = t->base.name; @@ -1925,7 +1925,7 @@ rel2bin_table(backend *be, sql_rel *rel, trigger_input *ti = rel->l; l = sa_list(sql->sa); - for(n = ti->t->columns.set->h; n; n = n->next) { + for(n = ol_first_node(ti->t->columns); n; n = n->next) { sql_column *c = n->data; if (ti->type == 2) { /* updates */ @@ -3996,7 +3996,7 @@ sql_stack_add_inserted( mvc *sql, const ti->updates = updates; ti->type = 1; ti->nn = name; - for (n = t->columns.set->h; n; n = n->next) { + for (n = ol_first_node(t->columns); n; n = n->next) { sql_column *c = n->data; sql_exp *ne = exp_column(sql->sa, name, c->base.name, &c->type, CARD_MULTI, c->null, 0); @@ -4050,7 +4050,7 @@ sql_insert_check_null(backend *be, sql_t node *m, *n; sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", sql_bind_localtype("void"), NULL, F_AGGR); - for (n = t->columns.set->h, m = inserts->h; n && m; + for (n = ol_first_node(t->columns), m = inserts->h; n && m; n = n->next, m = m->next) { stmt *i = m->data; sql_column *c = n->data; @@ -4076,7 +4076,7 @@ sql_insert_check_null(backend *be, sql_t static stmt ** table_update_stmts(mvc *sql, sql_table *t, int *Len) { - *Len = list_length(t->columns.set); + *Len = ol_length(t->columns); return SA_ZNEW_ARRAY(sql->sa, stmt *, *Len); } @@ -4126,7 +4126,7 @@ rel2bin_insert(backend *be, sql_rel *rel l = sa_list(sql->sa); updates = table_update_stmts(sql, t, &len); - for (n = t->columns.set->h, m = inserts->op4.lval->h; n && m; n = n->next, m = m->next) { + for (n = ol_first_node(t->columns), m = inserts->op4.lval->h; n && m; n = n->next, m = m->next) { sql_column *c = n->data; updates[c->colnr] = m->data; @@ -4192,7 +4192,7 @@ rel2bin_insert(backend *be, sql_rel *rel m = m->next; } - for (n = t->columns.set->h, m = inserts->op4.lval->h; n && m; n = n->next, m = m->next) { + for (n = ol_first_node(t->columns), m = inserts->op4.lval->h; n && m; n = n->next, m = m->next) { stmt *ins = m->data; sql_column *c = n->data; @@ -4905,7 +4905,7 @@ update_idxs_and_check_keys(backend *be, if (!t->idxs.set) return idx_updates; - updcol = first_updated_col(updates, list_length(t->columns.set)); + updcol = first_updated_col(updates, ol_length(t->columns)); for (n = t->idxs.set->h; n; n = n->next) { sql_idx *i = n->data; stmt *is = NULL; @@ -4946,7 +4946,7 @@ sql_stack_add_updated(mvc *sql, const ch ti->type = 2; ti->on = on; ti->nn = nn; - for (n = t->columns.set->h; n; n = n->next) { + for (n = ol_first_node(t->columns); n; n = n->next) { sql_column *c = n->data; if (updates[c->colnr]) { @@ -5017,7 +5017,
MonetDB: default - merged
Changeset: 6def2eeb4335 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6def2eeb4335 Branch: default Log Message: merged diffs (truncated from 1458 to 300 lines): diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 @@ -4365,19 +4365,16 @@ BEGIN END END; END; - CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || sys.replace(s,,'') || ''' '; END; CREATE FUNCTION sys.DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || sys.replace(s,'"','""') || '"'; END; --TODO: Figure out why this breaks with the space CREATE FUNCTION sys.FQN(s STRING, t STRING) RETURNS STRING BEGIN RETURN sys.DQ(s) || '.' || sys.DQ(t); END; CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN RETURN 'ALTER TABLE ' || sys.FQN(s, t) || ' '; END; - --We need pcre to implement a header guard which means adding the schema of an object explicitely to its identifier. CREATE FUNCTION sys.replace_first(ori STRING, pat STRING, rep STRING, flg STRING) RETURNS STRING EXTERNAL NAME "pcre"."replace_first"; CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS STRING BEGIN RETURN SELECT sys.replace_first(stmt, '(\\s*"?' || sch || '"?\\s*\\.|)\\s*"?' || nme || '"?\\s*', ' ' || sys.FQN(sch, nme) || ' ', 'imsx'); END; - CREATE VIEW sys.describe_constraints AS SELECT s.name sch, @@ -4392,7 +4389,6 @@ CREATE VIEW sys.describe_constraints AS AND t.system = FALSE AND k.type in (0, 1) AND t.type IN (0, 6); - CREATE VIEW sys.describe_indices AS WITH it (id, idx) AS (VALUES (0, 'INDEX'), (4, 'IMPRINTS INDEX'), (5, 'ORDERED INDEX')) --UNIQUE INDEX wraps to INDEX. SELECT @@ -4417,7 +4413,6 @@ CREATE VIEW sys.describe_indices AS AND k.type IS NULL AND i.type = it.id ORDER BY i.name, kc.nr; - CREATE VIEW sys.describe_column_defaults AS SELECT s.name sch, @@ -4431,7 +4426,6 @@ CREATE VIEW sys.describe_column_defaults s.name <> 'tmp' AND NOT t.system AND c."default" IS NOT NULL; - CREATE VIEW sys.describe_foreign_keys AS WITH action_type (id, act) AS (VALUES (0, 'NO ACTION'), @@ -4471,7 +4465,6 @@ CREATE VIEW sys.describe_foreign_keys AS AND (fkk."action" & 255) = od.id AND ((fkk."action" >> 8) & 255) = ou.id ORDER BY fkk.name, fkkc.nr; - --TODO: CRASHES when this function gets inlined into describe_tables CREATE FUNCTION sys.get_merge_table_partition_expressions(tid INT) RETURNS STRING BEGIN @@ -4494,12 +4487,10 @@ BEGIN END FROM (VALUES (tid)) t(id) LEFT JOIN sys.table_partitions tp ON t.id = tp.table_id; END; - --TODO: gives mergejoin errors when inlined CREATE FUNCTION sys.get_remote_table_expressions(s STRING, t STRING) RETURNS STRING BEGIN RETURN SELECT ' ON ' || sys.SQ(uri) || ' WITH USER ' || sys.SQ(username) || ' ENCRYPTED PASSWORD ' || sys.SQ("hash") FROM sys.remote_table_credentials(s ||'.' || t); END; - CREATE VIEW sys.describe_tables AS SELECT t.id o, @@ -4531,7 +4522,6 @@ CREATE VIEW sys.describe_tables AS AND s.id = t.schema_id AND ts.table_type_id = t.type AND s.name <> 'tmp'; - CREATE VIEW sys.describe_triggers AS SELECT s.name sch, @@ -4540,7 +4530,6 @@ CREATE VIEW sys.describe_triggers AS tr.statement def FROM sys.schemas s, sys.tables t, sys.triggers tr WHERE s.id = t.schema_id AND t.id = tr.table_id AND NOT t.system; - CREATE VIEW sys.describe_comments AS SELECT o.id id, @@ -4549,32 +4538,20 @@ CREATE VIEW sys.describe_comments AS c.remark rem FROM ( SELECT id, 'SCHEMA', sys.DQ(name) FROM sys.schemas - UNION ALL - SELECT t.id, CASE WHEN ts.table_type_name = 'VIEW' THEN 'VIEW' ELSE 'TABLE' END, sys.FQN(s.name, t.name) FROM sys.schemas s JOIN sys.tables t ON s.id = t.schema_id JOIN sys.table_types ts ON t.type = ts.table_type_id WHERE NOT s.name <> 'tmp' - UNION ALL - SELECT c.id, 'COLUMN', sys.FQN(s.name, t.name) || '.' || sys.DQ(c.name) FROM sys.columns c, sys.tables t, sys.schemas s WHERE c.table_id = t.id AND t.schema_id = s.id - UNION ALL - SELECT idx.id, 'INDEX', sys.FQN(s.name, idx.name) FROM sys.idxs idx, sys._tables t, sys.schemas s WHERE idx.table_id = t.id AND t.schema_id = s.id - UNION ALL - SELECT seq.id, 'SEQUENCE', sys.FQN(s.name, seq.name) FROM sys.sequences seq, sys.schemas s WHERE seq.schema_id = s.id - UNION ALL - SELE
MonetDB: default - Packing more optimizers
Changeset: fa589769ffd5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fa589769ffd5 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing more optimizers diffs (106 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3735,7 +3735,7 @@ rel_select_cse(visitor *v, sql_rel *rel) return rel; } -static sql_rel * +static inline sql_rel * rel_project_cse(visitor *v, sql_rel *rel) { if (is_project(rel->op) && rel->exps) { @@ -4533,9 +4533,6 @@ rel_push_select_down(visitor *v, sql_rel } exps = rel->exps; - if (rel->op == op_project && r && r->op == op_project && !(rel_is_ref(r))) - return rel_merge_projects(v, rel); - /* push select through join */ if (is_select(rel->op) && r && is_join(r->op) && !(rel_is_ref(r))) { sql_rel *jl = r->l; @@ -4713,7 +4710,7 @@ rel_push_select_down_join(visitor *v, sq * {semi}join( A, groupby( semijoin(B,A) [gbe == A.x] ) [gbe][aggrs] ) [ gbe == A.x ] */ -static sql_rel * +static inline sql_rel * rel_push_join_down(visitor *v, sql_rel *rel) { list *exps = NULL; @@ -9602,8 +9599,10 @@ rel_optimize_unions_topdown(visitor *v, } static sql_rel * -rel_optimize_group_by(visitor *v, sql_rel *rel) -{ +rel_optimize_projections(visitor *v, sql_rel *rel) +{ + rel = rel_project_cse(v, rel); + if (!is_groupby(rel->op)) return rel; @@ -9643,11 +9642,16 @@ rel_optimize_semi_and_anti(visitor *v, s static sql_rel * rel_optimize_select_and_joins_topdown(visitor *v, sql_rel *rel) { + /* push_join_down introduces semijoins */ + int level = *(int*) v->data; + if (level <= 0) + rel = rel_push_join_down(v, rel); + + rel = rel_simplify_fk_joins(v, rel); + rel = rel_push_select_down(v, rel); if (rel->l && (is_select(rel->op) || is_join(rel->op))) rel = rel_use_index(v, rel); - rel = rel_simplify_fk_joins(v, rel); - if (!is_select(rel->op) || list_empty(rel->exps)) return rel; @@ -9721,9 +9725,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_union]) rel = rel_visitor_bottomup(&v, rel, &rel_optimize_unions_bottomup); - if (gp.cnt[op_project]) - rel = rel_visitor_bottomup(&v, rel, &rel_project_cse); - if ((gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full]) && /* DISABLES CODE */ (0)) rel = rel_visitor_topdown(&v, rel, &rel_split_outerjoin); @@ -9736,8 +9737,8 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_union]) rel = rel_visitor_topdown(&v, rel, &rel_optimize_unions_topdown); - if (gp.cnt[op_groupby]) - rel = rel_visitor_topdown(&v, rel, &rel_optimize_group_by); + if (gp.cnt[op_groupby] || gp.cnt[op_project] || gp.cnt[op_union] || gp.cnt[op_inter] || gp.cnt[op_except]) + rel = rel_visitor_topdown(&v, rel, &rel_optimize_projections); if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti]) { rel = rel_remove_empty_join(&v, rel); @@ -9748,11 +9749,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_visitor_bottomup(&v, rel, &rel_join_push_exps_down); } - /* push_join_down introduces semijoins */ - /* rewrite semijoin (A, join(A,B)) into semijoin (A,B) */ - if (level <= 0 && gp.cnt[op_groupby] && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left])) - rel = rel_visitor_topdown(&v, rel, &rel_push_join_down); - /* Important -> Re-write semijoins after rel_join_order */ if (gp.cnt[op_anti] || gp.cnt[op_semi]) { rel = rel_visitor_bottomup(&v, rel, &rel_optimize_semi_and_anti); @@ -9762,9 +9758,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int /* Important -> Make sure rel_push_select_down gets called after rel_join_order, because pushing down select expressions makes rel_join_order more difficult */ - if (gp.cnt[op_select] && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_left] || gp.cnt[op_right])) - rel = rel_visitor_topdown(&v, rel, &rel_push_select_down); - if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti] || gp.cnt[op_select]) rel = rel_visitor_topdown(&v, rel, &rel_optimize_select_and_joins_topdown); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Packing rel_push_select_down_join optimizer w...
Changeset: 6f6b8b69f246 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6f6b8b69f246 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing rel_push_select_down_join optimizer with other join optimizers diffs (39 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -4618,7 +4618,7 @@ rel_push_select_down(visitor *v, sql_rel return try_remove_empty_select(v, rel); } -static sql_rel * +static inline sql_rel * rel_push_select_down_join(visitor *v, sql_rel *rel) { list *exps = NULL; @@ -9618,6 +9618,7 @@ rel_optimize_projections(visitor *v, sql static sql_rel * rel_optimize_joins(visitor *v, sql_rel *rel) { + rel = rel_push_select_down_join(v, rel); rel = rel_out2inner(v, rel); rel = rel_join2semijoin(v, rel); rel = rel_push_join_down_outer(v, rel); @@ -9731,9 +9732,6 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (level <= 1 && gp.cnt[op_project]) rel = rel_exp_visitor_bottomup(&v, rel, &rel_merge_project_rse, false); - if (gp.cnt[op_join]) - rel = rel_visitor_topdown(&v, rel, &rel_push_select_down_join); - if (gp.cnt[op_union]) rel = rel_visitor_topdown(&v, rel, &rel_optimize_unions_topdown); @@ -9742,7 +9740,7 @@ optimize_rel(mvc *sql, sql_rel *rel, int if (gp.cnt[op_join] || gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_semi] || gp.cnt[op_anti]) { rel = rel_remove_empty_join(&v, rel); - rel = rel_visitor_bottomup(&v, rel, &rel_optimize_joins); + rel = rel_visitor_topdown(&v, rel, &rel_optimize_joins); if (!gp.cnt[op_update]) rel = rel_join_order(&v, rel); if (level <= 0 && (gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti])) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged with Oct2020Z
Changeset: 765205749a3e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=765205749a3e Modified Files: gdk/gdk_join.c Branch: default Log Message: merged with Oct2020Z diffs (35 lines): diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c --- a/gdk/gdk_join.c +++ b/gdk/gdk_join.c @@ -2572,7 +2572,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B r->thash ? " ignoring existing hash" : "", swapped ? " (swapped)" : ""); if (snprintf(ext, sizeof(ext), "thshjn%x", -(unsigned) rci->s->batCacheid) >= (int) sizeof(ext)) +(unsigned) THRgettid()) >= (int) sizeof(ext)) goto bailout; if ((hsh = BAThash_impl(r, rci, ext)) == NULL) { goto bailout; diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All --- a/sql/jdbc/tests/Tests/All +++ b/sql/jdbc/tests/Tests/All @@ -1,5 +1,4 @@ HAVE_JDBCTESTS?JDBC_API_Tester -HAVE_JDBCTESTS?SQLcopyinto #HAVE_JDBCTESTS?Test_Csendthread # unfortunately has runtime-dependant output HAVE_JDBCTESTS&HAVE_HGE?Test_Int128 HAVE_JDBCCLIENT_JAR?Test_JdbcClient diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat b/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat deleted file mode 100755 --- a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.bat +++ /dev/null @@ -1,1 +0,0 @@ -@call "%TSTSRCDIR%\Test.SQL.bat" %* diff --git a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh b/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh deleted file mode 100755 --- a/sql/jdbc/tests/Tests/SQLcopyinto.SQL.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$TSTSRCDIR/Test.SQL.sh $* ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - idxs from changeset -> objlist
Changeset: 9d4cb6781a3a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d4cb6781a3a Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_schema.c sql/server/rel_updates.c sql/storage/bat/bat_storage.c sql/storage/sql_catalog.c sql/storage/store.c Branch: default Log Message: idxs from changeset -> objlist diffs (truncated from 515 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -1672,8 +1672,8 @@ rel2bin_sql_table(backend *be, sql_table sc = stmt_alias(be, sc, rnme, TID); list_append(l, sc); } - if (t->idxs.set) { - for (n = t->idxs.set->h; n; n = n->next) { + if (t->idxs) { + for (n = ol_first_node(t->idxs); n; n = n->next) { sql_idx *i = n->data; stmt *sc = stmt_idx(be, i, dels, dels->partition); const char *rnme = t->base.name; @@ -4152,9 +4152,9 @@ rel2bin_insert(backend *be, sql_rel *rel } insert = NULL; - if (t->idxs.set) { + if (t->idxs) { idx_m = m; - for (n = t->idxs.set->h; n && m; n = n->next) { + for (n = ol_first_node(t->idxs); n && m; n = n->next) { stmt *is = m->data; sql_idx *i = n->data; @@ -4177,8 +4177,8 @@ rel2bin_insert(backend *be, sql_rel *rel if (t->s) /* only not declared tables, need this */ pos = stmt_claim(be, t, cnt); - if (t->idxs.set) - for (n = t->idxs.set->h, m = idx_m; n && m; n = n->next) { + if (t->idxs) + for (n = ol_first_node(t->idxs), m = idx_m; n && m; n = n->next) { stmt *is = m->data; sql_idx *i = n->data; @@ -4864,10 +4864,10 @@ cascade_updates(backend *be, sql_table * mvc *sql = be->mvc; node *n; - if (!t->idxs.set) + if (!ol_length(t->idxs)) return 0; - for (n = t->idxs.set->h; n; n = n->next) { + for (n = ol_first_node(t->idxs); n; n = n->next) { sql_idx *i = n->data; /* check if update is needed, @@ -4902,11 +4902,11 @@ update_idxs_and_check_keys(backend *be, int updcol; list *idx_updates = sa_list(sql->sa); - if (!t->idxs.set) + if (!ol_length(t->idxs)) return idx_updates; updcol = first_updated_col(updates, ol_length(t->columns)); - for (n = t->idxs.set->h; n; n = n->next) { + for (n = ol_first_node(t->idxs); n; n = n->next) { sql_idx *i = n->data; stmt *is = NULL; 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 @@ -396,8 +396,8 @@ create_table_or_view(mvc *sql, char* sna throw(SQL, "sql.catalog", SQLSTATE(42000) "CREATE TABLE: %s_%s: an internal error occurred", s->base.name, t->base.name); } - if (t->idxs.set) { - for (n = t->idxs.set->h; n; n = n->next) { + if (t->idxs) { + for (n = ol_first_node(t->idxs); n; n = n->next) { sql_idx *i = n->data; if (!mvc_copy_idx(sql, nt, i)) { sql->sa = osa; @@ -4111,8 +4111,8 @@ sql_storage(Client cntxt, MalBlkPtr mb, } if (isTable(t)) - if (t->idxs.set) - for (ncol = (t)->idxs.set->h; ncol; ncol = ncol->next) { + if (t->idxs) + for (ncol = ol_first_node((t)->idxs); ncol; ncol = ncol->next) { sql_base *bc = ncol->data; sql_idx *c = (sql_idx *) ncol->data; if (idx_has_column(c->type)) { 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 @@ -92,10 +92,10 @@ rel_check_tables(mvc *sql, sql_table *nt } } if (isNonPartitionedTable(nt)) { - if (cs_size(&nt->idxs) != cs_size(&nnt->idxs)) + if (ol_length(nt->idxs) != ol_length(nnt->idxs)) throw(SQL,"sql.rel_check_tables",SQLSTATE(3F000) "ALTER %s: to be added table index doesn't
MonetDB: default - Packing level 0 optimizers
Changeset: c6f11fd35313 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6f11fd35313 Modified Files: sql/server/rel_optimizer.c Branch: default Log Message: Packing level 0 optimizers diffs (90 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -2387,12 +2387,12 @@ rel_is_join_on_pkey(sql_rel *rel) } /* if all arguments to a distinct aggregate are unique, remove 'distinct' property */ -static sql_rel * +static inline sql_rel * rel_distinct_aggregate_on_unique_values(visitor *v, sql_rel *rel) { sql_rel *l = (sql_rel*) rel->l; - if (rel->op == op_groupby && (!l || is_base(l->op))) { + if (is_groupby(rel->op) && (!l || is_base(l->op))) { for (node *n = rel->exps->h; n; n = n->next) { sql_exp *exp = (sql_exp*) n->data; @@ -2542,7 +2542,7 @@ is_fk_column_of_pk(mvc *sql, sql_rel *re return NULL; } -static sql_rel * +static inline sql_rel * rel_distinct_project2groupby(visitor *v, sql_rel *rel) { sql_rel *l = rel->l; @@ -3245,13 +3245,11 @@ exp_simplify_math( mvc *sql, sql_exp *e, return e; } -static sql_rel * +static inline sql_rel * rel_simplify_math(visitor *v, sql_rel *rel) { - int ochanges = 0; - if ((is_project(rel->op) || (rel->op == op_ddl && rel->flag == ddl_psm)) && rel->exps) { - int needed = 0; + int needed = 0, ochanges = 0; for (node *n = rel->exps->h; n && !needed; n = n->next) { sql_exp *e = n->data; @@ -3269,8 +3267,8 @@ rel_simplify_math(visitor *v, sql_rel *r return NULL; n->data = ne; } - } - v->changes += ochanges; + v->changes += ochanges; + } return rel; } @@ -9561,6 +9559,17 @@ rel_remove_union_partitions(visitor *v, return rel; } +static sql_rel * +rel_first_level_optimizations(visitor *v, sql_rel *rel) +{ + rel = rel_distinct_aggregate_on_unique_values(v, rel); + rel = rel_distinct_project2groupby(v, rel); + /* rel_simplify_math optimizer requires to clear the hash, so make sure it runs last in this batch */ + if (v->value_based_opt) + rel = rel_simplify_math(v, rel); + return rel; +} + /* pack optimizers into a single function call to avoid iterations in the AST */ static sql_rel * rel_optimize_select_and_joins_bottomup(visitor *v, sql_rel *rel) @@ -9690,15 +9699,10 @@ optimize_rel(mvc *sql, sql_rel *rel, int rel = rel_visitor_bottomup(&v, rel, &rel_push_project_up); if (level <= 0 && (gp.cnt[op_project] || gp.cnt[op_groupby])) rel = rel_split_project(&v, rel, 1); - if (level <= 0) { - if (value_based_opt) - rel = rel_visitor_bottomup(&v, rel, &rel_simplify_math); - if (gp.cnt[op_groupby]) - rel = rel_visitor_bottomup(&v, rel, &rel_distinct_aggregate_on_unique_values); if (gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || gp.cnt[op_join] || gp.cnt[op_semi] || gp.cnt[op_anti]) - rel = rel_visitor_bottomup(&v, rel, &rel_remove_redundant_join); - rel = rel_visitor_bottomup(&v, rel, &rel_distinct_project2groupby); + rel = rel_visitor_bottomup(&v, rel, &rel_remove_redundant_join); /* this optimizer has to run before rel_first_level_optimizations */ + rel = rel_visitor_bottomup(&v, rel, &rel_first_level_optimizations); } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - removed one more java test (is integrated)
Changeset: d3ddcccf2bf5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d3ddcccf2bf5 Removed Files: sql/jdbc/tests/Tests/Test_Int128.SQL.bat sql/jdbc/tests/Tests/Test_Int128.SQL.sh sql/jdbc/tests/Tests/Test_Int128.stable.err sql/jdbc/tests/Tests/Test_Int128.stable.out.int128 Modified Files: sql/jdbc/tests/Tests/All Branch: Oct2020 Log Message: removed one more java test (is integrated) diffs (112 lines): diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All --- a/sql/jdbc/tests/Tests/All +++ b/sql/jdbc/tests/Tests/All @@ -1,6 +1,5 @@ HAVE_JDBCTESTS?JDBC_API_Tester #HAVE_JDBCTESTS?Test_Csendthread # unfortunately has runtime-dependant output -HAVE_JDBCTESTS&HAVE_HGE?Test_Int128 HAVE_JDBCCLIENT_JAR?Test_JdbcClient HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by default (it takes a long time to run and does not need to be run everytime, only before a new release) diff --git a/sql/jdbc/tests/Tests/Test_Int128.SQL.bat b/sql/jdbc/tests/Tests/Test_Int128.SQL.bat deleted file mode 100755 --- a/sql/jdbc/tests/Tests/Test_Int128.SQL.bat +++ /dev/null @@ -1,1 +0,0 @@ -@call "%TSTSRCDIR%\Test.SQL.bat" %* diff --git a/sql/jdbc/tests/Tests/Test_Int128.SQL.sh b/sql/jdbc/tests/Tests/Test_Int128.SQL.sh deleted file mode 100755 --- a/sql/jdbc/tests/Tests/Test_Int128.SQL.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$TSTSRCDIR/Test.SQL.sh $* diff --git a/sql/jdbc/tests/Tests/Test_Int128.stable.err b/sql/jdbc/tests/Tests/Test_Int128.stable.err deleted file mode 100644 --- a/sql/jdbc/tests/Tests/Test_Int128.stable.err +++ /dev/null @@ -1,40 +0,0 @@ -stderr of test 'Test_Int128` in directory 'sql/jdbc/tests` itself: - - -# 14:37:35 > -# 14:37:35 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35496" "--set" "mapi_usock=/var/tmp/mtest-28293/.s.monetdb.35496" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/ufs/manegold/_/Monet/HG/int128/prefix/--disable-debug_--enable-assert_--enable-optimize/var/MonetDB/mTests_sql_jdbc_tests" "--set" "mal_listing=0" -# 14:37:35 > - -# builtin opt gdk_dbpath = /ufs/manegold/_/Monet/HG/int128/prefix/--disable-debug_--enable-assert_--enable-optimize/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 35496 -# cmdline opt mapi_usock = /var/tmp/mtest-28293/.s.monetdb.35496 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /ufs/manegold/_/Monet/HG/int128/prefix/--disable-debug_--enable-assert_--enable-optimize/var/MonetDB/mTests_sql_jdbc_tests -# cmdline opt mal_listing = 0 - -# 14:37:36 > -# 14:37:36 > "./Test_Int128.SQL.sh" "Test_Int128" -# 14:37:36 > - - -# 14:37:36 > -# 14:37:36 > java Test_Int128 "jdbc:monetdb://rome:35496/mTests_sql_jdbc_tests?user=monetdb&password=monetdb" -# 14:37:36 > - - -# 14:37:36 > -# 14:37:36 > "Done." -# 14:37:36 > - diff --git a/sql/jdbc/tests/Tests/Test_Int128.stable.out.int128 b/sql/jdbc/tests/Tests/Test_Int128.stable.out.int128 deleted file mode 100644 --- a/sql/jdbc/tests/Tests/Test_Int128.stable.out.int128 +++ /dev/null @@ -1,38 +0,0 @@ -stdout of test 'Test_Int128` in directory 'sql/jdbc/tests` itself: - - -# 14:37:35 > -# 14:37:35 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35496" "--set" "mapi_usock=/var/tmp/mtest-28293/.s.monetdb.35496" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/ufs/manegold/_/Monet/HG/int128/prefix/--disable-debug_--enable-assert_--enable-optimize/var/MonetDB/mTests_sql_jdbc_tests" "--set" "mal_listing=0" -# 14:37:35 > - -# MonetDB 5 server v11.17.17 "Jan2014-SP2" -# Serving database 'mTests_sql_jdbc_tests', using 8 threads -# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked -# Found 15.591 GiB available main-memory. -# Copyright (c) 1993-July 2008 CWI. -# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved -# Visit http://www.monetdb.org/ for further information -# Listening for connection requests on mapi:monetdb://rome.ins.cwi.nl:35496/ -# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-28293/.s.monetdb.35496 -# MonetDB/GIS module loaded -# MonetDB/JAQL module loaded -# MonetDB/SQL module loaded - - -# 14:37:36 > -# 14:37:36 > "./Test_Int128.SQL.sh" "Test_Int128" -# 14:37:36 > - - -# 14:37:36 > -# 14:37:36 > java Test_Int128 "jdbc:monetdb://rome:35496/mTests_sql_jdbc_te
MonetDB: default - merged with Oct2020
Changeset: 94ac77cf1fd6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94ac77cf1fd6 Branch: default Log Message: merged with Oct2020 diffs (24 lines): diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All --- a/sql/jdbc/tests/Tests/All +++ b/sql/jdbc/tests/Tests/All @@ -1,6 +1,5 @@ HAVE_JDBCTESTS?JDBC_API_Tester #HAVE_JDBCTESTS?Test_Csendthread # unfortunately has runtime-dependant output -HAVE_JDBCTESTS&HAVE_HGE?Test_Int128 HAVE_JDBCCLIENT_JAR?Test_JdbcClient HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by default (it takes a long time to run and does not need to be run everytime, only before a new release) diff --git a/sql/jdbc/tests/Tests/Test_Int128.SQL.bat b/sql/jdbc/tests/Tests/Test_Int128.SQL.bat deleted file mode 100755 --- a/sql/jdbc/tests/Tests/Test_Int128.SQL.bat +++ /dev/null @@ -1,1 +0,0 @@ -@call "%TSTSRCDIR%\Test.SQL.bat" %* diff --git a/sql/jdbc/tests/Tests/Test_Int128.SQL.sh b/sql/jdbc/tests/Tests/Test_Int128.SQL.sh deleted file mode 100755 --- a/sql/jdbc/tests/Tests/Test_Int128.SQL.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$TSTSRCDIR/Test.SQL.sh $* ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - keys -> objlist
Changeset: c903ca929669 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c903ca929669 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/include/sql_catalog.h sql/server/rel_schema.c sql/server/sql_mvc.c sql/storage/sql_catalog.c sql/storage/store.c Branch: default Log Message: keys -> objlist diffs (truncated from 413 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -5364,10 +5364,10 @@ sql_delete_keys(backend *be, sql_table * int res = 1; node *n; - if (!t->keys.set) + if (!ol_length(t->keys)) return res; - for (n = t->keys.set->h; n; n = n->next) { + for (n = ol_first_node(t->keys); n; n = n->next) { sql_key *k = n->data; if (k->type == pkey || k->type == ukey) { @@ -5506,8 +5506,8 @@ check_for_foreign_key_references(mvc *sq return; sqlstore *store = sql->session->tr->store; - if (t->keys.set) { /* Check for foreign key references */ - for (n = t->keys.set->h; n; n = n->next) { + if (t->keys) { /* Check for foreign key references */ + for (n = ol_first_node(t->keys); n; n = n->next) { sql_key *k = n->data; if (k->type == ukey || k->type == pkey) { 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 @@ -319,7 +319,7 @@ create_table_or_view(mvc *sql, char* sna return sql_message(SQLSTATE(42S01) "%s TABLE: name '%s' already in use", action, t->base.name); } else if (temp != SQL_DECLARED_TABLE && (!mvc_schema_privs(sql, s) && !(isTempSchema(s) && temp == SQL_LOCAL_TEMP))) { return sql_message(SQLSTATE(42000) "%s TABLE: insufficient privileges for user '%s' in schema '%s'", action, get_string_global_var(sql, "current_user"), s->base.name); - } else if (temp == SQL_DECLARED_TABLE && !list_empty(t->keys.set)) { + } else if (temp == SQL_DECLARED_TABLE && ol_length(t->keys)) { return sql_message(SQLSTATE(42000) "%s TABLE: '%s' cannot have constraints", action, t->base.name); } @@ -405,8 +405,8 @@ create_table_or_view(mvc *sql, char* sna } } } - if (t->keys.set) { - for (n = t->keys.set->h; n; n = n->next) { + if (t->keys) { + for (n = ol_first_node(t->keys); n; n = n->next) { sql_key *k = n->data; char *err = NULL; 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 @@ -103,10 +103,10 @@ rel_check_tables(mvc *sql, sql_table *nt throw(SQL,"sql.rel_check_tables",SQLSTATE(3F000) "ALTER %s: to be added table index type doesn't match %s definition", errtable, errtable); } } else { //for partitioned tables we allow indexes but the key set must be exactly the same - if (cs_size(&nt->keys) != cs_size(&nnt->keys)) + if (ol_length(nt->keys) != ol_length(nnt->keys)) throw(SQL,"sql.rel_check_tables",SQLSTATE(3F000) "ALTER %s: to be added table key doesn't match %s definition", errtable, errtable); - if (cs_size(&nt->keys)) - for (n = nt->keys.set->h, m = nnt->keys.set->h; n && m; n = n->next, m = m->next) { + if (ol_length(nt->keys)) + for (n = ol_first_node(nt->keys), m = ol_first_node(nnt->keys); n && m; n = n->next, m = m->next) { sql_key *ni = n->data; sql_key *mi = m->data; @@ -550,8 +550,8 @@ drop_table(mvc *sql, char *sname, char * if (!mvc_schema_privs(sql, s) && !(isTempSchema(s) && t->persistence == SQL_LOCAL_TEMP)) throw(SQL,"sql.drop_table", SQLSTATE(42000) "DROP TABLE: access denied for %s to schema '%s'", get_string_global_var(sql, "current_user"), s->base.name); - if (!drop_action && t->keys.set) { - for (node *n = t->keys.set->h; n; n = n->next) { + if (!drop_action && t->keys) { + for (node *n = ol_first_node(t->keys); n; n = n->next) { sql_key *k = n->data; if (k->type == ukey || k->type == pkey) { @@ -619,7 +619,7 @@ drop_key(mvc *sql, char *sname, char *tn throw(SQL,"sql.drop_key", SQLSTATE(42000) "ALTER TABLE: access denied for %s to schema '%s'", get_string_global_var(sql, "current_user"), s->base.name); if (!(t = mvc_bind_table(sql, s, tname)))
MonetDB: default - triggers -> objlist
Changeset: 6b3a30c6bbd9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b3a30c6bbd9 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_upgrades.c sql/include/sql_catalog.h sql/server/rel_schema.c sql/storage/store.c Branch: default Log Message: triggers -> objlist diffs (228 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -4015,10 +4015,10 @@ sql_insert_triggers(backend *be, sql_tab node *n; int res = 1; - if (!t->triggers.set) + if (!ol_length(t->triggers)) return res; - for (n = t->triggers.set->h; n; n = n->next) { + for (n = ol_first_node(t->triggers); n; n = n->next) { sql_trigger *trigger = n->data; if (!stack_push_frame(sql, "%OLD-NEW")) @@ -4979,10 +4979,10 @@ sql_update_triggers(backend *be, sql_tab node *n; int res = 1; - if (!t->triggers.set) + if (!ol_length(t->triggers)) return res; - for (n = t->triggers.set->h; n; n = n->next) { + for (n = ol_first_node(t->triggers); n; n = n->next) { sql_trigger *trigger = n->data; if (!stack_push_frame(sql, "%OLD-NEW")) @@ -5262,10 +5262,10 @@ sql_delete_triggers(backend *be, sql_tab node *n; int res = 1; - if (!t->triggers.set) + if (!ol_length(t->triggers)) return res; - for (n = t->triggers.set->h; n; n = n->next) { + for (n = ol_first_node(t->triggers); n; n = n->next) { sql_trigger *trigger = n->data; if (!stack_push_frame(sql, "%OLD-NEW")) @@ -5400,7 +5400,7 @@ sql_delete(backend *be, sql_table *t, st } /* project all columns */ - if (list_length(t->triggers.set) || partition_find_part(sql->session->tr, t, NULL)) { + if (ol_length(t->triggers) || partition_find_part(sql->session->tr, t, NULL)) { int nr = 0; deleted_cols = table_update_stmts(sql, t, &nr); int i = 0; @@ -5622,7 +5622,7 @@ sql_truncate(backend *be, sql_table *t, v = stmt_tid(be, next, 0); /* project all columns */ - if (list_length(t->triggers.set) || partition_find_part(sql->session->tr, t, NULL)) { + if (ol_length(t->triggers) || partition_find_part(sql->session->tr, t, NULL)) { int nr = 0; deleted_cols = table_update_stmts(sql, t, &nr); int i = 0; 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 @@ -422,8 +422,8 @@ create_table_or_view(mvc *sql, char* sna } } } - if (t->triggers.set) { - for (n = t->triggers.set->h; n; n = n->next) { + if (t->triggers) { + for (n = ol_first_node(t->triggers); n; n = n->next) { sql_trigger *tr = n->data; if (mvc_copy_trigger(sql, nt, tr)) { sql->sa = osa; 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 @@ -1733,7 +1733,7 @@ SQLrename_table(Client cntxt, MalBlkPtr throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a view"); if (isDeclaredTable(t)) throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); - if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || cs_size(&t->members) || !list_empty(t->triggers.set)) + if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || cs_size(&t->members) || ol_length(t->triggers)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); if (!(s = mvc_bind_schema(sql, nschema_name))) throw(SQL, "sql.rename_table", SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", nschema_name); diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -908,8 +908,8 @@ sql_update_nov2019_missing_dependencies( } } } - if (t->triggers.set) - for (node *mm =
MonetDB: default - more cleanup
Changeset: 2850c9805698 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2850c9805698 Modified Files: sql/common/sql_changeset.c sql/include/sql_catalog.h sql/storage/sql_catalog.c Branch: default Log Message: more cleanup diffs (85 lines): diff --git a/sql/common/sql_changeset.c b/sql/common/sql_changeset.c --- a/sql/common/sql_changeset.c +++ b/sql/common/sql_changeset.c @@ -61,12 +61,6 @@ cs_add_with_validate(changeset * cs, voi } void -cs_add_before(changeset * cs, node *n, void *elm) -{ - list_append_before(cs->set, n, elm); -} - -void cs_del(changeset * cs, void *gdata, node *elm, int flags) { if (cs->nelm == elm) @@ -80,14 +74,6 @@ cs_del(changeset * cs, void *gdata, node } } -void -cs_move(changeset *from, changeset *to, void *data) -{ - if (!to->set) - to->set = list_new(to->sa, to->destroy); - list_move_data(from->set, to->set, data); -} - int cs_size(changeset * cs) { @@ -96,14 +82,3 @@ cs_size(changeset * cs) return 0; } -node * -cs_first_node(changeset * cs) -{ - return cs->set->h; -} - -node * -cs_last_node(changeset * cs) -{ - return cs->set->t; -} diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -274,19 +274,13 @@ extern node *ol_rehash(objlist *ol, cons #define ol_last_node(ol) (ol->l->t) extern void cs_new(changeset * cs, sql_allocator *sa, fdestroy destroy); -extern changeset* cs_dup(changeset * cs); extern void cs_destroy(changeset * cs, void *data); extern void cs_add(changeset * cs, void *elm, int flag); extern void *cs_add_with_validate(changeset * cs, void *elm, void *extra, int flag, fvalidate cmp); -extern void cs_add_before(changeset * cs, node *n, void *elm); extern void cs_del(changeset * cs, void *gdata, node *elm, int flag); -extern void cs_move(changeset *from, changeset *to, void *data); extern void *cs_transverse_with_validate(changeset * cs, void *elm, void *extra, fvalidate cmp); extern int cs_size(changeset * cs); -extern node *cs_find_name(changeset * cs, const char *name); extern node *cs_find_id(changeset * cs, sqlid id); -extern node *cs_first_node(changeset * cs); -extern node *cs_last_node(changeset * cs); typedef void *backend_code; typedef size_t backend_stack; diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c --- a/sql/storage/sql_catalog.c +++ b/sql/storage/sql_catalog.c @@ -94,12 +94,6 @@ tr_version_of_parent(sql_trans *tr, ulng } node * -cs_find_name(changeset * cs, const char *name) -{ - return list_find_name(cs->set, name); -} - -node * list_find_name(list *l, const char *name) { node *n; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - members -> list
Changeset: 10d743d70ba1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10d743d70ba1 Modified Files: sql/backends/monet5/sql_cat.c sql/common/sql_changeset.c sql/include/sql_catalog.h sql/server/rel_distribute.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_partition.c sql/storage/store.c Branch: default Log Message: members -> list diffs (truncated from 526 to 300 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 @@ -153,7 +153,7 @@ validate_alter_table_add_table(mvc *sql, const char *errtable = TABLE_TYPE_DESCRIPTION(rmt->type, rmt->properties); if (!update && (!isMergeTable(rmt) && !isReplicaTable(rmt))) throw(SQL,call,SQLSTATE(42S02) "ALTER TABLE: cannot add table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - node *n = members_find_child_id(rmt->members.set, rpt->base.id); + node *n = members_find_child_id(rmt->members, rpt->base.id); if (isView(rpt)) throw(SQL,call,SQLSTATE(42000) "ALTER TABLE: can't add a view into a %s", errtable); if (isDeclaredTable(rpt)) @@ -421,7 +421,7 @@ alter_table_del_table(mvc *sql, char *ms const char *errtable = TABLE_TYPE_DESCRIPTION(mt->type, mt->properties); if (!isMergeTable(mt) && !isReplicaTable(mt)) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: cannot drop table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - if (!(n = members_find_child_id(mt->members.set, pt->base.id))) + if (!(n = members_find_child_id(mt->members, pt->base.id))) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: table '%s.%s' isn't part of %s '%s.%s'", ps->base.name, ptname, errtable, ms->base.name, mtname); if (sql_trans_del_table(sql->session->tr, mt, pt, drop_action)) @@ -1733,7 +1733,7 @@ SQLrename_table(Client cntxt, MalBlkPtr throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a view"); if (isDeclaredTable(t)) throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); - if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || cs_size(&t->members) || ol_length(t->triggers)) + if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL) || list_length(t->members) || ol_length(t->triggers)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); if (!(s = mvc_bind_schema(sql, nschema_name))) throw(SQL, "sql.rename_table", SQLSTATE(42S02) "ALTER TABLE: no such schema '%s'", nschema_name); diff --git a/sql/common/sql_changeset.c b/sql/common/sql_changeset.c --- a/sql/common/sql_changeset.c +++ b/sql/common/sql_changeset.c @@ -41,25 +41,6 @@ cs_add(changeset * cs, void *elm, int fl cs->nelm = cs->set->t; } -void * -cs_transverse_with_validate(changeset * cs, void *elm, void *extra, fvalidate cmp) -{ - return list_transverse_with_validate(cs->set, elm, extra, cmp); -} - -void * -cs_add_with_validate(changeset * cs, void *elm, void *extra, int flags, fvalidate cmp) -{ - void* res = NULL; - if (!cs->set) - cs->set = list_new(cs->sa, cs->destroy); - if((res = list_append_with_validate(cs->set, elm, extra, cmp)) != NULL) - return res; - if (newFlagSet(flags) && !cs->nelm) - cs->nelm = cs->set->t; - return res; -} - void cs_del(changeset * cs, void *gdata, node *elm, int flags) { diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -276,9 +276,7 @@ extern node *ol_rehash(objlist *ol, cons extern void cs_new(changeset * cs, sql_allocator *sa, fdestroy destroy); extern void cs_destroy(changeset * cs, void *data); extern void cs_add(changeset * cs, void *elm, int flag); -extern void *cs_add_with_validate(changeset * cs, void *elm, void *extra, int flag, fvalidate cmp); extern void cs_del(changeset * cs, void *gdata, node *elm, int flag); -extern void *cs_transverse_with_validate(changeset * cs, void *elm, void *extra, fvalidate cmp); extern int cs_size(changeset * cs); extern node *cs_find_id(changeset * cs, sqlid id); @@ -706,7 +704,7 @@ typedef struct sql_table { objlist *idxs; objlist *keys; objlist *triggers; - changeset members; /* member tables of merge/repl