Changeset: 086a22d16139 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=086a22d16139
Added Files:
        sql/test/astro/Tests/All
        sql/test/astro/Tests/drop.sql
        sql/test/astro/Tests/drop.stable.err
        sql/test/astro/Tests/drop.stable.out
        sql/test/astro/Tests/schema.sql
        sql/test/astro/Tests/schema.stable.err
        sql/test/astro/Tests/schema.stable.out
        sql/test/astro/Tests/update.sql
        sql/test/astro/Tests/update.stable.err
        sql/test/astro/Tests/update.stable.out
Modified Files:
        common/utils/mstring.h
        sql/backends/monet5/vaults/shp/shp.h
        sql/server/rel_unnest.c
        sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out
        sql/test/BugTracker-2016/Tests/storagemodel.stable.out
        sql/test/SQLancer/Tests/sqlancer02.sql
        sql/test/subquery/Tests/subquery6.sql
Branch: default
Log Message:

Merged with Jun2020


diffs (truncated from 618 to 300 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -30,6 +30,11 @@ strcpy_len(char *restrict dst, const cha
                                return i;
                }
                dst[n - 1] = 0;
+/* in some versions of GCC (at least gcc (Ubuntu 7.5.0-3ubuntu1~18.04)
+ * 7.5.0), the error just can't be turned off when using
+ * --enable-strict, so we just use the (more) expensive way of getting the
+ * right answer (rescan the whole string) */
+#if !defined(__GNUC__) || __GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ > 5)
 /* This code is correct, but GCC gives a warning in certain
  * conditions, so we disable the warning temporarily.
  * The warning happens e.g. in
@@ -44,6 +49,7 @@ GCC_Pragma("GCC diagnostic push")
 GCC_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
                return n + strlen(src + n);
 GCC_Pragma("GCC diagnostic pop")
+#endif
        }
        return strlen(src);
 }
diff --git a/sql/backends/monet5/vaults/shp/shp.h 
b/sql/backends/monet5/vaults/shp/shp.h
--- a/sql/backends/monet5/vaults/shp/shp.h
+++ b/sql/backends/monet5/vaults/shp/shp.h
@@ -23,7 +23,7 @@
 #undef HAVE_FCNTL_H
 #undef HAVE_ICONV
 #undef HAVE_STRINGS_H
-
+#undef HAVE_CXX11
 #include <gdal.h>
 #include <ogr_api.h>
 
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
@@ -1213,6 +1213,16 @@ push_up_select_l(mvc *sql, sql_rel *rel)
 static sql_rel *
 push_up_join(mvc *sql, sql_rel *rel, list *ad)
 {
+       if (rel && (is_join(rel->op) || is_semi(rel->op)) && is_dependent(rel)) 
{
+               sql_rel *j = rel->r;
+
+               if (j->op == op_join && !rel_is_ref(rel) && !rel_is_ref(j) && 
j->exps) {
+                       rel->exps =     rel->exps?list_merge(rel->exps, 
j->exps, (fdup)NULL):j->exps;
+                       j->exps = NULL;
+                       return rel;
+               }
+       }
+
        /* input rel is dependent join with on the right a project */
        if (rel && (is_join(rel->op) || is_semi(rel->op)) && is_dependent(rel)) 
{
                sql_rel *d = rel->l, *j = rel->r;
@@ -1439,6 +1449,18 @@ rel_unnest_dependent(mvc *sql, sql_rel *
                if (rel_has_freevar(sql, r)) {
                        list *ad = rel_dependent_var(sql, rel->l, rel->r);
 
+                       if (r && is_select(r->op)) {
+                               sql_rel *l = r->l;
+
+                               if (!rel_is_ref(r) && l && !rel_is_ref(l) && 
l->op == op_join && list_empty(l->exps)) {
+                                       l->exps = r->exps;
+                                       r->l = NULL;
+                                       rel_destroy(r);
+                                       rel->r = l;
+                                       return rel_unnest_dependent(sql, rel);
+                               }
+                       }
+
                        if (r && is_simple_project(r->op) && 
((!exps_have_freevar(sql, r->exps) && !exps_have_analytics(sql, r->exps)) || 
is_distinct_set(sql, l, ad))) {
                                rel = push_up_project(sql, rel, ad);
                                return rel_unnest_dependent(sql, rel);
diff --git a/sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out 
b/sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out
--- a/sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out
+++ b/sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out
@@ -74,28 +74,30 @@ join (
 | table(sys.bidder) [ "bidder"."id" NOT NULL HASHCOL  as "b"."id", 
"bidder"."open_auction_id" NOT NULL as "b"."open_auction_id", "bidder"."date" 
NOT NULL as "b"."date", "bidder"."time" NOT NULL as "b"."time", 
"bidder"."personref" NOT NULL as "b"."personref", "bidder"."increase" NOT NULL 
as "b"."increase", "bidder"."%TID%" NOT NULL as "b"."%TID%" ] COUNT 
 ) [ "o"."open_auction_id" NOT NULL = "b"."open_auction_id" NOT NULL ]
 REF 2 (2)
-single join (
-| & REF 1 ,
-| project (
-| | join (
-| | | table(sys.bidder) [ "bidder"."id" NOT NULL HASHCOL  as "b3"."id", 
"bidder"."open_auction_id" NOT NULL as "b3"."open_auction_id", "bidder"."date" 
NOT NULL as "b3"."date", "bidder"."time" NOT NULL as "b3"."time", 
"bidder"."personref" NOT NULL as "b3"."personref", "bidder"."increase" NOT NULL 
as "b3"."increase", "bidder"."%TID%" NOT NULL as "b3"."%TID%" ] COUNT ,
-| | | project (
-| | | | group by (
-| | | | | join (
-| | | | | | group by (
-| | | | | | | project (
-| | | | | | | | & REF 1 
-| | | | | | | ) [ "o"."open_auction_id" NOT NULL ]
-| | | | | | ) [ "o"."open_auction_id" NOT NULL ] [ "o"."open_auction_id" NOT 
NULL ],
-| | | | | | table(sys.bidder) [ "bidder"."id" NOT NULL HASHCOL  as "b3a"."id", 
"bidder"."open_auction_id" NOT NULL as "b3a"."open_auction_id", "bidder"."date" 
NOT NULL as "b3a"."date", "bidder"."time" NOT NULL as "b3a"."time", 
"bidder"."personref" NOT NULL as "b3a"."personref", "bidder"."increase" NOT 
NULL as "b3a"."increase", "bidder"."%TID%" NOT NULL as "b3a"."%TID%" ] COUNT 
-| | | | | ) [ "b3a"."open_auction_id" NOT NULL = "o"."open_auction_id" NOT 
NULL ]
-| | | | ) [ "o"."open_auction_id" NOT NULL ] [ sys.min no nil ("b3a"."id" NOT 
NULL HASHCOL ) NOT NULL as "%1"."%1", "o"."open_auction_id" NOT NULL ]
-| | | ) [ "o"."open_auction_id" NOT NULL, "%1"."%1" NOT NULL ]
-| | ) [ "b3"."id" NOT NULL HASHCOL  = "%1"."%1" NOT NULL ]
-| ) [ "b3"."increase" NOT NULL as "%2"."%2", "o"."open_auction_id" NOT NULL as 
"%23"."%23" ]
-) [ "o"."open_auction_id" NOT NULL * = "%23"."%23" NOT NULL ]
+single project (
+| single join (
+| | & REF 1 ,
+| | project (
+| | | join (
+| | | | table(sys.bidder) [ "bidder"."id" NOT NULL HASHCOL  as "b3"."id", 
"bidder"."open_auction_id" NOT NULL as "b3"."open_auction_id", "bidder"."date" 
NOT NULL as "b3"."date", "bidder"."time" NOT NULL as "b3"."time", 
"bidder"."personref" NOT NULL as "b3"."personref", "bidder"."increase" NOT NULL 
as "b3"."increase", "bidder"."%TID%" NOT NULL as "b3"."%TID%" ] COUNT ,
+| | | | project (
+| | | | | group by (
+| | | | | | join (
+| | | | | | | group by (
+| | | | | | | | project (
+| | | | | | | | | & REF 1 
+| | | | | | | | ) [ "o"."open_auction_id" NOT NULL ]
+| | | | | | | ) [ "o"."open_auction_id" NOT NULL ] [ "o"."open_auction_id" NOT 
NULL ],
+| | | | | | | table(sys.bidder) [ "bidder"."id" NOT NULL HASHCOL  as 
"b3a"."id", "bidder"."open_auction_id" NOT NULL as "b3a"."open_auction_id", 
"bidder"."date" NOT NULL as "b3a"."date", "bidder"."time" NOT NULL as 
"b3a"."time", "bidder"."personref" NOT NULL as "b3a"."personref", 
"bidder"."increase" NOT NULL as "b3a"."increase", "bidder"."%TID%" NOT NULL as 
"b3a"."%TID%" ] COUNT 
+| | | | | | ) [ "b3a"."open_auction_id" NOT NULL = "o"."open_auction_id" NOT 
NULL ]
+| | | | | ) [ "o"."open_auction_id" NOT NULL ] [ sys.min no nil ("b3a"."id" 
NOT NULL HASHCOL ) NOT NULL as "%1"."%1", "o"."open_auction_id" NOT NULL ]
+| | | | ) [ "o"."open_auction_id" NOT NULL, "%1"."%1" NOT NULL ]
+| | | ) [ "b3"."id" NOT NULL HASHCOL  = "%1"."%1" NOT NULL ]
+| | ) [ "b3"."id" NOT NULL HASHCOL , "b3"."open_auction_id" NOT NULL, 
"b3"."date" NOT NULL, "b3"."time" NOT NULL, "b3"."personref" NOT NULL, 
"b3"."increase" NOT NULL, "b3"."%TID%" NOT NULL, "%1"."%1" NOT NULL, 
"o"."open_auction_id" NOT NULL as "%32"."%32" ]
+| ) [ "o"."open_auction_id" NOT NULL * = "%32"."%32" NOT NULL ]
+) [ "o"."id" NOT NULL HASHCOL , "o"."open_auction_id" NOT NULL, "o"."initial" 
NOT NULL, "o"."reserve" NOT NULL, "o"."aktuell" NOT NULL, "o"."privacy" NOT 
NULL, "o"."itemref" NOT NULL, "o"."seller" NOT NULL, "o"."quantity" NOT NULL, 
"o"."type" NOT NULL, "o"."start" NOT NULL, "o"."ende" NOT NULL, "o"."%TID%" NOT 
NULL, "b"."id" NOT NULL HASHCOL , "b"."open_auction_id" NOT NULL, "b"."date" 
NOT NULL, "b"."time" NOT NULL, "b"."personref" NOT NULL, "b"."increase" NOT 
NULL, "b"."%TID%" NOT NULL, "b3"."increase" NOT NULL as "%2"."%2" ]
 project (
-| single select (
+| select (
 | | single join (
 | | | & REF 2 ,
 | | | project (
@@ -114,9 +116,9 @@ project (
 | | | | | | ) [ "o"."open_auction_id" NOT NULL ] [ sys.max no nil ("b2a"."id" 
NOT NULL HASHCOL ) NOT NULL as "%3"."%3", "o"."open_auction_id" NOT NULL ]
 | | | | | ) [ "o"."open_auction_id" NOT NULL, "%3"."%3" NOT NULL ]
 | | | | ) [ "b2"."id" NOT NULL HASHCOL  = "%3"."%3" NOT NULL ]
-| | | ) [ "b2"."increase" NOT NULL as "%4"."%4", "o"."open_auction_id" NOT 
NULL as "%43"."%43" ]
-| | ) [ "o"."open_auction_id" NOT NULL * = "%43"."%43" NOT NULL ]
-| ) [ sys.sql_mul("%2"."%2" NOT NULL, double "2") <= "%4"."%4" NOT NULL ]
+| | | ) [ "b2"."increase" NOT NULL, "o"."open_auction_id" NOT NULL as 
"%51"."%51" ]
+| | ) [ "o"."open_auction_id" NOT NULL * = "%51"."%51" NOT NULL ]
+| ) [ sys.sql_mul("%2"."%2" NOT NULL, double "2") <= "b2"."increase" NOT NULL ]
 ) [ "b"."id" NOT NULL HASHCOL , "b"."open_auction_id" NOT NULL, "b"."date" NOT 
NULL, "b"."time" NOT NULL, "b"."personref" NOT NULL, "b"."increase" NOT NULL ]
 #Select b.* FROM open_auctions o, bidder b WHERE (select b3.INCREASE from 
bidder b3 where b3.id = (select min(b3a.id) from bidder b3a where 
b3a.open_auction_id = o.open_auction_id)) * 2 <= (Select b2.INCREASE from 
bidder b2 where b2.id = (SELECT MAX(b2a.id) from bidder b2a where 
b2a.open_auction_id = o.open_auction_id)) AND o.open_auction_id = 
b.open_auction_id order by date, time;
 % sys.b,       sys.b,  sys.b,  sys.b,  sys.b,  sys.b # table_name
