Changeset: ba279291a60d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba279291a60d
Branch: Oct2020
Log Message:

merged


diffs (truncated from 317 to 300 lines):

diff --git a/sql/benchmarks/tpcds/Tests/09.stable.out 
b/sql/benchmarks/tpcds/Tests/09.stable.out
--- a/sql/benchmarks/tpcds/Tests/09.stable.out
+++ b/sql/benchmarks/tpcds/Tests/09.stable.out
@@ -42,7 +42,7 @@ stdout of test '09` in directory 'sql/be
 % .,   .,      .,      .,      . # table_name
 % bucket1,     bucket2,        bucket3,        bucket4,        bucket5 # name
 % decimal,     decimal,        decimal,        decimal,        decimal # type
-% 20,  20,     20,     20,     20 # length
+% 11,  11,     11,     11,     11 # length
 [ 39.65,       115.90, 191.63, 267.19, 341.99  ]
 
 # 11:36:53 >  
diff --git a/sql/benchmarks/tpcds/Tests/09.stable.out.int128 
b/sql/benchmarks/tpcds/Tests/09.stable.out.int128
deleted file mode 100644
--- a/sql/benchmarks/tpcds/Tests/09.stable.out.int128
+++ /dev/null
@@ -1,54 +0,0 @@
-stdout of test '09` in directory 'sql/benchmarks/tpcds` itself:
-
-
-# 18:29:57 >  
-# 18:29:57 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30709" "--set" 
"mapi_usock=/var/tmp/mtest-16393/.s.monetdb.30709" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/ufs/sjoerd/@Monet-devel/var/MonetDB/mTests_sql_benchmarks_tpcds" 
"--set" "embedded_c=true"
-# 18:29:57 >  
-
-# MonetDB 5 server v11.32.0 (hg id: edafb9f9a3c6+79d16e518d38+)
-# This is an unreleased version
-# Serving database 'mTests_sql_benchmarks_tpcds', using 8 threads
-# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
-# Found 62.694 GiB available main-memory.
-# Copyright (c) 1993 - July 2008 CWI.
-# Copyright (c) August 2008 - 2020 MonetDB B.V., all rights reserved
-# Visit https://www.monetdb.org/ for further information
-# Listening for connection requests on 
mapi:monetdb://methuselah.da.cwi.nl:30709/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-16393/.s.monetdb.30709
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-
-
-# 18:29:57 >  
-# 18:29:57 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-16393" "--port=30709"
-# 18:29:57 >  
-
-#SELECT CASE
-#           WHEN
-#                  (SELECT count(*)
-#                   FROM store_sales
-#                   WHERE ss_quantity BETWEEN 1 AND 20) > 74129 THEN
-#                  (SELECT avg(ss_ext_discount_amt)
-#                   FROM store_sales
-#                   WHERE ss_quantity BETWEEN 1 AND 20)
-#           ELSE
-#                  (SELECT avg(ss_net_paid)
-#                   FROM store_sales
-#                   WHERE ss_quantity BETWEEN 1 AND 20)
-#       END bucket1,
-#       CASE
-#           WHEN
-#                  (SELECT count(*)
-% .,   .,      .,      .,      . # table_name
-% bucket1,     bucket2,        bucket3,        bucket4,        bucket5 # name
-% decimal,     decimal,        decimal,        decimal,        decimal # type
-% 40,  40,     40,     40,     40 # length
-[ 39.65,       115.90, 191.63, 267.19, 341.99  ]
-
-# 11:36:53 >  
-# 11:36:53 >  "Done."
-# 11:36:53 >  
-
-# 18:29:57 >  
-# 18:29:57 >  "Done."
-# 18:29:57 >  
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
@@ -462,8 +462,10 @@ static sql_subfunc *
                        scale = member->scale;
                }
                /* same type as the input */
-               if (r->type->eclass == EC_ANY && member)
+               if (r->type->eclass == EC_ANY && member) {
                        r = member;
+                       digits = member->digits;
+               }
                if (!EC_SCALE(r->type->eclass))
                        scale = 0;
                res = sql_create_subtype(sa, r->type, digits, scale);
@@ -569,7 +571,7 @@ sql_dup_subfunc(sql_allocator *sa, sql_f
                                        } else if (r->scale)
                                                scale = r->scale;
                                }
-                               if (member && f->fix_scale == INOUT)
+                               if (member && (f->fix_scale == INOUT || 
r->type->eclass == EC_ANY))
                                        digits = member->digits;
                                if (IS_ANALYTIC(f) && mscale)
                                        scale = mscale;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -3270,6 +3270,8 @@ rewrite_values(visitor *v, sql_rel *rel)
        if (rel_is_ref(rel)) { /* need extra project */
                rel->l = rel_project(v->sql->sa, rel->l, rel->exps);
                rel->exps = rel_projections(v->sql, rel->l, NULL, 1, 1);
+               ((sql_rel*)rel->l)->r = rel->r; /* propagate order by exps */
+               rel->r = NULL;
                return rel;
        }
        sql_exp *e = rel->exps->h->data;
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -302,8 +302,19 @@ supertype(sql_subtype *super, sql_subtyp
                sql_find_subtype(&lsuper, tpe, 0, 0);
        } else {
                /* for strings use the max of both */
-               digits = EC_VARCHAR(eclass) ? sql_max(idigits, rdigits) :
-                                sql_max(idigits - i->scale, rdigits - 
r->scale);
+               if (eclass == EC_CHAR) {
+                       if (i->type->eclass == EC_NUM)
+                               idigits++; /* add '-' */
+                       else if (i->type->eclass == EC_DEC || i->type->eclass 
== EC_FLT)
+                               idigits+=2; /* add '-' and '.' TODO for 
floating-points maybe more is needed */
+                       if (r->type->eclass == EC_NUM)
+                               rdigits++;
+                       else if (r->type->eclass == EC_DEC || r->type->eclass 
== EC_FLT)
+                               rdigits+=2;
+                       digits = sql_max(idigits, rdigits);
+               } else {
+                       digits = sql_max(idigits - i->scale, rdigits - 
r->scale);
+               }
                sql_find_subtype(&lsuper, tpe, digits+scale, scale);
        }
        *super = lsuper;
diff --git 
a/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out 
b/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
--- a/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
+++ b/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
@@ -78,7 +78,7 @@ stdout of test 'outer-join-varchar.Bug-6
 % table_name,  column_name,    type,   type_digits # name
 % varchar,     varchar,        varchar,        int # type
 % 6,   4,      7,      2 # length
-[ "dummy6",    "key",  "varchar",      0       ]
+[ "dummy6",    "key",  "varchar",      32      ]
 [ "dummy6",    "val4", "int",  32      ]
 [ "dummy6",    "val5", "int",  32      ]
 #create table dummy7 as select "key", val as "val4", val as "val5" from dummy4 
natural full outer join dummy5;
@@ -88,7 +88,7 @@ stdout of test 'outer-join-varchar.Bug-6
 % table_name,  column_name,    type,   type_digits # name
 % varchar,     varchar,        varchar,        int # type
 % 6,   4,      7,      2 # length
-[ "dummy7",    "key",  "varchar",      0       ]
+[ "dummy7",    "key",  "varchar",      32      ]
 [ "dummy7",    "val4", "int",  32      ]
 [ "dummy7",    "val5", "int",  32      ]
 #create table dummy8 as select dummy4."key" as "key4", dummy5."key" as "key5", 
dummy4.val as "val4", dummy5.val as "val5" from dummy4 full outer join dummy5 
ON dummy4."key" = dummy5."key";
diff --git a/sql/test/SQLancer/Tests/sqlancer09.sql 
b/sql/test/SQLancer/Tests/sqlancer09.sql
--- a/sql/test/SQLancer/Tests/sqlancer09.sql
+++ b/sql/test/SQLancer/Tests/sqlancer09.sql
@@ -184,7 +184,7 @@ 239480113   NULL    NULL
 
 create view v2(vc0, vc1, vc2) as (values (((((+ 
(0.51506835))&(-2)))<<(scale_down(least(31552,
 0.3), cast(1500294098 as int)))),
-((- (((44257622)-(0.6))))>=(least(-15958291, -1534974396))), case - 
(sql_min(0.632858,
+((- (((44257622)-(0.6))))>=(least(-3, -4))), case - (sql_min(0.632858,
 0.3)) when ((((0.5)^(0.4)))+(((0.4)/(5))))
 then sql_max(cast(5293 as decimal), ((0.5)-
 (0.5))) end),(charindex(r'934079707', r'35305325'), not (false),
diff --git a/sql/test/SQLancer/Tests/sqlancer09.stable.err 
b/sql/test/SQLancer/Tests/sqlancer09.stable.err
--- a/sql/test/SQLancer/Tests/sqlancer09.stable.err
+++ b/sql/test/SQLancer/Tests/sqlancer09.stable.err
@@ -9,11 +9,7 @@ MAPI  = (monetdb) /var/tmp/mtest-133412/
 QUERY = INSERT INTO t2 VALUES (COALESCE(1 BETWEEN 2 AND 3, 1));
 ERROR = !INSERT INTO: PRIMARY KEY constraint 't2.t2_c0_pkey' violated
 CODE  = 40002
-MAPI  = (monetdb) /var/tmp/mtest-349169/.s.monetdb.38512
-QUERY = values (0.51506835), (2), (least('a', 0.5667308));
-ERROR = !value too long for type (var)char(8)
-CODE  = 22001
-MAPI  = (monetdb) /var/tmp/mtest-307586/.s.monetdb.36528
+MAPI  = (monetdb) /var/tmp/mtest-417038/.s.monetdb.32277
 QUERY = select 1 from v74 cross join v84 join (values ('b'), ('a'), (1)) as 
sub0 on (v84.vc0)^(-9223372036854775807) is not null;
 ERROR = !overflow in calculation 1XOR-9223372036854775807.
 CODE  = 22003
diff --git a/sql/test/SQLancer/Tests/sqlancer09.stable.out 
b/sql/test/SQLancer/Tests/sqlancer09.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer09.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer09.stable.out
@@ -167,6 +167,14 @@ stdout of test 'sqlancer09` in directory
 % 1 # length
 [ 0    ]
 #ROLLBACK;
