Changeset: 823dbf1ca560 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/823dbf1ca560
Branch: scatter
Log Message:

merged with jul2021


diffs (174 lines):

diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -261,8 +261,8 @@ typedef volatile int ATOMIC_TYPE;
 #define ATOMIC_XCG(var, val)   __atomic_exchange_n(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)
 #define ATOMIC_CAS(var, exp, des)      __atomic_compare_exchange_n(var, exp, 
(ATOMIC_BASE_TYPE) (des), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
 #define ATOMIC_ADD(var, val)   __atomic_fetch_add(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)
-#define ATOMIC_SUB(var, val)   __atomic_fetch_sub(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)#
-define ATOMIC_INC(var)                 __atomic_add_fetch(var, 1, 
__ATOMIC_SEQ_CST)
+#define ATOMIC_SUB(var, val)   __atomic_fetch_sub(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)
+#define ATOMIC_INC(var)                        __atomic_add_fetch(var, 1, 
__ATOMIC_SEQ_CST)
 #define ATOMIC_DEC(var)                        __atomic_sub_fetch(var, 1, 
__ATOMIC_SEQ_CST)
 #define ATOMIC_OR(var, val)            __atomic_fetch_or(var, 
(ATOMIC_BASE_TYPE) (val), __ATOMIC_SEQ_CST)
 #define ATOMIC_AND(var, val)   __atomic_fetch_and(var, (ATOMIC_BASE_TYPE) 
(val), __ATOMIC_SEQ_CST)
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1688,18 +1688,17 @@ int
 mvc_export_affrows(backend *b, stream *s, lng val, str w, oid query_id, lng 
starttime, lng maloptimizer)
 {
        mvc *m = b->mvc;
+
+       b->rowcnt = val;
+       sqlvar_set_number(find_global_var(m, mvc_bind_schema(m, "sys"), 
"rowcnt"), b->rowcnt);
+
        /* if we don't have a stream, nothing can go wrong, so we return
         * success.  This is especially vital for execution of internal SQL
         * commands, since they don't get a stream to suppress their output.
         * If we would fail on having no stream here, those internal commands
         * fail too.
         */
-       if (!s)
-               return 0;
-
-       b->rowcnt = val;
-       sqlvar_set_number(find_global_var(m, mvc_bind_schema(m, "sys"), 
"rowcnt"), b->rowcnt);
-       if(GDKembedded())
+       if(!s || GDKembedded())
                return 0;
        if (mnstr_write(s, "&2 ", 3, 1) != 1 ||
            !mvc_send_lng(s, val) ||
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
@@ -996,6 +996,8 @@ table_ref(sql_query *query, sql_rel *rel
                                        rel_base_disallow(rel);
                        } else {
                                rel = rel_parse(sql, t->s, t->query, 
m_instantiate);
+                               if (rel)
+                                       rel = rel_unnest(sql, rel);
                        }
 
                        if (!rel)
diff --git 
a/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.test
 
b/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.test
--- 
a/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.test
+++ 
b/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.test
@@ -56,8 +56,8 @@ project (
 | | | | ) [ "f"."id" as "fid", "line" ]
 | | | ) [ "fid" ] [ "line" ASC ]
 | | ) [ "fid" as "commented_function_signatures_6542"."fid" ]
-| ) [  ] [ "sys"."count"() NOT NULL as "%1"."%1" ]
-) [ "%1"."%1" NOT NULL ]
+| ) [  ] [ "sys"."count"() NOT NULL as "%3"."%3" ]
+) [ "%3"."%3" NOT NULL ]
 
 query I rowsort
 select count (*) from sys.commented_function_signatures_6542
diff --git a/sql/test/BugTracker-2021/Tests/All 
b/sql/test/BugTracker-2021/Tests/All
--- a/sql/test/BugTracker-2021/Tests/All
+++ b/sql/test/BugTracker-2021/Tests/All
@@ -10,3 +10,4 @@ lowercase-cryllic.Bug-7126
 unnest-union.Bug-7127
 subquery-missing.Bug-7128
 batcalc-between-undefined.Bug-7129