diff --git a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out 
b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
--- a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
+++ b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
@@ -83,8 +83,8 @@ stdout of test 'storagemodel` in directo
 % sys.storagemodel,    sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel # table_name
 % schema,      table,  column, type,   count,  columnsize,     heapsize,       
hashsize,       imprintsize,    orderidxsize,   sorted, unique, isacolumn # name
 % varchar,     varchar,        varchar,        varchar,        bigint, bigint, 
bigint, bigint, bigint, bigint, boolean,        boolean,        boolean # type
-% 3,   7,      1,      3,      5,      5,      1,      1,      4,      1,      
5,      5,      5 # length
-[ "sys",       "bug3923",      "i",    "int",  10000,  40000,  0,      0,      
8000,   0,      true,   NULL,   true    ]
+% 3,   7,      1,      3,      5,      5,      4,      1,      4,      1,      
5,      5,      5 # length
+[ "sys",       "bug3923",      "i",    "int",  10000,  10000,  8312,   0,      
2000,   0,      true,   NULL,   true    ]
 #drop table bug3923;
 #create table bug3923(i integer);
 #select "schema", "table", "column", "type", "mode", case when typewidth < 14 
then typewidth else 99 end as typewidth, hashes, phash, imprints from 
sys.storage('sys','_tables');
@@ -108,8 +108,8 @@ stdout of test 'storagemodel` in directo
 % sys.storagemodel,    sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel,       sys.storagemodel,       sys.storagemodel,       
