Changeset: d086c0e6d032 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d086c0e6d032
Modified Files:
        gdk/gdk_bbp.c
        sql/server/rel_unnest.c
        sql/storage/store.c
        sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
        sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
        sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
        sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql
        
sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
Branch: default
Log Message:

Merged with linear-hashing


diffs (181 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1415,6 +1415,15 @@ BBPinit(void)
        unsigned bbpversion = 0;
        int i;
 
+       /* the maximum number of BATs allowed in the system and the
+        * size of the "physical" array are linked in a complicated
+        * manner.  The expression below shows the relationship */
+       static_assert((uint64_t) N_BBPINIT * BBPINIT < (UINT64_C(1) << (3 * 
((sizeof(BBP[0][0].physical) + 2) * 2 / 5))), "\"physical\" array in BBPrec is 
too small");
+       /* similarly, the maximum number of BATs allowed also has a
+        * (somewhat simpler) relation with the size of the "bak"
+        * array */
+       static_assert((uint64_t) N_BBPINIT * BBPINIT < (UINT64_C(1) << (3 * 
(sizeof(BBP[0][0].bak) - 5))), "\"bak\" array in BBPrec is too small");
+
        if (!GDKinmemory()) {
                str bbpdirstr, backupbbpdirstr;
 
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
@@ -1640,7 +1640,7 @@ rewrite_simplify(mvc *sql, sql_rel *rel)
        if (!rel)
                return rel;
 
-       if ((is_select(rel->op) || is_join(rel->op)) && !list_empty(rel->exps))
+       if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
!list_empty(rel->exps))
                rel->exps = exps_simplify_exp(sql, rel->exps);
        return rel;
 }
@@ -1773,7 +1773,7 @@ rewrite_aggregates(mvc *sql, sql_rel *re
 static sql_rel *
 rewrite_or_exp(mvc *sql, sql_rel *rel)
 {
-       if ((is_select(rel->op) || is_join(rel->op)) && !list_empty(rel->exps)) 
{
+       if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
!list_empty(rel->exps)) {
                for(node *n=rel->exps->h; n; n=n->next) {
                        sql_exp *e = n->data;
 
@@ -2561,7 +2561,7 @@ rewrite_compare_exps(mvc *sql, list *exp
 static sql_rel *
 rewrite_compare_exp(mvc *sql, sql_rel *rel)
 {
-       if ((is_select(rel->op) || is_join(rel->op)) && !list_empty(rel->exps))
+       if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
!list_empty(rel->exps))
                rel->exps = rewrite_compare_exps(sql, rel->exps);
        return rel;
 }
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -5613,7 +5613,7 @@ sql_trans_add_table(sql_trans *tr, sql_t
        p->t = mt;
        base_init(tr->sa, &p->base, pt->base.id, TR_NEW, pt->base.name);
        cs_add(&mt->members, p, TR_NEW);
-       mt->s->base.wtime = mt->base.wtime = pt->s->base.wtime = pt->base.wtime 
= tr->wtime = tr->wstime;
+       mt->s->base.wtime = mt->base.wtime = pt->s->base.wtime = pt->base.wtime 
= p->base.wtime = tr->wtime = tr->wstime;
        table_funcs.table_insert(tr, sysobj, &mt->base.id, p->base.name, 
&p->base.id);
        return mt;
 }
@@ -5917,7 +5917,7 @@ sql_trans_del_table(sql_trans *tr, sql_t
        pt->p = NULL;
        table_funcs.table_delete(tr, sysobj, obj_oid);
 
-       mt->s->base.wtime = mt->base.wtime = pt->s->base.wtime = pt->base.wtime 
= tr->wtime = tr->wstime;
+       mt->s->base.wtime = mt->base.wtime = pt->s->base.wtime = pt->base.wtime 
= p->base.wtime = tr->wtime = tr->wstime;
 
        if (drop_action == DROP_CASCADE)
                sql_trans_drop_table(tr, mt->s, pt->base.id, drop_action);
diff --git a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql 
b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
--- a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
+++ b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
@@ -1,25 +1,30 @@
 delete from statistics;
 select count(*) from statistics;
 
-CREATE STREAM TABLE "sys"."strt" (
+CREATE SCHEMA "ttt";
+
+CREATE TABLE "ttt"."a"("id" INTEGER);
+
+CREATE STREAM TABLE "ttt"."strt" (
         "id" INTEGER       NOT NULL,
         "nm" VARCHAR(123)  NOT NULL,
         CONSTRAINT "strt_id_pkey" PRIMARY KEY ("id")
 );
 
-select * from "sys"."strt";
+select * from "ttt"."strt";
 
-analyze "sys"."strt";
+analyze "ttt"."strt";
 -- Error: Table 'strt' is not persistent   SQLState:  42S02
 select (count(*) > 0) as has_rows from statistics;
 
-analyze sys; --not an error, skip stream table "strt"
+analyze ttt; --not an error, skip stream table "strt"
 select (count(*) > 0) as has_rows from statistics;
 
-drop table "sys"."strt";
+drop table "ttt"."strt";
 -- now run analyze without the stream table
-analyze sys;
+analyze ttt;
 select (count(*) > 0) as has_rows from statistics;
--- true (181)
+-- true
 delete from statistics;
 
+drop schema "ttt" cascade;
diff --git 
a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err 
b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
--- a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
+++ b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
@@ -25,8 +25,8 @@ stderr of test 'analyze-stream-table.Bug
 # 13:50:18 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-891865" "--port=35996"
 # 13:50:18 >  
 
-MAPI  = (monetdb) /var/tmp/mtest-161340/.s.monetdb.34379
-QUERY = analyze "sys"."strt";
+MAPI  = (monetdb) /var/tmp/mtest-4325/.s.monetdb.33720
+QUERY = analyze "ttt"."strt";
 ERROR = !STREAM TABLE 'strt' is not persistent
 CODE  = 42S02
 
diff --git 
a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out 
b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
--- a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
+++ b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
@@ -35,8 +35,8 @@ stdout of test 'analyze-stream-table.Bug
 #        "nm" VARCHAR(123)  NOT NULL,
 #        CONSTRAINT "strt_id_pkey" PRIMARY KEY ("id")
 #);
-#select * from "sys"."strt";
-% sys.strt,    sys.strt # table_name
+#select * from "ttt"."strt";
+% ttt.strt,    ttt.strt # table_name
 % id,  nm # name
 % int, varchar # type
 % 1,   0 # length
@@ -63,7 +63,8 @@ stdout of test 'analyze-stream-table.Bug
 % 5 # length
 [ true ]
 #delete from statistics;
-[ 181  ]
+[ 1    ]
+#drop schema "ttt" cascade;
 
 # 13:50:18 >  
 # 13:50:18 >  "Done."
diff --git 
a/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql 
b/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql
--- a/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql
+++ b/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql
@@ -11,6 +11,11 @@ select "TABEL", "VELD"
 
 select "TABEL", "VELD"
  from dd_field f
+ where (rtrim("TABEL")) in (select "TABEL" from dd_field);
+-- no problemo
+
+select "TABEL", "VELD"
+ from dd_field f
  where (rtrim("TABEL"), rtrim("VELD")) in (select "TABEL", "VELD" from 
dd_field);
 -- sql/backends/monet5/rel_bin.c:920: exp_bin: Assertion `0' failed.
 
diff --git 
a/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
 
b/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
--- 
a/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
+++ 
b/sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
@@ -36,6 +36,13 @@ stdout of test 'select-where-in-rtrim-cr
 % 0,   0 # length
 #select "TABEL", "VELD"
 # from dd_field f
+# where (rtrim("TABEL")) in (select "TABEL" from dd_field);
+% sys.f,       sys.f # table_name
+% TABEL,       VELD # name
+% varchar,     varchar # type
+% 0,   0 # length
+#select "TABEL", "VELD"
+# from dd_field f
 # where (rtrim("TABEL"), rtrim("VELD")) in (select "TABEL", "VELD" from 
dd_field);
 % sys.f,       sys.f # table_name
 % TABEL,       VELD # name
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to