+#values (0.51506835), (2), (least('a', 0.5667308));
+% .%1 # table_name
+% %1 # name
+% decimal # type
+% 20 # length
+[ 0.51506835   ]
+[ 2.00000000   ]
+[ 0.56673080   ]
 #START TRANSACTION;
 #CREATE TABLE "sys"."t2" ("c0" BIGINT,"c1" BIGINT,"c2" REAL);
 #COPY 21 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"';
diff --git a/sql/test/SQLancer/Tests/sqlancer10.sql 
b/sql/test/SQLancer/Tests/sqlancer10.sql
--- a/sql/test/SQLancer/Tests/sqlancer10.sql
+++ b/sql/test/SQLancer/Tests/sqlancer10.sql
@@ -53,6 +53,12 @@ select 1 from v6, v2 join (values (0.54)
 ROLLBACK;
 
 START TRANSACTION;
+create view v3(vc0, vc1) as (values (0.67,NULL),(18.50, 3),(0.70, 6));
+create view v7(vc0) as (values (8505133838.114197),(NULL));
+(select v3.vc0 from v3) intersect (select greatest('-1115800120', v7.vc0) from 
v7);
+ROLLBACK;
+
+START TRANSACTION;
 CREATE TABLE t1(c0 int);
 CREATE VIEW v4(vc0) AS ((SELECT NULL FROM t1 AS l0t1) UNION ALL (SELECT true));
 INSERT INTO t1(c0) VALUES(12), (2), (6), (3), (1321), (10), (8), (1), (2), 
(3), (9);
diff --git a/sql/test/SQLancer/Tests/sqlancer10.stable.err 
b/sql/test/SQLancer/Tests/sqlancer10.stable.err
--- a/sql/test/SQLancer/Tests/sqlancer10.stable.err
+++ b/sql/test/SQLancer/Tests/sqlancer10.stable.err
@@ -5,6 +5,10 @@ stderr of test 'sqlancer10` in directory
 # 13:59:46 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-215607" "--port=30526"
 # 13:59:46 >  
 
+MAPI  = (monetdb) /var/tmp/mtest-485092/.s.monetdb.38732
+QUERY = (select v3.vc0 from v3) intersect (select greatest('-1115800120', 
v7.vc0) from v7);
+ERROR = !types char(18,0) and decimal(20,2) are not equal
+CODE  = 42000
 
 # 13:59:46 >  
 # 13:59:46 >  "Done."
diff --git a/sql/test/SQLancer/Tests/sqlancer10.stable.out 
b/sql/test/SQLancer/Tests/sqlancer10.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer10.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer10.stable.out
@@ -66,6 +66,26 @@ stdout of test 'sqlancer10` in directory
 % tinyint # type
 % 1 # length
 #ROLLBACK;
+#START TRANSACTION;
+#create view v3(vc0, vc1) as (values (0.67,NULL),(18.50, 3),(0.70, 6));
+#create view v7(vc0) as (values (8505133838.114197),(NULL));
+#ROLLBACK;
+#START TRANSACTION;
+#CREATE TABLE t1(c0 int);
+#CREATE VIEW v4(vc0) AS ((SELECT NULL FROM t1 AS l0t1) UNION ALL (SELECT 
true));
+#INSERT INTO t1(c0) VALUES(12), (2), (6), (3), (1321), (10), (8), (1), (2), 
(3), (9);
+[ 11   ]
+#DELETE FROM t1 WHERE true;
+[ 11   ]
+#INSERT INTO t1(c0) VALUES(9), (1), (3), (2), (5);
+[ 5    ]
+#SELECT 1 FROM v4 JOIN (SELECT 2) AS sub0 ON COALESCE(v4.vc0, v4.vc0 BETWEEN 
v4.vc0 AND v4.vc0);
+% .%13 # table_name
+% %13 # name
+% tinyint # type
+% 1 # length
+[ 1    ]
+#ROLLBACK;
 
 # 13:59:46 >  
 # 13:59:46 >  "Done."
