Changeset: 00f2cb145ec0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=00f2cb145ec0
Added Files:
sql/test/mergetables/Tests/mergequery.stable.out.single
Modified Files:
clients/mapiclient/tachograph.c
clients/mapiclient/tomograph.c
gdk/gdk_group.c
gdk/gdk_join.c
gdk/gdk_storage.c
sql/storage/bat/bat_logger.c
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: HTM
Log Message:
Merge with default branch.
diffs (truncated from 471 to 300 lines):
diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c
--- a/clients/mapiclient/tachograph.c
+++ b/clients/mapiclient/tachograph.c
@@ -960,9 +960,9 @@ main(int argc, char **argv)
doQ(buf);
if( cache){
#ifdef NATIVE_WIN32
- if( access(cache,F_OK) && _mkdir(cache)){
+ if( _mkdir(cache) < 0 && errno != EEXIST){
#else
- if( access(cache,F_OK) && mkdir(cache,0755) ) {
+ if( mkdir(cache,0755) < 0 && errno != EEXIST) {
#endif
fprintf(stderr,"Failed to create cache '%s'\n",cache);
exit(-1);
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -1735,9 +1735,9 @@ main(int argc, char **argv)
/* reprocess an existing profiler trace, possibly producing the trace
split */
if (cache) {
#ifdef NATIVE_WIN32
- if( access(cache, F_OK) && _mkdir(cache)){
+ if( _mkdir(cache) < 0 && errno != EEXIST){
#else
- if( access(cache, F_OK) && mkdir(cache,0755) ) {
+ if( mkdir(cache,0755) < 0 && errno != EEXIST) {
#endif
fprintf(stderr,"Failed to create cache '%s'\n",cache);
exit(-1);
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -69,12 +69,14 @@
maxgrps = BATcount(b); \
if (extents) { \
BATsetcount(en, ngrp); \
- BATextend(en, maxgrps); \
+ if (BATextend(en, maxgrps) != GDK_SUCCEED) \
+ goto error; \
exts = (oid *) Tloc(en, BUNfirst(en)); \
} \
if (histo) { \
BATsetcount(hn, ngrp); \
- BATextend(hn, maxgrps); \
+ if (BATextend(hn, maxgrps) != GDK_SUCCEED) \
+ goto error; \
cnts = (wrd *) Tloc(hn, BUNfirst(hn)); \
} \
} \
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3279,10 +3279,17 @@ BATproject(BAT *l, BAT *r)
}
assert(l->ttype == TYPE_oid);
- if (ATOMstorage(tpe) == TYPE_str && l->T->nonil &&
- (rcount == 0 || lcount > (rcount >> 3))) {
+ if (ATOMstorage(tpe) == TYPE_str &&
+ l->T->nonil &&
+ (rcount == 0 ||
+ lcount > (rcount >> 3) ||
+ r->batRestricted == BAT_READ)) {
/* insert strings as ints, we need to copy the string
- * heap whole sale */
+ * heap whole sale; we can not do this if there are
+ * nils in the left column, and we will not do it if
+ * the left is much smaller than the right and the
+ * right is writable (meaning we have to actually copy
+ * the right string heap) */
tpe = r->T->width == 1 ? TYPE_bte : (r->T->width == 2 ?
TYPE_sht : (r->T->width == 4 ? TYPE_int : TYPE_lng));
/* int's nil representation is a valid offset, so
* don't check for nils */
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -271,7 +271,7 @@ GDKextendf(int fd, size_t size, const ch
IODEBUG t0 = GDKms();
if (stb.st_size < (off_t) size) {
#ifdef HAVE_FALLOCATE
- if (fallocate(fd, 0, stb.st_size, (off_t) size - stb.st_size) <
0 &&
+ if ((rt = fallocate(fd, 0, stb.st_size, (off_t) size -
stb.st_size)) < 0 &&
errno == EOPNOTSUPP)
/* on Linux, posix_fallocate uses a slow
* method to allocate blocks if the underlying
@@ -287,6 +287,9 @@ GDKextendf(int fd, size_t size, const ch
* the operation, so just resize the file */
#endif
#endif
+ /* we get here when (posix_)fallocate fails because it
+ * is not supported on the file system, or if neither
+ * function exists */
rt = ftruncate(fd, (off_t) size);
}
IODEBUG fprintf(stderr, "#GDKextend %s " SZFMT " -> " SZFMT " %dms%s\n",
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
@@ -17,8 +17,13 @@ static int
bl_preversion( int oldversion, int newversion)
{
#define CATALOG_OCT2014 52100
+#define CATALOG_OCT2014SP3 52101
(void)newversion;
+ if (oldversion == CATALOG_OCT2014SP3) {
+ catalog_version = oldversion;
+ return 0;
+ }
if (oldversion == CATALOG_OCT2014) {
catalog_version = oldversion;
return 0;
@@ -73,8 +78,39 @@ bl_postversion( void *lg)
logger_add_bat(lg, tne, N(n, NULL, s, "types_eclass"));
bat_destroy(te);
bat_destroy(tn);
+ } else if (catalog_version == CATALOG_OCT2014SP3) {
+ BAT *te, *tn, *tne;
+ BATiter tei, tni;
+ char *s = "sys", n[64];
+ BUN p,q;
+
+ te = temp_descriptor(logger_find_bat(lg, N(n, NULL, s,
"types_eclass")));
+ tn = temp_descriptor(logger_find_bat(lg, N(n, NULL, s,
"types_sqlname")));
+ if (!te || !tn)
+ return;
+ tei = bat_iterator(te);
+ tni = bat_iterator(tn);
+ tne = BATnew(TYPE_void, TYPE_int, BATcount(te), PERSISTENT);
+ if (!tne)
+ return;
+ BATseqbase(tne, te->hseqbase);
+ for(p=BUNfirst(te), q=BUNlast(te); p<q; p++) {
+ int eclass = *(int*)BUNtail(tei, p);
+ char *name = BUNtail(tni, p);
+
+ if (eclass == EC_MONTH) /* old EC_INTERVAL */
+ eclass = strcmp(name, "sec_interval") == 0 ?
EC_SEC : EC_MONTH;
+ else if (eclass >= EC_SEC) /* old EC_DEC */
+ eclass += 1;
+ BUNappend(tne, &eclass, TRUE);
+ }
+ BATsetaccess(tne, BAT_READ);
+ logger_add_bat(lg, tne, N(n, NULL, s, "types_eclass"));
+ bat_destroy(te);
+ bat_destroy(tn);
}
- if (catalog_version == CATALOG_OCT2014) {
+ if (catalog_version == CATALOG_OCT2014 ||
+ catalog_version == CATALOG_OCT2014SP3) {
/* we need to replace tables.readonly by tables.access column */
BAT *b, *b1;
BATiter bi;
diff --git a/sql/test/mergetables/Tests/mergequery.stable.out.single
b/sql/test/mergetables/Tests/mergequery.stable.out.single
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/mergequery.stable.out.single
@@ -0,0 +1,225 @@
+stdout of test 'mergequery` in directory 'sql/test/mergetables` itself:
+
+
+# 16:20:23 >
+# 16:20:23 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=30678" "--set"
"mapi_usock=/var/tmp/mtest-11019/.s.monetdb.30678" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/mk/current//Linux/var/MonetDB/mTests_sql_test_mergetables"
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 16:20:23 >
+
+# MonetDB 5 server v11.20.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_mergetables', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit
integers dynamically linked
+# Found 15.590 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:30678/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-11019/.s.monetdb.30678
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/R module loaded
+
+Ready.
+
+# 16:20:23 >
+# 16:20:23 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-11019" "--port=30678"
+# 16:20:23 >
+
+#CREATE TABLE part1 ( x double, y double, z double);
+#COPY 4 RECORDS INTO part1 FROM stdin USING DELIMITERS ' ','\n';
+#0.0 0.0 0.0
+#1.0 0.0 0.0
+#0.0 1.0 0.0
+#1.0 1.0 0.0
+[ 4 ]
+#CREATE TABLE part2 ( x double, y double, z double);
+#COPY 4 RECORDS INTO part2 FROM stdin USING DELIMITERS ' ','\n';
+#2.0 0.0 0.0
+#3.0 0.0 0.0
+#2.0 1.0 0.0
+#3.0 1.0 0.0
+[ 4 ]
+#CREATE MERGE TABLE complete ( x double, y double, z double);
+#ALTER TABLE complete ADD TABLE part1;
+#ALTER TABLE complete ADD TABLE part2;
+#SELECT * FROM COMPLETE;
+% .complete, .complete, .complete # table_name
+% x, y, z # name
+% double, double, double # type
+% 24, 24, 24 # length
+[ 0, 0, 0 ]
+[ 1, 0, 0 ]
+[ 0, 1, 0 ]
+[ 1, 1, 0 ]
+[ 2, 0, 0 ]
+[ 3, 0, 0 ]
+[ 2, 1, 0 ]
+[ 3, 1, 0 ]
+#SELECT * FROM complete where x>=0.0 AND x <=1.0;
+% .complete, .complete, .complete # table_name
+% x, y, z # name
+% double, double, double # type
+% 24, 24, 24 # length
+[ 0, 0, 0 ]
+[ 1, 0, 0 ]
+[ 0, 1, 0 ]
+[ 1, 1, 0 ]
+#SELECT * FROM complete where x>=2.0 AND x <=3.0;
+% .complete, .complete, .complete # table_name
+% x, y, z # name
+% double, double, double # type
+% 24, 24, 24 # length
+[ 2, 0, 0 ]
+[ 3, 0, 0 ]
+[ 2, 1, 0 ]
+[ 3, 1, 0 ]
+#SELECT * FROM complete where x>=1.0 AND x <=2.0;
+% .complete, .complete, .complete # table_name
+% x, y, z # name
+% double, double, double # type
+% 24, 24, 24 # length
+[ 1, 0, 0 ]
+[ 1, 1, 0 ]
+[ 2, 0, 0 ]
+[ 2, 1, 0 ]
+#CREATE TABLE answ( LIKE complete);
+#EXPLAIN INSERT INTO answ
+#SELECT * FROM complete where x>=1.0 AND x <=2.0;
+% .explain # table_name
+% mal # name
+% clob # type
+% 129 # length
+function user.s13_1{autoCommit=true}(A0:dbl,A1:dbl):void;
+ X_83:void := querylog.define("explain insert into answ\nselect * from
complete where x>=1.0 and x <=2.0;","default_pipe",52);
+ X_4 := sql.mvc();
+ X_5:bat[:oid,:dbl] := bat.new(nil:oid,nil:dbl);
+ X_11:bat[:oid,:dbl] := sql.bind(X_4,"sys","part1","x",0);
+ X_8:bat[:oid,:oid] := sql.tid(X_4,"sys","part1");
+ X_97 := algebra.subselect(X_11,X_8,A0,A1,true,true,false);
+ (X_14,r1_14) := sql.bind(X_4,"sys","part1","x",2);
+ X_98 := algebra.subselect(r1_14,nil:bat[:oid,:oid],A0,A1,true,true,false);
+ X_17:bat[:oid,:dbl] := sql.bind(X_4,"sys","part1","x",1);
+ X_100 := algebra.subselect(X_17,X_8,A0,A1,true,true,false);
+ X_19 := sql.subdelta(X_97,X_8,X_14,X_98,X_100);
+ X_21 := sql.projectdelta(X_19,X_11,X_14,r1_14,X_17);
+ X_22 := bat.append(X_5,X_21,true);
+ X_25:bat[:oid,:dbl] := sql.bind(X_4,"sys","part2","x",0);
+ X_23:bat[:oid,:oid] := sql.tid(X_4,"sys","part2");
+ X_101 := algebra.subselect(X_25,X_23,A0,A1,true,true,false);
+ (X_26,r1_30) := sql.bind(X_4,"sys","part2","x",2);
+ X_102 := algebra.subselect(r1_30,nil:bat[:oid,:oid],A0,A1,true,true,false);
+ X_28:bat[:oid,:dbl] := sql.bind(X_4,"sys","part2","x",1);
+ X_104 := algebra.subselect(X_28,X_23,A0,A1,true,true,false);
+ X_29 := sql.subdelta(X_101,X_23,X_26,X_102,X_104);
+ X_31 := sql.projectdelta(X_29,X_25,X_26,r1_30,X_28);
+ X_32 := bat.append(X_22,X_31,true);
+ X_33 := sql.append(X_4,"sys","answ","x",X_32);
+ X_37:bat[:oid,:dbl] := bat.new(nil:oid,nil:dbl);
+ X_40:bat[:oid,:dbl] := sql.bind(X_33,"sys","part1","y",0);
+ (X_44,r1_53) := sql.bind(X_33,"sys","part1","y",2);
+ X_47:bat[:oid,:dbl] := sql.bind(X_33,"sys","part1","y",1);
+ X_49 := sql.projectdelta(X_19,X_40,X_44,r1_53,X_47);
+ X_50 := bat.append(X_37,X_49,true);
+ X_51:bat[:oid,:dbl] := sql.bind(X_33,"sys","part2","y",0);
+ (X_53,r1_64) := sql.bind(X_33,"sys","part2","y",2);
+ X_55:bat[:oid,:dbl] := sql.bind(X_33,"sys","part2","y",1);
+ X_56 := sql.projectdelta(X_29,X_51,X_53,r1_64,X_55);
+ X_57 := bat.append(X_50,X_56,true);
+ X_59 := sql.append(X_33,"sys","answ","y",X_57);
+ X_60:bat[:oid,:dbl] := bat.new(nil:oid,nil:dbl);
+ X_61:bat[:oid,:dbl] := sql.bind(X_59,"sys","part1","z",0);
+ (X_64,r1_78) := sql.bind(X_59,"sys","part1","z",2);
+ X_66:bat[:oid,:dbl] := sql.bind(X_59,"sys","part1","z",1);
+ X_67 := sql.projectdelta(X_19,X_61,X_64,r1_78,X_66);
+ X_68 := bat.append(X_60,X_67,true);
+ X_69:bat[:oid,:dbl] := sql.bind(X_59,"sys","part2","z",0);
+ (X_71,r1_87) := sql.bind(X_59,"sys","part2","z",2);
+ X_74:bat[:oid,:dbl] := sql.bind(X_59,"sys","part2","z",1);
+ X_76 := sql.projectdelta(X_29,X_69,X_71,r1_87,X_74);
+ X_77 := bat.append(X_68,X_76,true);
+ X_78 := sql.append(X_59,"sys","answ","z",X_77);
+ X_80 := aggr.count(X_77);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list