MonetDB: default - Merge with Aug2024 branch.

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: 349b68e0b222 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/349b68e0b222
Modified Files:
sql/backends/monet5/UDF/capi/Tests/capi11.test
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test
sql/backends/monet5/sql_upgrades.c
sql/common/sql_types.c
sql/server/rel_dump.c
sql/server/rel_psm.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/sql_parser.y

sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128

sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Merge with Aug2024 branch.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Aug2024 branch.

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: 7fb1a4e6d2ed for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7fb1a4e6d2ed
Modified Files:
sql/server/rel_dump.c
testing/Mtest.py.in
Branch: default
Log Message:

Merge with Aug2024 branch.


diffs (truncated from 414 to 300 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -335,7 +335,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
if (decorate && e->p && e->type != e_atom && !exp_is_atom(e)) {
for (prop *p = e->p; p; p = p->p) {
/* Don't show min/max/unique est on atoms, or when 
running tests with forcemito */
-   if ((ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) == 0 ||
+   if ((ATOMIC_GET(&GDKdebug) & NOSYNCMASK) == 0 ||
(p->kind != PROP_MIN && p->kind != PROP_MAX && 
p->kind != PROP_NUNIQUES)) {
char *pv = propvalue2string(sql->ta, p);
mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
@@ -697,7 +697,7 @@ rel_print_rel(mvc *sql, stream  *fout, s
}
if (decorate && rel->p) {
for (prop *p = rel->p; p; p = p->p) {
-   if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
FORCEMITOMASK) == 0) {
+   if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
NOSYNCMASK) == 0) {
char *pv = propvalue2string(sql->ta, p);
mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
}
diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
@@ -1,14 +1,14 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from fk
 
 project (
 |  [ "sys"."cnt"(varchar "sys", varchar "fk") NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 
-query T nosort
+query T python .plan.filter
plan select id   from fk order by id
 
 project (
diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
@@ -1,7 +1,7 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from v0
 
 project (
@@ -12,7 +12,7 @@ project (
 | ) [  ] [ "sys"."count"() NOT NULL UNIQUE as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL UNIQUE ]
 
-query T nosort
+query T python .plan.filter
plan select id   from v0 order by id
 
 project (
diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
@@ -1,21 +1,21 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from fk left outer join pk1 on fk.fk1 = pk1.pk1
 
 project (
 |  [ "sys"."cnt"(varchar "sys", varchar "fk") NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 
-query T nosort
+query T python .plan.filter
plan select id   from fk left outer join pk1 on fk.fk1 = pk1.pk1 order 
by id
 
 project (
 | table("sys"."fk") [ "fk"."id" NOT NULL UNIQUE HASHCOL  ]
 ) [ "fk"."id" NOT NULL UNIQUE HASHCOL  ] [ "fk"."id" ASC NOT NULL UNIQUE 
HASHCOL  ]
 
-query T nosort
+query T python .plan.filter
plan select id , v1  from fk left outer join pk1 on fk.fk1 = pk1.pk1 order 
by id
 
 project (
@@ -25,7 +25,7 @@ project (
 | ) [ ("fk"."%fk_fk1_fkey") = ("pk1"."%TID%" NOT NULL UNIQUE) JOINIDX 
"sys"."fk"."fk_fk1_fkey" ]
 ) [ "fk"."id" NOT NULL HASHCOL , "pk1"."v1" ] [ "fk"."id" ASC NOT NULL HASHCOL 
 ]
 
-query T nosort
+query T python .plan.filter
plan select id , v2  from fk left outer join pk2 on fk.fk2 = pk2.pk2 order 
by id
 
 project (
@@ -35,21 +35,21 @@ project (
 | ) [ ("fk"."%fk_fk2_fkey") = ("pk2"."%TID%" NOT NULL UNIQUE) JOINIDX 
"sys"."fk"."fk_fk2_fkey" ]
 ) [ "fk"."id" NOT NULL HASHCOL , "pk2"."v2" ] [ "fk"."id" ASC NOT NULL HASHCOL 
 ]
 
-query 

MonetDB: Aug2024 - Backed out changeset a32c685fa62b

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: acb9373e2e28 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acb9373e2e28
Modified Files:
sql/backends/monet5/UDF/capi/Tests/capi11.test
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test
sql/common/sql_types.c
sql/server/rel_psm.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/sql_parser.y
sql/test/SQLancer/Tests/sqlancer08.test
Branch: Aug2024
Log Message:

Backed out changeset a32c685fa62b


diffs (truncated from 327 to 300 lines):

diff --git a/sql/backends/monet5/UDF/capi/Tests/capi11.test 
b/sql/backends/monet5/UDF/capi/Tests/capi11.test
--- a/sql/backends/monet5/UDF/capi/Tests/capi11.test
+++ b/sql/backends/monet5/UDF/capi/Tests/capi11.test
@@ -1,4 +1,7 @@
-statement error 42000!CREATE FUNCTION: the function 'capi11' uses a generic 
DECIMAL type, UDFs require precision and scale
+statement ok
+START TRANSACTION
+
+statement ok
 CREATE FUNCTION capi11(inp DECIMAL) RETURNS DECIMAL(11,1) LANGUAGE C {
 size_t i;
 result->initialize(result, inp.count);
@@ -11,33 +14,6 @@ CREATE FUNCTION capi11(inp DECIMAL) RETU
 }
 }
 
-statement error 42000!CREATE FUNCTION: the function '_dbl2dec' returns a 
generic DECIMAL type, UDFs require precision and scale
-CREATE FUNCTION _dbl2dec(inp DOUBLE) RETURNS DECIMAL LANGUAGE C {
-size_t i;
-result->initialize(result, inp.count);
-for(i = 0; i < inp.count; i++) {
-result->data[i] = inp.data[i] * result->scale;
-}
-}
-
-
-statement ok
-START TRANSACTION
-
-statement ok
-CREATE FUNCTION capi11(inp DECIMAL(18,3)) RETURNS DECIMAL(11,1) LANGUAGE C {
-size_t i;
-result->initialize(result, inp.count);
-for(i = 0; i < inp.count; i++) {
-if (inp.data[i] == inp.null_value) {
-result->data[i] = result->null_value;
-} else {
-result->data[i] = (inp.data[i] / inp.scale) * result->scale;
-}
-}
-}
-
-
 statement ok
 CREATE TABLE decimals(d DECIMAL(18,3))
 
@@ -56,7 +32,7 @@ statement ok
 DROP FUNCTION capi11
 
 statement ok
-CREATE FUNCTION _dec2dbl(inp DECIMAL(18,3)) RETURNS DOUBLE LANGUAGE C {
+CREATE FUNCTION _dec2dbl(inp DECIMAL) RETURNS DOUBLE LANGUAGE C {
 size_t i;
 result->initialize(result, inp.count);
 for(i = 0; i < inp.count; i++) {
@@ -83,7 +59,7 @@ statement ok
 DROP FUNCTION _dec2dbl
 
 statement ok
-CREATE FUNCTION _dbl2dec(inp DOUBLE) RETURNS DECIMAL(18,3) LANGUAGE C {
+CREATE FUNCTION _dbl2dec(inp DOUBLE) RETURNS DECIMAL LANGUAGE C {
 size_t i;
 result->initialize(result, inp.count);
 for(i = 0; i < inp.count; i++) {
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test 
b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test
@@ -1,15 +1,3 @@
-statement error 42000!CREATE FUNCTION: the function 'pyapi_decimal' uses a 
generic DECIMAL type, UDFs require precision and scale
-CREATE FUNCTION pyapi_decimal(d DECIMAL) RETURNS DOUBLE LANGUAGE PYTHON { 
return d; }
-
-statement error 42000!CREATE UNION FUNCTION: the function 'pyapi_ret_decimal' 
returns a generic DECIMAL type, UDFs require precision and scale
-CREATE FUNCTION pyapi_ret_decimal() RETURNS TABLE(d DECIMAL)
-LANGUAGE PYTHON
-{
-result = dict()
-result['d'] = 100.33
-return result
-}
-
 statement ok
 START TRANSACTION
 
@@ -77,7 +65,7 @@ statement ok rowcount 1
 INSERT INTO decimal_table VALUES (123.4567)
 
 statement ok
-CREATE FUNCTION pyapi_decimal(d DECIMAL(18, 3)) RETURNS DOUBLE LANGUAGE PYTHON 
{ return d; }
+CREATE FUNCTION pyapi_decimal(d DECIMAL) RETURNS DOUBLE LANGUAGE PYTHON { 
return d; }
 
 query R rowsort
 SELECT pyapi_decimal(d) FROM decimal_table
@@ -130,7 +118,7 @@ SELECT * FROM pyapi_ret_timestamp()
 2000-01-01 12:00:00.01
 
 statement ok
-CREATE FUNCTION pyapi_ret_decimal() RETURNS TABLE(d DECIMAL(18, 3))
+CREATE FUNCTION pyapi_ret_decimal() RETURNS TABLE(d DECIMAL)
 LANGUAGE PYTHON
 {
 result = dict()
@@ -156,14 +144,14 @@ statement ok
 DROP FUNCTION pyapi_ret_decimal
 
 statement ok
-CREATE FUNCTION pyapi_ret_decimal() RETURNS TABLE(d DECIMAL(18, 3))
+CREATE FUNCTION pyapi_ret_decimal() RETURNS TABLE(d DECIMAL)
 LANGUAGE PYTHON
 {
 return numpy.arange(11) # return 100k decimal values
 }
 
 statement ok
-CREATE FUNCTION pyapi_inp_decimal(d DECIMAL(18, 3)) RETURNS DOUBLE
+CREATE FUNCTION pyapi_inp_decimal(d DECIMAL) RETURNS DOUBLE
 LANGUAGE PYTHON
 {
 return numpy.mean(d) # average 100k decimal values
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test 
b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.test
@@ -121,7 +121,7 @@ statement ok
 START TRANSACTION
 
 statement ok
-CREATE FUNCTION pyapi19_create_table() returns table (i integer, j 

MonetDB: Aug2024 - Kind of reapply changeset a32c685fa62b, but n...

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: 25f6c008500b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/25f6c008500b
Modified Files:
sql/common/sql_types.c
sql/server/rel_dump.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/sql_parser.y
sql/test/SQLancer/Tests/sqlancer08.test
Branch: Aug2024
Log Message:

Kind of reapply changeset a32c685fa62b, but now do it mostly in the parser.


diffs (214 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
@@ -244,6 +244,8 @@ sql_init_subtype(sql_subtype *res, sql_t
if (t->digits && res->digits > t->digits)
res->digits = t->digits;
res->scale = scale;
+   if (!digits && !scale && t->eclass == EC_DEC)
+   res->scale = res->digits = 0;
 }
 
 sql_subtype *
@@ -765,7 +767,7 @@ sql_create_type(allocator *sa, const cha
(void) keywords_insert(t->base.name, KW_TYPE);
list_append(types, t);
 
-   list_append(localtypes, sql_create_subtype(sa, t, 0, 0));
+   list_append(localtypes, sql_create_subtype(sa, t, digits, 0));
 
return t;
 }
@@ -799,10 +801,10 @@ sql_create_func_(allocator *sa, const ch
 
for (int i = 0; i < nargs; i++) {
sql_type *tpe = va_arg(valist, sql_type*);
-   list_append(ops, create_arg(sa, NULL, sql_create_subtype(sa, 
tpe, 0, 0), ARG_IN));
+   list_append(ops, create_arg(sa, NULL, sql_create_subtype(sa, 
tpe, tpe->digits, 0), ARG_IN));
}
if (res)
-   fres = create_arg(sa, NULL, sql_create_subtype(sa, res, 0, 0), 
ARG_OUT);
+   fres = create_arg(sa, NULL, sql_create_subtype(sa, res, 
res->digits, 0), ARG_OUT);
base_init(sa, &t->base, local_id++, false, name);
 
t->imp = sa_strdup(sa, imp);
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -1473,7 +1473,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (!sql_find_subtype(&tpe, tname, 0, 0)) {
if (!(t = mvc_bind_type(sql, tname))) /* try an 
external type */
return sql_error(sql, ERR_NOTFOUND, 
SQLSTATE(42000) "SQL type %s not found\n", tname);
-   sql_init_subtype(&tpe, t, 0, 0);
+   sql_init_subtype(&tpe, t, t->digits, 0);
}
if (!(exp = parse_atom(sql, r, pos, &tpe)))
return NULL;
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
@@ -1094,6 +1094,9 @@ create_column(sql_query *query, symbol *
if (l->h->next->next)
opt_list = l->h->next->next->data.lval;
 
+   if (ctype && ctype->type->eclass == EC_DEC && !ctype->digits && 
!ctype->scale) /* default 18,3 */
+   ctype = sql_bind_subtype(query->sql->sa, "decimal", 18, 3);
+
if (cname && ctype) {
sql_column *cs = NULL;
 
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
@@ -4073,10 +4073,12 @@ rel_cast(sql_query *query, sql_rel **rel
sql_subtype *et = exp_subtype(e);
if (et->type->eclass == EC_NUM) {
unsigned int min_precision = atom_num_digits(e->l);
+   if (!tpe->digits && !tpe->scale)
+   tpe->digits = min_precision;
if (min_precision > tpe->digits)
return sql_error(sql, 02, SQLSTATE(42000) 
"Precision (%d) should be at least (%d)", tpe->digits, min_precision);
-   tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, et->scale);
-   } else if (EC_VARCHAR(et->type->eclass)) {
+   tpe = sql_bind_subtype(sql->sa, "decimal", tpe->digits, 
et->scale);
+   } else if (EC_VARCHAR(et->type->eclass) && !tpe->digits && 
!tpe->scale) {
char *s = E_ATOM_STRING(e);
unsigned int min_precision = 0, min_scale = 0;
bool dot_seen = false;
@@ -4091,6 +4093,12 @@ rel_cast(sql_query *query, sql_rel **rel
}
tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, min_scale);
}
+   } else if (tpe->type->eclass == EC_DEC && !tpe->digits && !tpe->scale) {
+   sql_subtype *et = exp_subtype(e);
+   if (et->type->eclass == EC_NUM)
+   tpe = sql_bind_subtype(sql->sa, "decimal", et->digits, 
0);
+   else /* fallback */
+   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 3);
}
 
if (e)
diff --git a/sql/server/sql_parser.y b/sql/server/sql_p

MonetDB: Aug2024 - Backed out changesets 1abb97336c05 and 70402b...

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: f565eecf07cf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f565eecf07cf
Modified Files:
sql/backends/monet5/sql_upgrades.c

sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128

sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128
Branch: Aug2024
Log Message:

Backed out changesets 1abb97336c05 and 70402bf08abf


diffs (234 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -3747,10 +3747,10 @@ sql_update_aug2024(Client c, mvc *sql, s
"update sys.args set type_digits = 63 where 
type = 'bigint' and type_digits <> 63;\n"
"update sys.args set type_digits = 127 where 
type = 'hugeint' and type_digits <> 127;\n"
"update sys.args set type = 'varchar' where 
type in ('clob', 'char');\n"
-   "drop aggregate median(decimal(18,3));\n"
-   "drop aggregate median_avg(decimal(18,3));\n"
-   "drop aggregate quantile(decimal(18,3), 
double);\n"
-   "drop aggregate quantile_avg(decimal(18,3), 
double);\n"
+   "drop aggregate median(decimal);\n"
+   "drop aggregate median_avg(decimal);\n"
+   "drop aggregate quantile(decimal, double);\n"
+   "drop aggregate quantile_avg(decimal, 
double);\n"
"create aggregate median(val DECIMAL(2)) 
returns DECIMAL(2)\n"
" external name \"aggr\".\"median\";\n"
"GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) 
TO PUBLIC;\n"
diff --git 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal(18,3));
-drop aggregate median_avg(decimal(18,3));
-drop aggregate quantile(decimal(18,3), double);
-drop aggregate quantile_avg(decimal(18,3), double);
+drop aggregate median(decimal);
+drop aggregate median_avg(decimal);
+drop aggregate quantile(decimal, double);
+drop aggregate quantile_avg(decimal, double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal(18,3));
-drop aggregate median_avg(decimal(18,3));
-drop aggregate quantile(decimal(18,3), double);
-drop aggregate quantile_avg(decimal(18,3), double);
+drop aggregate median(decimal);
+drop aggregate median_avg(decimal);
+drop aggregate quantile(decimal, double);
+drop aggregate quantile_avg(decimal, double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
diff --git 
a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable

MonetDB: Aug2024 - Fix rel_cast taking into account new precisio...

2024-10-21 Thread Lucas Pereira via checkin-list
Changeset: 27d95b99462d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/27d95b99462d
Modified Files:
sql/ChangeLog.Aug2024
sql/server/rel_select.c
Branch: Aug2024
Log Message:

Fix rel_cast taking into account new precision and scale assumptions. Also, add 
ChangeLog entry.


diffs (80 lines):

diff --git a/sql/ChangeLog.Aug2024 b/sql/ChangeLog.Aug2024
--- a/sql/ChangeLog.Aug2024
+++ b/sql/ChangeLog.Aug2024
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Mon Oct 21 2024 Lucas Pereira 
+- Improve casting to generic decimal type by choosing a better fit for
+  precision and scale instead of defaulting to 18 and 3, respectively.
+
 * Thu Oct 17 2024 Sjoerd Mullender 
 - When for whatever reason the upgrade code produces an error, we now
   exit the server.  Before the server would limp on with what is basically
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
@@ -4069,36 +4069,35 @@ rel_cast(sql_query *query, sql_rel **rel
}
}
 
-   if (e->type == e_atom && tpe->type->eclass == EC_DEC) {
+   if (tpe->type->eclass == EC_DEC) {
sql_subtype *et = exp_subtype(e);
-   if (et->type->eclass == EC_NUM) {
-   unsigned int min_precision = atom_num_digits(e->l);
-   if (!tpe->digits && !tpe->scale)
-   tpe->digits = min_precision;
-   if (min_precision > tpe->digits)
-   return sql_error(sql, 02, SQLSTATE(42000) 
"Precision (%d) should be at least (%d)", tpe->digits, min_precision);
-   tpe = sql_bind_subtype(sql->sa, "decimal", tpe->digits, 
et->scale);
-   } else if (EC_VARCHAR(et->type->eclass) && !tpe->digits && 
!tpe->scale) {
-   char *s = E_ATOM_STRING(e);
-   unsigned int min_precision = 0, min_scale = 0;
-   bool dot_seen = false;
-   for (size_t i = 0; i < strlen(s); i++) {
-   if (isdigit(s[i])) {
-   min_precision++;
-   if (dot_seen)
-   min_scale++;
-   } else if (s[i] == '.') {
-   dot_seen = true;
+   if (e->type == e_atom && !tpe->digits) {
+   if (et->type->eclass == EC_NUM || et->type->eclass == 
EC_DEC) {
+   tpe->digits = atom_num_digits(e->l);
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
tpe->digits, et->scale);
+   } else if (EC_VARCHAR(et->type->eclass)) {
+   char *s = E_ATOM_STRING(e);
+   unsigned int min_precision = 0, min_scale = 0;
+   bool dot_seen = false;
+   for (size_t i = 0; i < strlen(s); i++) {
+   if (isdigit(s[i])) {
+   min_precision++;
+   if (dot_seen)
+   min_scale++;
+   } else if (s[i] == '.') {
+   dot_seen = true;
+   }
}
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, min_scale);
+   } else { /* fallback */
+   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 
3);
}
-   tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, min_scale);
-   }
-   } else if (tpe->type->eclass == EC_DEC && !tpe->digits && !tpe->scale) {
-   sql_subtype *et = exp_subtype(e);
-   if (et->type->eclass == EC_NUM)
-   tpe = sql_bind_subtype(sql->sa, "decimal", et->digits, 
0);
-   else /* fallback */
-   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 3);
+   } else if (!tpe->digits && !tpe->scale) {
+   if (et->type->eclass == EC_NUM)
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
et->digits, 0);
+   else /* fallback */
+   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 
3);
+   }
}
 
if (e)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Aug2024 - Filter out output expected to be different

2024-10-21 Thread Ying Zhang via checkin-list
Changeset: fdb9826d1224 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fdb9826d1224
Modified Files:

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-view.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-2join-query.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-2join-view.test

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-3join-query.test
Branch: Aug2024
Log Message:

Filter out output expected to be different


diffs (truncated from 381 to 300 lines):

diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-query.test
@@ -1,14 +1,14 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from fk
 
 project (
 |  [ "sys"."cnt"(varchar "sys", varchar "fk") NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 
-query T nosort
+query T python .plan.filter
plan select id   from fk order by id
 
 project (
diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-0join-view.test
@@ -1,7 +1,7 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from v0
 
 project (
@@ -12,7 +12,7 @@ project (
 | ) [  ] [ "sys"."count"() NOT NULL UNIQUE as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL UNIQUE ]
 
-query T nosort
+query T python .plan.filter
plan select id   from v0 order by id
 
 project (
diff --git 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
--- 
a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
+++ 
b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-plan-1join-query.test
@@ -1,21 +1,21 @@
 statement ok
 set optimizer = 'sequential_pipe'
 
-query T nosort
+query T python .plan.filter
plan select count(*) from fk left outer join pk1 on fk.fk1 = pk1.pk1
 
 project (
 |  [ "sys"."cnt"(varchar "sys", varchar "fk") NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 
-query T nosort
+query T python .plan.filter
plan select id   from fk left outer join pk1 on fk.fk1 = pk1.pk1 order 
by id
 
 project (
 | table("sys"."fk") [ "fk"."id" NOT NULL UNIQUE HASHCOL  ]
 ) [ "fk"."id" NOT NULL UNIQUE HASHCOL  ] [ "fk"."id" ASC NOT NULL UNIQUE 
HASHCOL  ]
 
-query T nosort
+query T python .plan.filter
plan select id , v1  from fk left outer join pk1 on fk.fk1 = pk1.pk1 order 
by id
 
 project (
@@ -25,7 +25,7 @@ project (
 | ) [ ("fk"."%fk_fk1_fkey") = ("pk1"."%TID%" NOT NULL UNIQUE) JOINIDX 
"sys"."fk"."fk_fk1_fkey" ]
 ) [ "fk"."id" NOT NULL HASHCOL , "pk1"."v1" ] [ "fk"."id" ASC NOT NULL HASHCOL 
 ]
 
-query T nosort
+query T python .plan.filter
plan select id , v2  from fk left outer join pk2 on fk.fk2 = pk2.pk2 order 
by id
 
 project (
@@ -35,21 +35,21 @@ project (
 | ) [ ("fk"."%fk_fk2_fkey") = ("pk2"."%TID%" NOT NULL UNIQUE) JOINIDX 
"sys"."fk"."fk_fk2_fkey" ]
 ) [ "fk"."id" NOT NULL HASHCOL , "pk2"."v2" ] [ "fk"."id" ASC NOT NULL HASHCOL 
 ]
 
-query T nosort
+query T python .plan.filter
plan select count(*) from pk1 right outer join fk on fk.fk1 = pk1.pk1
 
 project (
 |  [ "sys"."cnt"(varchar "sys", varchar "fk") NOT NULL as "%1"."%1" ]
 ) [ "%1"."%1" NOT NULL ]
 
-query T nosort
+query T python .plan.filter
plan select id   from pk1 right outer join fk on fk.fk1 = pk1.pk1 order 
by id
 
 project (
 | table("sys"."fk") [ "fk"."id" NOT NULL UNIQUE HASHCOL  ]
 ) [ "fk"."id" NOT NULL UNIQUE HASHCOL  ] [ "fk"."id" ASC NOT NULL UNIQUE 
HASHCOL  ]
 
-query T nosort
+query T python .plan.filter
plan select id , v1  from pk1 right outer join fk on fk.fk1 = pk1.pk1 order 
by id
 
 proj

MonetDB: Aug2024 - We now use NOSYNCMASK to determine if we are ...

2024-10-21 Thread Ying Zhang via checkin-list
Changeset: dc059fcade70 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dc059fcade70
Modified Files:
sql/server/rel_dump.c
Branch: Aug2024
Log Message:

We now use NOSYNCMASK to determine if we are running (M)test:
NOSYNCMASK is ON when (M)testing


diffs (21 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -335,7 +335,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
if (decorate && e->p && e->type != e_atom && !exp_is_atom(e)) {
for (prop *p = e->p; p; p = p->p) {
/* Don't show min/max/unique est on atoms, or when 
running tests with forcemito */
-   if ((ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) == 0 ||
+   if ((ATOMIC_GET(&GDKdebug) & NOSYNCMASK) == 0 ||
(p->kind != PROP_MIN && p->kind != PROP_MAX && 
p->kind != PROP_NUNIQUES)) {
char *pv = propvalue2string(sql->ta, p);
mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
@@ -690,7 +690,7 @@ rel_print_rel(mvc *sql, stream  *fout, s
}
if (decorate && rel->p) {
for (prop *p = rel->p; p; p = p->p) {
-   if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
FORCEMITOMASK) == 0) {
+   if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
NOSYNCMASK) == 0) {
char *pv = propvalue2string(sql->ta, p);
mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Aug2024 branch.

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: 835d3d7c4606 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/835d3d7c4606
Modified Files:
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
Branch: default
Log Message:

Merge with Aug2024 branch.


diffs (72 lines):

diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal);
-drop aggregate median_avg(decimal);
-drop aggregate quantile(decimal, double);
-drop aggregate quantile_avg(decimal, double);
+drop aggregate median(decimal(18,3));
+drop aggregate median_avg(decimal(18,3));
+drop aggregate quantile(decimal(18,3), double);
+drop aggregate quantile_avg(decimal(18,3), double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out 
b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal);
-drop aggregate median_avg(decimal);
-drop aggregate quantile(decimal, double);
-drop aggregate quantile_avg(decimal, double);
+drop aggregate median(decimal(18,3));
+drop aggregate median_avg(decimal(18,3));
+drop aggregate quantile(decimal(18,3), double);
+drop aggregate quantile_avg(decimal(18,3), double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
diff --git a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal);
-drop aggregate median_avg(decimal);
-drop aggregate quantile(decimal, double);
-drop aggregate quantile_avg(decimal, double);
+drop aggregate median(decimal(18,3));
+drop aggregate median_avg(decimal(18,3));
+drop aggregate quantile(decimal(18,3), double);
+drop aggregate quantile_avg(decimal(18,3), double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
diff --git a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out 
b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
--- a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
@@ -13,10 +13,10 @@ update sys.args set type_digits = 31 whe
 update sys.args set type_digits = 63 where type = 'bigint' and type_digits <> 
63;
 update sys.args set type_digits = 127 where type = 'hugeint' and type_digits 
<> 127;
 update sys.args set type = 'varchar' where type in ('clob', 'char');
-drop aggregate median(decimal);
-drop aggregate median_avg(decimal);
-drop aggregate quantile(decimal, double);
-drop aggregate quantile_avg(decimal, double);
+drop aggregate median(decimal(18,3));
+drop aggregate median_avg(decimal(18,3));
+drop aggregate quantile(decimal(18,3), double);
+drop aggregate quantile_avg(decimal(18,3), double);
 create aggregate median(val DECIMAL(2)) returns DECIMAL(2)
  external name "aggr"."median";
 GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) TO PUBLIC;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Aug2024 - When testing with --nomito, still enable the ...

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: 683db75a915e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/683db75a915e
Modified Files:
testing/Mtest.py.in
Branch: Aug2024
Log Message:

When testing with --nomito, still enable the NOSYNC debug flag, second location.


diffs (12 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3968,7 +3968,7 @@ def main(argv) :
 
 exe = {}
 exe['mserver5']   = CheckExec('mserver5') , 'mserver5 
--debug=%s --set gdk_nr_threads=%s %s --set mapi_listenaddr=all --set 
mapi_port=0 %s %s' % \
-   
(env['GDK_DEBUG'], env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, 
'--forcemito' if not nomito else '')
+   
(env['GDK_DEBUG'], env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, 
'--forcemito' if not nomito else f'-d{1 << 24}')
 exe['ruby_client']   = CheckExec(env['RUBYCLIENT'].split(None, 1)[0])  
 , '%s %s' % (env['RUBYCLIENT'], '${PORT}')
 exe['MAL_Client']= CheckExec(env['MALCLIENT'].split(None, 1)[0])  
, '%s --host=%s --port=%s' % (env['MALCLIENT'], HOST, '${PORT}')
 exe['SQL_Client']= CheckExec(env['SQLCLIENT'].split(None, 1)[0])   
, '%s -i -e --host=%s --port=%s' % (env['SQLCLIENT'], HOST, '${PORT}')
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Aug2024 - Always skip known-to-fail tests unless --allt...

2024-10-21 Thread Sjoerd Mullender via checkin-list
Changeset: af33e9e6ac9a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/af33e9e6ac9a
Modified Files:
testing/Mtest.py.in
Branch: Aug2024
Log Message:

Always skip known-to-fail tests unless --alltests is passed as argument.
I.e. when a specific tests is given as argument, we no longer assume
--alltests, but instead that argument has to be given explicitly.


diffs (35 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3992,7 +3992,6 @@ def main(argv) :
 ErrXit("%s: not a valid test name" % args[0])
 args = [head]
 if tail != 'All':
-CONDITIONALS['KNOWNFAIL'] = True
 for ext in ('.test', '.maltest', 'MAL.py', '.SQL.py',
 '.sql', '.py', '.R', '.rb', ''):
 # extensions .in and .src are never combined
@@ -4008,7 +4007,6 @@ def main(argv) :
 else:
 ErrXit("%s: not a valid test name" % args[0])
 elif head and tail and os.path.isdir(head) and tail != 'Tests' and 
os.path.isdir(os.path.join(head, 'Tests')):
-CONDITIONALS['KNOWNFAIL'] = True
 args = [head, tail]
 
 if len(args) == 1:
@@ -4024,7 +4022,6 @@ def main(argv) :
 elif args[0] != "All":
 #TODO:
 # check, whether args[0] in All
-CONDITIONALS['KNOWNFAIL'] = True
 testlist.append(args[0])
 elif len(args) > 1:
 i = 0
@@ -4037,7 +4034,6 @@ def main(argv) :
 # WARNING/ERROR
 i = i + 1
 if len(dirlist) == 1  and  i < len(args)  and  args[i] != "All":
-CONDITIONALS['KNOWNFAIL'] = True
 while i < len(args):
 if os.sep not in args[i]:
 #TODO:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged from Aug2024

2024-10-21 Thread Ying Zhang via checkin-list
Changeset: f32f44fd181a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f32f44fd181a
Modified Files:
testing/Mtest.py.in
Branch: default
Log Message:

merged from Aug2024


diffs (35 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -4030,7 +4030,6 @@ def main(argv) :
 ErrXit("%s: not a valid test name" % args[0])
 args = [head]
 if tail != 'All':
-CONDITIONALS['KNOWNFAIL'] = True
 for ext in ('.test', '.maltest', 'MAL.py', '.SQL.py',
 '.sql', '.py', '.R', '.rb', ''):
 # extensions .in and .src are never combined
@@ -4046,7 +4045,6 @@ def main(argv) :
 else:
 ErrXit("%s: not a valid test name" % args[0])
 elif head and tail and os.path.isdir(head) and tail != 'Tests' and 
os.path.isdir(os.path.join(head, 'Tests')):
-CONDITIONALS['KNOWNFAIL'] = True
 args = [head, tail]
 
 if len(args) == 1:
@@ -4062,7 +4060,6 @@ def main(argv) :
 elif args[0] != "All":
 #TODO:
 # check, whether args[0] in All
-CONDITIONALS['KNOWNFAIL'] = True
 testlist.append(args[0])
 elif len(args) > 1:
 i = 0
@@ -4075,7 +4072,6 @@ def main(argv) :
 # WARNING/ERROR
 i = i + 1
 if len(dirlist) == 1  and  i < len(args)  and  args[i] != "All":
-CONDITIONALS['KNOWNFAIL'] = True
 while i < len(args):
 if os.sep not in args[i]:
 #TODO:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Aug2024 branch.

2024-10-21 Thread Lucas Pereira via checkin-list
Changeset: 9e919c06b69e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9e919c06b69e
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

Merge with Aug2024 branch.


diffs (80 lines):

diff --git a/sql/ChangeLog.Aug2024 b/sql/ChangeLog.Aug2024
--- a/sql/ChangeLog.Aug2024
+++ b/sql/ChangeLog.Aug2024
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Mon Oct 21 2024 Lucas Pereira 
+- Improve casting to generic decimal type by choosing a better fit for
+  precision and scale instead of defaulting to 18 and 3, respectively.
+
 * Thu Oct 17 2024 Sjoerd Mullender 
 - When for whatever reason the upgrade code produces an error, we now
   exit the server.  Before the server would limp on with what is basically
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
@@ -4035,36 +4035,35 @@ rel_cast(sql_query *query, sql_rel **rel
}
}
 
-   if (e->type == e_atom && tpe->type->eclass == EC_DEC) {
+   if (tpe->type->eclass == EC_DEC) {
sql_subtype *et = exp_subtype(e);
-   if (et->type->eclass == EC_NUM) {
-   unsigned int min_precision = atom_num_digits(e->l);
-   if (!tpe->digits && !tpe->scale)
-   tpe->digits = min_precision;
-   if (min_precision > tpe->digits)
-   return sql_error(sql, 02, SQLSTATE(42000) 
"Precision (%d) should be at least (%d)", tpe->digits, min_precision);
-   tpe = sql_bind_subtype(sql->sa, "decimal", tpe->digits, 
et->scale);
-   } else if (EC_VARCHAR(et->type->eclass) && !tpe->digits && 
!tpe->scale) {
-   char *s = E_ATOM_STRING(e);
-   unsigned int min_precision = 0, min_scale = 0;
-   bool dot_seen = false;
-   for (size_t i = 0; i < strlen(s); i++) {
-   if (isdigit(s[i])) {
-   min_precision++;
-   if (dot_seen)
-   min_scale++;
-   } else if (s[i] == '.') {
-   dot_seen = true;
+   if (e->type == e_atom && !tpe->digits) {
+   if (et->type->eclass == EC_NUM || et->type->eclass == 
EC_DEC) {
+   tpe->digits = atom_num_digits(e->l);
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
tpe->digits, et->scale);
+   } else if (EC_VARCHAR(et->type->eclass)) {
+   char *s = E_ATOM_STRING(e);
+   unsigned int min_precision = 0, min_scale = 0;
+   bool dot_seen = false;
+   for (size_t i = 0; i < strlen(s); i++) {
+   if (isdigit(s[i])) {
+   min_precision++;
+   if (dot_seen)
+   min_scale++;
+   } else if (s[i] == '.') {
+   dot_seen = true;
+   }
}
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, min_scale);
+   } else { /* fallback */
+   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 
3);
}
-   tpe = sql_bind_subtype(sql->sa, "decimal", 
min_precision, min_scale);
-   }
-   } else if (tpe->type->eclass == EC_DEC && !tpe->digits && !tpe->scale) {
-   sql_subtype *et = exp_subtype(e);
-   if (et->type->eclass == EC_NUM)
-   tpe = sql_bind_subtype(sql->sa, "decimal", et->digits, 
0);
-   else /* fallback */
-   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 3);
+   } else if (!tpe->digits && !tpe->scale) {
+   if (et->type->eclass == EC_NUM)
+   tpe = sql_bind_subtype(sql->sa, "decimal", 
et->digits, 0);
+   else /* fallback */
+   tpe = sql_bind_subtype(sql->sa, "decimal", 18, 
3);
+   }
}
 
if (e)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org