Changeset: 27e3fb145d51 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=27e3fb145d51
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:
monetdb5/modules/kernel/batstr.c
sql/test/bugs/Tests/All
Branch: Jan2014
Log Message:
fixed bug in substring, now correctly sets the seqbase.
diffs (153 lines):
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/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