sys.storagemodel # table_name
 % schema,      table,  column, type,   count,  columnsize,     heapsize,       
hashsize,       imprintsize,    orderidxsize,   sorted, unique, isacolumn # name
 % varchar,     varchar,        varchar,        varchar,        bigint, bigint, 
bigint, bigint, bigint, bigint, boolean,        boolean,        boolean # type
-% 13,  7,      1,      3,      5,      5,      1,      1,      4,      1,      
5,      5,      5 # length
-[ "bug3923schema",     "bug3923",      "i",    "int",  10000,  40000,  0,      
0,      8000,   0,      true,   NULL,   true    ]
+% 13,  7,      1,      3,      5,      5,      4,      1,      4,      1,      
5,      5,      5 # length
+[ "bug3923schema",     "bug3923",      "i",    "int",  10000,  10000,  8312,   
0,      2000,   0,      true,   NULL,   true    ]
 #drop table bug3923;
 
 # 23:38:44 >  
diff --git a/sql/test/SQLancer/Tests/sqlancer02.sql 
b/sql/test/SQLancer/Tests/sqlancer02.sql
--- a/sql/test/SQLancer/Tests/sqlancer02.sql
+++ b/sql/test/SQLancer/Tests/sqlancer02.sql
@@ -33,6 +33,8 @@ select i between symmetric cast(1 as dec
        -- NULL
 ROLLBACK;
 
+SELECT CAST(1 AS INTERVAL SECOND) + CAST(3 AS HUGEINT);
+
 START TRANSACTION; -- Bug 6910
 CREATE TABLE t0("c0" DOUBLE NOT NULL);
 COPY 11 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
diff --git a/sql/test/astro/Tests/All b/sql/test/astro/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/astro/Tests/All
@@ -0,0 +1,3 @@
+schema
+update
+drop
diff --git a/sql/test/astro/Tests/drop.sql b/sql/test/astro/Tests/drop.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/astro/Tests/drop.sql
@@ -0,0 +1,2 @@
+drop table "fluxz";
+drop table "cm_flux";
diff --git a/sql/test/astro/Tests/drop.stable.err 
b/sql/test/astro/Tests/drop.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/astro/Tests/drop.stable.err
@@ -0,0 +1,31 @@
+stderr of test 'drop` in directory 'sql/test/astro` itself:
+
+
+# 13:00:21 >  
+# 13:00:21 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34568" "--set" 
"mapi_usock=/var/tmp/mtest-1707270/.s.monetdb.34568" "--forcemito" 
"--dbpath=/home/niels/scratch/rc-jun2020/Linux-x86_64/var/MonetDB/mTests_sql_test_astro"
 "--set" "embedded_c=true"
+# 13:00:21 >  
+
+# builtin opt  gdk_dbpath = 
/home/niels/scratch/rc-jun2020/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# builtin opt  raw_strings = false
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 34568
+# cmdline opt  mapi_usock = /var/tmp/mtest-1707270/.s.monetdb.34568
+# cmdline opt  gdk_dbpath = 
/home/niels/scratch/rc-jun2020/Linux-x86_64/var/MonetDB/mTests_sql_test_astro
+# cmdline opt  embedded_c = true
+
+# 13:00:21 >  
+# 13:00:21 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-1707270" "--port=34568"
+# 13:00:21 >  
+
+
+# 13:00:21 >  
+# 13:00:21 >  "Done."
+# 13:00:21 >  
+
diff --git a/sql/test/astro/Tests/drop.stable.out 
b/sql/test/astro/Tests/drop.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/astro/Tests/drop.stable.out
@@ -0,0 +1,31 @@
+stdout of test 'drop` in directory 'sql/test/astro` itself:
+
+
+# 13:00:21 >  
+# 13:00:21 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34568" "--set" 
"mapi_usock=/var/tmp/mtest-1707270/.s.monetdb.34568" "--forcemito" 
"--dbpath=/home/niels/scratch/rc-jun2020/Linux-x86_64/var/MonetDB/mTests_sql_test_astro"
 "--set" "embedded_c=true"
+# 13:00:21 >  
+
+# MonetDB 5 server v11.37.8 (hg id: 585d13e0c34f+)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_astro', using 8 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 15.354 GiB available main-memory of which we use 12.513 GiB
+# 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://xps13:34568/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-1707270/.s.monetdb.34568
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+# 13:00:21 >  
+# 13:00:21 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-1707270" "--port=34568"
+# 13:00:21 >  
+
+#drop table "fluxz";
+#drop table "cm_flux";
+
+# 13:00:21 >  
+# 13:00:21 >  "Done."
+# 13:00:21 >  
+
diff --git a/sql/test/astro/Tests/schema.sql b/sql/test/astro/Tests/schema.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/astro/Tests/schema.sql
@@ -0,0 +1,27 @@
+START TRANSACTION;
+CREATE TABLE "fluxz" (
+       "runcat"           INTEGER       NOT NULL,
+       "filter"           CHAR(1)       NOT NULL,
+       "f_datapoints"     INTEGER       NOT NULL,
+       "active"           BOOLEAN       NOT NULL DEFAULT true,
+       "avg_flux"         DOUBLE        NOT NULL,
+       "avg_fluxsq"       DOUBLE        NOT NULL,
+       "avg_w"            DOUBLE        NOT NULL,
+       "avg_wflux"        DOUBLE        NOT NULL,
+       "avg_wfluxsq"      DOUBLE        NOT NULL,
+       "avg_dec_zone_deg" TINYINT       NOT NULL
+);
+CREATE TABLE "cm_flux" (
+       "runcat"           INTEGER       NOT NULL,
+       "xtrsrc"           INTEGER       NOT NULL,
+       "filter"           CHAR(1)       NOT NULL,
+       "f_datapoints"     INTEGER       NOT NULL,
+       "active"           BOOLEAN       NOT NULL DEFAULT true,
+       "avg_flux"         DOUBLE        NOT NULL,
+       "avg_fluxsq"       DOUBLE        NOT NULL,
+       "avg_w"            DOUBLE        NOT NULL,
+       "avg_wflux"        DOUBLE        NOT NULL,
+       "avg_wfluxsq"      DOUBLE        NOT NULL,
+       "avg_dec_zone_deg" TINYINT       NOT NULL
+);
+COMMIT;
diff --git a/sql/test/astro/Tests/schema.stable.err 
b/sql/test/astro/Tests/schema.stable.err
new file mode 100644
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to