Changeset: bf2a0c4dc0d5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf2a0c4dc0d5
Added Files:
sql/test/bugs/Tests/substring_limit_bug.sql
sql/test/bugs/Tests/substring_limit_bug.stable.err
sql/test/bugs/Tests/substring_limit_bug.stable.out
Modified Files:
MonetDB.spec
clients/odbc/driver/ODBCUtil.c
gdk/gdk_calc.c
gdk/gdk_heap.c
gdk/gdk_search.c
monetdb5/modules/kernel/batstr.c
sql/include/sql_catalog.h
sql/storage/bat/bat_storage.c
sql/test/bugs/Tests/All
Branch: default
Log Message:
Merge with Jan2014 branch.
diffs (299 lines):
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -435,7 +435,7 @@ automatic index management, extensibilit
accelerators. It also has an SQL frontend.
This package contains the JAQL extension for MonetDB. JAQL is a
-querly language for JavaScript Object Notation (JSON).
+query language for JavaScript Object Notation (JSON).
%files jaql
%defattr(-,root,root)
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -521,7 +521,7 @@ ODBCTranslateSQL(ODBCDbc *dbc, const SQL
free(nquery);
nquery = q;
q += n;
- } else if (strncasecmp(p, "interval", 8) == 0 && p[8] == ' ') {
+ } else if (strncasecmp(p, "interval ", 9) == 0) {
const char *intv = p;
size_t intvl;
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -2120,7 +2120,7 @@ VARcalcadd(ValPtr ret, const ValRecord *
}
static BAT *
-BATcaclincrdecr(BAT *b, BAT *s, int abort_on_error,
+BATcalcincrdecr(BAT *b, BAT *s, int abort_on_error,
BUN (*typeswitchloop)(const void *, int, int, const void *,
int, int, void *, int, BUN, BUN, BUN,
const oid *, const oid *, oid, int,
@@ -2184,7 +2184,7 @@ BATcaclincrdecr(BAT *b, BAT *s, int abor
BAT *
BATcalcincr(BAT *b, BAT *s, int abort_on_error)
{
- return BATcaclincrdecr(b, s, abort_on_error, add_typeswitchloop,
+ return BATcalcincrdecr(b, s, abort_on_error, add_typeswitchloop,
"BATcalcincr");
}
@@ -3340,7 +3340,7 @@ VARcalcsub(ValPtr ret, const ValRecord *
BAT *
BATcalcdecr(BAT *b, BAT *s, int abort_on_error)
{
- return BATcaclincrdecr(b, s, abort_on_error, sub_typeswitchloop,
+ return BATcalcincrdecr(b, s, abort_on_error, sub_typeswitchloop,
"BATcalcdecr");
}
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -247,9 +247,8 @@ HEAPextend(Heap *h, size_t size, int may
existing = 1;
close(fd);
} else {
- /* no pre-existing heap file, attempt
- * to use a file from the cache (or
- * create a new one) */
+ /* no pre-existing heap file, so
+ * create a new one */
h->filename = GDKmalloc(strlen(nme) +
strlen(ext) + 2);
if (h->filename == NULL) {
failure = "h->storage == STORE_MEM &&
can_map && h->filename == NULL";
@@ -604,7 +603,7 @@ HEAPload_intern(Heap *h, const char *nme
long_str srcpath, dstpath;
struct stat st;
- h->storage = h->newstorage;
+ h->storage = h->newstorage = h->size < GDK_mmap_minsize ? STORE_MEM :
STORE_MMAP;
if (h->filename == NULL)
h->filename = (char *) GDKmalloc(strlen(nme) + strlen(ext) + 2);
if (h->filename == NULL)
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -393,20 +393,20 @@ BAThash(BAT *b, BUN masksize)
case TYPE_int:
case TYPE_flt:
#if SIZEOF_OID == SIZEOF_INT
- case TYPE_oid:
+ case TYPE_oid:
#endif
#if SIZEOF_WRD == SIZEOF_INT
- case TYPE_wrd:
+ case TYPE_wrd:
#endif
finishhash(int);
break;
case TYPE_dbl:
case TYPE_lng:
#if SIZEOF_OID == SIZEOF_LNG
- case TYPE_oid:
+ case TYPE_oid:
#endif
#if SIZEOF_WRD == SIZEOF_LNG
- case TYPE_wrd:
+ case TYPE_wrd:
#endif
finishhash(lng);
break;
diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c
--- a/monetdb5/modules/kernel/batstr.c
+++ b/monetdb5/modules/kernel/batstr.c
@@ -835,7 +835,7 @@ STRbatsubstringcst(bat *ret, bat *bid, i
if( (b= BATdescriptor(*bid)) == NULL)
throw(MAL, "batstr.substring",RUNTIME_OBJECT_MISSING);
bn= BATnew(TYPE_void, TYPE_str, BATcount(b)/10+5);
- BATseqbase(bn, 0);
+ BATseqbase(bn, b->hseqbase);
bn->hsorted = b->hsorted;
bn->hrevsorted = b->hrevsorted;
bn->tsorted = b->tsorted;
@@ -891,7 +891,7 @@ str STRbatsubstring(bat *ret, bat *l, ba
throw(MAL, "batstr.substring", ILLEGAL_ARGUMENT " Requires bats
of identical size");
bn= BATnew(TYPE_void, TYPE_str,BATcount(left));
- BATseqbase(bn, 0);
+ BATseqbase(bn, left->hseqbase);
if( bn == NULL){
BBPreleaseref(left->batCacheid);
BBPreleaseref(start->batCacheid);
@@ -938,7 +938,7 @@ str STRbatreplace(bat *ret, bat *l, str
if( (left= BATdescriptor(*l)) == NULL )
throw(MAL, "batstr.replace" , RUNTIME_OBJECT_MISSING);
bn= BATnew(TYPE_void, TYPE_str,BATcount(left));
- BATseqbase(bn, 0);
+ BATseqbase(bn, left->hseqbase);
if (bn == NULL){
BBPreleaseref(left->batCacheid);
throw(MAL, "batstr.replace", MAL_MALLOC_FAIL);
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -93,6 +93,7 @@
#define RDONLY 0
#define RD_INS 1
#define RD_UPD 2
+#define QUICK 3
#define FRAME_ROWS 0
#define FRAME_RANGE 1
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
@@ -139,8 +139,10 @@ delta_bind_bat( sql_delta *bat, int acce
{
BAT *b;
- assert(access == RDONLY || access == RD_INS);
+ assert(access == RDONLY || access == RD_INS || access == QUICK);
assert(bat != NULL);
+ if (access == QUICK)
+ return quick_descriptor(bat->bid);
if (temp || access == RD_INS) {
assert(bat->ibid);
b = temp_descriptor(bat->ibid);
@@ -761,10 +763,10 @@ sorted_col(sql_trans *tr, sql_column *co
}
if (col && col->data) {
- BAT *b = bind_col(tr, col, RDONLY);
+ BAT *b = bind_col(tr, col, QUICK);
- sorted = BATtordered(b);
- bat_destroy(b);
+ if (b)
+ sorted = BATtordered(b);
}
return sorted;
}
diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -104,3 +104,4 @@ procedure_resolution_bug
correlated_update_bug
polymorphism
emili
+substring_limit_bug
diff --git a/sql/test/bugs/Tests/substring_limit_bug.sql
b/sql/test/bugs/Tests/substring_limit_bug.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/substring_limit_bug.sql
@@ -0,0 +1,14 @@
+CREATE TABLE "source1" (
+ "source" CHARACTER LARGE OBJECT,
+ "id" INTEGER
+);
+COPY 5 RECORDS INTO "source1" FROM stdin USING DELIMITERS '\t','\n','"';
+"0499999999999" 1
+"0499999999999" 1
+"0499999999999" 1
+"0499999999999" 1
+"0499999999999" 1
+
+select * from source1 where substring(source,1,2) = '04' limit 1 offset 4;
+drop table source1;
+
diff --git a/sql/test/bugs/Tests/substring_limit_bug.stable.err
b/sql/test/bugs/Tests/substring_limit_bug.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/substring_limit_bug.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'substring_limit_bug` in directory 'sql/test/bugs` itself:
+
+
+# 15:26:55 >
+# 15:26:55 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35479" "--set"
"mapi_usock=/var/tmp/mtest-5917/.s.monetdb.35479" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
"--set" "mal_listing=0"
+# 15:26:55 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 35479
+# cmdline opt mapi_usock = /var/tmp/mtest-5917/.s.monetdb.35479
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs
+# cmdline opt mal_listing = 0
+
+# 15:26:55 >
+# 15:26:55 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5917" "--port=35479"
+# 15:26:55 >
+
+
+# 15:26:55 >
+# 15:26:55 > "Done."
+# 15:26:55 >
+
diff --git a/sql/test/bugs/Tests/substring_limit_bug.stable.out
b/sql/test/bugs/Tests/substring_limit_bug.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/substring_limit_bug.stable.out
@@ -0,0 +1,51 @@
+stdout of test 'substring_limit_bug` in directory 'sql/test/bugs` itself:
+
+
+# 15:26:55 >
+# 15:26:55 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35479" "--set"
"mapi_usock=/var/tmp/mtest-5917/.s.monetdb.35479" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
"--set" "mal_listing=0"
+# 15:26:55 >
+
+# MonetDB 5 server v11.17.2
+# This is an unreleased version
+# Serving database 'mTests_sql_test_bugs', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 3.777 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on
mapi:monetdb://localhost.localdomain:35479/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-5917/.s.monetdb.35479
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 15:26:55 >
+# 15:26:55 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5917" "--port=35479"
+# 15:26:55 >
+
+#CREATE TABLE "source1" (
+# "source" CHARACTER LARGE OBJECT,
+# "id" INTEGER
+#);
+#COPY 5 RECORDS INTO "source1" FROM stdin USING DELIMITERS '\t','\n','"';
+#"0499999999999" 1
+#"0499999999999" 1
+#"0499999999999" 1
+#"0499999999999" 1
+#"0499999999999" 1
+#
+[ 5 ]
+#select * from source1 where substring(source,1,2) = '04' limit 1 offset 4;
+% sys.source1, sys.source1 # table_name
+% source, id # name
+% clob, int # type
+% 13, 1 # length
+[ "0499999999999", 1 ]
+#drop table source1;
+
+# 15:26:55 >
+# 15:26:55 > "Done."
+# 15:26:55 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list