MonetDB: default - merged with jun
Changeset: 16f425c76298 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=16f425c76298 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c Branch: default Log Message: merged with jun diffs (57 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 @@ -1098,23 +1098,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l s = stmt_unop(be, s, a); s->cand = cand; } -#if 0 - } else if (((e->flag&3) != 3) /* both sides closed use between implementation */ && l->nrcols > 0 && r->nrcols > 0 && r2->nrcols > 0) { - s = stmt_uselect(be, l, r, range2lcompare(e->flag), - stmt_uselect(be, l, r2, range2rcompare(e->flag), sel, is_anti(e), 0), is_anti(e), 0); -#endif } else { - /* done in stmt_uselect2 - if (sel && ((l->cand && l->nrcols) || (r->cand && r->nrcols) || (r2->cand && r->nrcols))) { - if (!l->cand && l->nrcols) - l = stmt_project(be, sel, l); - if (!r->cand && r->nrcols) - r = stmt_project(be, sel, r); - if (!r2->cand && r2->nrcols) - r2 = stmt_project(be, sel, r2); - sel = NULL; - } - */ if (l->nrcols == 0) l = stmt_const(be, bin_first_column(be, left), l); s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e)); diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1638,14 +1638,18 @@ select2_join2(backend *be, stmt *op1, st p = pushNil(mb, p, TYPE_bat); else if (op1->nrcols) p = pushArgument(mb, p, sub->nr); - if (op2->cand) - p = pushNil(mb, p, TYPE_bat); - else if (op2->nrcols) - p = pushArgument(mb, p, sub->nr); - if (op3->cand) - p = pushNil(mb, p, TYPE_bat); - else if (op3->nrcols) - p = pushArgument(mb, p, sub->nr); + if (op2->nrcols) { + if (op2->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op2->nrcols) + p = pushArgument(mb, p, sub->nr); + } + if (op2->nrcols) { + if (op3->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op3->nrcols) + p = pushArgument(mb, p, sub->nr); + } sub = NULL; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - cleanup
Changeset: 946211cedad2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=946211cedad2 Modified Files: sql/backends/monet5/rel_bin.c Branch: Jun2020 Log Message: cleanup diffs (27 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 @@ -1098,23 +1098,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l s = stmt_unop(be, s, a); s->cand = cand; } -#if 0 - } else if (((e->flag&3) != 3) /* both sides closed use between implementation */ && l->nrcols > 0 && r->nrcols > 0 && r2->nrcols > 0) { - s = stmt_uselect(be, l, r, range2lcompare(e->flag), - stmt_uselect(be, l, r2, range2rcompare(e->flag), sel, is_anti(e), 0), is_anti(e), 0); -#endif } else { - /* done in stmt_uselect2 - if (sel && ((l->cand && l->nrcols) || (r->cand && r->nrcols) || (r2->cand && r->nrcols))) { - if (!l->cand && l->nrcols) - l = stmt_project(be, sel, l); - if (!r->cand && r->nrcols) - r = stmt_project(be, sel, r); - if (!r2->cand && r2->nrcols) - r2 = stmt_project(be, sel, r2); - sel = NULL; - } - */ if (l->nrcols == 0) l = stmt_const(be, bin_first_column(be, left), l); s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e)); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - make sure we don't push candidates for scalars
Changeset: e52f92efdfc3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e52f92efdfc3 Modified Files: sql/backends/monet5/sql_statement.c Branch: Jun2020 Log Message: make sure we don't push candidates for scalars diffs (30 lines): diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1633,14 +1633,18 @@ select2_join2(backend *be, stmt *op1, st p = pushNil(mb, p, TYPE_bat); else if (op1->nrcols) p = pushArgument(mb, p, sub->nr); - if (op2->cand) - p = pushNil(mb, p, TYPE_bat); - else if (op2->nrcols) - p = pushArgument(mb, p, sub->nr); - if (op3->cand) - p = pushNil(mb, p, TYPE_bat); - else if (op3->nrcols) - p = pushArgument(mb, p, sub->nr); + if (op2->nrcols) { + if (op2->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op2->nrcols) + p = pushArgument(mb, p, sub->nr); + } + if (op2->nrcols) { + if (op3->cand) + p = pushNil(mb, p, TYPE_bat); + else if (op3->nrcols) + p = pushArgument(mb, p, sub->nr); + } sub = NULL; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - approved output
Changeset: 8f9254188caf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f9254188caf Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 Branch: default Log Message: approved output diffs (48 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 @@ -5902,12 +5902,20 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "avg", "pattern batcalc.avg(X_2:bat[:sht], X_3:bat[:oid]) (X_0:dbl, X_1:lng) ","CMDcalcavg;", "" ] [ "batcalc", "avg", "pattern batcalc.avg(X_2:bat[:sht], X_3:bat[:oid], X_4:int) (X_0:dbl, X_1:lng) ", "CMDcalcavg;", "" ] [ "batcalc", "avg", "pattern batcalc.avg(X_2:bat[:sht], X_3:int) (X_0:dbl, X_1:lng) ", "CMDcalcavg;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:any_1, X_4:bat[:bit], X_5:bit, X_6:bit, X_7:bit, X_8:bit, X_9:bit):bat[:bit] ","CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:any_1, X_4:bat[:oid], X_5:bat[:bit], X_6:bit, X_7:bit, X_8:bit, X_9:bit, X_10:bit):bat[:bit] ","CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:any_1, X_4:bat[:oid], X_5:bit, X_6:bit, X_7:bit, X_8:bit, X_9:bit):bat[:bit] ","CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit, X_8:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:bat[:any_1], X_4:bat[:bit], X_5:bit, X_6:bit, X_7:bit, X_8:bit, X_9:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bat[:bit], X_7:bit, X_8:bit, X_9:bit, X_10:bit, X_11:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:bit, X_8:bit, X_9:bit, X_10:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:any_1, X_3:bat[:any_1], X_4:bit, X_5:bit, X_6:bit, X_7:bit, X_8:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:any_1, X_4:bat[:bit], X_5:bit, X_6:bit, X_7:bit, X_8:bit, X_9:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:any_1, X_4:bat[:oid], X_5:bat[:oid], X_6:bat[:bit], X_7:bit, X_8:bit, X_9:bit, X_10:bit, X_11:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:any_1, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:bit, X_8:bit, X_9:bit, X_10:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:any_1, X_4:bit, X_5:bit, X_6:bit, X_7:bit, X_8:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:any_1], X_4:bat[:bit], X_5:bit, X_6:bit, X_7:bit, X_8:bit, X_9:bit):bat[:bit] ","CMDbatBETWEEN;", "" ] +[ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bat[:oid], X_7:bat[:bit], X_8:bit, X_9:bit, X_10:bit, X_11:bit, X_12:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:bit, X_9:bit, X_10:bit, X_11:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "between", "pattern batcalc.between(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:any_1], X_4:bit, X_5:bit, X_6:bit, X_7:bit, X_8:bit):bat[:bit] ", "CMDbatBETWEEN;", "" ] [ "batcalc", "bit", "pattern batcalc.bit(X_1:bat[:bit]):bat[:bit] ", "CMDconvertsignal_bit;","" ] 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 @@ -8567,12 +8567,20 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "avg", "pattern batcalc.avg(X_2:bat[:sht], X_3:bat[:oid]) (X_0:dbl, X_1:lng) ",
MonetDB: default - small fix in varBetween
Changeset: e1205905fa18 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e1205905fa18 Modified Files: monetdb5/modules/mal/calc.c Branch: default Log Message: small fix in varBetween diffs (14 lines): diff --git a/monetdb5/modules/mal/calc.c b/monetdb5/modules/mal/calc.c --- a/monetdb5/modules/mal/calc.c +++ b/monetdb5/modules/mal/calc.c @@ -386,8 +386,8 @@ CMDvarBETWEEN(Client cntxt, MalBlkPtr mb symmetric = *getArgReference_bit(stk, pci, 4); linc = *getArgReference_bit(stk, pci, 5); hinc = *getArgReference_bit(stk, pci, 6); - nils_false = *getArgReference_bit(stk, pci, 6); - anti = *getArgReference_bit(stk, pci, 7); + nils_false = *getArgReference_bit(stk, pci, 7); + anti = *getArgReference_bit(stk, pci, 8); if (VARcalcbetween(>stk[getArg(pci, 0)], >stk[getArg(pci, 1)], >stk[getArg(pci, 2)], >stk[getArg(pci, 3)], symmetric, linc, hinc, nils_false, anti) != GDK_SUCCEED) return mythrow(MAL, "calc.between", OPERATION_FAILED); return MAL_SUCCEED; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - add missing interface
Changeset: c66770d9f246 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c66770d9f246 Modified Files: monetdb5/modules/mal/batcalc.c Branch: default Log Message: add missing interface diffs (19 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -2562,6 +2562,15 @@ static mel_func batcalc_init_funcs[] = { pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa)", args(1,9, batarg("",bit),batargany("b",1),argany("v1",1),argany("v2",1),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa) with candidate list", args(1,10, batarg("",bit),batargany("b",1),argany("v1",1),argany("v2",1),batarg("s",oid),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa)", args(1,10, batarg("",bit),batargany("b",1),batargany("v1",1),batargany("v2",1),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa) with candidate list", args(1,13, batarg("",bit),batargany("b",1),batargany("v1",1),batargany("v2",1),batarg("s",oid),batarg("s1",oid),batarg("s2",oid),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa)", args(1,10, batarg("",bit),batargany("b",1),batargany("v1",1),argany("v2",1),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa) with candidate list", args(1,12, batarg("",bit),batargany("b",1),batargany("v1",1),argany("v2",1),batarg("s",oid),batarg("s1",oid),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa)", args(1,10, batarg("",bit),batargany("b",1),argany("v1",1),batargany("v2",1),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa) with candidate list", args(1,12, batarg("",bit),batargany("b",1),argany("v1",1),batargany("v2",1),batarg("s",oid),batarg("s2",oid),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa)", args(1,10, batarg("",bit),batargany("b",1),argany("v1",1),argany("v2",1),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("batcalc", "between", CMDbatBETWEEN, false, "B between V1 and V2 (or vice versa) with candidate list", args(1,11, batarg("",bit),batargany("b",1),argany("v1",1),argany("v2",1),batarg("s",oid),batarg("ce",bit),arg("sym",bit),arg("linc",bit),arg("hinc",bit),arg("nils_false",bit),arg("anti",bit))), + pattern("aggr", "avg", CMDcalcavg, false, "Gives the avg of all tail values", args(1,2, arg("",dbl),batargany("b",2))), pattern("aggr", "avg", CMDcalcavg, false, "Gives the avg of all tail values", args(1,3, arg("",dbl),batargany("b",2),arg("scale",int))), ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged
Changeset: 9d8e4b6007ac for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d8e4b6007ac Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 gdk/gdk_analytic_func.c gdk/gdk_calc.c monetdb5/modules/mal/01_batcalc.mal monetdb5/modules/mal/01_batcalc.mal.sh monetdb5/modules/mal/batcalc.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c sql/server/rel_optimizer.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: default Log Message: merged diffs (truncated from 570 to 300 lines): diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c --- a/gdk/gdk_analytic_func.c +++ b/gdk/gdk_analytic_func.c @@ -66,10 +66,7 @@ GDKanalyticaldiff(BAT *r, BAT *b, BAT *p BUN i, cnt = BATcount(b); bit *restrict rb = (bit *) Tloc(r, 0), *restrict np = p ? (bit *) Tloc(p, 0) : NULL; - switch (tpe) { - case TYPE_bit: - ANALYTICAL_DIFF_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_DIFF_IMP(bte); break; @@ -299,10 +296,7 @@ GDKanalyticalfirst(BAT *r, BAT *b, BAT * start = (lng *) Tloc(s, 0); end = (lng *) Tloc(e, 0); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_FIRST_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_FIRST_IMP(bte); break; @@ -371,10 +365,7 @@ GDKanalyticallast(BAT *r, BAT *b, BAT *s start = (lng *) Tloc(s, 0); end = (lng *) Tloc(e, 0); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LAST_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LAST_IMP(bte); break; @@ -543,10 +534,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA default: goto nosupport; } - switch (tp1) { - case TYPE_bit: - ANALYTICAL_NTHVALUE_IMP_SINGLE_FIXED(bit); - break; + switch (ATOMbasetype(tp1)) { case TYPE_bte: ANALYTICAL_NTHVALUE_IMP_SINGLE_FIXED(bte); break; @@ -589,10 +577,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA } } } else { - switch (tp1) { - case TYPE_bit: - ANALYTICAL_NTHVALUE_CALC_FIXED(bit); - break; + switch (ATOMbasetype(tp1)) { case TYPE_bte: ANALYTICAL_NTHVALUE_CALC_FIXED(bte); break; @@ -721,10 +706,7 @@ GDKanalyticallag(BAT *r, BAT *b, BAT *p, assert(default_value); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LAG_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LAG_IMP(bte); break; @@ -864,10 +846,7 @@ GDKanalyticallead(BAT *r, BAT *b, BAT *p assert(default_value); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LEAD_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LEAD_IMP(bte); break; @@ -972,10 +951,7 @@ GDKanalytical##OP(BAT *r, BAT *b, BAT *s start = (lng*)Tloc(s, 0); \ end = (lng*)Tloc(e, 0); \ \ - switch (tpe) { \ - case TYPE_bit: \ - ANALYTICAL_MIN_MAX_CALC(bit, IMP); \ - break; \ + switch (ATOMbasetype(tpe)) {\ case TYPE_bte: \ ANALYTICAL_MIN_MAX_CALC(bte, IMP); \ break; \ @@ -1068,10 +1044,7 @@ GDKanalyticalcount(BAT *r, BAT *b, BAT * for (; i < cnt; i++, rb++) *rb = (end[i] > start[i]) ? (end[i] - start[i]) : 0; } else { - switch (tpe) { - case TYPE_bit: - ANALYTICAL_COUNT_NO_NIL_FIXED_SIZE_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_COUNT_NO_NIL_FIXED_SIZE_IMP(bte); break; diff
MonetDB: Jun2020 - we need to include the candidates when checki...
Changeset: 8c952596c543 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c952596c543 Modified Files: gdk/gdk_calc.c Branch: Jun2020 Log Message: we need to include the candidates when checking for equal sized inputs (as was done later already) diffs (13 lines): diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -13202,9 +13202,6 @@ BATcalcbetweenbatcst(BAT *b, BAT *lo, co BATcheck(b, NULL); BATcheck(lo, NULL); - if (checkbats(b, lo, __func__) != GDK_SUCCEED) - return NULL; - if (ATOMbasetype(b->ttype) != ATOMbasetype(hi->vtype)) { GDKerror("incompatible input types.\n"); return NULL; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Approved output
Changeset: 8f93575cf911 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f93575cf911 Modified Files: sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: Jun2020 Log Message: Approved output diffs (44 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out b/sql/test/SQLancer/Tests/sqlancer03.stable.out --- a/sql/test/SQLancer/Tests/sqlancer03.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out @@ -186,8 +186,39 @@ stdout of test 'sqlancer03` in directory # CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2"), # CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1") #); +#INSERT INTO "sys"."t0" VALUES (NULL, true, 10), +# (NULL, false, 11), +# (true, NULL, 12), +# (NULL, false, 13), +# (NULL, true, 14), +# (true, false, 15), +# (NULL, true, 16), +# (true, true, 17), +# (NULL, true, 18), +# (NULL, false, 19), +# (true, NULL, 20), +# (true, NULL, 21), +# (NULL, NULL, 22), +# (false, true, 23); +[ 14 ] #TRUNCATE t0; -[ 0] +[ 14 ] +#COPY 14 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +#NULL true10 +#NULL false 11 +#true NULL12 +#NULL false 13 +#NULL true14 +#true false 15 +#NULL true16 +#true true17 +#NULL true18 +#NULL false 19 +#true NULL20 +#true NULL21 +#NULL NULL22 +#false true23 +[ 14 ] #DROP TABLE t0; # 17:14:16 > ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - remove nils when checking for unique values i...
Changeset: ade2bbbaa3a9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ade2bbbaa3a9 Modified Files: sql/backends/monet5/rel_bin.c Branch: Jun2020 Log Message: remove nils when checking for unique values in the to be inserted values. The order/reorder stmt's have null == null semantics diffs (31 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 @@ -3809,13 +3809,26 @@ insert_check_ukey(backend *be, list *ins if ((!idx_inserts && ins->nrcols) || (idx_inserts && idx_inserts->nrcols)) {/* insert columns not atoms */ sql_subfunc *or = sql_bind_func_result(sql->sa, sql->session->schema, "or", F_FUNC, bt, 2, bt, bt); stmt *orderby_ids = NULL, *orderby_grp = NULL; - + stmt *sel = NULL; + + /* remove any nils as in stmt_order NULL = NULL, instead of NULL != NULL */ + if ((k->type == ukey) && stmt_has_null(col)) { + + for (m = k->columns->h; m; m = m->next) { + sql_kc *c = m->data; + stmt *cs = list_fetch(inserts, c->c->colnr); + + sel = stmt_selectnonil(be, cs, sel); + } + } /* implementation uses sort key check */ for (m = k->columns->h; m; m = m->next) { sql_kc *c = m->data; stmt *orderby; stmt *cs = list_fetch(inserts, c->c->colnr); + if (sel) + cs = stmt_project(be, sel, cs); if (orderby_grp) orderby = stmt_reorder(be, cs, 1, 0, orderby_ids, orderby_grp); else ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - The problem comes from the uniqueness validation
Changeset: 65d14bf984dd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65d14bf984dd Modified Files: sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: Jun2020 Log Message: The problem comes from the uniqueness validation diffs (79 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -91,20 +91,20 @@ CREATE TABLE "sys"."t0" ( CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2"), CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1") ); -INSERT INTO "sys"."t0" VALUES (NULL, true, 10); -INSERT INTO "sys"."t0" VALUES (NULL, false, 11); -INSERT INTO "sys"."t0" VALUES (true, NULL, 12); -INSERT INTO "sys"."t0" VALUES (NULL, false, 13); -INSERT INTO "sys"."t0" VALUES (NULL, true, 14); -INSERT INTO "sys"."t0" VALUES (true, false, 15); -INSERT INTO "sys"."t0" VALUES (NULL, true, 16); -INSERT INTO "sys"."t0" VALUES (true, true, 17); -INSERT INTO "sys"."t0" VALUES (NULL, true, 18); -INSERT INTO "sys"."t0" VALUES (NULL, false, 19); -INSERT INTO "sys"."t0" VALUES (true, NULL, 20); -INSERT INTO "sys"."t0" VALUES (true, NULL, 21); -INSERT INTO "sys"."t0" VALUES (NULL, NULL, 22); -INSERT INTO "sys"."t0" VALUES (false, true, 23); +INSERT INTO "sys"."t0" VALUES (NULL, true, 10), + (NULL, false, 11), + (true, NULL, 12), + (NULL, false, 13), + (NULL, true, 14), + (true, false, 15), + (NULL, true, 16), + (true, true, 17), + (NULL, true, 18), + (NULL, false, 19), + (true, NULL, 20), + (true, NULL, 21), + (NULL, NULL, 22), + (false, true, 23); TRUNCATE t0; -- The following copy into shouldn't trigger a constrain violation error (it's the same insert above) diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out b/sql/test/SQLancer/Tests/sqlancer03.stable.out --- a/sql/test/SQLancer/Tests/sqlancer03.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out @@ -186,36 +186,8 @@ stdout of test 'sqlancer03` in directory # CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2"), # CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1") #); -#INSERT INTO "sys"."t0" VALUES (NULL, true, 10); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, false, 11); -[ 1] -#INSERT INTO "sys"."t0" VALUES (true, NULL, 12); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, false, 13); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, true, 14); -[ 1] -#INSERT INTO "sys"."t0" VALUES (true, false, 15); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, true, 16); -[ 1] -#INSERT INTO "sys"."t0" VALUES (true, true, 17); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, true, 18); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, false, 19); -[ 1] -#INSERT INTO "sys"."t0" VALUES (true, NULL, 20); -[ 1] -#INSERT INTO "sys"."t0" VALUES (true, NULL, 21); -[ 1] -#INSERT INTO "sys"."t0" VALUES (NULL, NULL, 22); -[ 1] -#INSERT INTO "sys"."t0" VALUES (false, true, 23); -[ 1] #TRUNCATE t0; -[ 14 ] +[ 0] #DROP TABLE t0; # 17:14:16 > ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Approved output. Time to look at the csv issue
Changeset: 4c3a27a8805a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c3a27a8805a Modified Files: sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: Jun2020 Log Message: Approved output. Time to look at the csv issue diffs (99 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out b/sql/test/SQLancer/Tests/sqlancer03.stable.out --- a/sql/test/SQLancer/Tests/sqlancer03.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out @@ -128,6 +128,95 @@ stdout of test 'sqlancer03` in directory [ "屁1珙", "屁抔珙", "屁ಜ珙" ] [ "屁1珙", "屁抔珙", "屁ಜ珙" ] #ROLLBACK; +#CREATE TABLE t0(c0 boolean, c1 boolean, c2 serial, UNIQUE(c0, c1)); -- Bug 6920 +#INSERT INTO t0(c1) VALUES((0.5968066098520423) NOT BETWEEN SYMMETRIC (CAST(length(upper(r'z')) AS INT)) AND (1347145665)), (FALSE); +[ 2] +#INSERT INTO t0(c0) VALUES(TRUE); +[ 1] +#INSERT INTO t0(c1) VALUES(FALSE), (TRUE); +[ 2] +#INSERT INTO t0(c2, c0, c1) VALUES(1347145665, (ltrim(lower(r'K'), ((upper(r'296348087'))||(- (1582370739) IS NOT NULL, (((lower(r'ö +#eg#K,纗HSJw!{cOw⇒l/l!B*H'))||(((CAST(0.12411368110083143 AS INT))+(-1795901173) IN (lower(CAST(TRUE AS STRING, (-1795901173, NULL, (0.9575114678279173) NOT IN (2.96348087E8, 0.501053365665)), (1922411524, TRUE, (0.5020325273627405) NOT IN (-1388966352, 1163825182)); +[ 3] +#INSERT INTO t0(c1) VALUES(TRUE); +[ 1] +#INSERT INTO t0(c1, c2) VALUES(FALSE, 623585248); +[ 1] +#INSERT INTO t0(c0) VALUES(NOT (NOT -1388966352)*(-984145454))) NOT IN (0.7356286, (FALSE); +[ 2] +#INSERT INTO t0(c0) VALUES(TRUE); +[ 1] +#INSERT INTO t0(c2) VALUES(-1235619315); +[ 1] +#DELETE FROM t0 WHERE (t0.c0) = FALSE; +[ 1] +#INSERT INTO t0(c1, c0, c2) VALUES(TRUE, ((+ (- (1580722914)))>(charindex(CAST(0.347536126443453330381316845887340605258941650390625 AS STRING), ((CAST(TRUE AS STRING(771)))||(0.2182260714120349831546263885684311389923095703125)), length(r'd', -1819817735); +[ 1] +#UPDATE t0 SET c2 = DEFAULT WHERE t0.c1)OR(CAST(t0.c2 AS BOOLEANOR((CAST(0.6873694879073857 AS DECIMAL)) NOT IN (0.10021624439224552371996423971722833812236785888671875))); +[ 14 ] +#SELECT t0.c0 FROM t0 WHERE ((CAST(t0.c2 AS INT)) NOT BETWEEN ASYMMETRIC (abs(t0.c2)) AND (((t0.c2)/(t0.c2 NOT BETWEEN ASYMMETRIC (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); +% sys.t0 # table_name +% c0 # name +% boolean # type +% 5 # length +[ NULL ] +[ NULL ] +[ true ] +[ NULL ] +[ NULL ] +[ true ] +[ NULL ] +[ true ] +[ NULL ] +[ NULL ] +[ true ] +[ false] +[ true ] +[ NULL ] +#SELECT t0.c0 FROM t0 WHERE (t0.c2) BETWEEN (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); +% sys.t0 # table_name +% c0 # name +% boolean # type +% 5 # length +#DROP TABLE t0; +#CREATE TABLE "sys"."t0" ( +# "c0" BOOLEAN, +# "c1" BOOLEAN, +# "c2" INTEGER, +# CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2"), +# CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1") +#); +#INSERT INTO "sys"."t0" VALUES (NULL, true, 10); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, false, 11); +[ 1] +#INSERT INTO "sys"."t0" VALUES (true, NULL, 12); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, false, 13); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, true, 14); +[ 1] +#INSERT INTO "sys"."t0" VALUES (true, false, 15); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, true, 16); +[ 1] +#INSERT INTO "sys"."t0" VALUES (true, true, 17); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, true, 18); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, false, 19); +[ 1] +#INSERT INTO "sys"."t0" VALUES (true, NULL, 20); +[ 1] +#INSERT INTO "sys"."t0" VALUES (true, NULL, 21); +[ 1] +#INSERT INTO "sys"."t0" VALUES (NULL, NULL, 22); +[ 1] +#INSERT INTO "sys"."t0" VALUES (false, true, 23); +[ 1] +#TRUNCATE t0; +[ 14 ] +#DROP TABLE t0; # 17:14:16 > # 17:14:16 > "Done." ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged
Changeset: 6a11e6172e05 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6a11e6172e05 Modified Files: gdk/gdk_subquery.c sql/backends/monet5/sql_subquery.c Branch: default Log Message: merged diffs (126 lines): diff --git a/gdk/gdk_subquery.c b/gdk/gdk_subquery.c --- a/gdk/gdk_subquery.c +++ b/gdk/gdk_subquery.c @@ -88,10 +88,7 @@ BATall_grp(BAT *l, BAT *g, BAT *e, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLall_grp_imp(bit); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLall_grp_imp(bte); break; @@ -240,10 +237,7 @@ BATnil_grp(BAT *l, BAT *g, BAT *e, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLnil_grp_imp(bit); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLnil_grp_imp(bte); break; @@ -375,10 +369,7 @@ BATanyequal_grp(BAT *l, BAT *r, BAT *g, else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp_imp(bit, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp_imp(bte, TRUE); break; @@ -491,10 +482,7 @@ BATallnotequal_grp(BAT *l, BAT *r, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp_imp(bit, FALSE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp_imp(bte, FALSE); break; @@ -636,10 +624,7 @@ BATanyequal_grp2(BAT *l, BAT *r, BAT *ri else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp2_imp(bit, TRUE, FALSE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp2_imp(bte, TRUE, FALSE); break; @@ -758,10 +743,7 @@ BATallnotequal_grp2(BAT *l, BAT *r, BAT else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp2_imp(bit, FALSE, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp2_imp(bte, FALSE, TRUE); break; diff --git a/sql/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -156,10 +156,7 @@ SQLall(ptr ret, const bat *bid) oid p = oid_nil; memcpy(ret, , sizeof(oid)); } else { - switch (b->ttype) { - case TYPE_bit: - SQLall_imp(bit); - break; + switch (ATOMbasetype(b->ttype)) { case TYPE_bte: SQLall_imp(bte); break; @@ -295,10 +292,7 @@ SQLnil(bit *ret, const bat *bid) if (BATcount(b) > 0) { BUN o = BUNlast(b); - switch (b->ttype) { - case TYPE_bit: - SQLnil_imp(bit); - break; + switch (ATOMbasetype(b->ttype)) { case TYPE_bte: SQLnil_imp(bte); break; @@ -630,10 +624,7 @@ SQLanyequal(bit *ret, const bat *bid1, c if (BATcount(r) > 0) { BUN o = BUNlast(r); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_imp(bit, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_imp(bte, TRUE); break; @@ -826,10 +817,7 @@ SQLallnotequal(bit *ret, const bat *bid1 if (BATcount(r) > 0) { BUN o = BUNlast(r); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_imp(bit, FALSE); - break; + switch
MonetDB: default - add 'select ' to the rel_parse_val side, redu...
Changeset: 8804b8179901 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8804b8179901 Modified Files: sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_updates.c sql/server/rel_updates.h sql/server/sql_atom.c sql/server/sql_partition.c sql/server/sql_var.c Branch: default Log Message: add 'select ' to the rel_parse_val side, reduces copying diffs (150 lines): diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c --- a/sql/server/rel_propagate.c +++ b/sql/server/rel_propagate.c @@ -32,7 +32,7 @@ rel_generate_anti_expression(mvc *sql, s res = exp_ref(sql, res); } else if (isPartitionedByExpressionTable(mt)) { *anti_rel = rel_project(sql->sa, *anti_rel, NULL); - if (!(res = rel_parse_val(sql, sa_message(sql->sa, "select %s;", mt->part.pexp->exp), sql->emode, (*anti_rel)->l))) + if (!(res = rel_parse_val(sql, mt->part.pexp->exp, NULL, sql->emode, (*anti_rel)->l))) return NULL; } else { assert(0); @@ -98,7 +98,7 @@ rel_generate_anti_insert_expression(mvc res = list_fetch((*anti_rel)->exps, colr); } else if (isPartitionedByExpressionTable(t)) { *anti_rel = rel_project(sql->sa, *anti_rel, rel_projections(sql, *anti_rel, NULL, 1, 1)); - if (!(res = rel_parse_val(sql, sa_message(sql->sa, "select %s;", t->part.pexp->exp), sql->emode, (*anti_rel)->l))) + if (!(res = rel_parse_val(sql, t->part.pexp->exp, NULL, sql->emode, (*anti_rel)->l))) return NULL; exp_label(sql->sa, res, ++sql->label); append((*anti_rel)->exps, res); diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c --- a/sql/server/rel_schema.c +++ b/sql/server/rel_schema.c @@ -1564,7 +1564,7 @@ sql_alter_table(sql_query *query, dlist for (node *n = nt->columns.nelm; n; n = n->next) { sql_column *c = n->data; if (c->def) { - e = rel_parse_val(sql, sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL); + e = rel_parse_val(sql, c->def, >type, sql->emode, NULL); } else { e = exp_atom(sql->sa, atom_general(sql->sa, >type, NULL)); } diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -29,7 +29,7 @@ insert_value(sql_query *query, sql_colum return exp_atom(sql->sa, atom_general(sql->sa, >type, NULL)); } else if (s->token == SQL_DEFAULT) { if (c->def) { - sql_exp *e = rel_parse_val(sql, sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL); + sql_exp *e = rel_parse_val(sql, c->def, >type, sql->emode, NULL); if (!e || (e = exp_check_type(sql, >type, r ? *r : NULL, e, type_equal)) == NULL) return sql_error(sql, 02, SQLSTATE(HY005) "%s: default expression could not be evaluated", action); return e; @@ -342,7 +342,7 @@ rel_inserts(mvc *sql, sql_table *t, sql_ sql_exp *e = NULL; if (c->def) { - e = rel_parse_val(sql, sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL); + e = rel_parse_val(sql, c->def, >type, sql->emode, NULL); if (!e || (e = exp_check_type(sql, >type, r, e, type_equal)) == NULL) return sql_error(sql, 02, SQLSTATE(HY005) "%s: default expression could not be evaluated", action); } else { @@ -938,7 +938,7 @@ update_generate_assignments(sql_query *q if (!c) return sql_error(sql, 02, SQLSTATE(42S22) "%s: no such column '%s.%s'", action, t->base.name, colname); if (c->def) { - v = rel_parse_val(sql, sa_message(sql->sa, "select %s;", c->def), sql->emode, NULL); + v = rel_parse_val(sql, c->def, >type, sql->emode, NULL); } else { return sql_error(sql, 02, SQLSTATE(42000) "%s: column '%s' has no valid default value", action, c->base.name); } @@ -1888,7 +1888,7 @@ copyto(sql_query *query, symbol *sq, con } sql_exp * -rel_parse_val(mvc *m, char *query, char emode, sql_rel
MonetDB: Jun2020 - Get the test right.
Changeset: 2458be0a4111 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2458be0a4111 Modified Files: monetdb5/modules/mal/batcalc.c Branch: Jun2020 Log Message: Get the test right. diffs (12 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -1144,7 +1144,7 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb if (tp != TYPE_bat && !isaBatType(tp)) goto bailout; bid = *getArgReference_bat(stk, pci, 4 + bc); - if (is_bat_nil(bid)) { + if (!is_bat_nil(bid)) { shi = BATdescriptor(bid); if (shi == NULL) goto bailout; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - make sure we also set the used candidates in ...
Changeset: a6b08f4c6260 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a6b08f4c6260 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c Branch: Jun2020 Log Message: make sure we also set the used candidates in none reducing compare functions (e_cmp type) also do the candidate handleing in the batcalc.between (ie sql_statement.c). diffs (93 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 @@ -1085,10 +1085,18 @@ exp_bin(backend *be, sql_exp *e, stmt *l s = stmt_binop(be, stmt_binop(be, l, r, lf), stmt_binop(be, l, r2, rf), a); + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; + if (r2->cand) + s->cand = r2->cand; } if (is_anti(e)) { + stmt *cand = s->cand; sql_subfunc *a = sql_bind_func(sql->sa, sql->session->schema, "not", bt, NULL, F_FUNC); s = stmt_unop(be, s, a); + s->cand = cand; } #if 0 } else if (((e->flag&3) != 3) /* both sides closed use between implementation */ && l->nrcols > 0 && r->nrcols > 0 && r2->nrcols > 0) { @@ -1096,6 +1104,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l stmt_uselect(be, l, r2, range2rcompare(e->flag), sel, is_anti(e), 0), is_anti(e), 0); #endif } else { + /* done in stmt_uselect2 if (sel && ((l->cand && l->nrcols) || (r->cand && r->nrcols) || (r2->cand && r->nrcols))) { if (!l->cand && l->nrcols) l = stmt_project(be, sel, l); @@ -1105,6 +1114,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l r2 = stmt_project(be, sel, r2); sel = NULL; } + */ if (l->nrcols == 0) l = stmt_const(be, bin_first_column(be, left), l); s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e)); @@ -1118,6 +1128,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l sql_subfunc *f = sql_bind_func(sql->sa, sql->session->schema, in_flag?"=":"<>", tail_type(l), tail_type(l), F_FUNC); assert(f); s = stmt_binop(be, l, r, f); + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; } else if (!reduce || (l->nrcols == 0 && r->nrcols == 0)) { sql_subfunc *f = sql_bind_func(sql->sa, sql->session->schema, compare_func((comp_type)e->flag, is_anti(e)), @@ -1137,6 +1151,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l } else { s = stmt_binop(be, l, r, f); } + if (l->cand) + s->cand = l->cand; + if (r->cand) + s->cand = r->cand; } else { /* this can still be a join (as relational algebra and single value subquery results still means joins */ s = stmt_uselect(be, l, r, (comp_type)e->flag, sel, is_anti(e), is_semantics(e)); diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1622,11 +1622,28 @@
MonetDB: Jun2020 - disable a*a -> pow(a,2) rewriter
Changeset: d0dab26b9b66 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d0dab26b9b66 Modified Files: sql/server/rel_optimizer.c Branch: Jun2020 Log Message: disable a*a -> pow(a,2) rewriter diffs (12 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 @@ -3143,7 +3143,7 @@ exp_simplify_math( mvc *sql, sql_exp *e, return e; } /* change a*a into pow(a,2), later change pow(a,2) back into a*a */ - if (exp_equal(le, re)==0 && exp_subtype(le)->type->eclass == EC_FLT) { + if (/* DISABLES CODE */ (0) && exp_equal(le, re)==0 && exp_subtype(le)->type->eclass == EC_FLT) { /* pow */ list *l; sql_exp *ne; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Check atom base type at subquery operators
Changeset: 5cbb0d4d2e12 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5cbb0d4d2e12 Modified Files: gdk/gdk_subquery.c sql/backends/monet5/sql_subquery.c Branch: default Log Message: Check atom base type at subquery operators diffs (126 lines): diff --git a/gdk/gdk_subquery.c b/gdk/gdk_subquery.c --- a/gdk/gdk_subquery.c +++ b/gdk/gdk_subquery.c @@ -88,10 +88,7 @@ BATall_grp(BAT *l, BAT *g, BAT *e, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLall_grp_imp(bit); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLall_grp_imp(bte); break; @@ -240,10 +237,7 @@ BATnil_grp(BAT *l, BAT *g, BAT *e, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLnil_grp_imp(bit); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLnil_grp_imp(bte); break; @@ -375,10 +369,7 @@ BATanyequal_grp(BAT *l, BAT *r, BAT *g, else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp_imp(bit, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp_imp(bte, TRUE); break; @@ -491,10 +482,7 @@ BATallnotequal_grp(BAT *l, BAT *r, BAT * else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp_imp(bit, FALSE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp_imp(bte, FALSE); break; @@ -636,10 +624,7 @@ BATanyequal_grp2(BAT *l, BAT *r, BAT *ri else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp2_imp(bit, TRUE, FALSE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp2_imp(bte, TRUE, FALSE); break; @@ -758,10 +743,7 @@ BATallnotequal_grp2(BAT *l, BAT *r, BAT else gids = (const oid *) Tloc(g, 0); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_grp2_imp(bit, FALSE, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_grp2_imp(bte, FALSE, TRUE); break; diff --git a/sql/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -156,10 +156,7 @@ SQLall(ptr ret, const bat *bid) oid p = oid_nil; memcpy(ret, , sizeof(oid)); } else { - switch (b->ttype) { - case TYPE_bit: - SQLall_imp(bit); - break; + switch (ATOMbasetype(b->ttype)) { case TYPE_bte: SQLall_imp(bte); break; @@ -295,10 +292,7 @@ SQLnil(bit *ret, const bat *bid) if (BATcount(b) > 0) { BUN o = BUNlast(b); - switch (b->ttype) { - case TYPE_bit: - SQLnil_imp(bit); - break; + switch (ATOMbasetype(b->ttype)) { case TYPE_bte: SQLnil_imp(bte); break; @@ -630,10 +624,7 @@ SQLanyequal(bit *ret, const bat *bid1, c if (BATcount(r) > 0) { BUN o = BUNlast(r); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_imp(bit, TRUE); - break; + switch (ATOMbasetype(l->ttype)) { case TYPE_bte: SQLanyequal_or_not_imp(bte, TRUE); break; @@ -826,10 +817,7 @@ SQLallnotequal(bit *ret, const bat *bid1 if (BATcount(r) > 0) { BUN o = BUNlast(r); - switch (l->ttype) { - case TYPE_bit: - SQLanyequal_or_not_imp(bit, FALSE); - break; +
MonetDB: Jun2020 - A nil bat is (potentially) a candidate list. ...
Changeset: d129ef32e549 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d129ef32e549 Modified Files: monetdb5/modules/mal/batcalc.c Branch: Jun2020 Log Message: A nil bat is (potentially) a candidate list. That's the whole point here. diffs (21 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -1107,6 +1107,7 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb tp = getArgType(mb, pci, 4); if (tp == TYPE_bat || isaBatType(tp)) { bid = *getArgReference_bat(stk, pci, 4); + has_cand = true; if (!is_bat_nil(bid)) { s = BATdescriptor(bid); if (s == NULL) @@ -1115,8 +1116,7 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb r = s; s = NULL; has_cand = false; - } else - has_cand = true; + } } bc++; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Cleaning my own mess. Use ATOMbasetype macro ...
Changeset: af7d73d614b9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af7d73d614b9 Modified Files: gdk/gdk_analytic_func.c Branch: Jun2020 Log Message: Cleaning my own mess. Use ATOMbasetype macro to know the internal storage of a type. Time types now use the faster route on the window functions implementations. Sorry people diffs (111 lines): diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c --- a/gdk/gdk_analytic_func.c +++ b/gdk/gdk_analytic_func.c @@ -66,10 +66,7 @@ GDKanalyticaldiff(BAT *r, BAT *b, BAT *p BUN i, cnt = BATcount(b); bit *restrict rb = (bit *) Tloc(r, 0), *restrict np = p ? (bit *) Tloc(p, 0) : NULL; - switch (tpe) { - case TYPE_bit: - ANALYTICAL_DIFF_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_DIFF_IMP(bte); break; @@ -299,10 +296,7 @@ GDKanalyticalfirst(BAT *r, BAT *b, BAT * start = (lng *) Tloc(s, 0); end = (lng *) Tloc(e, 0); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_FIRST_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_FIRST_IMP(bte); break; @@ -371,10 +365,7 @@ GDKanalyticallast(BAT *r, BAT *b, BAT *s start = (lng *) Tloc(s, 0); end = (lng *) Tloc(e, 0); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LAST_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LAST_IMP(bte); break; @@ -543,10 +534,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA default: goto nosupport; } - switch (tp1) { - case TYPE_bit: - ANALYTICAL_NTHVALUE_IMP_SINGLE_FIXED(bit); - break; + switch (ATOMbasetype(tp1)) { case TYPE_bte: ANALYTICAL_NTHVALUE_IMP_SINGLE_FIXED(bte); break; @@ -589,10 +577,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA } } } else { - switch (tp1) { - case TYPE_bit: - ANALYTICAL_NTHVALUE_CALC_FIXED(bit); - break; + switch (ATOMbasetype(tp1)) { case TYPE_bte: ANALYTICAL_NTHVALUE_CALC_FIXED(bte); break; @@ -721,10 +706,7 @@ GDKanalyticallag(BAT *r, BAT *b, BAT *p, assert(default_value); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LAG_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LAG_IMP(bte); break; @@ -864,10 +846,7 @@ GDKanalyticallead(BAT *r, BAT *b, BAT *p assert(default_value); - switch (tpe) { - case TYPE_bit: - ANALYTICAL_LEAD_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_LEAD_IMP(bte); break; @@ -972,10 +951,7 @@ GDKanalytical##OP(BAT *r, BAT *b, BAT *s start = (lng*)Tloc(s, 0); \ end = (lng*)Tloc(e, 0); \ \ - switch (tpe) { \ - case TYPE_bit: \ - ANALYTICAL_MIN_MAX_CALC(bit, IMP); \ - break; \ + switch (ATOMbasetype(tpe)) {\ case TYPE_bte: \ ANALYTICAL_MIN_MAX_CALC(bte, IMP); \ break; \ @@ -1068,10 +1044,7 @@ GDKanalyticalcount(BAT *r, BAT *b, BAT * for (; i < cnt; i++, rb++) *rb = (end[i] > start[i]) ? (end[i] - start[i]) : 0; } else { - switch (tpe) { - case TYPE_bit: - ANALYTICAL_COUNT_NO_NIL_FIXED_SIZE_IMP(bit); - break; + switch (ATOMbasetype(tpe)) { case TYPE_bte: ANALYTICAL_COUNT_NO_NIL_FIXED_SIZE_IMP(bte); break; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Check all candidate list parameters for nil.
Changeset: 0f24758e14b6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0f24758e14b6 Modified Files: monetdb5/modules/mal/batcalc.c Branch: Jun2020 Log Message: Check all candidate list parameters for nil. diffs (18 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -1144,9 +1144,11 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb if (tp != TYPE_bat && !isaBatType(tp)) goto bailout; bid = *getArgReference_bat(stk, pci, 4 + bc); - shi = BATdescriptor(bid); - if (shi == NULL) - goto bailout; + if (is_bat_nil(bid)) { + shi = BATdescriptor(bid); + if (shi == NULL) + goto bailout; + } bc++; } tp = getArgType(mb, pci, 4 + bc); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Better check for bat-ness.
Changeset: 96b6def91b46 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=96b6def91b46 Modified Files: monetdb5/modules/mal/batcalc.c Branch: Jun2020 Log Message: Better check for bat-ness. diffs (52 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -1076,7 +1076,7 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb { bat bid; BAT *bn, *b = NULL, *lo = NULL, *hi = NULL, *s = NULL, *slo = NULL, *shi = NULL, *r = NULL; - int tp1, tp2, tp3; + int tp1, tp2, tp3, tp; int bc = 0; /* number of extra BAT arguments */ bool symmetric, linc, hinc, nils_false, anti, has_cand = false; @@ -1104,7 +1104,8 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb if (hi == NULL) goto bailout; } - if (isaBatType(getArgType(mb, pci, 4))) { + tp = getArgType(mb, pci, 4); + if (tp == TYPE_bat || isaBatType(tp)) { bid = *getArgReference_bat(stk, pci, 4); if (!is_bat_nil(bid)) { s = BATdescriptor(bid); @@ -1120,7 +1121,8 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb bc++; } if (has_cand && lo) { - if (isaBatType(getArgType(mb, pci, 4 + bc))) { + tp = getArgType(mb, pci, 4 + bc); + if (tp == TYPE_bat || isaBatType(tp)) { bid = *getArgReference_bat(stk, pci, 4 + bc); if (!is_bat_nil(bid)) { slo = BATdescriptor(bid); @@ -1138,7 +1140,8 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb } } if (has_cand && hi) { - if (!isaBatType(getArgType(mb, pci, 4 + bc))) + tp = getArgType(mb, pci, 4 + bc); + if (tp != TYPE_bat && !isaBatType(tp)) goto bailout; bid = *getArgReference_bat(stk, pci, 4 + bc); shi = BATdescriptor(bid); @@ -1146,7 +1149,8 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb goto bailout; bc++; } - if (r == NULL && isaBatType(getArgType(mb, pci, 4 + bc))) { + tp = getArgType(mb, pci, 4 + bc); + if (r == NULL && (tp == TYPE_bat || isaBatType(tp))) { bid = *getArgReference_bat(stk, pci, 4 + bc); if (!is_bat_nil(bid)) { r = BATdescriptor(bid); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Add MAL interface for conditional execution i...
Changeset: 326594c76682 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=326594c76682 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 monetdb5/modules/mal/01_batcalc.mal monetdb5/modules/mal/01_batcalc.mal.sh Branch: Jun2020 Log Message: Add MAL interface for conditional execution in batcalc.between. diffs (116 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 @@ -7478,12 +7478,20 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "avg", "pattern batcalc.avg(b:bat[:sht], s:bat[:oid], scale:int):dbl ","CMDcalcavg;", "average of non-nil values of B" ] [ "batcalc", "avg", "pattern batcalc.avg(b:bat[:sht], scale:int) (X_0:dbl, X_1:lng) ", "CMDcalcavg;", "average and number of non-nil values of B" ] [ "batcalc", "avg", "pattern batcalc.avg(b:bat[:sht], scale:int):dbl ", "CMDcalcavg;", "average of non-nil values of B with candidates list" ] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:any_1, r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ","CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with conditional execution bat"] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:any_1, s:bat[:oid], r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list and conditional execution bat" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:any_1, s:bat[:oid], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ","CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:any_1, sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa)" ] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:bat[:any_1], r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with conditional execution bat"] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:bat[:any_1], s:bat[:oid], s2:bat[:oid], r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list and conditional execution bat" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:bat[:any_1], s:bat[:oid], s2:bat[:oid], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ","CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:any_1, v2:bat[:any_1], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa)" ] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:any_1, r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with conditional execution bat"] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:any_1, s:bat[:oid], s1:bat[:oid], r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list and conditional execution bat" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:any_1, s:bat[:oid], s1:bat[:oid], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ","CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with candidate list" ] [ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:any_1, sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ", "CMDbatBETWEEN;", "B between V1 and V2 (or vice versa)" ] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:bat[:any_1], r:bat[:bit], sym:bit, linc:bit, hinc:bit, nils_false:bit, anti:bit):bat[:bit] ","CMDbatBETWEEN;", "B between V1 and V2 (or vice versa) with conditional execution bat"] +[ "batcalc", "between", "pattern batcalc.between(b:bat[:any_1], v1:bat[:any_1], v2:bat[:any_1], s:bat[:oid], s1:bat[:oid], s2:bat[:oid], r:bat[:bit], sym:bit,
MonetDB: Jun2020 - Properly (I hope) check for NIL candidate lis...
Changeset: 89a468d33b81 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=89a468d33b81 Modified Files: monetdb5/modules/mal/batcalc.c Branch: Jun2020 Log Message: Properly (I hope) check for NIL candidate list bats. diffs (85 lines): diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c --- a/monetdb5/modules/mal/batcalc.c +++ b/monetdb5/modules/mal/batcalc.c @@ -1078,7 +1078,7 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb BAT *bn, *b = NULL, *lo = NULL, *hi = NULL, *s = NULL, *slo = NULL, *shi = NULL, *r = NULL; int tp1, tp2, tp3; int bc = 0; /* number of extra BAT arguments */ - bool symmetric, linc, hinc, nils_false, anti; + bool symmetric, linc, hinc, nils_false, anti, has_cand = false; (void) cntxt; (void) mb; @@ -1106,25 +1106,38 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb } if (isaBatType(getArgType(mb, pci, 4))) { bid = *getArgReference_bat(stk, pci, 4); - s = BATdescriptor(bid); - if (s == NULL) - goto bailout; - if (s->ttype == TYPE_bit) { - r = s; - s = NULL; + if (!is_bat_nil(bid)) { + s = BATdescriptor(bid); + if (s == NULL) + goto bailout; + if (s->ttype == TYPE_bit) { + r = s; + s = NULL; + has_cand = false; + } else + has_cand = true; } bc++; } - if (s != NULL && lo) { - if (!isaBatType(getArgType(mb, pci, 4 + bc))) - goto bailout; - bid = *getArgReference_bat(stk, pci, 4 + bc); - slo = BATdescriptor(bid); - if (slo == NULL) - goto bailout; - bc++; + if (has_cand && lo) { + if (isaBatType(getArgType(mb, pci, 4 + bc))) { + bid = *getArgReference_bat(stk, pci, 4 + bc); + if (!is_bat_nil(bid)) { + slo = BATdescriptor(bid); + if (slo == NULL) + goto bailout; + } + bc++; + } else { + if (s == NULL) { + /* apparently the extra bat was a NIL conditional +* execution bat */ + has_cand = false; + } else + goto bailout; + } } - if (s != NULL && hi) { + if (has_cand && hi) { if (!isaBatType(getArgType(mb, pci, 4 + bc))) goto bailout; bid = *getArgReference_bat(stk, pci, 4 + bc); @@ -1135,11 +1148,13 @@ CMDbatBETWEEN(Client cntxt, MalBlkPtr mb } if (r == NULL && isaBatType(getArgType(mb, pci, 4 + bc))) { bid = *getArgReference_bat(stk, pci, 4 + bc); - r = BATdescriptor(bid); - if (r == NULL) - goto bailout; - if (r->ttype != TYPE_bit) - goto bailout; + if (!is_bat_nil(bid)) { + r = BATdescriptor(bid); + if (r == NULL) + goto bailout; + if (r->ttype != TYPE_bit) + goto bailout; + } bc++; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merged with oscar
Changeset: 13efef9d7245 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=13efef9d7245 Modified Files: cmake/monetdb-defines.cmake monetdb5/modules/mal/batExtensions.c Branch: default Log Message: Merged with oscar diffs (81 lines): diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -194,8 +194,10 @@ CMDBATimprintsize(lng *ret, bat *bid) return MAL_SUCCEED; } -#define append_bulk_imp_fixed_size(TPE) \ +#define append_bulk_imp_fixed_size(TPE, UNION_VAL) \ do { \ + ValRecord *stack = stk->stk; \ + int *argv = pci->argv; \ TPE *restrict heap; \ total = number_existing + inputs; \ if (BATextend(b, total) != GDK_SUCCEED) { \ @@ -205,13 +207,13 @@ CMDBATimprintsize(lng *ret, bat *bid) heap = (TPE*) Tloc(b, number_existing); \ if (!b->tsorted && !b->trevsorted) { \ for (int i = 3, args = pci->argc; i < args; i++) { \ - TPE next = *(TPE*) getArgReference(stk,pci,i); \ + TPE next = stack[argv[i]].val.UNION_VAL; \ new_nil |= is_##TPE##_nil(next); \ heap[j++] = next; \ } \ } else { \ bool sorted = b->tsorted, revsorted = b->trevsorted; \ - TPE prev = *(TPE*) getArgReference(stk,pci,3); \ + TPE prev = stack[argv[3]].val.UNION_VAL; \ new_nil |= is_##TPE##_nil(prev); \ if (number_existing) { \ TPE last = *(TPE*) Tloc(b, number_existing - 1); \ @@ -220,7 +222,7 @@ CMDBATimprintsize(lng *ret, bat *bid) } \ heap[j++] = prev; \ for (int i = 4, args = pci->argc; i < args; i++) { \ - TPE next = *(TPE*) getArgReference(stk,pci,i); \ + TPE next = stack[argv[i]].val.UNION_VAL; \ new_nil |= is_##TPE##_nil(next); \ sorted &= next >= prev; \ revsorted &= next <= prev; \ @@ -266,32 +268,32 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt switch (b->ttype) { case TYPE_bit: case TYPE_bte: - append_bulk_imp_fixed_size(bte); + append_bulk_imp_fixed_size(bte, btval); break; case TYPE_sht: - append_bulk_imp_fixed_size(sht); + append_bulk_imp_fixed_size(sht, shval); break; case TYPE_date: case TYPE_int: - append_bulk_imp_fixed_size(int); + append_bulk_imp_fixed_size(int, ival); break; case TYPE_daytime: case TYPE_timestamp: case TYPE_lng: - append_bulk_imp_fixed_size(lng); + append_bulk_imp_fixed_size(lng, lval); break; case TYPE_oid: - append_bulk_imp_fixed_size(oid); + append_bulk_imp_fixed_size(oid, oval); break; case TYPE_flt: - append_bulk_imp_fixed_size(flt); + append_bulk_imp_fixed_size(flt, fval); break; case TYPE_dbl: - append_bulk_imp_fixed_size(dbl); + append_bulk_imp_fixed_size(dbl, dval); break; #ifdef HAVE_HGE case TYPE_hge: - append_bulk_imp_fixed_size(hge); + append_bulk_imp_fixed_size(hge, hval); break; #endif default: ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - Use check_symbol_exists to find stpcpy. check_f...
Changeset: 6e05242c86cb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e05242c86cb Modified Files: cmake/monetdb-defines.cmake Branch: oscar Log Message: Use check_symbol_exists to find stpcpy. check_function_exists was not finding on my machine diffs (12 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -105,7 +105,7 @@ function(monetdb_configure_defines) check_function_exists("setsid" HAVE_SETSID) check_function_exists("shutdown" HAVE_SHUTDOWN) check_function_exists("sigaction" HAVE_SIGACTION) - check_function_exists("stpcpy" HAVE_STPCPY) + check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY) check_function_exists("strcasestr" HAVE_STRCASESTR) check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP) check_function_exists("strptime" HAVE_STRPTIME) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Minimal changes to get this to compile on Win...
Changeset: eaa4187bd9df for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eaa4187bd9df Modified Files: sql/include/sql_list.h tools/monetdbe/monetdbe.c Branch: default Log Message: Minimal changes to get this to compile on Windows. diffs (24 lines): diff --git a/sql/include/sql_list.h b/sql/include/sql_list.h --- a/sql/include/sql_list.h +++ b/sql/include/sql_list.h @@ -74,7 +74,7 @@ extern void *list_append_with_validate(l extern void *list_append_sorted(list *l, void *data, void *extra, fcmpvalidate cmp); extern node *list_find(list *l, void *key, fcmp cmp); extern int list_position(list *l, void *val); -extern void *list_fetch(list *l, int pos); +sql_export void *list_fetch(list *l, int pos); extern list *list_select(list *l, void *key, fcmp cmp, fdup dup); extern list *list_order(list *l, fcmp cmp, fdup dup); extern list *list_distinct(list *l, fcmp cmp, fdup dup); diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -824,7 +824,7 @@ monetdbe_bind(monetdbe_statement *stmt, /* TODO !data treat as NULL value (add nil mask) ? */ if (i > stmt->nparam) return createException(MAL, "monetdbe.monetdbe_bind", "Parameter %zu not bound to a value", i); - sql_arg *a = (sql_arg*)list_fetch(stmt_internal->q->f->ops, i); + sql_arg *a = (sql_arg*)list_fetch(stmt_internal->q->f->ops, (int) i); assert(a); stmt_internal->data[i].vtype = a->type.type->localtype; /* TODO handle conversion from NULL and special types */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - Backported recent CMDBATappend_bulk fixes into ...
Changeset: d604a9b23cf2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d604a9b23cf2 Modified Files: monetdb5/modules/mal/batExtensions.c Branch: oscar Log Message: Backported recent CMDBATappend_bulk fixes into oscar, also perform less cache misses while accessing the MAL stack. I think this will conflict while merging into default, so the oscar branch changes should stay. Sorry for the confusion. diffs (144 lines): diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -194,19 +194,42 @@ CMDBATimprintsize(lng *ret, bat *bid) return MAL_SUCCEED; } -#define append_bulk_imp_fixed_size(TPE) \ +#define append_bulk_imp_fixed_size(TPE, UNION_VAL) \ do { \ + ValRecord *stack = stk->stk; \ + int *argv = pci->argv; \ TPE *restrict heap; \ - total = count + inputs; \ + total = number_existing + inputs; \ if (BATextend(b, total) != GDK_SUCCEED) { \ BBPunfix(b->batCacheid); \ throw(MAL,"bat.append_bulk", SQLSTATE(HY013) MAL_MALLOC_FAIL); \ } \ - heap = Tloc(b, count); \ - for (int i = 3, args = pci->argc; i < args; i++, j++) { \ - TPE val = *(TPE*) getArgReference(stk,pci,i); \ - new_nil |= is_##TPE##_nil(val); \ - heap[j] = val; \ + heap = (TPE*) Tloc(b, number_existing); \ + if (!b->tsorted && !b->trevsorted) { \ + for (int i = 3, args = pci->argc; i < args; i++) { \ + TPE next = stack[argv[i]].val.UNION_VAL; \ + new_nil |= is_##TPE##_nil(next); \ + heap[j++] = next; \ + } \ + } else { \ + bool sorted = b->tsorted, revsorted = b->trevsorted; \ + TPE prev = stack[argv[3]].val.UNION_VAL; \ + new_nil |= is_##TPE##_nil(prev); \ + if (number_existing) { \ + TPE last = *(TPE*) Tloc(b, number_existing - 1); \ + sorted &= prev >= last; \ + revsorted &= prev <= last; \ + } \ + heap[j++] = prev; \ + for (int i = 4, args = pci->argc; i < args; i++) { \ + TPE next = stack[argv[i]].val.UNION_VAL; \ + new_nil |= is_##TPE##_nil(next); \ + sorted &= next >= prev; \ + revsorted &= next <= prev; \ + heap[j++] = prev = next; \ + } \ + b->tsorted &= sorted; \ + b->trevsorted &= revsorted; \ } \ } while (0) @@ -216,7 +239,7 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt bat *r = getArgReference_bat(stk, pci, 0), *bid = getArgReference_bat(stk, pci, 1); bit force = *getArgReference_bit(stk, pci, 2), new_nil = 0; BAT *b; - BUN inputs = (BUN)(pci->argc - 3), count = 0, total = 0, j = 0; + BUN inputs = (BUN)(pci->argc - 3), number_existing = 0, total = 0, j = 0; (void) cntxt; if ((b = BATdescriptor(*bid)) == NULL) @@ -224,7 +247,7 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt if (inputs > 0) { uint8_t storage = ATOMstorage(b->ttype); - count = BATcount(b); + number_existing = BATcount(b); if (isaBatType(getArgType(mb, pci, 3))) { /* use BATappend for the bulk case */ gdk_return rt; @@ -244,48 +267,40 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt } else if (b->ttype < TYPE_str && storage == b->ttype) { switch (b->ttype) { case TYPE_bit: - append_bulk_imp_fixed_size(bit); - break; case TYPE_bte: - append_bulk_imp_fixed_size(bte); + append_bulk_imp_fixed_size(bte, btval); break; case TYPE_sht: - append_bulk_imp_fixed_size(sht); + append_bulk_imp_fixed_size(sht, shval); break; + case TYPE_date: case TYPE_int: - append_bulk_imp_fixed_size(int); + append_bulk_imp_fixed_size(int, ival); break; + case TYPE_daytime: +
MonetDB: default - Merged with oscar
Changeset: a559af546856 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a559af546856 Modified Files: monetdb5/modules/atoms/json.c Branch: default Log Message: Merged with oscar diffs (31 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1247,13 +1247,6 @@ JSONplaintext(char **r, size_t *l, size_ } static str -JSONjson2text(str *ret, json *js) -{ - char *sep = " "; - return JSONjson2textSeparator(ret, js, ); -} - -static str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; @@ -1281,6 +1274,13 @@ JSONjson2textSeparator(str *ret, json *j } static str +JSONjson2text(str *ret, json *js) +{ + char *sep = " "; + return JSONjson2textSeparator(ret, js, ); +} + +static str JSONjson2numberInternal(void **ret, json *js, void (*str2num)(void **ret, const char *nptr, size_t len)) { JSON *jt; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - JSONjson2text function requires JSONjson2textSe...
Changeset: 60cc406c9d55 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=60cc406c9d55 Modified Files: monetdb5/modules/atoms/json.c Branch: oscar Log Message: JSONjson2text function requires JSONjson2textSeparator, so its definition must come later diffs (31 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1247,13 +1247,6 @@ JSONplaintext(char **r, size_t *l, size_ } static str -JSONjson2text(str *ret, json *js) -{ - char *sep = " "; - return JSONjson2textSeparator(ret, js, ); -} - -static str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; @@ -1281,6 +1274,13 @@ JSONjson2textSeparator(str *ret, json *j } static str +JSONjson2text(str *ret, json *js) +{ + char *sep = " "; + return JSONjson2textSeparator(ret, js, ); +} + +static str JSONjson2numberInternal(void **ret, json *js, void (*str2num)(void **ret, const char *nptr, size_t len)) { JSON *jt; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with oscar branch.
Changeset: ed3a8e6141a9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed3a8e6141a9 Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/str.c sql/backends/monet5/sql_optimizer.c sql/storage/bat/bat_storage.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out testing/Mtest.py.in Branch: default Log Message: Merge with oscar branch. diffs (truncated from 466 to 300 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1223,7 +1223,7 @@ JSONplaintext(char **r, size_t *l, size_ break; default: if (*l < jt->elm[idx].valuelen + sep_len + 1) { - unsigned int offset = *ilen - *l; + size_t offset = *ilen - *l; char *p = *r - offset; *ilen *= 2; *r = GDKrealloc(p, *ilen); @@ -1249,39 +1249,21 @@ JSONplaintext(char **r, size_t *l, size_ static str JSONjson2text(str *ret, json *js) { - JSON *jt; - size_t l, ilen; - str s; - - jt = JSONparse(*js); - - CHECK_JSON(jt); - ilen = l = strlen(*js) + 1; - s = GDKmalloc(l); - if(s == NULL) { - JSONfree(jt); - throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - s = JSONplaintext(, , , jt, 0, " ", 1); - s -= ilen - l; - l = strlen(s); - if (l) - s[l - 1] = 0; - *ret = s; - JSONfree(jt); - return MAL_SUCCEED; + char *sep = " "; + return JSONjson2textSeparator(ret, js, ); } static str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; - size_t l, ilen, sep_len = strlen(*sep); + size_t l, ilen, sep_len; str s; jt = JSONparse(*js); CHECK_JSON(jt); + sep_len = strlen(*sep); ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -3156,6 +3156,59 @@ UTF8_strtail(const char *s, int pos) return (str) s; } +static inline str +UTF8_strncpy(char *restrict dst, const char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + } else { + /* 1 byte UTF-8 "sequence" */ + *dst++ = *s++; + } + n--; + } + *dst = '\0'; + return dst; +} + +static inline str +UTF8_offset(char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + s += 4; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + s += 3; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + s += 2; + } else { + /* 1 byte UTF-8 "sequence" */ + s++; + } + n--; + } + return s; +} + static str convertCase(BAT *from, BAT *to, str *res, const char *src, const char *malfunc) { @@ -4120,20 +4173,18 @@ STRlocate(int *ret, const str *needle, c } str -STRinsert(str *ret, const str *s, const int *start, const int *l, const str *s2) +STRinsert(str *ret, const str *input, const int *start, const int *nchars, const str *input2) { - str v; - int strt = *start; - if (strNil(*s) || strNil(*s2) || is_int_nil(*start) || is_int_nil(*l)) { + str v, s = *input, s2 = *input2; + int strt = *start, l = *nchars; + + if (strNil(s) || strNil(s2) || is_int_nil(strt) || is_int_nil(l)) { if ((*ret = GDKstrdup(str_nil)) == NULL) throw(MAL, "str.insert", SQLSTATE(HY013) MAL_MALLOC_FAIL); } else { - size_t l1 = strlen(*s); - size_t l2 = strlen(*s2); + size_t l1 = UTF8_strlen(s); - if (l1
MonetDB: oscar - Merge with Jun2020 branch.
Changeset: ca65cdd81f29 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ca65cdd81f29 Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/str.c sql/backends/monet5/sql_optimizer.c sql/storage/bat/bat_storage.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out testing/Mtest.py.in Branch: oscar Log Message: Merge with Jun2020 branch. diffs (truncated from 466 to 300 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1223,7 +1223,7 @@ JSONplaintext(char **r, size_t *l, size_ break; default: if (*l < jt->elm[idx].valuelen + sep_len + 1) { - unsigned int offset = *ilen - *l; + size_t offset = *ilen - *l; char *p = *r - offset; *ilen *= 2; *r = GDKrealloc(p, *ilen); @@ -1249,39 +1249,21 @@ JSONplaintext(char **r, size_t *l, size_ static str JSONjson2text(str *ret, json *js) { - JSON *jt; - size_t l, ilen; - str s; - - jt = JSONparse(*js); - - CHECK_JSON(jt); - ilen = l = strlen(*js) + 1; - s = GDKmalloc(l); - if(s == NULL) { - JSONfree(jt); - throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - s = JSONplaintext(, , , jt, 0, " ", 1); - s -= ilen - l; - l = strlen(s); - if (l) - s[l - 1] = 0; - *ret = s; - JSONfree(jt); - return MAL_SUCCEED; + char *sep = " "; + return JSONjson2textSeparator(ret, js, ); } static str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; - size_t l, ilen, sep_len = strlen(*sep); + size_t l, ilen, sep_len; str s; jt = JSONparse(*js); CHECK_JSON(jt); + sep_len = strlen(*sep); ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -3156,6 +3156,59 @@ UTF8_strtail(const char *s, int pos) return (str) s; } +static inline str +UTF8_strncpy(char *restrict dst, const char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + } else { + /* 1 byte UTF-8 "sequence" */ + *dst++ = *s++; + } + n--; + } + *dst = '\0'; + return dst; +} + +static inline str +UTF8_offset(char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + s += 4; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + s += 3; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + s += 2; + } else { + /* 1 byte UTF-8 "sequence" */ + s++; + } + n--; + } + return s; +} + static str convertCase(BAT *from, BAT *to, str *res, const char *src, const char *malfunc) { @@ -4120,20 +4173,18 @@ STRlocate(int *ret, const str *needle, c } str -STRinsert(str *ret, const str *s, const int *start, const int *l, const str *s2) +STRinsert(str *ret, const str *input, const int *start, const int *nchars, const str *input2) { - str v; - int strt = *start; - if (strNil(*s) || strNil(*s2) || is_int_nil(*start) || is_int_nil(*l)) { + str v, s = *input, s2 = *input2; + int strt = *start, l = *nchars; + + if (strNil(s) || strNil(s2) || is_int_nil(strt) || is_int_nil(l)) { if ((*ret = GDKstrdup(str_nil)) == NULL) throw(MAL, "str.insert", SQLSTATE(HY013) MAL_MALLOC_FAIL); } else { - size_t l1 = strlen(*s); - size_t l2 = strlen(*s2); + size_t l1 = UTF8_strlen(s); - if (l1
MonetDB: Jun2020 - whitespace.
Changeset: bc87766c6c49 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc87766c6c49 Modified Files: sql/storage/bat/bat_storage.c Branch: Jun2020 Log Message: whitespace. diffs (12 lines): diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1085,7 +1085,7 @@ count_col(sql_trans *tr, sql_column *c, sql_column *oc = tr_find_column(tr->parent, c); c->data = timestamp_delta(oc->data, c->base.stime); } -b = c->data; + b = c->data; if (!b) return 1; if (all) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - A size_t is not the same as an unsigned int.
Changeset: 9808cd4e65fd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9808cd4e65fd Modified Files: monetdb5/modules/atoms/json.c Branch: Jun2020 Log Message: A size_t is not the same as an unsigned int. diffs (12 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1187,7 +1187,7 @@ JSONplaintext(char **r, size_t *l, size_ break; default: if (*l < jt->elm[idx].valuelen + sep_len + 1) { - unsigned int offset = *ilen - *l; + size_t offset = *ilen - *l; char *p = *r - offset; *ilen *= 2; *r = GDKrealloc(p, *ilen); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - white space
Changeset: 925e679a441b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=925e679a441b Modified Files: sql/storage/bat/bat_storage.c Branch: Jun2020 Log Message: white space diffs (12 lines): diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1085,7 +1085,7 @@ count_col(sql_trans *tr, sql_column *c, sql_column *oc = tr_find_column(tr->parent, c); c->data = timestamp_delta(oc->data, c->base.stime); } -b = c->data; +b = c->data; if (!b) return 1; if (all) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - add lock's around early (sql_optimizer) acces...
Changeset: 697ae64b5a1c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=697ae64b5a1c Modified Files: sql/backends/monet5/sql_optimizer.c sql/storage/bat/bat_storage.c Branch: Jun2020 Log Message: add lock's around early (sql_optimizer) access to table information diffs (67 lines): diff --git a/sql/backends/monet5/sql_optimizer.c b/sql/backends/monet5/sql_optimizer.c --- a/sql/backends/monet5/sql_optimizer.c +++ b/sql/backends/monet5/sql_optimizer.c @@ -30,6 +30,7 @@ SQLgetColumnSize(sql_trans *tr, sql_colu { lng size = 0; BAT *b; + store_lock(); switch(access){ case 0: b= store_funcs.bind_col(tr, c, RDONLY); @@ -57,6 +58,7 @@ SQLgetColumnSize(sql_trans *tr, sql_colu BBPunfix(b->batCacheid); } } + store_unlock(); return size; } diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1891,8 +1891,11 @@ delayed_destroy_dbat(sql_dbat *b) if (!n) return LOG_OK; MT_lock_set(_lock); - while(n->next) + assert(n->r.refcnt == 1); + while(n->next) { + assert(n->r.refcnt == 1); n = n->next; + } n->next = tobe_destroyed_dbat; tobe_destroyed_dbat = b; MT_lock_unset(_lock); @@ -2677,6 +2680,7 @@ update_table(sql_trans *tr, sql_table *f if (!tt->data) tt->base.allocated = ft->base.allocated; ft->data = NULL; + assert(!b->next); b->next = tt->data; tt->data = b; @@ -2730,6 +2734,7 @@ update_table(sql_trans *tr, sql_table *f if (!oc->data) oc->base.allocated = cc->base.allocated; cc->data = NULL; + assert(!b->next); b->next = oc->data; oc->data = b; tr_handle_snapshot(tr, b); @@ -2818,6 +2823,7 @@ update_table(sql_trans *tr, sql_table *f if (!oi->data) oi->base.allocated = ci->base.allocated; ci->data = NULL; + assert(!b->next); b->next = oi->data; oi->data = b; tr_handle_snapshot(tr, b); @@ -2872,6 +2878,7 @@ update_table(sql_trans *tr, sql_table *f if (ft->data) destroy_del(tr, ft); ft->base.allocated = 0; + ft->data = NULL; return ok; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Use check_symbol_exists to find stpcpy. check...
Changeset: f2277dbeafd3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2277dbeafd3 Modified Files: cmake/monetdb-defines.cmake Branch: default Log Message: Use check_symbol_exists to find stpcpy. check_function_exists was not finding on my machine diffs (12 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -105,7 +105,7 @@ function(monetdb_configure_defines) check_function_exists("setsid" HAVE_SETSID) check_function_exists("shutdown" HAVE_SHUTDOWN) check_function_exists("sigaction" HAVE_SIGACTION) - check_function_exists("stpcpy" HAVE_STPCPY) + check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY) check_function_exists("strcasestr" HAVE_STRCASESTR) check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP) check_function_exists("strptime" HAVE_STRPTIME) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Save mserver output from SingleServer test di...
Changeset: 7470c5da8828 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7470c5da8828 Modified Files: testing/Mtest.py.in Branch: Jun2020 Log Message: Save mserver output from SingleServer test directories. diffs (36 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -1339,7 +1339,12 @@ def PerformDir(env, testdir, testlist, B for TST,COND in testlist: if oneserver and (pSrvr is None or pSrvr.poll() is not None): # restart server -pSrvr = ServerClass(splitcommand(env['exe']['mserver5'][1]) + ['--dbpath=%s' % LogDBdir] + options, open(os.devnull, 'w'), open(os.devnull, 'w'), 0, os.path.join(LogDBdir, '.started'), int(env['MAPIPORT'])) +pSrvr = ServerClass(splitcommand(env['exe']['mserver5'][1]) + ['--dbpath=%s' % LogDBdir] + options, +open(os.path.join(TSTTRGDIR, 'SingleServer.out'), 'a'), +open(os.path.join(TSTTRGDIR, 'SingleServer.err'), 'a'), +0, +os.path.join(LogDBdir, '.started'), +int(env['MAPIPORT'])) os.chdir(TSTTRGDIR) pSrvr.LaunchIt() if global_timeout and start_time + global_timeout < time.time(): @@ -1401,7 +1406,8 @@ def PerformDir(env, testdir, testlist, B '*.out.diff.html', '*.out.head.html', '*.out.html', '*.server.err', '*.server.out', '*.stable.err*', '*.stable.out*', -'*.test.err', '*.test.out']: +'*.test.err', '*.test.out', +'SingleServer.out', 'SingleServer.err']: if fnmatch.fnmatch(f, pat): break else: @@ -2881,6 +2887,8 @@ class ServerClass: self.proc.wait() t.cancel() self.code = returnCode(self.proc, self.errfile) +self.outfile.close() +self.errfile.close() def LaunchIt(self): global setpgrp ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - add interface to storage to directly return s...
Changeset: a616f5db46cf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a616f5db46cf Modified Files: sql/server/sql_privileges.c sql/storage/bat/bat_table.c sql/storage/sql_storage.h Branch: default Log Message: add interface to storage to directly return sqlid's (reduces malloc/frees) diffs (211 lines): diff --git a/sql/server/sql_privileges.c b/sql/server/sql_privileges.c --- a/sql/server/sql_privileges.c +++ b/sql/server/sql_privileges.c @@ -509,12 +509,8 @@ role_granting_privs(mvc *m, oid role_rid sql_table *auths = find_sql_table(sys, "auths"); sql_column *auths_grantor = find_sql_column(auths, "grantor"); sqlid owner_id; - void *val; - val = table_funcs.column_find_value(m->session->tr, auths_grantor, role_rid); - owner_id = *(sqlid*)val; - _DELETE(val); - + owner_id = table_funcs.column_find_sqlid(m->session->tr, auths_grantor, role_rid); if (owner_id == grantor_id) return true; if (sql_privilege(m, grantor_id, role_id, PRIV_ROLE_ADMIN)) @@ -533,15 +529,11 @@ sql_grant_role(mvc *m, str grantee, str sql_column *auths_name = find_sql_column(auths, "name"); sql_column *auths_id = find_sql_column(auths, "id"); sqlid role_id, grantee_id; - void *val; rid = table_funcs.column_find_row(m->session->tr, auths_name, role, NULL); if (is_oid_nil(rid)) throw(SQL, "sql.grant_role", SQLSTATE(M1M05) "GRANT: Cannot grant ROLE '%s' to user '%s'", role, grantee); - val = table_funcs.column_find_value(m->session->tr, auths_id, rid); - role_id = *(sqlid*)val; - _DELETE(val); - + role_id = table_funcs.column_find_sqlid(m->session->tr, auths_id, rid); if (backend_find_user(m, role) >= 0) throw(SQL,"sql.grant_role", SQLSTATE(M1M05) "GRANT: '%s' is a USER not a ROLE", role); if (!admin_privs(grantor) && !role_granting_privs(m, rid, role_id, grantor)) @@ -549,9 +541,7 @@ sql_grant_role(mvc *m, str grantee, str rid = table_funcs.column_find_row(m->session->tr, auths_name, grantee, NULL); if (is_oid_nil(rid)) throw(SQL,"sql.grant_role", SQLSTATE(M1M05) "GRANT: Cannot grant ROLE '%s' to user '%s'", role, grantee); - val = table_funcs.column_find_value(m->session->tr, auths_id, rid); - grantee_id = *(sqlid*)val; - _DELETE(val); + grantee_id = table_funcs.column_find_sqlid(m->session->tr, auths_id, rid); rid = table_funcs.column_find_row(m->session->tr, find_sql_column(roles, "login_id"), _id, find_sql_column(roles, "role_id"), _id, NULL); if (!is_oid_nil(rid)) throw(SQL,"sql.grant_role", SQLSTATE(M1M05) "GRANT: User '%s' already has ROLE '%s'", grantee, role); @@ -580,21 +570,15 @@ sql_revoke_role(mvc *m, str grantee, str sql_column *roles_role_id = find_sql_column(roles, "role_id"); sql_column *roles_login_id = find_sql_column(roles, "login_id"); sqlid role_id, grantee_id; - void *val; rid = table_funcs.column_find_row(m->session->tr, auths_name, grantee, NULL); if (is_oid_nil(rid)) throw(SQL,"sql.revoke_role", SQLSTATE(01006) "REVOKE: no such role '%s' or grantee '%s'", role, grantee); - val = table_funcs.column_find_value(m->session->tr, auths_id, rid); - grantee_id = *(sqlid*)val; - _DELETE(val); - + grantee_id = table_funcs.column_find_sqlid(m->session->tr, auths_id, rid); rid = table_funcs.column_find_row(m->session->tr, auths_name, role, NULL); if (is_oid_nil(rid)) throw(SQL,"sql.revoke_role", SQLSTATE(01006) "REVOKE: no such role '%s' or grantee '%s'", role, grantee); - val = table_funcs.column_find_value(m->session->tr, auths_id, rid); - role_id = *(sqlid*)val; - _DELETE(val); + role_id = table_funcs.column_find_sqlid(m->session->tr, auths_id, rid); if (!admin_privs(grantor) && !role_granting_privs(m, rid, role_id, grantor)) throw(SQL,"sql.revoke_role", SQLSTATE(0P000) "REVOKE: insufficient privileges to revoke ROLE '%s'", role); @@ -628,12 +612,10 @@ sql_find_auth(mvc *m, str auth) if (!is_oid_nil(rid)) { sql_column *auths_id = find_sql_column(auths, "id"); - sqlid *p = (sqlid *) table_funcs.column_find_value(m->session->tr, auths_id, rid); + sqlid p = table_funcs.column_find_sqlid(m->session->tr, auths_id, rid); - if (p) { - res = *p; - _DELETE(p); - } + if (p > -1) + res = p; } return res; } @@ -651,12 +633,10 @@ sql_find_schema(mvc *m, str schema) if (!is_oid_nil(rid)) { sql_column *schemas_id = find_sql_column(schemas, "id"); - sqlid *p = (sqlid *)
MonetDB: Jun2020 - Another quety with similar issue
Changeset: 32496b01c757 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32496b01c757 Modified Files: sql/test/SQLancer/Tests/sqlancer03.sql Branch: Jun2020 Log Message: Another quety with similar issue diffs (11 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -81,6 +81,7 @@ DELETE FROM t0 WHERE (t0.c0) = FALSE; INSERT INTO t0(c1, c0, c2) VALUES(TRUE, ((+ (- (1580722914)))>(charindex(CAST(0.347536126443453330381316845887340605258941650390625 AS STRING), ((CAST(TRUE AS STRING(771)))||(0.2182260714120349831546263885684311389923095703125)), length(r'd', -1819817735); UPDATE t0 SET c2 = DEFAULT WHERE t0.c1)OR(CAST(t0.c2 AS BOOLEANOR((CAST(0.6873694879073857 AS DECIMAL)) NOT IN (0.10021624439224552371996423971722833812236785888671875))); SELECT t0.c0 FROM t0 WHERE ((CAST(t0.c2 AS INT)) NOT BETWEEN ASYMMETRIC (abs(t0.c2)) AND (((t0.c2)/(t0.c2 NOT BETWEEN ASYMMETRIC (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); +SELECT t0.c0 FROM t0 WHERE (t0.c2) BETWEEN (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); DROP TABLE t0; CREATE TABLE "sys"."t0" ( ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - cleanup odbc package detection
Changeset: dbee97e2af88 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dbee97e2af88 Modified Files: cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake Branch: default Log Message: cleanup odbc package detection diffs (69 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -312,6 +312,25 @@ macro(monetdb_configure_sizes) endif() cmake_pop_check_state() endif() + + if(ODBC_FOUND) +cmake_push_check_state() +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${ODBC_INCLUDE_DIR}") +if(WIN32) + set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};Windows.h;sqlext.h;sqltypes.h") + check_include_file("afxres.h" HAVE_AFXRES_H) +else() + set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};sql.h;sqltypes.h") +endif() +check_type_size(SQLLEN _SQLLEN LANGUAGE C) +if(HAVE__SQLLEN) + set(LENP_OR_POINTER_T "SQLLEN *") +else() + set(LENP_OR_POINTER_T "SQLPOINTER") +endif() +check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C) +cmake_pop_check_state() + endif() endmacro() macro(monetdb_configure_misc) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -105,25 +105,6 @@ endif() if(ODBC) find_package(ODBC) - set(HAVE_ODBC "${ODBC_FOUND}") - if(ODBC_FOUND) -cmake_push_check_state() -set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${ODBC_INCLUDE_DIR}") -if(WIN32) - set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};Windows.h;sqlext.h;sqltypes.h") - check_include_file("afxres.h" HAVE_AFXRES_H) -else() - set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};sql.h;sqltypes.h") -endif() -check_type_size(SQLLEN _SQLLEN LANGUAGE C) -if(HAVE__SQLLEN) - set(LENP_OR_POINTER_T "SQLLEN *") -else() - set(LENP_OR_POINTER_T "SQLPOINTER") -endif() -check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C) -cmake_pop_check_state() - endif() endif() if(RINTEGRATION) diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -143,6 +143,7 @@ function(monetdb_cmake_summary) message(STATUS "Netcdf library: ${NETCDF_FOUND}") message(STATUS "Readline library: ${READLINE_FOUND}") message(STATUS "R library: ${LIBR_FOUND}") + message(STATUS "ODBC: ${ODBC_FOUND}") message(STATUS "Sphinx: ${SPHINX_FOUND}") message(STATUS "Createrepo: ${CREATEREPO_FOUND}") message(STATUS "-") ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Two new sqlancer bugs
Changeset: a528bcf2aa6b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a528bcf2aa6b Modified Files: sql/test/SQLancer/Tests/sqlancer03.sql Branch: Jun2020 Log Message: Two new sqlancer bugs diffs (66 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -65,3 +65,62 @@ 27 0.1052118441396751 select "insert"('屁{珙', 1, 1, '1'), "insert"('屁{珙', 1, 1, '抔'), "insert"('屁抔珙', 1, 1, 'ಜ'), "insert"('a', 0, 1, 'ಜ'), "insert"('a', 0, 0, 'ಜ'); select "insert"('屁{珙', 1, 1, '1'), "insert"('屁{珙', 1, 1, '抔'), "insert"('屁抔珙', 1, 1, 'ಜ') from t0; ROLLBACK; + +CREATE TABLE t0(c0 boolean, c1 boolean, c2 serial, UNIQUE(c0, c1)); -- Bug 6920 +INSERT INTO t0(c1) VALUES((0.5968066098520423) NOT BETWEEN SYMMETRIC (CAST(length(upper(r'z')) AS INT)) AND (1347145665)), (FALSE); +INSERT INTO t0(c0) VALUES(TRUE); +INSERT INTO t0(c1) VALUES(FALSE), (TRUE); +INSERT INTO t0(c2, c0, c1) VALUES(1347145665, (ltrim(lower(r'K'), ((upper(r'296348087'))||(- (1582370739) IS NOT NULL, (((lower(r'ö +eg#K,纗HSJw!{cOw⇒l/l!B*H'))||(((CAST(0.12411368110083143 AS INT))+(-1795901173) IN (lower(CAST(TRUE AS STRING, (-1795901173, NULL, (0.9575114678279173) NOT IN (2.96348087E8, 0.501053365665)), (1922411524, TRUE, (0.5020325273627405) NOT IN (-1388966352, 1163825182)); +INSERT INTO t0(c1) VALUES(TRUE); +INSERT INTO t0(c1, c2) VALUES(FALSE, 623585248); +INSERT INTO t0(c0) VALUES(NOT (NOT -1388966352)*(-984145454))) NOT IN (0.7356286, (FALSE); +INSERT INTO t0(c0) VALUES(TRUE); +INSERT INTO t0(c2) VALUES(-1235619315); +DELETE FROM t0 WHERE (t0.c0) = FALSE; +INSERT INTO t0(c1, c0, c2) VALUES(TRUE, ((+ (- (1580722914)))>(charindex(CAST(0.347536126443453330381316845887340605258941650390625 AS STRING), ((CAST(TRUE AS STRING(771)))||(0.2182260714120349831546263885684311389923095703125)), length(r'd', -1819817735); +UPDATE t0 SET c2 = DEFAULT WHERE t0.c1)OR(CAST(t0.c2 AS BOOLEANOR((CAST(0.6873694879073857 AS DECIMAL)) NOT IN (0.10021624439224552371996423971722833812236785888671875))); +SELECT t0.c0 FROM t0 WHERE ((CAST(t0.c2 AS INT)) NOT BETWEEN ASYMMETRIC (abs(t0.c2)) AND (((t0.c2)/(t0.c2 NOT BETWEEN ASYMMETRIC (t0.c0) AND ((t0.c2) NOT IN (t0.c2)); +DROP TABLE t0; + +CREATE TABLE "sys"."t0" ( + "c0" BOOLEAN, + "c1" BOOLEAN, + "c2" INTEGER, + CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2"), + CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1") +); +INSERT INTO "sys"."t0" VALUES (NULL, true, 10); +INSERT INTO "sys"."t0" VALUES (NULL, false, 11); +INSERT INTO "sys"."t0" VALUES (true, NULL, 12); +INSERT INTO "sys"."t0" VALUES (NULL, false, 13); +INSERT INTO "sys"."t0" VALUES (NULL, true, 14); +INSERT INTO "sys"."t0" VALUES (true, false, 15); +INSERT INTO "sys"."t0" VALUES (NULL, true, 16); +INSERT INTO "sys"."t0" VALUES (true, true, 17); +INSERT INTO "sys"."t0" VALUES (NULL, true, 18); +INSERT INTO "sys"."t0" VALUES (NULL, false, 19); +INSERT INTO "sys"."t0" VALUES (true, NULL, 20); +INSERT INTO "sys"."t0" VALUES (true, NULL, 21); +INSERT INTO "sys"."t0" VALUES (NULL, NULL, 22); +INSERT INTO "sys"."t0" VALUES (false, true, 23); +TRUNCATE t0; + +-- The following copy into shouldn't trigger a constrain violation error (it's the same insert above) +COPY 14 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +NULL true10 +NULL false 11 +true NULL12 +NULL false 13 +NULL true14 +true false 15 +NULL true16 +true true17 +NULL true18 +NULL false 19 +true NULL20 +true NULL21 +NULL NULL22 +false true23 + +DROP TABLE t0; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with oscar branch.
Changeset: f8d6f96a7ac2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8d6f96a7ac2 Modified Files: misc/python/fixlicense.py sql/benchmarks/ATIS/Tests/select_group.stable.out sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 sql/benchmarks/tpcds/Tests/07.stable.out sql/benchmarks/tpcds/Tests/09.stable.out sql/benchmarks/tpcds/Tests/13.stable.out sql/benchmarks/tpcds/Tests/13.stable.out.int128 sql/benchmarks/tpcds/Tests/18.stable.out sql/benchmarks/tpcds/Tests/18.stable.out.int128 sql/benchmarks/tpcds/Tests/26.stable.out sql/benchmarks/tpcds/Tests/27.stable.out sql/benchmarks/tpcds/Tests/28.stable.out sql/benchmarks/tpcds/Tests/85.stable.out sql/benchmarks/tpch/LOCKED/Tests/01.stable.out sql/benchmarks/tpch/LOCKED/Tests/01.stable.out.int128 sql/benchmarks/tpch/Tests/01.stable.out sql/benchmarks/tpch/Tests/01.stable.out.int128 sql/test/mergetables/Tests/forex.stable.out sql/test/mergetables/Tests/forex.stable.out.int128 sql/test/sys-schema/Tests/systemfunctions.stable.out Branch: default Log Message: Merge with oscar branch. diffs (truncated from 1542 to 300 lines): diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -85,50 +85,39 @@ def main(): func(filename[:-1], pre=pre, post=post, start=start, end=end, verbose=verbose) suffixrules = { -# suffix:(pre, post, start, end) -'.ac': ('', '','dnl ', ''), -'.ag': ('', '','# ', ''), -'.am': ('', '','# ', ''), -'.bash': ('', '','# ', ''), -'.bat': ('', '','@REM ',''), -'.brg': ('/*',' */', ' * ', ''), -'.c':('/*',' */', ' * ', ''), -'.cc': ('', '','// ', ''), -'.cf': ('', '','# ', ''), -'.cpp': ('', '','// ', ''), -'.el': ('', '','; ', ''), -'.h':('/*',' */', ' * ', ''), -'.hs': ('', '','-- ', ''), -'.html': ('', '', ''), -'.i':('', '','// ', ''), -'.java': ('/*',' */', ' * ', ''), -'.l':('/*',' */', ' * ', ''), -'.m4': ('', '','dnl ', ''), -'.mal': ('', '','# ', ''), -'.mil': ('', '','# ', ''), -'.mk': ('', '','# ', ''), -'.msc': ('', '','# ', ''), -'.php': ('', '# ', ''), -'.pc': ('', '','# ', ''), -'.pl': ('', '','# ', ''), -'.pm': ('', '','# ', ''), -'.py': ('', '','# ', ''), -'.R':('', '','# ', ''), -'.rb': ('', '','# ', ''), -'.rc': ('', '','// ', ''), -'.rst': ('', '','.. ', ''), -'.sh': ('', '','# ', ''), -'.sql': ('', '','-- ', ''), -'.t':('', '','# ', ''), -'.xml': ('', '', ''), -'.xq': ('(:',':)', '', ''), -'.xs': ('/*',' */', ' * ', ''), -'.y':('/*',' */', ' * ', ''), +# suffix: (pre, post, start, end) +'.bash': ('', '','# ', ''), # shell script +'.bat': ('', '','@REM ',''), # Windows cmd batch script +'.c': ('/*',' */', ' * ', ''), # C source +'.cc':('', '','// ', ''), # C++ source +'.cmake': ('#[[', '#]]', '# ', ''), # CMake source +'.cpp': ('', '','// ', ''), # C++ source +'.el':('', '','; ', ''), # Emacs Lisp +'.fc':('', '','# ', ''), # SELinux file context +'.h': ('/*',' */', ' * ', ''), # C header file +'.hs':('', '','-- ', ''), # Haskell source +'.html': ('', '', ''), # HTML source +'.java': ('/*',' */', ' * ', ''), # Java source +'.l': ('/*',' */', ' * ', ''), # (f)lex source +'.mal': ('', '','# ', ''), # MonetDB Assembly Language +'.php': ('', '# ', ''), # PHP source +'.pl':('', '','# ', ''), # Perl source +'.pm':('', '','# ', ''), # Perl module source +'.py':('', '','# ', ''), # Python source +'.R': ('', '','# ', ''), # R source +'.rb':('', '','# ', ''), # Ruby source +'.rc':('', '','// ', ''), # Windows resource file +'.rst': ('', '','.. ', ''), # reStructured Text +'.sh':('', '','# ', ''), # shell script +'.sql': ('', '','-- ', ''), # SQL source +'.t': ('', '','# ', ''), # Perl test +'.te':('', '','# ', ''), # SELinux +'.xml': ('', '', ''), # XML source +'.y': ('/*',' */', ' * ', ''), # yacc (bison) source # we also match some complete
MonetDB: default - remove assert
Changeset: 055c56d61a7a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=055c56d61a7a Modified Files: sql/server/sql_parser.y Branch: default Log Message: remove assert diffs (12 lines): diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -6394,7 +6394,7 @@ sqlformaterror(mvc * sql, _In_z_ _Printf /* default: Syntax error or access rule violation */ sqlstate = SQLSTATE(42000); } - assert(sql->scanner.errstr == NULL); + //assert(sql->scanner.errstr == NULL); if (sql->errstr[0] == '\0') { if (sqlstate) len += snprintf(sql->errstr+len, ERRSIZE-1-len, "%s", sqlstate); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - A little cleanup.
Changeset: 0ec83cca8eb2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ec83cca8eb2 Modified Files: misc/python/fixlicense.py Branch: oscar Log Message: A little cleanup. diffs (95 lines): diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -85,50 +85,39 @@ def main(): func(filename[:-1], pre=pre, post=post, start=start, end=end, verbose=verbose) suffixrules = { -# suffix:(pre, post, start, end) -'.ac': ('', '','dnl ', ''), -'.ag': ('', '','# ', ''), -'.am': ('', '','# ', ''), -'.bash': ('', '','# ', ''), -'.bat': ('', '','@REM ',''), -'.brg': ('/*',' */', ' * ', ''), -'.c':('/*',' */', ' * ', ''), -'.cc': ('', '','// ', ''), -'.cf': ('', '','# ', ''), -'.cpp': ('', '','// ', ''), -'.el': ('', '','; ', ''), -'.h':('/*',' */', ' * ', ''), -'.hs': ('', '','-- ', ''), -'.html': ('', '', ''), -'.i':('', '','// ', ''), -'.java': ('/*',' */', ' * ', ''), -'.l':('/*',' */', ' * ', ''), -'.m4': ('', '','dnl ', ''), -'.mal': ('', '','# ', ''), -'.mil': ('', '','# ', ''), -'.mk': ('', '','# ', ''), -'.msc': ('', '','# ', ''), -'.php': ('', '# ', ''), -'.pc': ('', '','# ', ''), -'.pl': ('', '','# ', ''), -'.pm': ('', '','# ', ''), -'.py': ('', '','# ', ''), -'.R':('', '','# ', ''), -'.rb': ('', '','# ', ''), -'.rc': ('', '','// ', ''), -'.rst': ('', '','.. ', ''), -'.sh': ('', '','# ', ''), -'.sql': ('', '','-- ', ''), -'.t':('', '','# ', ''), -'.xml': ('', '', ''), -'.xq': ('(:',':)', '', ''), -'.xs': ('/*',' */', ' * ', ''), -'.y':('/*',' */', ' * ', ''), +# suffix: (pre, post, start, end) +'.bash': ('', '','# ', ''), # shell script +'.bat': ('', '','@REM ',''), # Windows cmd batch script +'.c': ('/*',' */', ' * ', ''), # C source +'.cc':('', '','// ', ''), # C++ source +'.cmake': ('#[[', '#]]', '# ', ''), # CMake source +'.cpp': ('', '','// ', ''), # C++ source +'.el':('', '','; ', ''), # Emacs Lisp +'.fc':('', '','# ', ''), # SELinux file context +'.h': ('/*',' */', ' * ', ''), # C header file +'.hs':('', '','-- ', ''), # Haskell source +'.html': ('', '', ''), # HTML source +'.java': ('/*',' */', ' * ', ''), # Java source +'.l': ('/*',' */', ' * ', ''), # (f)lex source +'.mal': ('', '','# ', ''), # MonetDB Assembly Language +'.php': ('', '# ', ''), # PHP source +'.pl':('', '','# ', ''), # Perl source +'.pm':('', '','# ', ''), # Perl module source +'.py':('', '','# ', ''), # Python source +'.R': ('', '','# ', ''), # R source +'.rb':('', '','# ', ''), # Ruby source +'.rc':('', '','// ', ''), # Windows resource file +'.rst': ('', '','.. ', ''), # reStructured Text +'.sh':('', '','# ', ''), # shell script +'.sql': ('', '','-- ', ''), # SQL source +'.t': ('', '','# ', ''), # Perl test +'.te':('', '','# ', ''), # SELinux +'.xml': ('', '', ''), # XML source +'.y': ('/*',' */', ' * ', ''), # yacc (bison) source # we also match some complete filenames 'CMakeLists.txt': ('#[[', '#]]', '# ', ''), 'Makefile': ('', '', '# ', ''), -'.merovingian_properties.in': ('', '', '# ', ''), -'configure.ag': ('', '', 'dnl ', ''), +'.merovingian_properties': ('', '', '# ', ''), 'copyright': ('', '', '', ''), 'license.txt': ('', '', '', ''), } @@ -136,7 +125,9 @@ suffixrules = { def getcomments(file, pre = None, post = None, start = None, end = None): ext = '' if pre is None and post is None and start is None and end is None: -if os.path.basename(file) in suffixrules: +if file.endswith('.in') and os.path.basename(file[:-3]) in suffixrules: +ext = os.path.basename(file) +elif os.path.basename(file) in suffixrules: ext = os.path.basename(file) else: root, ext = os.path.splitext(file) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - Stop databases at end of monetdb_snapshot test
Changeset: 478a276e0742 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=478a276e0742 Modified Files: tools/merovingian/client/Tests/monetdb_snapshot.py tools/merovingian/client/Tests/monetdb_snapshot.stable.err tools/merovingian/client/Tests/monetdb_snapshot.stable.out tools/merovingian/client/Tests/monetdbd.py Branch: oscar Log Message: Stop databases at end of monetdb_snapshot test diffs (68 lines): diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.py b/tools/merovingian/client/Tests/monetdb_snapshot.py --- a/tools/merovingian/client/Tests/monetdb_snapshot.py +++ b/tools/merovingian/client/Tests/monetdb_snapshot.py @@ -12,7 +12,7 @@ from monetdbd import MonetDBD # MonetDBD.VERBOSE = True -gdk_farmdir = os.environ.get('GDK_FARMDIR') or '/tmp' +gdk_farmdir = os.environ.get('TSTTRGDIR') or '/tmp/' farmdir = os.path.join(gdk_farmdir, 'monetdbd-test') def header(*args, **opts): @@ -23,7 +23,7 @@ def header(*args, **opts): header('CREATE FARM') -# test that .napshotdir is not set by default +# test that .snapshotdir is not set by default with MonetDBD(farmdir, set_snapdir=False) as m: header('CHECK SNAPDIR NOT SET') @@ -93,3 +93,5 @@ with MonetDBD(farmdir, set_snapdir=False m.run_monetdb('snapshot', 'restore', qcustom_name, 'foo99', output=True) out = m.run_mclient('-s', 'select * from t', '-fcsv', output=True, db='foo99') assert out.strip() == 'foo1' + +header('DONE') diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.stable.err b/tools/merovingian/client/Tests/monetdb_snapshot.stable.err --- a/tools/merovingian/client/Tests/monetdb_snapshot.stable.err +++ b/tools/merovingian/client/Tests/monetdb_snapshot.stable.err @@ -18,6 +18,7 @@ snapshot: Snapshot target file not allow - SNAPSHOT MULTI - RESTORE OVER EXISTING - CUSTOM FILENAME +- DONE # 15:32:48 > # 15:32:48 > "Done." diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.stable.out b/tools/merovingian/client/Tests/monetdb_snapshot.stable.out --- a/tools/merovingian/client/Tests/monetdb_snapshot.stable.out +++ b/tools/merovingian/client/Tests/monetdb_snapshot.stable.out @@ -41,6 +41,11 @@ snapshotting database 'foo2'... done -- RESTORE OVER EXISTING -- CUSTOM FILENAME snapshotting database 'foo1'... done +-- DONE +stopping database 'bar'... done +stopping database 'foo1'... done +stopping database 'foo2'... done +stopping database 'foo99'... done # 15:32:48 > # 15:32:48 > "Done." diff --git a/tools/merovingian/client/Tests/monetdbd.py b/tools/merovingian/client/Tests/monetdbd.py --- a/tools/merovingian/client/Tests/monetdbd.py +++ b/tools/merovingian/client/Tests/monetdbd.py @@ -99,8 +99,10 @@ class MonetDBD: def __exit__(self, exc_type, exc_val, exc_tb): if self.proc: +self.run_monetdb('stop', '-a') self.proc.terminate() if exc_type == None: # clean exit -self.remove_dir() +if not self.keep: +self.remove_dir() return False # do not suppress any exceptions ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - small fix (ie don't output error on just hitt...
Changeset: 19f57f13126c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=19f57f13126c Modified Files: sql/server/sql_scan.c Branch: default Log Message: small fix (ie don't output error on just hitting EOF, only when unexpected) diffs (12 lines): diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c --- a/sql/server/sql_scan.c +++ b/sql/server/sql_scan.c @@ -620,7 +620,7 @@ scanner_getc(struct scanner *lc) int c, m, n, mask; if (scanner_read_more(lc, 1) == EOF) { - lc->errstr = SQLSTATE(42000) "end of input stream"; + //lc->errstr = SQLSTATE(42000) "end of input stream"; return EOF; } lc->errstr = NULL; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - Approved tests.
Changeset: 6c5d944219a5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6c5d944219a5 Modified Files: sql/benchmarks/ATIS/Tests/select_group.stable.out sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 sql/benchmarks/tpcds/Tests/07.stable.out sql/benchmarks/tpcds/Tests/09.stable.out sql/benchmarks/tpcds/Tests/13.stable.out sql/benchmarks/tpcds/Tests/13.stable.out.int128 sql/benchmarks/tpcds/Tests/18.stable.out sql/benchmarks/tpcds/Tests/18.stable.out.int128 sql/benchmarks/tpcds/Tests/26.stable.out sql/benchmarks/tpcds/Tests/27.stable.out sql/benchmarks/tpcds/Tests/28.stable.out sql/benchmarks/tpcds/Tests/85.stable.out sql/benchmarks/tpch/LOCKED/Tests/01.stable.out sql/benchmarks/tpch/LOCKED/Tests/01.stable.out.int128 sql/benchmarks/tpch/Tests/01.stable.out sql/benchmarks/tpch/Tests/01.stable.out.int128 sql/test/mergetables/Tests/forex.stable.out sql/test/mergetables/Tests/forex.stable.out.int128 sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 Branch: oscar Log Message: Approved tests. diffs (truncated from 1492 to 300 lines): diff --git a/sql/benchmarks/ATIS/Tests/select_group.stable.out b/sql/benchmarks/ATIS/Tests/select_group.stable.out --- a/sql/benchmarks/ATIS/Tests/select_group.stable.out +++ b/sql/benchmarks/ATIS/Tests/select_group.stable.out @@ -71,15 +71,15 @@ stdout of test 'select_group` in directo #select avg(engines) from aircraft; % sys.%1 # table_name % %1 # name -% double # type -% 24 # length -[ 2.059259259 ] +% decimal # type +% 3 # length +[ 2] #select avg(engines) from aircraft where engines>0; % sys.%1 # table_name % %1 # name -% double # type -% 24 # length -[ 2.376068376 ] +% decimal # type +% 3 # length +[ 2] #select count(*),min(pay_load),max(pay_load) from aircraft where pay_load>0; % sys.%1, sys.%2, sys.%3 # table_name % %1, %2, %3 # name @@ -119,9 +119,9 @@ stdout of test 'select_group` in directo #SELECT from_airport,to_airport,avg(time_elapsed) FROM flight WHERE from_airport='ATL' AND to_airport='BOS' group by from_airport,to_airport; % sys.flight, sys.flight, sys.%1 # table_name % from_airport,to_airport, %1 # name -% char,char, double # type -% 3, 3, 24 # length -[ "ATL", "BOS", 154.3684211 ] +% char,char, decimal # type +% 3, 3, 5 # length +[ "ATL", "BOS", 154 ] #select city_code, avg(ground_fare) from ground_service where ground_fare<>0 group by city_code; % sys.ground_service, sys.%1 # table_name % city_code, %1 # name @@ -156,7 +156,7 @@ stdout of test 'select_group` in directo [ 3, "BBWI" ] [ 1, "" ] #select category,count(*) as totalnr from aircraft where engines=2 group by category having count(*)>4 order by category; -% sys.aircraft,sys.%1 # table_name +% sys.aircraft,sys. # table_name % category,totalnr # name % char,bigint # type % 10, 2 # length diff --git a/sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 b/sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 --- a/sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 +++ b/sql/benchmarks/ATIS/Tests/select_group.stable.out.int128 @@ -71,15 +71,15 @@ stdout of test 'select_group` in directo #select avg(engines) from aircraft; % sys.%1 # table_name % %1 # name -% double # type -% 24 # length -[ 2.059259259 ] +% decimal # type +% 3 # length +[ 2] #select avg(engines) from aircraft where engines>0; % sys.%1 # table_name % %1 # name -% double # type -% 24 # length -[ 2.376068376 ] +% decimal # type +% 3 # length +[ 2] #select count(*),min(pay_load),max(pay_load) from aircraft where pay_load>0; % sys.%1, sys.%2, sys.%3 # table_name % %1, %2, %3 # name @@ -119,9 +119,9 @@ stdout of test 'select_group` in directo #SELECT from_airport,to_airport,avg(time_elapsed) FROM flight WHERE from_airport='ATL' AND to_airport='BOS' group by from_airport,to_airport; % sys.flight, sys.flight, sys.%1 # table_name % from_airport,to_airport, %1 # name -% char,char, double # type -% 3, 3, 24 # length -[ "ATL", "BOS", 154.3684211 ] +% char,char, decimal # type +% 3, 3, 5 # length +[ "ATL", "BOS", 154 ] #select city_code, avg(ground_fare) from ground_service where ground_fare<>0 group by city_code; % sys.ground_service, sys.%1 # table_name % city_code, %1 # name @@ -156,7 +156,7 @@ stdout of test 'select_group` in directo [ 3, "BBWI" ] [ 1, "" ] #select category,count(*) as totalnr from aircraft where engines=2 group by category having count(*)>4 order by category; -% sys.aircraft,sys.%1 # table_name +% sys.aircraft,sys. # table_name % category,totalnr # name % char,
MonetDB: default - more usage of allocators (and cleanup of erro...
Changeset: 0c05a2843ccc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0c05a2843ccc Modified Files: sql/server/sql_parser.h sql/server/sql_parser.y Branch: default Log Message: more usage of allocators (and cleanup of error functions) in sql_parser diffs (truncated from 692 to 300 lines): diff --git a/sql/server/sql_parser.h b/sql/server/sql_parser.h --- a/sql/server/sql_parser.h +++ b/sql/server/sql_parser.h @@ -19,10 +19,9 @@ #define YYDEBUG 1 */ -extern int find_subgeometry_type(char*); +extern int find_subgeometry_type(mvc *m, char*); extern char *token2string(tokens token); extern int sqlparse(mvc *m); -extern int sqlerror(mvc *sql, const char *s); #include "mal_errors.h"/* for SQLSTATE() */ diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -20,6 +20,13 @@ #include "mal.h" /* for have_hge */ #endif +static int sqlerror(mvc *sql, const char *err); +static int sqlformaterror(mvc *sql, _In_z_ _Printf_format_string_ const char *format, ...) + __attribute__((__format__(__printf__, 2, 3))); + +static void *ma_alloc(sql_allocator *sa, size_t sz); +static void ma_free(void *p); + #include #include @@ -43,8 +50,9 @@ #define _atom_string(t, v) atom_string(SA, t, v) -#define YYMALLOC GDKmalloc -#define YYFREE GDKfree +#define Malloc(sz) ma_alloc(m->ta,sz) +#define YYMALLOC Malloc +#define YYFREE ma_free #define YY_parse_LSP_NEEDED/* needed for bison++ 1.21.11-3 */ @@ -93,6 +101,7 @@ UTF8_strlen(const char *val) return pos; } + static char * uescape_xform(char *restrict s, const char *restrict esc) { @@ -2153,9 +2162,7 @@ func_def: else if (l == 'J' || l == 'j') lang = FUNC_LANG_J; else { - char *msg = sql_message("Language name R, C, PYTHON[3], PYTHON[3]_MAP or J(avascript):expected, received '%c'", l); - yyerror(m, msg); - _DELETE(msg); + sqlformaterror(m, "Language name R, C, PYTHON[3], PYTHON[3]_MAP or J(avascript):expected, received '%c'", l); } append_list(f, $3); @@ -3666,7 +3673,7 @@ like_exp: | scalar_exp ESCAPE string { const char *s = $3; if (_strlen(s) != 1) { - yyerror(m, SQLSTATE(22019) "ESCAPE must be one character"); + sqlformaterror(m, SQLSTATE(22019) "%s", "ESCAPE must be one character"); $$ = NULL; YYABORT; } else { @@ -4504,7 +4511,7 @@ interval_type: $$.type = NULL; if ( (tpe = parse_interval_qualifier( m, $2, , , , )) < 0){ - yyerror(m, SQLSTATE(22006) "incorrect interval"); + sqlformaterror(m, SQLSTATE(22006) "%s", "incorrect interval"); YYABORT; } else { int d = inttype2digits(sk, ek); @@ -4599,10 +4606,7 @@ literal: } if (err != 0) { - char *msg = sql_message(SQLSTATE(22003) "Invalid hexadecimal number or hexadecimal too large (%s)", $1); - - yyerror(m, msg); - _DELETE(msg); + sqlformaterror(m, SQLSTATE(22003) "Invalid hexadecimal number or hexadecimal too large (%s)", $1); $$ = NULL; YYABORT; } else { @@ -4630,10 +4634,7 @@ literal: } if (err) { - char *msg = sql_message(SQLSTATE(22003) "OID value too large or not a number (%s)", $1); - - yyerror(m, msg); - _DELETE(msg); + sqlformaterror(m, SQLSTATE(22003) "OID value too large or not a number (%s)", $1); $$ = NULL; YYABORT; } else { @@ -4691,10 +4692,7 @@ literal: } if (err) { - char *msg = sql_message(SQLSTATE(22003) "integer value too large or not a number (%s)", $1); - - yyerror(m, msg); - _DELETE(msg); + sqlformaterror(m, SQLSTATE(22003) "integer value too large or not a number (%s)", $1); $$ = NULL; YYABORT; } else { @@ -4729,10 +4727,7 @@ literal: errno = 0; val = strtod($1,); if (p == $1 || is_dbl_nil(val) || (errno == ERANGE && (val < -1 || val > 1))) { - char *msg = sql_message(SQLSTATE(22003) "Double value too large or not a number (%s)", $1); - -
MonetDB: Jun2020 - Handle UTF-8 strings at str.insert function
Changeset: f6605069493d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f6605069493d Modified Files: monetdb5/modules/atoms/str.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: Jun2020 Log Message: Handle UTF-8 strings at str.insert function diffs (238 lines): diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -3156,6 +3156,59 @@ UTF8_strtail(const char *s, int pos) return (str) s; } +static inline str +UTF8_strncpy(char *restrict dst, const char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + *dst++ = *s++; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + *dst++ = *s++; + *dst++ = *s++; + } else { + /* 1 byte UTF-8 "sequence" */ + *dst++ = *s++; + } + n--; + } + *dst = '\0'; + return dst; +} + +static inline str +UTF8_offset(char *restrict s, int n) +{ + UTF8_assert(s); + while (*s && n) { + if ((*s & 0xF8) == 0xF0) { + /* 4 byte UTF-8 sequence */ + s += 4; + } else if ((*s & 0xF0) == 0xE0) { + /* 3 byte UTF-8 sequence */ + s += 3; + } else if ((*s & 0xE0) == 0xC0) { + /* 2 byte UTF-8 sequence */ + s += 2; + } else { + /* 1 byte UTF-8 "sequence" */ + s++; + } + n--; + } + return s; +} + static str convertCase(BAT *from, BAT *to, str *res, const char *src, const char *malfunc) { @@ -4120,20 +4173,18 @@ STRlocate(int *ret, const str *needle, c } str -STRinsert(str *ret, const str *s, const int *start, const int *l, const str *s2) +STRinsert(str *ret, const str *input, const int *start, const int *nchars, const str *input2) { - str v; - int strt = *start; - if (strNil(*s) || strNil(*s2) || is_int_nil(*start) || is_int_nil(*l)) { + str v, s = *input, s2 = *input2; + int strt = *start, l = *nchars; + + if (strNil(s) || strNil(s2) || is_int_nil(strt) || is_int_nil(l)) { if ((*ret = GDKstrdup(str_nil)) == NULL) throw(MAL, "str.insert", SQLSTATE(HY013) MAL_MALLOC_FAIL); } else { - size_t l1 = strlen(*s); - size_t l2 = strlen(*s2); + size_t l1 = UTF8_strlen(s); - if (l1 + l2 + 1 >= INT_MAX) - throw(MAL, "str.insert", SQLSTATE(HY013) MAL_MALLOC_FAIL); - if (*l < 0) + if (l < 0) throw(MAL, "str.insert", SQLSTATE(42000) "The number of characters for insert function must be non negative"); if (strt < 0) { if ((size_t) -strt <= l1) @@ -4143,15 +4194,14 @@ STRinsert(str *ret, const str *s, const } if ((size_t) strt > l1) strt = (int) l1; - v = *ret = GDKmalloc(strlen(*s) + strlen(*s2) + 1); + v = *ret = GDKmalloc(strlen(s) + strlen(s2) + 1); if (v == NULL) throw(MAL, "str.insert", SQLSTATE(HY013) MAL_MALLOC_FAIL); if (strt > 0) - strncpy(v, *s, strt); - v[strt] = 0; - strcpy(v + strt, *s2); - if (strt + *l < (int) l1) - strcat(v, *s + strt + *l); + v = UTF8_strncpy(v, s, strt); + strcpy(v, s2); + if (strt + l < (int) l1) + strcat(v, UTF8_offset(s, strt + l)); } return MAL_SUCCEED; } diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -24,3 +24,44 @@ SELECT sql_min(sql_max(NULL, ''), ''); SELECT ALL length(upper(MIN(ALL CAST(((trim(CAST(r'' AS STRING(659)), CAST(r'o3%+i]抔DCöf▟nßOpNbybಜ7' AS STRING)))||(sql_min(sql_max(NULL, r''), splitpart(r'x', r',7+.', t0.c1 AS STRING(151), 0.4179268710155164 FROM v0 LEFT OUTER JOIN t0 ON NOT (t0.c0) WHERE t0.c0 GROUP
MonetDB: Jun2020 - Remove code duplication
Changeset: 3f31095d487e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3f31095d487e Modified Files: monetdb5/modules/atoms/json.c Branch: Jun2020 Log Message: Remove code duplication diffs (47 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1213,39 +1213,21 @@ JSONplaintext(char **r, size_t *l, size_ str JSONjson2text(str *ret, json *js) { - JSON *jt; - size_t l, ilen; - str s; - - jt = JSONparse(*js); - - CHECK_JSON(jt); - ilen = l = strlen(*js) + 1; - s = GDKmalloc(l); - if(s == NULL) { - JSONfree(jt); - throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - s = JSONplaintext(, , , jt, 0, " ", 1); - s -= ilen - l; - l = strlen(s); - if (l) - s[l - 1] = 0; - *ret = s; - JSONfree(jt); - return MAL_SUCCEED; + char *sep = " "; + return JSONjson2textSeparator(ret, js, ); } str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; - size_t l, ilen, sep_len = strlen(*sep); + size_t l, ilen, sep_len; str s; jt = JSONparse(*js); CHECK_JSON(jt); + sep_len = strlen(*sep); ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with oscar branch.
Changeset: 2667c0094e2e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2667c0094e2e Modified Files: monetdb5/mal/mal_authorize.c Branch: default Log Message: Merge with oscar branch. diffs (20 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -390,10 +390,12 @@ AUTHinitTables(const char *passwd) { if (passwd == NULL) passwd = "monetdb"; /* default password */ pw = mcrypt_BackendSum(passwd, strlen(passwd)); - if(!pw && !GDKembedded()) - throw(MAL, "initTables", SQLSTATE(42000) "Crypt backend hash not found"); - else if (!pw && GDKembedded()) - pw = strdup(passwd); + if(!pw) { + if (!GDKembedded()) + throw(MAL, "initTables", SQLSTATE(42000) "Crypt backend hash not found"); + else + pw = strdup(passwd); + } msg = AUTHaddUser(, NULL, "monetdb", pw); free(pw); if (msg) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Stop databases at end of monetdb_snapshot test
Changeset: 8e2af2992cfc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8e2af2992cfc Modified Files: tools/merovingian/client/Tests/monetdb_snapshot.py tools/merovingian/client/Tests/monetdb_snapshot.stable.err tools/merovingian/client/Tests/monetdb_snapshot.stable.out tools/merovingian/client/Tests/monetdbd.py Branch: default Log Message: Stop databases at end of monetdb_snapshot test diffs (68 lines): diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.py b/tools/merovingian/client/Tests/monetdb_snapshot.py --- a/tools/merovingian/client/Tests/monetdb_snapshot.py +++ b/tools/merovingian/client/Tests/monetdb_snapshot.py @@ -12,7 +12,7 @@ from monetdbd import MonetDBD # MonetDBD.VERBOSE = True -gdk_farmdir = os.environ.get('GDK_FARMDIR') or '/tmp' +gdk_farmdir = os.environ.get('TSTTRGDIR') or '/tmp/' farmdir = os.path.join(gdk_farmdir, 'monetdbd-test') def header(*args, **opts): @@ -23,7 +23,7 @@ def header(*args, **opts): header('CREATE FARM') -# test that .napshotdir is not set by default +# test that .snapshotdir is not set by default with MonetDBD(farmdir, set_snapdir=False) as m: header('CHECK SNAPDIR NOT SET') @@ -93,3 +93,5 @@ with MonetDBD(farmdir, set_snapdir=False m.run_monetdb('snapshot', 'restore', qcustom_name, 'foo99', output=True) out = m.run_mclient('-s', 'select * from t', '-fcsv', output=True, db='foo99') assert out.strip() == 'foo1' + +header('DONE') diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.stable.err b/tools/merovingian/client/Tests/monetdb_snapshot.stable.err --- a/tools/merovingian/client/Tests/monetdb_snapshot.stable.err +++ b/tools/merovingian/client/Tests/monetdb_snapshot.stable.err @@ -18,6 +18,7 @@ snapshot: Snapshot target file not allow - SNAPSHOT MULTI - RESTORE OVER EXISTING - CUSTOM FILENAME +- DONE # 15:32:48 > # 15:32:48 > "Done." diff --git a/tools/merovingian/client/Tests/monetdb_snapshot.stable.out b/tools/merovingian/client/Tests/monetdb_snapshot.stable.out --- a/tools/merovingian/client/Tests/monetdb_snapshot.stable.out +++ b/tools/merovingian/client/Tests/monetdb_snapshot.stable.out @@ -41,6 +41,11 @@ snapshotting database 'foo2'... done -- RESTORE OVER EXISTING -- CUSTOM FILENAME snapshotting database 'foo1'... done +-- DONE +stopping database 'bar'... done +stopping database 'foo1'... done +stopping database 'foo2'... done +stopping database 'foo99'... done # 15:32:48 > # 15:32:48 > "Done." diff --git a/tools/merovingian/client/Tests/monetdbd.py b/tools/merovingian/client/Tests/monetdbd.py --- a/tools/merovingian/client/Tests/monetdbd.py +++ b/tools/merovingian/client/Tests/monetdbd.py @@ -99,8 +99,10 @@ class MonetDBD: def __exit__(self, exc_type, exc_val, exc_tb): if self.proc: +self.run_monetdb('stop', '-a') self.proc.terminate() if exc_type == None: # clean exit -self.remove_dir() +if not self.keep: +self.remove_dir() return False # do not suppress any exceptions ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: oscar - Logic error.
Changeset: 68a714d21b0e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=68a714d21b0e Modified Files: monetdb5/mal/mal_authorize.c Branch: oscar Log Message: Logic error. diffs (20 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -390,10 +390,12 @@ AUTHinitTables(const char *passwd) { if (passwd == NULL) passwd = "monetdb"; /* default password */ pw = mcrypt_BackendSum(passwd, strlen(passwd)); - if(!pw && !GDKembedded()) - throw(MAL, "initTables", SQLSTATE(42000) "Crypt backend hash not found"); - else - pw = strdup(passwd); + if(!pw) { + if (!GDKembedded()) + throw(MAL, "initTables", SQLSTATE(42000) "Crypt backend hash not found"); + else + pw = strdup(passwd); + } msg = AUTHaddUser(, NULL, "monetdb", pw); free(pw); if (msg) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with oscar branch.
Changeset: 4b4219a8c481 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b4219a8c481 Added Files: sql/test/json/Tests/jsontext.Bug-6859.stable.err sql/test/json/Tests/jsontext.Bug-6859.stable.out Modified Files: NT/mkodbcwxs.py NT/mksqlwxs.py clients/mapilib/mapi.c common/utils/msabaoth.c ctest/tools/monetdbe/backup.c ctest/tools/monetdbe/example_backup.c ctest/tools/monetdbe/test_helper.c ctest/tools/monetdbe/test_helper.h ctest/tools/monetdbe/test_helper_template.h geom/monetdb5/geom_funcs.mal misc/python/fixlicense.py monetdb5/mal/mal.h monetdb5/mal/mal_prelude.h monetdb5/mal/mel.h monetdb5/modules/atoms/json.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/tracer.c monetdb5/modules/mal/tracer.h sql/backends/monet5/UDF/pyapi3/pytypes.h sql/backends/monet5/sql_import.h sql/backends/monet5/sql_session.mal sql/backends/monet5/vaults/fits/72_fits.sql sql/common/sql_types.c sql/server/cmp_exp_eval.h sql/server/rel_distribute.c sql/server/rel_outer_join_optimizer.h sql/storage/store.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out testing/exportutils.py testing/malcheck.py tools/merovingian/utils/control.c tools/monetdbe/monetdbe_mapi.c tools/monetdbe/monetdbe_mapi.h Branch: default Log Message: Merge with oscar branch. diffs (truncated from 749 to 300 lines): diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mkodbcwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB-ODBC-Installer.wixobj diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mksqlwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB5-SQL-Installer.wixobj diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -2716,12 +2716,14 @@ mapi_reconnect(Mapi mid) } else #endif { + (void)pwdhash; snprintf(buf, sizeof(buf), "server requires unknown hash '%.100s'", serverhash); close_connection(mid); return mapi_setError(mid, buf, __func__, MERROR); } +#if defined(HAVE_RIPEMD160_UPDATE) || defined(HAVE_SHA512_UPDATE) || defined(HAVE_SHA384_UPDATE) || defined(HAVE_SHA256_UPDATE) || defined(HAVE_SHA224_UPDATE) || defined(HAVE_SHA1_UPDATE) if (pwdhash == NULL) { snprintf(buf, sizeof(buf), "allocation failure or unknown hash '%.100s'", serverhash); @@ -2733,6 +2735,7 @@ mapi_reconnect(Mapi mid) mid->password = malloc(1 + strlen(pwdhash) + 1); sprintf(mid->password, "\1%s", pwdhash); free(pwdhash); +#endif } p = mid->password + 1; diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c --- a/common/utils/msabaoth.c +++ b/common/utils/msabaoth.c @@ -579,8 +579,6 @@ msab_pickSecret(char **generated_secret) char *secret; char pathbuf[FILENAME_MAX]; char *e; - int fd; - FILE *f; if ((e = getDBPath(pathbuf, sizeof(pathbuf), SECRETFILE)) != NULL) return e; @@ -615,7 +613,9 @@ msab_pickSecret(char **generated_secret) return NULL; #endif #endif - +#if defined(HAVE_OPENSSL) || defined(HAVE_COMMONCRYPTO) +
MonetDB: oscar - Add/fix license text.
Changeset: 06e47ca47b78 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=06e47ca47b78 Modified Files: ctest/tools/monetdbe/backup.c ctest/tools/monetdbe/example_backup.c ctest/tools/monetdbe/test_helper.c ctest/tools/monetdbe/test_helper.h ctest/tools/monetdbe/test_helper_template.h geom/monetdb5/geom_funcs.mal misc/python/fixlicense.py monetdb5/mal/mal_prelude.h monetdb5/mal/mel.h sql/backends/monet5/sql_import.h sql/server/cmp_exp_eval.h sql/server/rel_outer_join_optimizer.h tools/monetdbe/monetdbe_mapi.c tools/monetdbe/monetdbe_mapi.h Branch: oscar Log Message: Add/fix license text. diffs (193 lines): diff --git a/ctest/tools/monetdbe/backup.c b/ctest/tools/monetdbe/backup.c --- a/ctest/tools/monetdbe/backup.c +++ b/ctest/tools/monetdbe/backup.c @@ -1,3 +1,10 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ #include "monetdb_config.h" #include "stream.h" diff --git a/ctest/tools/monetdbe/example_backup.c b/ctest/tools/monetdbe/example_backup.c --- a/ctest/tools/monetdbe/example_backup.c +++ b/ctest/tools/monetdbe/example_backup.c @@ -1,3 +1,10 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ #include "monetdb_config.h" #include diff --git a/ctest/tools/monetdbe/test_helper.c b/ctest/tools/monetdbe/test_helper.c --- a/ctest/tools/monetdbe/test_helper.c +++ b/ctest/tools/monetdbe/test_helper.c @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + #include "test_helper.h" #define _CONCAT(A, B) A##B diff --git a/ctest/tools/monetdbe/test_helper.h b/ctest/tools/monetdbe/test_helper.h --- a/ctest/tools/monetdbe/test_helper.h +++ b/ctest/tools/monetdbe/test_helper.h @@ -1,3 +1,10 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ #include "monetdbe.h" diff --git a/ctest/tools/monetdbe/test_helper_template.h b/ctest/tools/monetdbe/test_helper_template.h --- a/ctest/tools/monetdbe/test_helper_template.h +++ b/ctest/tools/monetdbe/test_helper_template.h @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + #include #ifndef EQUALS diff --git a/geom/monetdb5/geom_funcs.mal b/geom/monetdb5/geom_funcs.mal --- a/geom/monetdb5/geom_funcs.mal +++ b/geom/monetdb5/geom_funcs.mal @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + module geom; function AsText(w:wkb) :str; diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -125,6 +125,7 @@ suffixrules = { '.xs': ('/*',' */', ' * ', ''), '.y':('/*',' */', ' * ', ''), # we also match some complete filenames +'CMakeLists.txt': ('#[[', '#]]', '# ', ''), 'Makefile': ('', '', '# ', ''), '.merovingian_properties.in': ('', '', '# ', ''), 'configure.ag': ('', '', 'dnl ', ''), diff --git a/monetdb5/mal/mal_prelude.h b/monetdb5/mal/mal_prelude.h --- a/monetdb5/mal/mal_prelude.h +++ b/monetdb5/mal/mal_prelude.h @@ -1,4 +1,3 @@ - /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/monetdb5/mal/mel.h b/monetdb5/mal/mel.h --- a/monetdb5/mal/mel.h +++ b/monetdb5/mal/mel.h @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 -
MonetDB: oscar - Merge with Jun2020 branch.
Changeset: ed8fe60e504d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed8fe60e504d Added Files: sql/test/json/Tests/jsontext.Bug-6859.stable.err sql/test/json/Tests/jsontext.Bug-6859.stable.out Modified Files: NT/mkodbcwxs.py NT/mksqlwxs.py misc/python/fixlicense.py monetdb5/mal/mal.h monetdb5/modules/atoms/json.c monetdb5/modules/mal/tracer.c monetdb5/modules/mal/tracer.h sql/backends/monet5/UDF/pyapi3/pytypes.h sql/backends/monet5/sql_session.mal sql/backends/monet5/vaults/fits/72_fits.sql sql/common/sql_types.c sql/server/rel_distribute.c sql/storage/store.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out testing/exportutils.py testing/malcheck.py Branch: oscar Log Message: Merge with Jun2020 branch. diffs (truncated from 441 to 300 lines): diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mkodbcwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB-ODBC-Installer.wixobj diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mksqlwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB5-SQL-Installer.wixobj diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -177,7 +177,11 @@ def addlicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return -data = f.read() +try: +data = f.read() +except UnicodeError: +print('UnicodeError in file %s' % file, file=sys.stderr) +return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: @@ -282,7 +286,11 @@ def dellicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return -data = f.read() +try: +data = f.read() +except UnicodeError: +print('UnicodeError in file %s' % file, file=sys.stderr) +return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -98,7 +98,7 @@ mal_export void mal_reset(void); #define LIST_MAL_FLOW 128 /* output MAL dataflow dependencies */ #define LIST_MAL_CALL (LIST_MAL_NAME | LIST_MAL_VALUE ) #define LIST_MAL_DEBUG (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS | LIST_MAL_FLOW) -#define LIST_MAL_ALL (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS | LIST_MAL_MAPI) +#define LIST_MAL_ALL (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_MAPI) /* type check status is kept around to improve type checking efficiency */ #define TYPE_ERROR -1 diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1178,73 +1178,92 @@ JSONfilter(json *ret, json *js, str *exp // The json string should be valid static char * -JSONplaintext(char *r, size_t *l, JSON *jt, int idx, char sep) +JSONplaintext(char **r, size_t *l, size_t *ilen, JSON *jt, int idx, str sep, size_t sep_len) { int i; - size_t j; + unsigned int j, k; switch (jt->elm[idx].kind) { case JSON_OBJECT: for (i = jt->elm[idx].next; i; i = jt->elm[i].next) if (jt->elm[i].child) - r = JSONplaintext(r, l, jt, jt->elm[i].child, sep); + *r = JSONplaintext(r, l, ilen, jt,
MonetDB: Jun2020 - Add/fix license text.
Changeset: bdaf9438f9af for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bdaf9438f9af Modified Files: NT/mkodbcwxs.py NT/mksqlwxs.py buildtools/conf/fixlicense.py monetdb5/modules/mal/tracer.c monetdb5/modules/mal/tracer.h sql/backends/monet5/UDF/pyapi3/pytypes.h sql/backends/monet5/sql_session.mal sql/backends/monet5/vaults/fits/72_fits.sql sql/backends/monet5/vaults/lidar/75_lidar.sql sql/server/rel_distribute.c sql/storage/store.c testing/exportutils.py testing/malcheck.py Branch: Jun2020 Log Message: Add/fix license text. diffs (181 lines): diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mkodbcwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB-ODBC-Installer.wixobj diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mksqlwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB5-SQL-Installer.wixobj diff --git a/buildtools/conf/fixlicense.py b/buildtools/conf/fixlicense.py --- a/buildtools/conf/fixlicense.py +++ b/buildtools/conf/fixlicense.py @@ -177,7 +177,11 @@ def addlicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return -data = f.read() +try: +data = f.read() +except UnicodeError: +print('UnicodeError in file %s' % file, file=sys.stderr) +return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: @@ -282,7 +286,11 @@ def dellicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return -data = f.read() +try: +data = f.read() +except UnicodeError: +print('UnicodeError in file %s' % file, file=sys.stderr) +return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c --- a/monetdb5/modules/mal/tracer.c +++ b/monetdb5/modules/mal/tracer.c @@ -4,8 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - * - * + */ + +/* * GDKtracer exposes routines where an occuring failure should reach the * client immediately. For that reason, GDKtracer reports those errors * directly to the stream. diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h --- a/monetdb5/modules/mal/tracer.h +++ b/monetdb5/modules/mal/tracer.h @@ -4,9 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - * + */ + +/* * All the functions correspond one by one to the API calls in gdk_tracer.h - * */ #ifndef _TRACER_H diff --git a/sql/backends/monet5/UDF/pyapi3/pytypes.h b/sql/backends/monet5/UDF/pyapi3/pytypes.h --- a/sql/backends/monet5/UDF/pyapi3/pytypes.h +++ b/sql/backends/monet5/UDF/pyapi3/pytypes.h @@ -1,4 +1,4 @@ - /* +/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/sql/backends/monet5/sql_session.mal b/sql/backends/monet5/sql_session.mal --- a/sql/backends/monet5/sql_session.mal +++ b/sql/backends/monet5/sql_session.mal @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB
MonetDB: Jun2020 - Added test and fix for SQLancer query, ie whe...
Changeset: 05e97a4c3892 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=05e97a4c3892 Modified Files: sql/common/sql_types.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out Branch: Jun2020 Log Message: Added test and fix for SQLancer query, ie when checking check that the types of all EC_ANY's are equal, skip if one is already EC_ANY diffs (59 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -603,7 +603,7 @@ sql_dup_subfunc(sql_allocator *sa, sql_f sql_arg *s = m->data; if (s->type.type->eclass == EC_ANY) { - if (!st) + if (!st || st->type->eclass == EC_ANY) /* if input parameter is ANY, skip validation */ st = tn->data; else if (subtype_cmp(st, tn->data)) return NULL; diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql b/sql/test/SQLancer/Tests/sqlancer03.sql --- a/sql/test/SQLancer/Tests/sqlancer03.sql +++ b/sql/test/SQLancer/Tests/sqlancer03.sql @@ -15,3 +15,12 @@ SELECT v0.c0 FROM t0 FULL OUTER JOIN v0 -- empty ROLLBACK; + +START TRANSACTION; -- Bug 6918 +CREATE TABLE "sys"."t0" ("c0" BOOLEAN NOT NULL,"c1" BIGINT,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0")); +create view v0(c0, c1, c2) as (select all 2.020551048E9, 0.16688174, 0.373226221729 from t0 where t0.c0) with check option; +SELECT sql_min(sql_max(NULL, ''), '') FROM v0 LEFT OUTER JOIN t0 ON true; +SELECT sql_min(sql_max(NULL, ''), ''); +SELECT ALL length(upper(MIN(ALL CAST(((trim(CAST(r'' AS STRING(659)), CAST(r'o3%+i]抔DCöf▟nßOpNbybಜ7' AS STRING)))||(sql_min(sql_max(NULL, r''), splitpart(r'x', r',7+.', t0.c1 AS STRING(151), 0.4179268710155164 +FROM v0 LEFT OUTER JOIN t0 ON NOT (t0.c0) WHERE t0.c0 GROUP BY 0.3584962, CAST(t0.c1 AS STRING(601)), t0.c1; +ROLLBACK; diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out b/sql/test/SQLancer/Tests/sqlancer03.stable.out --- a/sql/test/SQLancer/Tests/sqlancer03.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out @@ -39,6 +39,27 @@ stdout of test 'sqlancer03` in directory % smallint # type % 1 # length #ROLLBACK; +#START TRANSACTION; +#CREATE TABLE "sys"."t0" ("c0" BOOLEAN NOT NULL,"c1" BIGINT,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0")); +#create view v0(c0, c1, c2) as (select all 2.020551048E9, 0.16688174, 0.373226221729 from t0 where t0.c0) with check option; +#SELECT sql_min(sql_max(NULL, ''), '') FROM v0 LEFT OUTER JOIN t0 ON true; +% .%12 # table_name +% %12 # name +% char # type +% 0 # length +#SELECT sql_min(sql_max(NULL, ''), ''); +% .%2 # table_name +% %2 # name +% char # type +% 0 # length +[ NULL ] +#SELECT ALL length(upper(MIN(ALL CAST(((trim(CAST(r'' AS STRING(659)), CAST(r'o3%+i]抔DCöf▟nßOpNbybಜ7' AS STRING)))||(sql_min(sql_max(NULL, r''), splitpart(r'x', r',7+.', t0.c1 AS STRING(151), 0.4179268710155164 +#FROM v0 LEFT OUTER JOIN t0 ON NOT (t0.c0) WHERE t0.c0 GROUP BY 0.3584962, CAST(t0.c1 AS STRING(601)), t0.c1; +% .%24,.%25 # table_name +% %24, %25 # name +% int, decimal # type +% 1, 19 # length +#ROLLBACK; # 17:14:16 > # 17:14:16 > "Done." ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Approve test results
Changeset: e0da98ef090f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e0da98ef090f Added Files: sql/test/json/Tests/jsontext.Bug-6859.stable.err sql/test/json/Tests/jsontext.Bug-6859.stable.out Branch: Jun2020 Log Message: Approve test results diffs (52 lines): diff --git a/sql/test/json/Tests/jsontext.Bug-6859.stable.err b/sql/test/json/Tests/jsontext.Bug-6859.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/json/Tests/jsontext.Bug-6859.stable.err @@ -0,0 +1,12 @@ +stderr of test 'jsontext.Bug-6859` in directory 'sql/test/json` itself: + + +# 10:51:41 > +# 10:51:41 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-2739722" "--port=39078" +# 10:51:41 > + + +# 10:51:41 > +# 10:51:41 > "Done." +# 10:51:41 > + diff --git a/sql/test/json/Tests/jsontext.Bug-6859.stable.out b/sql/test/json/Tests/jsontext.Bug-6859.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/json/Tests/jsontext.Bug-6859.stable.out @@ -0,0 +1,30 @@ +stdout of test 'jsontext.Bug-6859` in directory 'sql/test/json` itself: + + +# 10:51:41 > +# 10:51:41 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-2739722" "--port=39078" +# 10:51:41 > + +#select json.text(json '[1,2,3,4]', 'a'); +% .%2 # table_name +% %2 # name +% clob # type +% 7 # length +[ "1a2a3a4"] +#select json.text(json '[1,2,3,4]', 'ax'); +% .%2 # table_name +% %2 # name +% clob # type +% 10 # length +[ "1ax2ax3ax4" ] +#select json.text(json '[1,2,3,4]', 'test'); +% .%2 # table_name +% %2 # name +% clob # type +% 16 # length +[ "1test2test3test4" ] + +# 10:51:41 > +# 10:51:41 > "Done." +# 10:51:41 > + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Allow for whole strings as separators in JSOn...
Changeset: 76211429a963 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=76211429a963 Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/json.h Branch: Jun2020 Log Message: Allow for whole strings as separators in JSOnplaintext The idea is to check if there is enough space in the output string and realloc it if there isn't, before copying the value and the separator. diffs (161 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1142,73 +1142,92 @@ JSONfilter(json *ret, json *js, str *exp // The json string should be valid static char * -JSONplaintext(char *r, size_t *l, JSON *jt, int idx, char sep) +JSONplaintext(char **r, size_t *l, size_t *ilen, JSON *jt, int idx, str sep, size_t sep_len) { int i; - size_t j; + unsigned int j, k; switch (jt->elm[idx].kind) { case JSON_OBJECT: for (i = jt->elm[idx].next; i; i = jt->elm[i].next) if (jt->elm[i].child) - r = JSONplaintext(r, l, jt, jt->elm[i].child, sep); + *r = JSONplaintext(r, l, ilen, jt, jt->elm[i].child, sep, sep_len); break; case JSON_ARRAY: for (i = jt->elm[idx].next; i; i = jt->elm[i].next) - r = JSONplaintext(r, l, jt, i, sep); + *r = JSONplaintext(r, l, ilen, jt, i, sep, sep_len); break; case JSON_ELEMENT: case JSON_VALUE: if (jt->elm[idx].child) - r = JSONplaintext(r, l, jt, jt->elm[idx].child, sep); + *r = JSONplaintext(r, l, ilen, jt, jt->elm[idx].child, sep, sep_len); break; - case JSON_STRING: - for (j = 1; *l > 1 && j < jt->elm[idx].valuelen - 1; j++) { + case JSON_STRING: + // Make sure there is enough space for the value plus the separator plus the NULL byte + if (*l < jt->elm[idx].valuelen - 2 + sep_len + 1) { + char *p = *r - *ilen + *l; + *ilen *= 2; + *r = GDKrealloc(p, *ilen); + *r += *l; + *l = *ilen - *l; + } + for (j = 1; j < jt->elm[idx].valuelen - 1; j++) { if (jt->elm[idx].value[j] == '\\') - *r = jt->elm[idx].value[++j]; + **r = jt->elm[idx].value[++j]; else - *r = jt->elm[idx].value[j]; - r++; - (*l)--; - } - if (*l > 1 && sep) { - *r++ = sep; + **r = jt->elm[idx].value[j]; + (*r)++; (*l)--; } + for(k = 0; k < sep_len; k++) { + **r = *(sep + k); + (*r)++; + } + (*l) -= k; break; default: - for (j = 0; *l > 1 && j < jt->elm[idx].valuelen; j++) { - *r = jt->elm[idx].value[j]; - r++; + if (*l < jt->elm[idx].valuelen + sep_len + 1) { + unsigned int offset = *ilen - *l; + char *p = *r - offset; + *ilen *= 2; + *r = GDKrealloc(p, *ilen); + *r += offset; + *l = *ilen - offset; + } + for (j = 0; j < jt->elm[idx].valuelen; j++) { + **r = jt->elm[idx].value[j]; + (*r)++; (*l)--; } - if (*l > 1 && sep) { - *r++ = sep; - (*l)--; + for(k = 0; k < sep_len; k++) { + **r = *(sep + k); + (*r)++; } + (*l) -= k; } assert(*l > 0); - *r = 0; - return r; + **r = 0; + return *r; } str JSONjson2text(str *ret, json *js) { JSON *jt; - size_t l; + size_t l, ilen; str s; jt = JSONparse(*js); CHECK_JSON(jt); - l = strlen(*js) + 1; + ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { JSONfree(jt); throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - JSONplaintext(s, , jt, 0, ' '); + s = JSONplaintext(, , , jt, 0, " ", 1); + s -= ilen - l; l = strlen(s); if (l) s[l - 1] = 0; @@ -1221,22 +1240,23 @@ str JSONjson2textSeparator(str *ret, json *js, str *sep) {
MonetDB: default - more alloction cleanup
Changeset: 11921e6a3683 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=11921e6a3683 Modified Files: sql/backends/monet5/sql_scenario.c sql/server/rel_psm.c sql/server/rel_schema.c sql/server/sql_scan.c sql/server/sql_scan.h Branch: default Log Message: more alloction cleanup diffs (133 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -888,10 +888,7 @@ SQLparser(Client c) int pstatus = 0; int err = 0, opt, preparedid = -1; - /* clean up old stuff */ - GDKfree(c->query); /* may be NULL */ c->query = NULL; - be = (backend *) c->sqlcontext; if (be == 0) { /* leave a message in the log */ @@ -1040,7 +1037,7 @@ SQLparser(Client c) * produce code. */ be->q = NULL; - c->query = query_cleaned(QUERY(m->scanner)); + c->query = query_cleaned(m->sa, QUERY(m->scanner)); if (c->query == NULL) { err = 1; @@ -1192,7 +1189,6 @@ SQLparser(Client c) finalize: if (msg) { sqlcleanup(be, 0); - GDKfree(c->query); c->query = NULL; } return msg; diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -991,9 +991,8 @@ rel_create_func(sql_query *query, dlist sql_schema *os = cur_schema(sql); if (create) { /* needed for recursive functions */ - q = query_cleaned(q); + q = query_cleaned(sql->ta, q); sql->forward = f = mvc_create_func(sql, sql->sa, s, fname, l, restype, type, lang, "user", q, q, FALSE, vararg, FALSE); - GDKfree(q); } sql->session->schema = s; b = sequential_block(query, (ra)?>type:NULL, ra?NULL:restype, body, NULL, is_func); @@ -1020,22 +1019,18 @@ rel_create_func(sql_query *query, dlist return NULL; sql->params = NULL; if (create) { - q = query_cleaned(q); + q = query_cleaned(sql->ta, q); f = mvc_create_func(sql, sql->sa, s, fname, l, restype, type, lang, fmod, fnme, q, FALSE, vararg, FALSE); - GDKfree(q); } else if (!sf) { return sql_error(sql, 01, SQLSTATE(42000) "CREATE %s: external name %s.%s not bound (%s.%s)", F, fmod, fnme, s->base.name, fname ); } else { sql_func *f = sf->func; if (!f->mod || strcmp(f->mod, fmod)) - f->mod = _STRDUP(fmod); + f->mod = (f->sa)?sa_strdup(f->sa, fmod):sa_strdup(sql->pa, fmod); if (!f->imp || strcmp(f->imp, fnme)) - f->imp = (f->sa)?sa_strdup(f->sa, fnme):_STRDUP(fnme); - if (!f->mod || !f->imp) { - _DELETE(f->mod); - _DELETE(f->imp); + f->imp = (f->sa)?sa_strdup(f->sa, fnme):sa_strdup(sql->pa, fnme); + if (!f->mod || !f->imp) return sql_error(sql, 02, SQLSTATE(HY013) "CREATE %s: could not allocate space", F); - } f->sql = 0; /* native */ f->lang = FUNC_LANG_INT; } @@ -1321,12 +1316,11 @@ create_trigger(sql_query *query, dlist * default: return sql_error(sql, 02, SQLSTATE(42000) "%s TRIGGER: invalid event: %s", base, token2string(trigger_event->token)); } - orientation = triggered_action->h->data.i_val; - q = query_cleaned(QUERY(sql->scanner)); assert(triggered_action->h->type == type_int); + orientation = triggered_action->h->data.i_val; + q = query_cleaned(sql->ta, QUERY(sql->scanner)); r = rel_create_trigger(sql, t->s->base.name, t->base.name, triggername, time, orientation, event, old_name, new_name, condition, q); - GDKfree(q); return r; } diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c --- a/sql/server/rel_schema.c +++ b/sql/server/rel_schema.c @@ -1185,9 +1185,8 @@ rel_create_view(sql_query *query, sql_sc }
MonetDB: default - Allocation checks
Changeset: a07a05c5c5c8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a07a05c5c5c8 Modified Files: sql/backends/monet5/sql_scenario.c Branch: default Log Message: Allocation checks diffs (51 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -226,7 +226,12 @@ SQLprepareClient(Client c, int login) str msg = MAL_SUCCEED; if (c->sqlcontext == 0) { - m = mvc_create(sa_create(NULL), c->idx, SQLdebug, c->fdin, c->fdout); + sql_allocator *sa = sa_create(NULL); + if (sa == NULL) { + msg = createException(SQL,"sql.initClient", SQLSTATE(HY013) MAL_MALLOC_FAIL); + goto bailout; + } + m = mvc_create(sa, c->idx, SQLdebug, c->fdin, c->fdout); if (m == NULL) { msg = createException(SQL,"sql.initClient", SQLSTATE(HY013) MAL_MALLOC_FAIL); goto bailout; @@ -265,8 +270,9 @@ SQLprepareClient(Client c, int login) } bailout: - /*expect SQL text first */ - be->language = 'S'; + /* expect SQL text first */ + if (be) + be->language = 'S'; /* Set state, this indicates an initialized client scenario */ c->state[MAL_SCENARIO_READER] = c; c->state[MAL_SCENARIO_PARSER] = c; @@ -325,6 +331,7 @@ SQLinit(Client c) static int maybeupgrade = 1; backend *be = NULL; mvc *m = NULL; + sql_allocator *sa = NULL; MT_lock_set(_contextLock); @@ -345,7 +352,12 @@ SQLinit(Client c) SQLdebug |= 64; if (readonly) SQLdebug |= 32; - if ((SQLnewcatalog = mvc_init(sa_create(NULL), SQLdebug, GDKinmemory() ? store_mem : store_bat, readonly, single_user)) < 0) { + + if (!(sa = sa_create(NULL))) { + MT_lock_unset(_contextLock); + throw(SQL,"sql.init",SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + if ((SQLnewcatalog = mvc_init(sa, SQLdebug, GDKinmemory() ? store_mem : store_bat, readonly, single_user)) < 0) { MT_lock_unset(_contextLock); throw(SQL, "SQLinit", SQLSTATE(42000) "Catalogue initialization failed"); } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Initialize variable after setjmp.
Changeset: 06cce85577d7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=06cce85577d7 Modified Files: sql/backends/monet5/sql_scenario.c Branch: default Log Message: Initialize variable after setjmp. diffs (20 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -874,7 +874,7 @@ SQLparser(Client c) mvc *m; int oldvtop, oldstop; int pstatus = 0; - int err = 0, opt = 0, preparedid = -1; + int err = 0, opt, preparedid = -1; /* clean up old stuff */ GDKfree(c->query); /* may be NULL */ @@ -915,6 +915,7 @@ SQLparser(Client c) throw(SQL, "SQLparser", SQLSTATE(HY001) MAL_MALLOC_FAIL " for SQL allocator"); } + opt = 0; m->emode = m_normal; m->emod = mod_none; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list