Changeset: 503c8dae0cbe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=503c8dae0cbe Modified Files: gdk/gdk_calc.c sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in-cast.Bug-6561.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-wrong-select-not-between.Bug-6511.stable.out testing/Mtest.py.in Branch: default Log Message:
Merge with Nov2019 branch. diffs (truncated from 319 to 300 lines): diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -12757,16 +12757,46 @@ VARcalcrsh(ValPtr ret, const ValRecord * /* ---------------------------------------------------------------------- */ /* between (any "linear" type) */ +#define LTbte(a,b) ((a) < (b)) +#define LTsht(a,b) ((a) < (b)) +#define LTint(a,b) ((a) < (b)) +#define LTlng(a,b) ((a) < (b)) +#define LThge(a,b) ((a) < (b)) +#define LTflt(a,b) ((a) < (b)) +#define LTdbl(a,b) ((a) < (b)) +#define LTany(a,b) ((*atomcmp)(a, b) < 0) +#define EQbte(a,b) ((a) == (b)) +#define EQsht(a,b) ((a) == (b)) +#define EQint(a,b) ((a) == (b)) +#define EQlng(a,b) ((a) == (b)) +#define EQhge(a,b) ((a) == (b)) +#define EQflt(a,b) ((a) == (b)) +#define EQdbl(a,b) ((a) == (b)) +#define EQany(a,b) ((*atomcmp)(a, b) == 0) + +#define is_any_nil(v) ((v) == NULL || (*atomcmp)((v), nil) == 0) + +#define less3(a,b,i,t) (is_##t##_nil(a) || is_##t##_nil(b) ? bit_nil : LT##t(a, b) || (i && EQ##t(a, b))) +#define grtr3(a,b,i,t) (is_##t##_nil(a) || is_##t##_nil(b) ? bit_nil : LT##t(b, a) || (i && EQ##t(a, b))) +#define and3(a,b) (is_bit_nil(a) ? is_bit_nil(b) || (b) ? bit_nil : 0 : is_bit_nil(b) ? (a) ? bit_nil : 0 : (a) && (b)) +#define or3(a,b) (is_bit_nil(a) ? (is_bit_nil(b) || !(b) ? bit_nil : 1) : ((a) ? 1 : (is_bit_nil(b) ? bit_nil : (b)))) +#define not3(a) (is_bit_nil(a) ? bit_nil : !(a)) + +#define between3(v, lo, linc, hi, hinc, TYPE) \ + and3(grtr3(v, lo, linc, TYPE), less3(v, hi, hinc, TYPE)) + #define BETWEEN(v, lo, hi, TYPE) \ (is_##TYPE##_nil(v) \ - ? nils_false ? 0 : (nils++, bit_nil) \ - : (is_##TYPE##_nil(lo) || is_##TYPE##_nil(hi) \ - ? (nils++, bit_nil) \ - : (bit) (((((lo) < (v) || (linc && (lo) == (v))) && \ - ((v) < (hi) || (hinc && (v) == (hi)))) || \ - (symmetric && \ - ((hi) < (v) || (hinc && (hi) == (v))) && \ - ((v) < (lo) || (linc && (v) == (lo))))) ^ anti))) + ? nils_false ? 0 : bit_nil \ + : (bit) (anti \ + ? (symmetric \ + ? not3(or3(between3(v, lo, linc, hi, hinc, TYPE), \ + between3(v, hi, hinc, lo, linc, TYPE))) \ + : not3(between3(v, lo, linc, hi, hinc, TYPE))) \ + : (symmetric \ + ? or3(between3(v, lo, linc, hi, hinc, TYPE), \ + between3(v, hi, hinc, lo, linc, TYPE)) \ + : between3(v, lo, linc, hi, hinc, TYPE)))) #define BETWEEN_LOOP_TYPE(TYPE) \ do { \ @@ -12781,6 +12811,7 @@ VARcalcrsh(ValPtr ret, const ValRecord * ((const TYPE *) lo)[j], \ ((const TYPE *) hi)[k], \ TYPE); \ + nils += is_bit_nil(dst[l]); \ } \ } while (0) @@ -12862,34 +12893,8 @@ BATcalcbetween_intern(const void *src, i p3 = hp3 ? (const void *) (hp3 + VarHeapVal(hi, k, wd3)) : (const void *) ((const char *) hi + hoff); - if (p1 == NULL || p2 == NULL || p3 == NULL) { - nils++; - dst[l] = bit_nil; - } else if ((*atomcmp)(p1, nil) == 0) { - if (nils_false) - dst[l] = 0; - else { - nils++; - dst[l] = bit_nil; - } - } else if ((*atomcmp)(p2, nil) == 0 || - (*atomcmp)(p3, nil) == 0) { - nils++; - dst[l] = bit_nil; - } else { - int c; - dst[l] = (bit) - (((((c = (*atomcmp)(p1, p2)) > 0 - || (linc && c == 0)) - && ((c = (*atomcmp)(p1, p3)) < 0 - || (hinc && c == 0))) - || (symmetric - && ((c = (*atomcmp)(p1, p3)) > 0 - || (hinc && c == 0)) - && ((c = (*atomcmp)(p1, p2)) < 0 - || (linc && c == 0)))) - ^ anti); - } + dst[l] = BETWEEN(p1, p2, p3, any); + nils += is_bit_nil(dst[l]); } break; } @@ -13083,7 +13088,6 @@ VARcalcbetween(ValPtr ret, const ValReco const ValRecord *hi, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti) { - BUN nils = 0; /* to make reusing BETWEEN macro easier */ int t; int (*atomcmp)(const void *, const void *); const void *nil; @@ -13128,28 +13132,9 @@ VARcalcbetween(ValPtr ret, const ValReco default: nil = ATOMnilptr(t); atomcmp = ATOMcompare(t); - if (atomcmp(VALptr(v), nil) == 0) - ret->val.btval = nils_false ? 0 : bit_nil; - else if (atomcmp(VALptr(lo), nil) == 0 || - atomcmp(VALptr(hi), nil) == 0) - ret->val.btval = bit_nil; - else { - int c; - ret->val.btval = (bit) - (((((c = atomcmp(VALptr(v), VALptr(lo))) > 0 || - (linc && c == 0)) && - ((c = atomcmp(VALptr(v), VALptr(hi)) < 0 || - (hinc && c == 0)))) || - (symmetric && - ((c = atomcmp(VALptr(v), VALptr(hi))) > 0 || - (hinc && c == 0)) && - ((c = atomcmp(VALptr(v), VALptr(lo))) < 0 || - (linc && c == 0)))) - ^ anti); - } - break; - } - (void) nils; + ret->val.btval = BETWEEN(VALptr(v), VALptr(lo), VALptr(hi), any); + break; + } return GDK_SUCCEED; } diff --git a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out --- a/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out +++ b/sql/test/BugTracker-2017/Tests/sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496.stable.out @@ -44,17 +44,22 @@ stdout of test 'sqlitelogictest-comparis [ 1 ] #INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv'); [ 1 ] -#SELECT * FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 +#SELECT * FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; % sys.cor0, sys.cor0, sys.cor0, sys.cor0, sys.cor0, sys.cor0, sys.cor0 # table_name % pk, col0, col1, col2, col3, col4, col5 # name % int, int, double, clob, int, double, clob # type -% 1, 1, 24, 0, 1, 24, 0 # length +% 1, 3, 24, 5, 3, 24, 5 # length +[ 0, 698, 169.42, "apdbu", 431, 316.15, "sqvis" ] +[ 4, 754, 677.3, "iofrg", 67, 665.49, "bzqba" ] +[ 6, 904, 193.16, "eozui", 48, 698.55, "ejyzs" ] +[ 8, 535, 18.11, "ijika", 630, 489.63, "hpnyu" ] +[ 9, 501, 776.4, "cvygg", 725, 75.5, "etlyv" ] #SELECT + - COUNT ( * ) FROM tab0 AS cor0 WHERE NOT ( - col0 ) BETWEEN - + col4 AND NULL; --should be -5 -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % bigint # type -% 1 # length -[ 0 ] +% 2 # length +[ -5 ] #DROP TABLE tab0; #CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER); #INSERT INTO tab1 VALUES(51,14,96); @@ -69,8 +74,8 @@ stdout of test 'sqlitelogictest-comparis % int, int, int # type % 1, 1, 1 # length #SELECT ALL + COUNT ( DISTINCT 64 ) FROM tab1 AS cor0 WHERE col2 + 5 > NULL; --should be 0 -% .L4 # table_name -% L3 # name +% .L2 # table_name +% L2 # name % bigint # type % 1 # length [ 0 ] diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.stable.out b/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.stable.out --- a/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.stable.out +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.stable.out @@ -36,7 +36,25 @@ stdout of test 'sqlitelogictest-algebra- % sys.tab2, sys.tab2, sys.tab2, sys.cor0, sys.cor0, sys.cor0, sys.tab1, sys.tab1, sys.tab1 # table_name % col0, col1, col2, col0, col1, col2, col0, col1, col2 # name % int, int, int, int, int, int, int, int, int # type -% 1, 1, 1, 1, 1, 1, 1, 1, 1 # length +% 2, 2, 2, 2, 2, 2, 2, 2, 2 # length +[ 79, 17, 38, 64, 10, 57, 64, 10, 57 ] +[ 79, 17, 38, 64, 10, 57, 3, 26, 54 ] +[ 79, 17, 38, 64, 10, 57, 80, 13, 96 ] +[ 78, 59, 26, 64, 10, 57, 64, 10, 57 ] +[ 78, 59, 26, 64, 10, 57, 3, 26, 54 ] +[ 78, 59, 26, 64, 10, 57, 80, 13, 96 ] +[ 79, 17, 38, 3, 26, 54, 64, 10, 57 ] +[ 79, 17, 38, 3, 26, 54, 3, 26, 54 ] +[ 79, 17, 38, 3, 26, 54, 80, 13, 96 ] +[ 78, 59, 26, 3, 26, 54, 64, 10, 57 ] +[ 78, 59, 26, 3, 26, 54, 3, 26, 54 ] +[ 78, 59, 26, 3, 26, 54, 80, 13, 96 ] +[ 79, 17, 38, 80, 13, 96, 64, 10, 57 ] +[ 79, 17, 38, 80, 13, 96, 3, 26, 54 ] +[ 79, 17, 38, 80, 13, 96, 80, 13, 96 ] +[ 78, 59, 26, 80, 13, 96, 64, 10, 57 ] +[ 78, 59, 26, 80, 13, 96, 3, 26, 54 ] +[ 78, 59, 26, 80, 13, 96, 80, 13, 96 ] #SELECT ALL * FROM tab1, tab2, tab2 AS cor0 WHERE + tab2.col2 BETWEEN ( tab1.col0 ) AND NULL; % sys.tab1, sys.tab1, sys.tab1, sys.tab2, sys.tab2, sys.tab2, sys.cor0, sys.cor0, sys.cor0 # table_name % col0, col1, col2, col0, col1, col2, col0, col1, col2 # name diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in-cast.Bug-6561.stable.out b/sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in-cast.Bug-6561.stable.out --- a/sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in-cast.Bug-6561.stable.out +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-having-in-cast.Bug-6561.stable.out @@ -26,9 +26,9 @@ stdout of test 'sqlitelogictest-groupby- #CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER); #INSERT INTO tab0 VALUES(83,0,38), (26,0,79), (43,81,24); [ 3 ] -#SELECT - col0 * - + 8 + + + col0 + + + col0 + + + 42 * col0 FROM tab0 GROUP BY col0, col0, col1 HAVING NOT 18 + - col0 IN ( + CAST ( + col0 AS INTEGER ) ); -% sys.L2 # table_name -% L2 # name +#SELECT CAST (- col0 * - + 8 + + + col0 + + + col0 + + + 42 * col0 AS BIGINT) FROM tab0 GROUP BY col0, col0, col1 HAVING NOT 18 + - col0 IN ( + CAST ( + col0 AS INTEGER ) ); +% sys.L1 # table_name +% L1 # name % bigint # type % 4 # length [ 4316 ] @@ -38,7 +38,10 @@ stdout of test 'sqlitelogictest-groupby- % sys.cor0 # table_name % col2 # name % int # type -% 1 # length +% 2 # length +[ 38 ] +[ 79 ] +[ 24 ] #DROP TABLE tab0; # 16:15:04 > diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.stable.out b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.stable.out --- a/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.stable.out +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-having-not-null-not-in.Bug-6557.stable.out @@ -49,13 +49,17 @@ stdout of test 'sqlitelogictest-having-n % sys.L3 # table_name % L3 # name % bigint # type -% 1 # length +% 3 # length [ 126 ] -#finish +#debug SELECT CAST(SUM(col0) AS BIGINT) FROM tab0 WHERE + + col0 NOT BETWEEN NULL AND + col2; +mdb>#X_2=0@0:void := querylog.define("debug select cast(sum(col0) as bigint) from tab0 where + + col0 not between null and + col2;", "default_pipe", 24:int); +mdb>#barrier X_139=false := language.dataflow(); +mdb>#X_5=0 := sql.mvc(); +mdb>#X_94=nil:bat[:int] := sql.bind(X_5=0, "sys", "tab0", "col0", 0:int, 0:int, 3:int); % sys.L3 # table_name % L3 # name % bigint # type -% 1 # length +% 3 # length [ 126 ] mdb>#EOD #DROP TABLE tab0; diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-wrong-select-not-between.Bug-6511.stable.out b/sql/test/BugTracker-2018/Tests/sqlitelogictest-wrong-select-not-between.Bug-6511.stable.out --- a/sql/test/BugTracker-2018/Tests/sqlitelogictest-wrong-select-not-between.Bug-6511.stable.out +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-wrong-select-not-between.Bug-6511.stable.out @@ -31,10 +31,13 @@ stdout of test 'sqlitelogictest-wrong-se #INSERT INTO tab2 VALUES(46,51,23); [ 1 ] #SELECT ALL - col0 / col0 FROM tab2 cor0 WHERE - col0 NOT BETWEEN ( + col1 + - 0 ) AND ( NULL ); -% sys.L2 # table_name -% L2 # name +% sys.L1 # table_name +% L1 # name % int # type -% 1 # length +% 2 # length +[ -1 ] +[ -1 ] +[ -1 ] #DROP TABLE tab2; # 11:35:41 > diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -632,9 +632,7 @@ def Usage (options) : try: monet_options.usage(options, '%s [options] ( [<dir>] [<tests>] | [<dirs>] )' % THISFILE) except monet_options.Error: - pass - - sys.stderr.write(""" + sys.stderr.write(""" <dir> : if present, %(prog)s behaves as if called in <dir> _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list