+batappend-undefined.Bug-7130
diff --git a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test 
b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
@@ -0,0 +1,64 @@
+statement ok
+start transaction
+
+statement ok
+create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , 
c_mknkhml TEXT, primary key(c_f, c_y2), unique(c_y2) )
+
+statement ok rowcount 3
+insert into t_qh values (1,1,1,'a','a'),(2,2,2,'b','b'),(3,3,3,'c','c')
+
+statement ok
+create table t_ckfystsc ( c_kvhq5p INTEGER , c_aifpl INTEGER , c_jf6 TEXT , 
c_f31ix TEXT NOT NULL, c_lo0zqfe TEXT , c_zv INTEGER , c_l153 INTEGER , primary 
key(c_zv), unique(c_zv) )
+
+statement ok rowcount 3
+insert into t_ckfystsc values 
(1,1,'a','a','a',1,1),(2,2,'b','b','b',2,2),(3,3,'c','c','c',3,3)
+
+statement ok
+create view t_vehkuero as select distinct abs( cast(subq_0.c1 as INTEGER)) as 
c0 from (select ref_0.c_f as c0, ref_0.c_f as c1, ref_0.c_i768 as c2, 
ref_0.c_y2 as c3 from t_qh as ref_0)
+as subq_0 where cast(nullif('zdo', 'apqonv1a') as CHAR) like 'aou%2' AND 
length( cast(case when subq_0.c1 = ( select subq_0.c3 as c0 from t_qh as ref_6
+where (subq_0.c0 <> ( select subq_0.c0 as c0 from t_qh as ref_7)) ) then 'xk' 
else 'xk' end as CHAR)) <> subq_0.c0
+
+query T rowsort
+select 1000 in (select 2 from t_vehkuero) from (select 1 as c0 from 
t_ckfystsc) as subq_0
+----
+False
+False
+False
+
+query T rowsort
+select case when subq_0.c0 in ( select ref_5.c_tqx as c0 from t_qh as ref_5 
where ref_5.c_y2 in ( select ref_6.c_y2 as c0 from t_qh as ref_6 union select 2 
as c0 from t_vehkuero as ref_7))
+then cast(nullif(subq_0.c0, subq_0.c0) as CHAR) else cast(nullif(subq_0.c0, 
subq_0.c0) as CHAR) end as c0 from (select ref_0.c_lo0zqfe as c0, ref_0.c_aifpl 
as c1 from t_ckfystsc as ref_0) as subq_0
+----
+NULL
+NULL
+NULL
+
+statement ok
+rollback
+
+statement ok
+create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx 
INTEGER , primary key(c_i768), unique(c_y2) )
+
+statement ok rowcount 3
+insert into t_qh values (1,1,1,1),(2,2,2,2),(3,3,3,3)
+
+statement ok
+create view t_amy as select ref_1.c_f as c0 from t_qh as ref_0 cross join t_qh 
as ref_1 left outer join (select ref_2.c_i768 as c0, cast(sum( cast(ref_3.c_f 
as INTEGER)) as bigint) as c1, count(*) as c2 from t_qh as ref_2
+left outer join t_qh as ref_3 on (ref_2.c_f < ref_2.c_f) where ref_2.c_i768 > 
ref_3.c_y2 group by ref_2.c_i768) as subq_0 on (ref_0.c_y2 < ref_1.c_f) where 
ref_0.c_f <> ( select ref_4.c_i768 as c0 from t_qh
+as ref_4 cross join t_qh as ref_5 where EXISTS ( select ref_6.c_i768 as c0, 
ref_1.c_i768 as c1, ref_6.c_y2 as c2 from t_qh as ref_6 where subq_0.c0 < ( 
select subq_0.c1 as c0 from t_qh as ref_7
+where (ref_5.c_f <> ref_6.c_f) or (subq_0.c1 is NULL))))
+
+statement error GDK reported error: hashjoin: more than one match
+select (subq_0.c0 = case when EXISTS ( select ref_15.c0 as c6 from t_amy as 
ref_15) then subq_0.c1 else subq_0.c1 end) as c4 from (select ref_12.c_f as c0, 
30 as c1 from t_qh as ref_12) as subq_0
+
+statement error GDK reported error: BATsubcross: more than one match
+select (select (select 1 where subq_0.c0 = (select subq_0.c1 from t_qh)) from 
(select 320, 1) subq_0(c0,c1)) from (select 2) subq_0(c3)
+
+statement error GDK reported error: BATsubcross: more than one match
+select EXISTS(select 1 from t_qh left outer join (select cast(2 as INTEGER) 
from t_qh) as subq_0(c1) on 2 <> (select 1 from t_qh where EXISTS(select 3 as 
c0 from t_qh as ref_6 where 2 <
+(select subq_0.c1 as c0 from t_qh where (1 <> ref_6.c_f) or (subq_0.c1 is 
NULL))))) from (select 30 from t_qh) as subq_0(c1)
+
+statement ok
+drop table t_qh cascade
+
+
diff --git a/sql/test/SQLancer/Tests/sqlancer15.test 
b/sql/test/SQLancer/Tests/sqlancer15.test
--- a/sql/test/SQLancer/Tests/sqlancer15.test
+++ b/sql/test/SQLancer/Tests/sqlancer15.test
@@ -595,7 +595,7 @@ statement ok rowcount 3
 INSERT INTO t1(c2) VALUES('aaa'), ('y2qxM9H'), (')pI')
 
 query T rowsort
-SELECT min(NULL) FROM t1 GROUP BY (0.5834739146589698)|(232)
+SELECT min(NULL) FROM t1 GROUP BY (0.58)|(232)
 ----
 NULL
 
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -2093,6 +2093,14 @@ remote_cleanup:
                        //set default flags
                        BATsettrivprop(bn);
 
+                       if (cnt > 1) {
+                               bn->tsorted = bn->trevsorted = false;
+                               bn->tnosorted = bn->tnorevsorted = 0;
+                               bn->tkey = false;
+                               bn->tnonil = false;
+                               bn->tnil = false;
+                       }
+
                        if (store->storage_api.append_col(m->session->tr, c, 
pos, bn, TYPE_bat, 0) != 0) {
                                bn->theap->base = prev_base;
                                bn->theap->size = prev_size;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to