MonetDB: default - approved output
Changeset: e97055c37ca4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e97055c37ca4 Branch: default Log Message: approved output diffs (153 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -2179,11 +2179,11 @@ rel_logical_value_exp(sql_query *query, if (!rs) return NULL; - if (ls && rs && exp_is_null(ls) && exp_is_null(rs)) - return exp_convert(sql->sa, ls, exp_subtype(ls), sql_bind_localtype("bit")); - if (rel_binop_check_types(sql, rel ? *rel : NULL, ls, rs, 0) < 0) return NULL; + if (exp_is_null(ls) && exp_is_null(rs)) + return exp_atom(sql->sa, atom_general(sql->sa, sql_bind_localtype("bit"), NULL)); + ls = exp_compare_func(sql, ls, rs, compare_func(compare_str2type(compare_op), quantifier?0:need_not), quantifier); if (need_not && quantifier) ls = rel_unop_(sql, NULL, ls, NULL, "not", card_value); diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.out b/sql/test/miscellaneous/Tests/groupby_error.stable.out --- a/sql/test/miscellaneous/Tests/groupby_error.stable.out +++ b/sql/test/miscellaneous/Tests/groupby_error.stable.out @@ -151,8 +151,8 @@ stdout of test 'groupby_error` in direct % bigint # type % 1 # length #SELECT NOT ( NOT + - CAST ( NULL AS INTEGER ) NOT IN ( col0 / CAST ( col2 AS INTEGER ) - + col1 ) ) FROM tab0 AS cor0; -% .%4 # table_name -% %4 # name +% .%3 # table_name +% %3 # name % boolean # type % 5 # length [ NULL ] @@ -191,8 +191,8 @@ project ( % 2 # length [ 64 ] #SELECT 11 FROM tab1 AS cor0 LEFT JOIN tab0 ON 80 = 70; -% .%6 # table_name -% %6 # name +% .%4 # table_name +% %4 # name % tinyint # type % 2 # length [ 11 ] @@ -218,8 +218,8 @@ project ( % int, int,int # type % 1, 1, 1 # length #SELECT CAST(+ col2 * col2 AS BIGINT) FROM tab2 AS cor0 WHERE NOT - CAST ( NULL AS INTEGER ) <> - - col1 AND NOT NULL NOT BETWEEN ( NULL ) AND - 91 - - + 27 * + col2; -% sys.%2 # table_name -% %2 # name +% sys.%1 # table_name +% %1 # name % bigint # type % 1 # length #SELECT + 2 FROM tab0 AS cor0 WHERE NOT - 29 IS NULL OR NOT NULL IS NULL AND NOT NULL BETWEEN + col1 - + 60 AND + 37 * + col1 + + col0; @@ -434,21 +434,21 @@ project ( [ 1303 ] #SELECT CAST(- 4 * + COUNT ( * ) + 22 + 69 AS BIGINT) AS col2, CAST(- ( + CASE + 85 WHEN - 77 / - CAST ( + CASE - + 51 WHEN 79 THEN + 95 + 13 * ( 60 * 77 ) END AS INTEGER ) + + 82 - COUNT ( * ) * COUNT ( * ) THEN #NULL WHEN SUM ( ALL 99 ) THEN COUNT ( * ) ELSE COUNT ( * ) * - ( COUNT ( * ) ) END ) * 46 - 83 AS BIGINT); -% ., .%11 # table_name -% col2,%11 # name +% ., .%4 # table_name +% col2,%4 # name % bigint, bigint # type % 2, 3 # length [ 87, -37 ] #SELECT DISTINCT CAST(- CAST ( CASE 81 WHEN 48 - - 3 / - - 47 - - CAST ( NULL AS INTEGER ) THEN NULL WHEN COUNT ( * ) THEN + - 91 + + 43 ELSE + - 0 END AS INTEGER ) AS BIGINT) AS col0, CAST(- 27 * + 43 AS BIGINT); -% ., .%5 # table_name -% col0,%5 # name +% ., .%4 # table_name +% col0,%4 # name % bigint, bigint # type % 1, 5 # length [ 0, -1161 ] #SELECT DISTINCT CAST(66 * - + CAST ( - - COUNT ( * ) AS INTEGER ) * 54 * + CASE 68 WHEN - 56 * + CAST ( NULL AS INTEGER ) + + + 47 THEN #- 83 ELSE + 59 + - COUNT ( * ) - 26 * ( 59 ) * 11 - - + COUNT ( * ) * - 73 END + + COUNT ( * ) / + ( 86 + 19 * 90 ) AS BIGINT); -% .%7 # table_name -% %7 # name +% .%3 # table_name +% %3 # name % bigint # type % 8 # length [ 60192396 ] @@ -465,6 +465,41 @@ project ( % bigint # type % 1 # length [ 1] +#SELECT DISTINCT CAST(COALESCE ( + 38, - - ( - 70 ) * 52 + + 91 + - 47 ) + + CAST ( - 54 AS REAL ) / + 68 / + ( - 92 ) * - - CASE WHEN NULL >= NULL THEN COUNT ( * ) WHEN - COUNT ( * ) IS NULL +#THEN NULL ELSE NULL END * + 28 * - 58 + COUNT ( * ) + + COUNT ( * ) AS BIGINT); +% .%3 # table_name +% %3 # name +% bigint # type +% 1 # length +[ NULL ] +#SELECT DISTINCT CAST(- ( COUNT ( * ) ) / + CASE 28 * + 72 + - 45 * + 2 WHEN - 14 THEN NULL WHEN 37 THEN - COALESCE ( CASE WHEN + 17 IS NOT NULL THEN ( + ( - 39 ) ) WHEN NOT NULL = ( NULL ) +#THEN NULL ELSE 52 END, - COUNT ( * ) * - 80, + NULLIF ( CASE - 70 WHEN 48 + 63 THEN NULL ELSE 89 * + 57 END, + 15 ) + - CASE + 19 WHEN - 97 THEN + 66 + - 25 END ) * + 79 + 93 * 21 END AS BIGINT) AS col1; +% . # table_name +% col1 # name +% bigint # type +% 1 # length +[ NULL ] +#START TRANSACTION; +#CREATE TABLE "tab0" ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO "tab0" VALUES (83, 0, 38), (26, 0, 79), (43, 81, 24); +[ 3] +#ROLLBACK; +#START TRANSACTION; +#CREATE TABLE tab2 ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO tab2 VALUES(64,77,40), (75,67,58), (46,51,23); +[ 3] +#ROLLBACK; +#START
MonetDB: default - make sure a between (l.a 'const' <= l.l <= r....
Changeset: 3dd57abc3260 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3dd57abc3260 Modified Files: sql/backends/monet5/rel_bin.c Branch: default Log Message: make sure a between (l.a 'const' <= l.l <= r.a) is seen as a select expression (ie in sqlancer02 test we need a cross first). TODO create optimizer to split this between and to check better for constants. diffs (19 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 @@ -2244,11 +2244,11 @@ split_join_exps(sql_rel *rel, list *join int nrcr1 = 0, nrcr2 = 0, nrcl1 = 0, nrcl2 = 0; if ((ll && !rl && - ((rr && !lr) || (nrcr1 = r->card == CARD_ATOM)) && - ((rf && !lf) || (nrcr2 = f->card == CARD_ATOM)) && (nrcr1+nrcr2) <= 1) || + ((rr && !lr) || (nrcr1 = r->card == CARD_ATOM && exp_is_atom(r))) && + ((rf && !lf) || (nrcr2 = f->card == CARD_ATOM && exp_is_atom(f))) && (nrcr1+nrcr2) <= 1) || (rl && !ll && - ((lr && !rr) || (nrcl1 = r->card == CARD_ATOM)) && - ((lf && !rf) || (nrcl2 = f->card == CARD_ATOM)) && (nrcl1+nrcl2) <= 1)) { + ((lr && !rr) || (nrcl1 = r->card == CARD_ATOM && exp_is_atom(r))) && + ((lf && !rf) || (nrcl2 = f->card == CARD_ATOM && exp_is_atom(f))) && (nrcl1+nrcl2) <= 1)) { left_reference = right_reference = 1; } } else { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Also make sure the input types are compatible
Changeset: 3f4a24dc23e4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3f4a24dc23e4 Modified Files: sql/server/rel_select.c Branch: default Log Message: Also make sure the input types are compatible diffs (18 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -2179,11 +2179,11 @@ rel_logical_value_exp(sql_query *query, if (!rs) return NULL; - if (ls && rs && exp_is_null(ls) && exp_is_null(rs)) - return exp_atom(sql->sa, atom_general(sql->sa, sql_bind_localtype("bit"), NULL)); - if (rel_binop_check_types(sql, rel ? *rel : NULL, ls, rs, 0) < 0) return NULL; + if (exp_is_null(ls) && exp_is_null(rs)) + return exp_atom(sql->sa, atom_general(sql->sa, sql_bind_localtype("bit"), NULL)); + ls = exp_compare_func(sql, ls, rs, compare_func(compare_str2type(compare_op), quantifier?0:need_not), quantifier); if (need_not && quantifier) ls = rel_unop_(sql, NULL, ls, NULL, "not", card_value); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Don't call exp_convert for any input type (it...
Changeset: fe0603e7435b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe0603e7435b Modified Files: sql/server/rel_select.c sql/test/miscellaneous/Tests/groupby_error.stable.out sql/test/miscellaneous/Tests/simple_selects.sql sql/test/miscellaneous/Tests/simple_selects.stable.out Branch: default Log Message: Don't call exp_convert for any input type (it may not be convertible to boolean). Approved other tests as well diffs (147 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -2180,7 +2180,7 @@ rel_logical_value_exp(sql_query *query, return NULL; if (ls && rs && exp_is_null(ls) && exp_is_null(rs)) - return exp_convert(sql->sa, ls, exp_subtype(ls), sql_bind_localtype("bit")); + return exp_atom(sql->sa, atom_general(sql->sa, sql_bind_localtype("bit"), NULL)); if (rel_binop_check_types(sql, rel ? *rel : NULL, ls, rs, 0) < 0) return NULL; diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.out b/sql/test/miscellaneous/Tests/groupby_error.stable.out --- a/sql/test/miscellaneous/Tests/groupby_error.stable.out +++ b/sql/test/miscellaneous/Tests/groupby_error.stable.out @@ -151,8 +151,8 @@ stdout of test 'groupby_error` in direct % bigint # type % 1 # length #SELECT NOT ( NOT + - CAST ( NULL AS INTEGER ) NOT IN ( col0 / CAST ( col2 AS INTEGER ) - + col1 ) ) FROM tab0 AS cor0; -% .%4 # table_name -% %4 # name +% .%3 # table_name +% %3 # name % boolean # type % 5 # length [ NULL ] @@ -191,8 +191,8 @@ project ( % 2 # length [ 64 ] #SELECT 11 FROM tab1 AS cor0 LEFT JOIN tab0 ON 80 = 70; -% .%6 # table_name -% %6 # name +% .%4 # table_name +% %4 # name % tinyint # type % 2 # length [ 11 ] @@ -218,8 +218,8 @@ project ( % int, int,int # type % 1, 1, 1 # length #SELECT CAST(+ col2 * col2 AS BIGINT) FROM tab2 AS cor0 WHERE NOT - CAST ( NULL AS INTEGER ) <> - - col1 AND NOT NULL NOT BETWEEN ( NULL ) AND - 91 - - + 27 * + col2; -% sys.%2 # table_name -% %2 # name +% sys.%1 # table_name +% %1 # name % bigint # type % 1 # length #SELECT + 2 FROM tab0 AS cor0 WHERE NOT - 29 IS NULL OR NOT NULL IS NULL AND NOT NULL BETWEEN + col1 - + 60 AND + 37 * + col1 + + col0; @@ -434,21 +434,21 @@ project ( [ 1303 ] #SELECT CAST(- 4 * + COUNT ( * ) + 22 + 69 AS BIGINT) AS col2, CAST(- ( + CASE + 85 WHEN - 77 / - CAST ( + CASE - + 51 WHEN 79 THEN + 95 + 13 * ( 60 * 77 ) END AS INTEGER ) + + 82 - COUNT ( * ) * COUNT ( * ) THEN #NULL WHEN SUM ( ALL 99 ) THEN COUNT ( * ) ELSE COUNT ( * ) * - ( COUNT ( * ) ) END ) * 46 - 83 AS BIGINT); -% ., .%11 # table_name -% col2,%11 # name +% ., .%4 # table_name +% col2,%4 # name % bigint, bigint # type % 2, 3 # length [ 87, -37 ] #SELECT DISTINCT CAST(- CAST ( CASE 81 WHEN 48 - - 3 / - - 47 - - CAST ( NULL AS INTEGER ) THEN NULL WHEN COUNT ( * ) THEN + - 91 + + 43 ELSE + - 0 END AS INTEGER ) AS BIGINT) AS col0, CAST(- 27 * + 43 AS BIGINT); -% ., .%5 # table_name -% col0,%5 # name +% ., .%4 # table_name +% col0,%4 # name % bigint, bigint # type % 1, 5 # length [ 0, -1161 ] #SELECT DISTINCT CAST(66 * - + CAST ( - - COUNT ( * ) AS INTEGER ) * 54 * + CASE 68 WHEN - 56 * + CAST ( NULL AS INTEGER ) + + + 47 THEN #- 83 ELSE + 59 + - COUNT ( * ) - 26 * ( 59 ) * 11 - - + COUNT ( * ) * - 73 END + + COUNT ( * ) / + ( 86 + 19 * 90 ) AS BIGINT); -% .%7 # table_name -% %7 # name +% .%3 # table_name +% %3 # name % bigint # type % 8 # length [ 60192396 ] @@ -465,6 +465,41 @@ project ( % bigint # type % 1 # length [ 1] +#SELECT DISTINCT CAST(COALESCE ( + 38, - - ( - 70 ) * 52 + + 91 + - 47 ) + + CAST ( - 54 AS REAL ) / + 68 / + ( - 92 ) * - - CASE WHEN NULL >= NULL THEN COUNT ( * ) WHEN - COUNT ( * ) IS NULL +#THEN NULL ELSE NULL END * + 28 * - 58 + COUNT ( * ) + + COUNT ( * ) AS BIGINT); +% .%3 # table_name +% %3 # name +% bigint # type +% 1 # length +[ NULL ] +#SELECT DISTINCT CAST(- ( COUNT ( * ) ) / + CASE 28 * + 72 + - 45 * + 2 WHEN - 14 THEN NULL WHEN 37 THEN - COALESCE ( CASE WHEN + 17 IS NOT NULL THEN ( + ( - 39 ) ) WHEN NOT NULL = ( NULL ) +#THEN NULL ELSE 52 END, - COUNT ( * ) * - 80, + NULLIF ( CASE - 70 WHEN 48 + 63 THEN NULL ELSE 89 * + 57 END, + 15 ) + - CASE + 19 WHEN - 97 THEN + 66 + - 25 END ) * + 79 + 93 * 21 END AS BIGINT) AS col1; +% . # table_name +% col1 # name +% bigint # type +% 1 # length +[ NULL ] +#START TRANSACTION; +#CREATE TABLE "tab0" ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO "tab0" VALUES (83, 0, 38), (26, 0, 79), (43, 81, 24); +[ 3] +#ROLLBACK; +#START TRANSACTION; +#CREATE TABLE tab2 ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO tab2 VALUES(64,77,40), (75,67,58), (46,51,23); +[ 3] +#ROLLBACK; +#START TRANSACTION;