diff --git a/sql/test/analytics/Tests/analytics02.stable.out 
b/sql/test/analytics/Tests/analytics02.stable.out
--- a/sql/test/analytics/Tests/analytics02.stable.out
+++ b/sql/test/analytics/Tests/analytics02.stable.out
@@ -58,8 +58,8 @@ stdout of test 'analytics02` in director
 % .prepare,    .prepare,       .prepare,       .prepare,       .prepare,       
.prepare # table_name
 % type,        digits, scale,  schema, table,  column # name
 % varchar,     int,    int,    str,    str,    str # type
-% 7,   2,      1,      0,      2,      2 # length
-[ "varchar",   0,      0,      "",     "%7",   "%7"    ]
+% 7,   3,      1,      0,      2,      2 # length
+[ "varchar",   64,     0,      "",     "%7",   "%7"    ]
 [ "bigint",    64,     0,      NULL,   NULL,   NULL    ]
 #exec 13(2);
 % sys.%7 # table_name
diff --git a/sql/test/analytics/Tests/analytics03.stable.out 
b/sql/test/analytics/Tests/analytics03.stable.out
--- a/sql/test/analytics/Tests/analytics03.stable.out
+++ b/sql/test/analytics/Tests/analytics03.stable.out
@@ -255,8 +255,8 @@ stdout of test 'analytics03` in director
 #       floor(avg(aa) over (order by bb range between current row and 
