MonetDB: Jul2021 - Flag changes please

2021-08-10 Thread Pedro Ferreira
Changeset: 5f173749bb71 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5f173749bb71
Modified Files:
sql/server/rel_optimizer.c
Branch: Jul2021
Log Message:

Flag changes please


diffs (27 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -9529,8 +9529,8 @@ rel_basecount(visitor *v, sql_rel *rel)
if (is_groupby(rel->op) && rel->l && !rel->r && list_length(rel->exps) 
== 1 && exp_aggr_is_count(rel->exps->h->data)) {
sql_rel *bt = rel->l;
sql_exp *e = rel->exps->h->data;
-   if (is_basetable(bt->op) && !e->l) { /* count(*) */
-   /* change into select cnt('schema','table') */;
+   if (is_basetable(bt->op) && list_empty(e->l)) { /* count(*) */
+   /* change into select cnt('schema','table') */
sql_table *t = bt->l;
/* I need to get the declared table's frame number to 
make this work correctly for those */
if (!isTable(t) || isDeclaredTable(t))
@@ -9543,9 +9543,9 @@ rel_basecount(visitor *v, sql_rel *rel)
 
ne = exp_propagate(v->sql->sa, ne, e);
exp_setname(v->sql->sa, ne, exp_find_rel_name(e), 
exp_name(e));
-   return rel_project(v->sql->sa, NULL, 
append(sa_list(v->sql->sa), ne));
-   }
-   return rel;
+   rel = rel_project(v->sql->sa, NULL, 
append(sa_list(v->sql->sa), ne));
+   v->changes++;
+   }
}
return rel;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jul2021 - Void bats don't have a tail. Small cleanup

2021-08-10 Thread Pedro Ferreira
Changeset: 26b4cd27e2f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/26b4cd27e2f9
Modified Files:
monetdb5/modules/mal/remote.c
Branch: Jul2021
Log Message:

Void bats don't have a tail. Small cleanup


diffs (37 lines):

diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -596,7 +596,6 @@ typedef struct _binbat_v1 {
Tnonil:1,
Tdense:1;
BUN size;
-   size_t headsize;
size_t tailsize;
size_t theapsize;
 } binbat;
@@ -604,7 +603,7 @@ typedef struct _binbat_v1 {
 static str
 RMTinternalcopyfrom(BAT **ret, char *hdr, stream *in, bool must_flush)
 {
-   binbat bb = { 0, 0, 0, false, false, false, false, false, 0, 0, 0, 0 };
+   binbat bb = { 0, 0, 0, false, false, false, false, false, 0, 0, 0 };
char *nme = NULL;
char *val = NULL;
char tmp;
@@ -750,7 +749,6 @@ RMTinternalcopyfrom(BAT **ret, char *hdr
if (bb.Ttype == TYPE_str && bb.size)
BATsetcapacity(b, (BUN) (bb.tailsize >> b->tshift));
BATsetcount(b, bb.size);
-   b->batDirtydesc = true;
 
// read blockmode flush
while (must_flush && mnstr_read(in, , 1, 1) > 0) {
@@ -1551,7 +1549,7 @@ static str RMTbincopyto(Client cntxt, Ma
v->tnonil,
BATtdense(v),
v->batCount,
-   (size_t)v->batCount << v->tshift,
+   BATtvoid(v) ? 0 : (size_t)v->batCount << v->tshift,
sendtheap && v->batCount > 0 ? v->tvheap->free : 0
);
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Approve output.

2021-08-10 Thread Sjoerd Mullender
Changeset: 468848218b68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/468848218b68
Modified Files:
sql/test/sql_dump/Tests/dump.test
Branch: default
Log Message:

Approve output.


diffs (94 lines):

diff --git a/sql/test/sql_dump/Tests/dump.test 
b/sql/test/sql_dump/Tests/dump.test
--- a/sql/test/sql_dump/Tests/dump.test
+++ b/sql/test/sql_dump/Tests/dump.test
@@ -296,10 +296,10 @@ SELECT stmt FROM sys.dump_database(FALSE
 START TRANSACTION;
 SET SCHEMA "sys";
 CREATE ROLE "king";
-CREATE USER "voc" WITH ENCRYPTED PASSWORD  
'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e'
  NAME  'VOC Explorer'  SCHEMA sys;
-CREATE USER "voc2" WITH ENCRYPTED PASSWORD  
'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e'
  NAME  'VOC Explorer'  SCHEMA sys;
-CREATE SCHEMA "sbar" AUTHORIZATION monetdb;
-CREATE SCHEMA "sfoo" AUTHORIZATION monetdb;
+CREATE USER "voc" WITH ENCRYPTED PASSWORD 
'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e'
 NAME 'VOC Explorer' SCHEMA sys;
+CREATE USER "voc2" WITH ENCRYPTED PASSWORD 
'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e'
 NAME 'VOC Explorer' SCHEMA sys;
+CREATE SCHEMA "sbar" AUTHORIZATION "monetdb";
+CREATE SCHEMA "sfoo" AUTHORIZATION "monetdb";
 CREATE TYPE "sfoo"."json" EXTERNAL NAME "json";
 CREATE TYPE "sys"."t1" EXTERNAL NAME "json";
 ALTER USER "voc" SET SCHEMA "sfoo";
@@ -312,15 +312,6 @@ CREATE SEQUENCE "sys"."seq6" AS BIGINT S
 CREATE SEQUENCE "sys"."seq7" AS BIGINT START WITH 10;
 CREATE SEQUENCE "sys"."seq8" AS BIGINT START WITH -5 INCREMENT BY -1 MINVALUE 
-10 MAXVALUE -1;
 CREATE SEQUENCE "sys"."seq9" AS BIGINT START WITH 10 MINVALUE 10 MAXVALUE 10;
-UPDATE sys.sequences seq SET start = 5 WHERE name =  'seq1'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 4 WHERE name =  'seq2'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 4 WHERE name =  'seq3'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 1 WHERE name =  'seq4'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 1 WHERE name =  'seq5'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 1 WHERE name =  'seq6'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 1 WHERE name =  'seq7'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = -1 WHERE name =  'seq8'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
-UPDATE sys.sequences seq SET start = 10 WHERE name =  'seq9'  AND schema_id = 
(SELECT s.id FROM sys.schemas s WHERE s.name =  'sys' );
 CREATE TABLE "sys"."test" ("s" CHARACTER LARGE OBJECT);
 CREATE TABLE "sys"."bla" ("s" CHARACTER LARGE OBJECT(10));
 CREATE TABLE "sys"."bob" ("ts" TIMESTAMP(3));
@@ -342,7 +333,7 @@ CREATE TABLE "sys"."higher_scorers" ("na
 CREATE TABLE "sys"."unknown_scorers" ("name" CHARACTER LARGE OBJECT, 
"first_score" INTEGER, "second_score" INTEGER);
 CREATE TABLE "sfoo"."foo" ("fi" INTEGER NOT NULL, "fs" CHARACTER LARGE OBJECT 
NOT NULL);
 CREATE TABLE "sbar"."bar" ("bi" INTEGER NOT NULL, "bs" CHARACTER LARGE OBJECT 
NOT NULL);
-CREATE REMOTE TABLE "sys"."rfoo" ("i" INTEGER) ON  
'mapi:monetdb://remote.host.url:5/dbname'  WITH USER  'bob'  ENCRYPTED 
PASSWORD  
'f8e3183d38e6c51889582cb260ab825252f395b4ac8fb0e6b13e9a71f7c10a80d5301e4a949f2783cb0c20205f1d850f87045f4420ad2271c8fd5f0cd8944be3'
 ;
+CREATE REMOTE TABLE "sys"."rfoo" ("i" INTEGER) ON 
'mapi:monetdb://remote.host.url:5/dbname' WITH USER 'bob' ENCRYPTED 
PASSWORD 
'f8e3183d38e6c51889582cb260ab825252f395b4ac8fb0e6b13e9a71f7c10a80d5301e4a949f2783cb0c20205f1d850f87045f4420ad2271c8fd5f0cd8944be3';
 CREATE MERGE TABLE "sys"."scorers" ("name" CHARACTER LARGE OBJECT, 
"first_score" INTEGER, "second_score" INTEGER) PARTITION BY VALUES USING 
("sys"."mod"("sys"."greatest"("first_score","second_score"),10));
 CREATE MERGE TABLE "sys"."splitted" ("stamp" TIMESTAMP, "val" INTEGER) 
PARTITION BY RANGE ON ("stamp");
 CREATE MERGE TABLE "sys"."m1" ("i" INTEGER);
@@ -357,6 +348,15 @@ create function "sys"."f1" () returns in
 create procedure "sys"."f1" (i int) begin declare x int; end@;
 create procedure "sys"."f1" () begin declare x int; end@;
 CREATE TABLE "sys"."tbl_with_data" ("c1" INTEGER, "c2" BIGINT, "c3" BINARY 
LARGE OBJECT, "c4" BOOLEAN, "c5" CHARACTER LARGE OBJECT, "c6" DATE, "c7" 
INTERVAL DAY, "c8" DECIMAL(18,3), "c9" DECIMAL(5), 

MonetDB: default - merged

2021-08-10 Thread Niels Nes
Changeset: eb5661843a65 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eb5661843a65
Branch: default
Log Message:

merged


diffs (12 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -3750,7 +3750,7 @@ claim_segmentsV2(sql_trans *tr, sql_tabl
 static int
 claim_segments(sql_trans *tr, sql_table *t, storage *s, size_t cnt, BUN 
*offset, BAT **offsets, bool locked)
 {
-   if (cnt > 1)
+   if (cnt > 1 && offsets)
return claim_segmentsV2(tr, t, s, cnt, offset, offsets, locked);
int in_transaction = segments_in_transaction(tr, t), ok = LOG_OK;
assert(s->segs);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jul2021 - only use claimV2 with an offsets bat

2021-08-10 Thread Niels Nes
Changeset: 766a0bc9bbb7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/766a0bc9bbb7
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Jul2021
Log Message:

only use claimV2 with an offsets bat


diffs (12 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -3750,7 +3750,7 @@ claim_segmentsV2(sql_trans *tr, sql_tabl
 static int
 claim_segments(sql_trans *tr, sql_table *t, storage *s, size_t cnt, BUN 
*offset, BAT **offsets, bool locked)
 {
-   if (cnt > 1)
+   if (cnt > 1 && offsets)
return claim_segmentsV2(tr, t, s, cnt, offset, offsets, locked);
int in_transaction = segments_in_transaction(tr, t), ok = LOG_OK;
assert(s->segs);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Approve output.

2021-08-10 Thread Sjoerd Mullender
Changeset: ce8ddcc3d014 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ce8ddcc3d014
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Approve output.


diffs (truncated from 1989 to 300 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -100,19 +100,21 @@
 \dSv sys.describe_user_defined_types
 \dSv sys.dump_add_schemas_to_users
 \dSv sys.dump_column_defaults
+\dSv sys.dump_column_grants
 \dSv sys.dump_comments
 \dSv sys.dump_create_roles
 \dSv sys.dump_create_schemas
 \dSv sys.dump_create_users
 \dSv sys.dump_foreign_keys
+\dSv sys.dump_function_grants
 \dSv sys.dump_functions
 \dSv sys.dump_grant_user_privileges
 \dSv sys.dump_indices
 \dSv sys.dump_partition_tables
-\dSv sys.dump_privileges
 \dSv sys.dump_sequences
 \dSv sys.dump_start_sequences
 \dSv sys.dump_table_constraint_type
+\dSv sys.dump_table_grants
 \dSv sys.dump_tables
 \dSv sys.dump_triggers
 \dSv sys.dump_user_defined_types
@@ -140,7 +142,6 @@
 \dSv sys.tracelog
 \dSv sys.users
 \dSv sys.var_values
-\dSf sys."_dump_table_data"
 \dSf sys."abbrev"
 \dSf sys."alpha"
 \dSf sys."alter_table"
@@ -464,19 +465,21 @@ SYSTEM VIEW  sys.describe_triggers
 SYSTEM VIEW  sys.describe_user_defined_types
 SYSTEM VIEW  sys.dump_add_schemas_to_users
 SYSTEM VIEW  sys.dump_column_defaults
+SYSTEM VIEW  sys.dump_column_grants
 SYSTEM VIEW  sys.dump_comments
 SYSTEM VIEW  sys.dump_create_roles
 SYSTEM VIEW  sys.dump_create_schemas
 SYSTEM VIEW  sys.dump_create_users
 SYSTEM VIEW  sys.dump_foreign_keys
+SYSTEM VIEW  sys.dump_function_grants
 SYSTEM VIEW  sys.dump_functions
 SYSTEM VIEW  sys.dump_grant_user_privileges
 SYSTEM VIEW  sys.dump_indices
 SYSTEM VIEW  sys.dump_partition_tables
-SYSTEM VIEW  sys.dump_privileges
 SYSTEM VIEW  sys.dump_sequences
 SYSTEM VIEW  sys.dump_start_sequences
 SYSTEM VIEW  sys.dump_table_constraint_type
+SYSTEM VIEW  sys.dump_table_grants
 SYSTEM VIEW  sys.dump_tables
 SYSTEM VIEW  sys.dump_triggers
 SYSTEM VIEW  sys.dump_user_defined_types
@@ -510,7 +513,6 @@ SYSTEM FUNCTION sys.<>
 SYSTEM FUNCTION sys.=
 SYSTEM FUNCTION sys.>
 SYSTEM FUNCTION sys.>=
-SYSTEM PROCEDUREsys._dump_table_data
 SYSTEM FUNCTION sys.abbrev
 SYSTEM FUNCTION sys.abs
 SYSTEM FUNCTION sys.acos
@@ -1030,7 +1032,7 @@ create view sys.describe_column_defaults
 create view sys.describe_comments as select o.id id, o.tpe tpe, o.nme fqn, 
c.remark rem from (select id, 'SCHEMA', sys.dq(name) from sys.schemas union all 
select t.id, case when ts.table_type_name = 'VIEW' then 'VIEW' else 'TABLE' 
end, sys.fqn(s.name, t.name) from sys.schemas s join sys.tables t on s.id = 
t.schema_id join sys.table_types ts on t.type = ts.table_type_id where not 
s.name <> 'tmp' union all select c.id, 'COLUMN', sys.fqn(s.name, t.name) || '.' 
|| sys.dq(c.name) from sys.columns c, sys.tables t, sys.schemas s where 
c.table_id = t.id and t.schema_id = s.id union all select idx.id, 'INDEX', 
sys.fqn(s.name, idx.name) from sys.idxs idx, sys._tables t, sys.schemas s where 
idx.table_id = t.id and t.schema_id = s.id union all select seq.id, 'SEQUENCE', 
sys.fqn(s.name, seq.name) from sys.sequences seq, sys.schemas s where 
seq.schema_id = s.id union all select f.id, ft.function_type_keyword, 
sys.fqn(s.name, f.name) from sys.functions f, sys.function_types ft, 
sys.schemas s where
  f.type = ft.function_type_id and f.schema_id = s.id) as o(id, tpe, nme) join 
sys.comments c on c.id = o.id;
 create view sys.describe_constraints as select s.name sch, t.name tbl, kc.name 
col, k.name con, case when k.type = 0 then 'PRIMARY KEY' when k.type = 1 then 
'UNIQUE' end tpe from sys.schemas s, sys._tables t, sys.objects kc, sys.keys k 
where kc.id = k.id and k.table_id = t.id and s.id = t.schema_id and t.system = 
false and k.type in (0, 1) and t.type in (0, 6);
 create view sys.describe_foreign_keys as with action_type (id, act) as (values 
(0, 'NO ACTION'), (1, 'CASCADE'), (2, 'RESTRICT'), (3, 'SET NULL'), (4, 'SET 
DEFAULT')) select fs.name fk_s, fkt.name fk_t, fkkc.name fk_c, fkkc.nr o, 
fkk.name fk, ps.name pk_s, pkt.name pk_t, pkkc.name pk_c, ou.act on_update, 
od.act on_delete from sys._tables fkt, sys.objects fkkc, sys.keys fkk, 
sys._tables pkt, sys.objects pkkc, sys.keys pkk, sys.schemas ps, sys.schemas 
fs, action_type ou, action_type od where fkt.id = fkk.table_id and pkt.id = 
pkk.table_id and fkk.id = fkkc.id and pkk.id = pkkc.id and fkk.rkey = pkk.id 
and fkkc.nr = pkkc.nr and pkt.schema_id = ps.id and fkt.schema_id = fs.id and 
(fkk."action" & 255) = od.id and ((fkk."action" >> 8) & 255) = ou.id order by 
fkk.name, fkkc.nr;
-create view sys.describe_functions as select f.id o, s.name sch, f.name fun, 
f.func def from 

MonetDB: default - Merge with Jul2021 branch.

2021-08-10 Thread Sjoerd Mullender
Changeset: f913719e8320 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f913719e8320
Modified Files:
gdk/gdk_batop.c
monetdb5/modules/mal/remote.c
sql/backends/monet5/sql.c
sql/server/rel_optimizer.c
sql/server/rel_schema.c
sql/storage/bat/bat_logger.c
Branch: default
Log Message:

Merge with Jul2021 branch.


diffs (truncated from 440 to 300 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -61,13 +61,13 @@ insert_string_bat(BAT *b, BAT *n, struct
BATiter ni; /* iterator */
size_t toff = ~(size_t) 0;  /* tail offset */
BUN p, r;   /* loop variables */
-   const void *tp; /* tail value pointer */
+   const void *tp = NULL;  /* tail value pointer */
unsigned char tbv;  /* tail value-as-bte */
unsigned short tsv; /* tail value-as-sht */
 #if SIZEOF_VAR_T == 8
unsigned int tiv;   /* tail value-as-int */
 #endif
-   var_t v = GDK_VAROFFSET; /* value */
+   var_t v;/* value */
size_t off; /* offset within n's string heap */
BUN cnt = ci->ncand;
BUN oldcnt = BATcount(b);
@@ -80,143 +80,88 @@ insert_string_bat(BAT *b, BAT *n, struct
if (cnt == 0)
return GDK_SUCCEED;
ni = bat_iterator(n);
-   tp = NULL;
-   if (oldcnt == 0 || (!GDK_ELIMDOUBLES(b->tvheap) &&
-   !GDK_ELIMDOUBLES(ni.vh))) {
-   if (b->batRole == TRANSIENT || b->tvheap == ni.vh) {
-   /* If b is in the transient farm (i.e. b will
-* never become persistent), we try some
-* clever tricks to avoid copying:
-* - if b is empty, we just let it share the
- *   string heap with n;
-* - otherwise, if b's string heap and n's
- *   string heap are the same (i.e. shared),
- *   we leave it that way (this includes the
- *   case that b is persistent and n shares
- *   its string heap with b);
-* - otherwise, if b shares its string heap
- *   with some other bat, we materialize it
- *   and we will have to copy strings.
-*/
-   bat bid = b->batCacheid;
 
-   /* if candidates are not dense, there is no
-* wholesale copying of n's offset heap, but
-* we may still be able to share the string
-* heap */
-   if (mayshare &&
-   oldcnt == 0 &&
-   b->tvheap != ni.vh &&
-   ci->tpe == cand_dense) {
-   /* make sure locking happens in a
-* predictable order: lowest id
-* first */
-   MT_thread_setalgorithm("share vheap, copy 
heap");
-   MT_lock_set(>theaplock);
-   if (b->tvheap->parentid != bid)
-   BBPunshare(b->tvheap->parentid);
-   HEAPdecref(b->tvheap, true);
-   HEAPincref(ni.vh);
-   b->tvheap = ni.vh;
-   BBPshare(ni.vh->parentid);
-   b->batDirtydesc = true;
-   MT_lock_unset(>theaplock);
-   toff = 0;
-   v = ni.width == 1 ? GDK_VAROFFSET + 1 :
-   ni.width == 2 ? GDK_VAROFFSET + (1 << 
9) :
-#if SIZEOF_VAR_T == 8
-   ni.width != 4 ? (var_t) 1 << 33 :
-#endif
-   (var_t) 1 << 17;
-   } else if (b->tvheap->parentid == ni.vh->parentid &&
-  ci->tpe == cand_dense) {
-   MT_thread_setalgorithm("copy heap");
-   toff = 0;
-   } else if (b->tvheap->parentid != bid &&
-  unshare_varsized_heap(b) != GDK_SUCCEED) {
-   bat_iterator_end();
-   return GDK_FAIL;
-   }
-   } else if (oldcnt == 0) {
-   v = ni.width == 1 ? GDK_VAROFFSET + 1 :
-   ni.width == 2 ? GDK_VAROFFSET + (1 << 9) :
-#if SIZEOF_VAR_T == 8
-   ni.width != 4 ? (var_t) 1 << 33 :
-#endif
-   (var_t) 1 << 17;
-   

MonetDB: Jul2021 - Don't copy vheap at all cost.

2021-08-10 Thread Sjoerd Mullender
Changeset: a7ca138a5812 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7ca138a5812
Modified Files:
gdk/gdk_batop.c
Branch: Jul2021
Log Message:

Don't copy vheap at all cost.


diffs (241 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -61,13 +61,13 @@ insert_string_bat(BAT *b, BAT *n, struct
BATiter ni; /* iterator */
size_t toff = ~(size_t) 0;  /* tail offset */
BUN p, r;   /* loop variables */
-   const void *tp; /* tail value pointer */
+   const void *tp = NULL;  /* tail value pointer */
unsigned char tbv;  /* tail value-as-bte */
unsigned short tsv; /* tail value-as-sht */
 #if SIZEOF_VAR_T == 8
unsigned int tiv;   /* tail value-as-int */
 #endif
-   var_t v = GDK_VAROFFSET; /* value */
+   var_t v;/* value */
size_t off; /* offset within n's string heap */
BUN cnt = ci->ncand;
BUN oldcnt = BATcount(b);
@@ -80,146 +80,89 @@ insert_string_bat(BAT *b, BAT *n, struct
if (cnt == 0)
return GDK_SUCCEED;
ni = bat_iterator(n);
-   tp = NULL;
-   if (oldcnt == 0 || (!GDK_ELIMDOUBLES(b->tvheap) &&
-   !GDK_ELIMDOUBLES(ni.vh) &&
-   b->tvheap->hashash == ni.vh->hashash)) {
-   if (b->batRole == TRANSIENT || b->tvheap == ni.vh) {
-   /* If b is in the transient farm (i.e. b will
-* never become persistent), we try some
-* clever tricks to avoid copying:
-* - if b is empty, we just let it share the
- *   string heap with n;
-* - otherwise, if b's string heap and n's
- *   string heap are the same (i.e. shared),
- *   we leave it that way (this includes the
- *   case that b is persistent and n shares
- *   its string heap with b);
-* - otherwise, if b shares its string heap
- *   with some other bat, we materialize it
- *   and we will have to copy strings.
-*/
-   bat bid = b->batCacheid;
 
-   /* if candidates are not dense, there is no
-* wholesale copying of n's offset heap, but
-* we may still be able to share the string
-* heap */
-   if (mayshare &&
-   oldcnt == 0 &&
-   b->tvheap != ni.vh &&
-   ci->tpe == cand_dense) {
-   /* make sure locking happens in a
-* predictable order: lowest id
-* first */
-   MT_thread_setalgorithm("share vheap, copy 
heap");
-   MT_lock_set(>theaplock);
-   if (b->tvheap->parentid != bid)
-   BBPunshare(b->tvheap->parentid);
-   HEAPdecref(b->tvheap, true);
-   HEAPincref(ni.vh);
-   b->tvheap = ni.vh;
-   BBPshare(ni.vh->parentid);
-   b->batDirtydesc = true;
-   MT_lock_unset(>theaplock);
-   toff = 0;
-   v = ni.width == 1 ? GDK_VAROFFSET + 1 :
-   ni.width == 2 ? GDK_VAROFFSET + (1 << 
9) :
-#if SIZEOF_VAR_T == 8
-   ni.width != 4 ? (var_t) 1 << 33 :
-#endif
-   (var_t) 1 << 17;
-   } else if (b->tvheap->parentid == ni.vh->parentid &&
-  ci->tpe == cand_dense) {
-   MT_thread_setalgorithm("copy heap");
-   toff = 0;
-   } else if (b->tvheap->parentid != bid &&
-  unshare_varsized_heap(b) != GDK_SUCCEED) {
-   bat_iterator_end();
-   return GDK_FAIL;
-   }
-   } else if (oldcnt == 0) {
-   v = ni.width == 1 ? GDK_VAROFFSET + 1 :
-   ni.width == 2 ? GDK_VAROFFSET + (1 << 9) :
-#if SIZEOF_VAR_T == 8
-   ni.width != 4 ? (var_t) 1 << 33 :
-#endif
-   (var_t) 1 << 17;
-   MT_thread_setalgorithm("copy vheap, copy heap");
-   if (b->tvheap->size < ni.vh->free) {
-   if 

MonetDB: Jul2021 - Clean up after and check for errors.

2021-08-10 Thread Sjoerd Mullender
Changeset: 04b982b956c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/04b982b956c3
Modified Files:
monetdb5/modules/mal/remote.c
Branch: Jul2021
Log Message:

Clean up after and check for errors.


diffs (21 lines):

diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1518,10 +1518,16 @@ static str RMTbincopyto(Client cntxt, Ma
 
sendtheap = b->ttype != TYPE_void && b->tvarsized;
if (isVIEW(b) && sendtheap && VIEWvtparent(b) && BATcount(b) < 
BATcount(BBP_cache(VIEWvtparent(b {
-   if ((b = BATdescriptor(bid)) == NULL)
+   if ((b = BATdescriptor(bid)) == NULL) {
+   BBPunfix(bid);
throw(MAL, "remote.bincopyto", RUNTIME_OBJECT_MISSING);
+   }
v = COLcopy(b, b->ttype, true, TRANSIENT);
BBPunfix(b->batCacheid);
+   if (v == NULL) {
+   BBPunfix(bid);
+   throw(MAL, "remote.bincopyto", GDK_EXCEPTION);
+   }
}
 
mnstr_printf(cntxt->fdout, /*JSON*/"{"
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jul2021 - Initial support for upgrading from Jun2020-mm...

2021-08-10 Thread Sjoerd Mullender
Changeset: 6d7914da9ee4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6d7914da9ee4
Modified Files:
sql/storage/bat/bat_logger.c
Branch: Jul2021
Log Message:

Initial support for upgrading from Jun2020-mmt branch.

We just do all the upgrades from Jun2020, minus the bit where the
sys.objects.sub column is added.


diffs (89 lines):

diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -16,6 +16,7 @@
 
 #define CATALOG_NOV2019 52203  /* first in Apr2019 */
 #define CATALOG_JUN2020 52204  /* first in Jun2020 */
+#define CATALOG_JUN2020_MMT 52206  /* only in Jun2020-mmt */
 #define CATALOG_OCT2020 52205  /* first in Oct2020 */
 
 /* Note, CATALOG version 52300 is the first one where the basic system
@@ -45,6 +46,14 @@ bl_preversion(sqlstore *store, int oldve
}
 #endif
 
+#ifdef CATALOG_JUN2020_MMT
+   if (oldversion == CATALOG_JUN2020_MMT) {
+   /* upgrade to default releases */
+   store->catalog_version = oldversion;
+   return GDK_SUCCEED;
+   }
+#endif
+
 #ifdef CATALOG_OCT2020
if (oldversion == CATALOG_OCT2020) {
/* upgrade to default releases */
@@ -932,6 +941,7 @@ struct table {
.column = "nr",
.fullname = "sys_objects_nr",
.newid = 2113,
+   .hasids = true,
},
{
.schema = "sys",
@@ -939,6 +949,7 @@ struct table {
.column = "sub",
.fullname = "sys_objects_sub",
.newid = 2163,
+   .hasids = true,
},
{
.schema = "tmp",
@@ -1415,7 +1426,7 @@ upgrade(old_logger *lg)
mapnew = NULL;
}
 
-   /* do the mapping in the system tables: all tables with the .hasids
+   /* do the mapping in the system tables: all columns with the .hasids
 * flag set may contain IDs that have to be mapped; also add all
 * system tables to the new catalog bats and add the new ones to the
 * lg->add bat and the old ones that were replaced to the lg->del bat */
@@ -1874,7 +1885,11 @@ bl_postversion(void *Store, old_logger *
 #endif
 
 #ifdef CATALOG_JUN2020
-   if (store->catalog_version <= CATALOG_JUN2020) {
+   if (store->catalog_version <= CATALOG_JUN2020
+#ifdef CATALOG_JUN2020_MMT
+   || store->catalog_version == CATALOG_JUN2020_MMT
+#endif
+   ) {
BAT *b; 
 /* temp variable */
{
/* new BOOLEAN column sys.functions.semantics */
@@ -2070,7 +2085,7 @@ bl_postversion(void *Store, old_logger *
 #endif
 
 #ifdef CATALOG_OCT2020
-   if (store->catalog_version <= CATALOG_OCT2020) {
+   if (store->catalog_version <= CATALOG_OCT2020) { /* not for 
Jun2020-mmt! */
/* add sub column to "objects" table. This is required for 
merge tables */
/* alter table sys.objects add column sub integer; */
if (tabins(lg, old_lg, tabins_first, -1, 0,
@@ -2283,7 +2298,14 @@ bl_postversion(void *Store, old_logger *
BBPretain(objs_sub->batCacheid);
bat_destroy(objs_sub);
}
-
+   }
+#endif
+#ifdef CATALOG_OCT2020
+   if (store->catalog_version <= CATALOG_OCT2020
+#ifdef CATALOG_JUN2020_MMT
+   || store->catalog_version == CATALOG_JUN2020_MMT
+#endif
+   ) {
/* update sys.functions set mod = 'sql' where mod = 'user'; */
{
BAT *b1, *b2, *b3;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Add missing cleanups.

2021-08-10 Thread Aris Koning
Changeset: 6b8835bde0a0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6b8835bde0a0
Modified Files:
sql/backends/monet5/sql_result.c
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

Add missing cleanups.


diffs (23 lines):

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
@@ -1027,6 +1027,8 @@ create_prepare_result(backend *b, cq *q,
BBPunfix(btype->batCacheid);
if (bdigits)
BBPunfix(bdigits->batCacheid);
+   if (bimpl)
+   BBPunfix(bimpl->batCacheid);
if (bscale)
BBPunfix(bscale->batCacheid);
if (bschema)
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -2581,6 +2581,7 @@ monetdbe_result_fetch(monetdbe_result* m
}
j++;
}
+   bat_iterator_end();
} else if (bat_type == TYPE_date) {
date *baseptr;
GENERATE_BAT_INPUT_BASE(date);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Various improvements to the dump code.

2021-08-10 Thread Sjoerd Mullender
Changeset: 183e9e27b7f2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/183e9e27b7f2
Modified Files:
sql/scripts/52_describe.sql
sql/scripts/76_dump.sql
Branch: default
Log Message:

Various improvements to the dump code.
Add columns to helper views so that they can be selected on;
fix dumping of functions, especially in languages other than SQL;
fix dumping of grants by issuing GRANT statements.

We're not there yet...


diffs (truncated from 647 to 300 lines):

diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql
--- a/sql/scripts/52_describe.sql
+++ b/sql/scripts/52_describe.sql
@@ -145,7 +145,7 @@ BEGIN
 END;
 END;
 
-CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || 
sys.replace(s,,'') || ''' '; END;
+CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN  || 
sys.replace(s,,'') || ; END;
 CREATE FUNCTION sys.DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || 
sys.replace(s,'"','""') || '"'; END; --TODO: Figure out why this breaks with 
the space
 CREATE FUNCTION sys.FQN(s STRING, t STRING) RETURNS STRING BEGIN RETURN 
sys.DQ(s) || '.' || sys.DQ(t); END;
 CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN 
RETURN 'ALTER TABLE ' || sys.FQN(s, t) || ' '; END;
@@ -514,12 +514,54 @@ CREATE VIEW sys.describe_sequences AS
ORDER BY s.name, seq.name;
 
 CREATE VIEW sys.describe_functions AS
+   WITH func_args_all(func_id, number, max_number, func_arg) AS
+   (
+   SELECT
+   func_id,
+   number,
+   max(number) OVER (PARTITION BY func_id ORDER BY number 
DESC),
+   group_concat(sys.dq(name) || ' ' || 
sys.describe_type(type, type_digits, type_scale),', ') OVER (PARTITION BY 
func_id ORDER BY number)
+   FROM sys.args
+   WHERE inout = 1
+   ),
+   func_args(func_id, func_arg) AS
+   (
+   SELECT func_id, func_arg
+   FROM func_args_all
+   WHERE number = max_number
+   ),
+   func_rets_all(func_id, number, max_number, func_ret, func_ret_type) AS
+   (
+   SELECT
+   func_id,
+   number,
+   max(number) OVER (PARTITION BY func_id ORDER BY number 
DESC),
+   group_concat(sys.dq(name) || ' ' || 
sys.describe_type(type, type_digits, type_scale),', ') OVER (PARTITION BY 
func_id ORDER BY number),
+   group_concat(sys.describe_type(type, type_digits, 
type_scale),', ') OVER (PARTITION BY func_id ORDER BY number)
+   FROM sys.args
+   WHERE inout = 0
+   ),
+   func_rets(func_id, func_ret, func_ret_type) AS
+   (
+   SELECT
+   func_id,
+   func_ret,
+   func_ret_type
+   FROM func_rets_all
+   WHERE number = max_number
+   )
SELECT
f.id o,
s.name sch,
f.name fun,
-   f.func def
-   FROM sys.functions f JOIN sys.schemas s ON f.schema_id = s.id WHERE 
s.name <> 'tmp' AND NOT f.system;
+   CASE WHEN f.language IN (1, 2) THEN f.func ELSE 'CREATE ' || 
ft.function_type_keyword || ' ' || sys.FQN(s.name, f.name) || '(' || 
coalesce(fa.func_arg, '') || ')' || CASE WHEN f.type = 5 THEN ' RETURNS TABLE 
(' || coalesce(fr.func_ret, '') || ')' WHEN f.type IN (1,3) THEN ' RETURNS ' || 
fr.func_ret_type ELSE '' END || CASE WHEN fl.language_keyword IS NULL THEN '' 
ELSE ' LANGUAGE ' || fl.language_keyword END || ' ' || f.func END def
+   FROM sys.functions f
+   LEFT OUTER JOIN func_args fa ON fa.func_id = f.id
+   LEFT OUTER JOIN func_rets fr ON fr.func_id = f.id
+   JOIN sys.schemas s ON f.schema_id = s.id
+   JOIN sys.function_types ft ON f.type = ft.function_type_id
+   LEFT OUTER JOIN sys.function_languages fl ON f.language = 
fl.language_id
+   WHERE s.name <> 'tmp' AND NOT f.system;
 
 CREATE FUNCTION sys.describe_columns(schemaName string, tableName string)
RETURNS TABLE(name string, type string, digits integer, scale integer, 
Nulls boolean, cDefault string, number integer, sqltype string, remark string)
diff --git a/sql/scripts/76_dump.sql b/sql/scripts/76_dump.sql
--- a/sql/scripts/76_dump.sql
+++ b/sql/scripts/76_dump.sql
@@ -5,145 +5,239 @@
 -- Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
 
 CREATE VIEW sys.dump_create_roles AS
-   SELECT
-   'CREATE ROLE ' || sys.dq(name) || ';' stmt FROM sys.auths
-   WHERE name NOT IN (SELECT name FROM sys.db_user_info)
-   AND grantor <> 0;
+  SELECT
+'CREATE ROLE ' || sys.dq(name) || ';' stmt,
+name user_name
+FROM sys.auths
+   WHERE name NOT IN (SELECT name FROM sys.db_user_info)
+ AND grantor <> 0;
 
 CREATE VIEW 

MonetDB: Jul2021 - Don't close client's stream

2021-08-10 Thread Pedro Ferreira
Changeset: fee590863a7a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fee590863a7a
Modified Files:
sql/backends/monet5/sql.c
Branch: Jul2021
Log Message:

Don't close client's stream


diffs (21 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2601,7 +2601,7 @@ mvc_export_table_wrap( Client cntxt, Mal
}
if ((ok = mvc_export_result(cntxt->sqlcontext, s, res, tostdout, 
mb->starttime, mb->optimize)) < 0) {
msg = createException(SQL, "sql.resultSet", SQLSTATE(45000) 
"Result set construction failed");
-   if (!tostdout)
+   if (!onclient && !tostdout)
close_stream(s);
goto wrapup_result_set1;
}
@@ -2832,7 +2832,7 @@ mvc_export_row_wrap( Client cntxt, MalBl
}
if ((ok = mvc_export_result(cntxt->sqlcontext, s, res, strcmp(filename, 
"stdout") == 0, mb->starttime, mb->optimize)) < 0) {
msg = createException(SQL, "sql.resultSet", SQLSTATE(45000) 
"Result set construction failed");
-   if (!tostdout)
+   if (!onclient && !tostdout)
close_stream(s);
goto wrapup_result_set;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jul2021 - Defensive lines for declared tables

2021-08-10 Thread Pedro Ferreira
Changeset: 136a16cc8969 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/136a16cc8969
Modified Files:
sql/server/rel_optimizer.c
sql/server/rel_schema.c
sql/test/miscellaneous/Tests/simple_selects.test
Branch: Jul2021
Log Message:

Defensive lines for declared tables


diffs (82 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -9523,7 +9523,7 @@ rel_optimize_unions_topdown(visitor *v, 
return rel;
 }
 
-static sql_rel *
+static inline sql_rel *
 rel_basecount(visitor *v, sql_rel *rel)
 {
if (is_groupby(rel->op) && rel->l && !rel->r && list_length(rel->exps) 
== 1 && exp_aggr_is_count(rel->exps->h->data)) {
@@ -9532,7 +9532,8 @@ rel_basecount(visitor *v, sql_rel *rel)
if (is_basetable(bt->op) && !e->l) { /* count(*) */
/* change into select cnt('schema','table') */;
sql_table *t = bt->l;
-   if (!isTable(t))
+   /* I need to get the declared table's frame number to 
make this work correctly for those */
+   if (!isTable(t) || isDeclaredTable(t))
return rel;
sql_subfunc *cf = sql_bind_func(v->sql, "sys", "cnt", 
sql_bind_localtype("str"), sql_bind_localtype("str"), F_FUNC);
list *exps = sa_list(v->sql->sa);
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
@@ -1471,6 +1471,8 @@ sql_drop_view(sql_query *query, dlist *q
}
return NULL;
}
+   if (!isView(t))
+   return sql_error(sql, 02, SQLSTATE(42000) "DROP VIEW: unable to 
drop view '%s': is a table", tname);
 
return rel_drop(sql->sa, ddl_drop_view, t->s->base.name, tname, NULL, 
nr, if_exists);
 }
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -792,9 +792,6 @@ select ""()
 1
 
 statement ok
-rollback
-
-statement ok
 CREATE FUNCTION ups() RETURNS INT
 BEGIN
DECLARE 
"nononononononononononononononononononononononononononononononono" int;
@@ -804,6 +801,9 @@ END;  -- error for now
 statement error
 select ups()
 
+statement ok
+rollback
+
 statement error
 create function 
""() returns 
int return 2
 
@@ -833,3 +833,24 @@ rollback
 
 statement ok
 drop table thisnamewontconflict
+
+statement ok
+start transaction
+
+statement ok
+CREATE OR REPLACE FUNCTION nasty() RETURNS BIGINT
+BEGIN
+   DECLARE TABLE atest (a int);
+   DECLARE res BIGINT;
+   INSERT INTO atest VALUES (1),(2),(3);
+   SELECT count(*) INTO res FROM atest;
+   RETURN res;
+END
+
+query I rowsort
+select nasty()
+
+3
+
+statement ok
+rollback
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Reduce optimization iterations by applying si...

2021-08-10 Thread Pedro Ferreira
Changeset: a5efdf4dce5f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a5efdf4dce5f
Modified Files:
sql/server/rel_optimizer.c
Branch: default
Log Message:

Reduce optimization iterations by applying simplify count optimizer first


diffs (13 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -9613,8 +9613,8 @@ rel_optimize_projections(visitor *v, sql
rel = rel_push_count_down(v, rel);
/* only when value_based_opt is on, ie not for dependency resolution */
if (v->value_based_opt) {
+   rel = rel_simplify_count(v, rel);
rel = rel_basecount(v, rel);
-   rel = rel_simplify_count(v, rel);
}
return rel;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: properties - Merged with default

2021-08-10 Thread Pedro Ferreira
Changeset: bf24465ff603 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf24465ff603
Modified Files:
gdk/gdk.h
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_private.h
monetdb5/modules/atoms/mtime.c
monetdb5/modules/atoms/mtime.h
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_optimizer.h
sql/server/rel_planner.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_rewriter.c
sql/server/rel_rewriter.h
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/rel_statistics.c
sql/server/rel_statistics_functions.c
sql/server/rel_updates.c
sql/server/sql_atom.c
sql/server/sql_atom.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_partition.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
tools/monetdbe/monetdbe.c
Branch: properties
Log Message:

Merged with default


diffs (truncated from 199397 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -803,3 +803,11 @@ 6b71a8cc3498561815ac88d6c652922359efd13a
 02fd591b7d3311d566007e1bfb0c59682b17f12c Jul2021_root
 5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_17
 5cb19dc0880d1fb4799cd0f8019d1c2b430c503e Oct2020_SP5_release
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_1
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_release
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_3
+489951059c7fc87ef706d8a563cd024ebdeed108 Jul2021_release
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_release
+9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_5
+404cb13ad1bc3469bfaf5b7696a4d2cfe5ce71f4 Jul2021_release
+9ab0adea978c184d895ca445792a79f26cb9d075 Jul2021_release
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ set(CMAKE_FIND_APPBUNDLE LAST)
 include(CheckCSourceCompiles REQUIRED)
 include(CheckCCompilerFlag REQUIRED)
 include(CheckIncludeFile REQUIRED)
+include(CheckIncludeFiles REQUIRED)
 include(CMakePushCheckState REQUIRED)
 include(CheckStructHasMember REQUIRED)
 include(CheckSymbolExists REQUIRED)
@@ -76,7 +77,6 @@ if(NOT HAVE_SYS_SOCKET_H)
 endif()
 set(CMAKE_REQUIRED_INCLUDES "/usr/include")
 
-monetdb_configure_crypto()
 monetdb_configure_sizes()
 
 include(GNUInstallDirs)
diff --git a/ChangeLog.Jul2021 b/ChangeLog.Jul2021
--- a/ChangeLog.Jul2021
+++ b/ChangeLog.Jul2021
@@ -1,6 +1,3 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
-* Thu Apr 15 2021 svetlin 
-- preserve in query comments
-
diff --git a/ChangeLog.Oct2020 b/ChangeLog.Oct2020
deleted file mode 100644
--- a/ChangeLog.Oct2020
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for devel
-# This file is updated with Maddlog
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP5/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jul2021/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -119,18 +119,11 @@ BuildRequires: pkgconfig(libcurl)
 BuildRequires: pkgconfig(liblzma)
 BuildRequires: pkgconfig(uuid)
 BuildRequires: pkgconfig(libxml-2.0)
-BuildRequires: pkgconfig(openssl)
 %if %{with pcre}
 BuildRequires: pkgconfig(libpcre) >= 4.5
 %endif
 BuildRequires: pkgconfig(zlib)
-%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7
-# not on RHEL 7
 BuildRequires: pkgconfig(liblz4) >= 1.8
-%global LZ4 ON
-%else
-%global LZ4 OFF
-%endif
 %if %{with py3integration}
 BuildRequires: pkgconfig(python3) >= 3.5
 BuildRequires: python3-numpy
@@ -281,7 +274,6 @@ Summary: MonetDB - Monet Database Manage
 Group: Applications/Databases
 Requires: %{name}-client%{?_isa} = %{version}-%{release}
 Requires: %{name}-stream-devel%{?_isa} = %{version}-%{release}
-Requires: openssl-devel
 
 %description client-devel
 MonetDB is a database management system that is developed from a
@@ -350,6 +342,10 @@ Recommends: php-monetdb >= 1.0
 %endif
 Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
 Requires: python3-pymonetdb >= 1.0.6
+%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7
+Recommends: python3dist(lz4)
+Recommends: python3dist(scipy)
+%endif
 
 %description client-tests
 MonetDB is a database management system that is developed from a
@@ -794,9 +790,8 @@ fi

MonetDB: properties - This optimizer has been backported

2021-08-10 Thread Pedro Ferreira
Changeset: 1afbf38fb99a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1afbf38fb99a
Modified Files:
sql/server/rel_statistics.c
Branch: properties
Log Message:

This optimizer has been backported


diffs (64 lines):

diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c
--- a/sql/server/rel_statistics.c
+++ b/sql/server/rel_statistics.c
@@ -514,51 +514,6 @@ rel_prune_predicates(visitor *v, sql_rel
return rel->exps;
 }
 
-static list*
-rel_simplify_count(visitor *v, sql_rel *rel)
-{
-   mvc *sql = v->sql;
-   int ncountstar = 0;
-
-   /* Convert count(no null) into count(*) */
-   for (node *n = rel->exps->h; n ; n = n->next) {
-   sql_exp *e = n->data;
-
-   if (exp_aggr_is_count(e) && !need_distinct(e)) {
-   if (list_length(e->l) == 0) {
-   ncountstar++;
-   } else if (list_length(e->l) == 1 && 
!has_nil((sql_exp*)((list*)e->l)->h->data)) {
-   sql_subfunc *cf = sql_bind_func(sql, "sys", 
"count", sql_bind_localtype("void"), NULL, F_AGGR);
-   sql_exp *ne = exp_aggr(sql->sa, NULL, cf, 0, 0, 
e->card, 0);
-   if (exp_name(e))
-   exp_prop_alias(sql->sa, ne, e);
-   n->data = ne;
-   ncountstar++;
-   v->changes++;
-   }
-   }
-   }
-   /* With multiple count(*), use exp_ref to reduce the number of calls to 
this aggregate */
-   if (ncountstar > 1) {
-   sql_exp *count_star = NULL;
-   for (node *n = rel->exps->h; n ; n = n->next) {
-   sql_exp *e = n->data;
-
-   if (exp_aggr_is_count(e) && !need_distinct(e) && 
list_length(e->l) == 0) {
-   if (!count_star) {
-   count_star = e;
-   } else {
-   sql_exp *ne = exp_ref(sql, count_star);
-   if (exp_name(e))
-   exp_prop_alias(sql->sa, ne, e);
-   n->data = ne;
-   }
-   }
-   }
-   }
-   return rel->exps;
-}
-
 sql_rel *
 rel_get_statistics(visitor *v, sql_rel *rel)
 {
@@ -620,8 +575,6 @@ rel_get_statistics(visitor *v, sql_rel *
if (is_simple_project(rel->op) && !list_empty(rel->r))
rel->r = exps_exp_visitor_bottomup(v, rel, rel->r, 0, 
_propagate_statistics, false);
/* The following optimizations can only be applied after 
propagating the statistics to rel->exps */
-   if (is_groupby(rel->op) && rel->exps)
-   rel->exps = rel_simplify_count(v, rel);
if ((is_join(rel->op) || is_select(rel->op)) && rel->exps) {
int changes = v->changes;
rel->exps = rel_prune_predicates(v, rel);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Windows compilation fixes

2021-08-10 Thread Pedro Ferreira
Changeset: c62d6539655e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c62d6539655e
Modified Files:
common/utils/rmd160.c
sql/backends/monet5/sql_result.c
Branch: default
Log Message:

Windows compilation fixes


diffs (26 lines):

diff --git a/common/utils/rmd160.c b/common/utils/rmd160.c
--- a/common/utils/rmd160.c
+++ b/common/utils/rmd160.c
@@ -34,9 +34,7 @@
 \/
 
 /*  header files */
-#include 
-#include 
-#include 
+#include "monetdb_config.h"
 #include "rmd160.h"
 
 //
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
@@ -1632,7 +1632,7 @@ export_length(stream *s, int mtype, sql_
return -2;
if (mvc_send_lng(s, length) != 1)
return -4;
-   return length;
+   return 0;
 }
 
 int
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list