unbounded following)),
 #       floor(avg(aa) over (partition by bb order by bb rows unbounded 
preceding)),
 #       floor(avg(aa) over (partition by bb order by bb range unbounded 
preceding)) from overflowme;
-% sys.%65,     sys.%66,        sys.%67,        sys.%70,        sys.%71,        
sys.%72 # table_name
-% %65, %66,    %67,    %70,    %71,    %72 # name
+% sys.%53,     sys.%54,        sys.%55,        sys.%56,        sys.%57,        
sys.%60 # table_name
+% %53, %54,    %55,    %56,    %57,    %60 # name
 % double,      double, double, double, double, double # type
 % 24,  24,     24,     24,     24,     24 # length
 [ 2147483645,  2147483645,     2147483645,     2147483645,     2147483644,     
2147483645      ]
@@ -282,8 +282,8 @@ stdout of test 'analytics03` in director
 % .%12 # table_name
 % %12 # name
 % time # type
-% 15 # length
-[ 10:10:00.000000      ]
+% 8 # length
+[ 10:10:00     ]
 #drop table rowsvsrangevsgroups;
 
 # 17:06:35 >  
diff --git a/sql/test/subquery/Tests/subquery6.stable.out 
b/sql/test/subquery/Tests/subquery6.stable.out
--- a/sql/test/subquery/Tests/subquery6.stable.out
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to