Changeset: 2b0eb9d109d6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b0eb9d109d6
Added Files:
        sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.sql
        sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.err
        sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.out
Modified Files:
        sql/server/rel_select.c
        sql/test/BugTracker-2013/Tests/All
Branch: Feb2013
Log Message:

fixed bug 3313 and added test


diffs (truncated from 518 to 300 lines):

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
@@ -795,8 +795,10 @@ rel_lastexp(mvc *sql, sql_rel *rel )
        if (!is_processed(rel))
                rel = rel_parent(rel);
        assert(list_length(rel->exps));
-       if (rel->op == op_project)
+       if (rel->op == op_project) {
+               rel->exps->ht = NULL;
                return exp_alias_or_copy(sql, NULL, NULL, rel, 
rel->exps->t->data);
+       }
        assert(is_project(rel->op));
        e = rel->exps->t->data;
        return exp_column(sql->sa, e->rname, e->name, exp_subtype(e), e->card, 
has_nil(e), is_intern(e));
diff --git a/sql/test/BugTracker-2013/Tests/All 
b/sql/test/BugTracker-2013/Tests/All
--- a/sql/test/BugTracker-2013/Tests/All
+++ b/sql/test/BugTracker-2013/Tests/All
@@ -22,3 +22,4 @@ add_boolean.Bug-3289
 prepare-smallint.Bug-3297
 psm_functions_and_accessrights.Bug-3300
 decimal-cast.Bug-3310
+hashed_exp.Bug-3313
diff --git a/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.sql 
b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.sql
@@ -0,0 +1,206 @@
+start transaction;
+
+CREATE TABLE "_attributesString" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     CHARACTER LARGE OBJECT,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_attributesDate" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     DATE,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_attributesInteger" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     BIGINT,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_attributesDouble" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     DOUBLE,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_attributesPoint" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     POINT,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_attributes" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "type"      CHARACTER LARGE OBJECT,
+       "value"     CHARACTER LARGE OBJECT,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_regions" (
+       "subject"  INTEGER,
+       "line"     CHARACTER LARGE OBJECT,
+       "startpos" BIGINT,
+       "endpos"   BIGINT,
+       "prob"     DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_relations" (
+       "subject"   INTEGER,
+       "predicate" CHARACTER LARGE OBJECT,
+       "object"    INTEGER,
+       "prob"      DOUBLE        DEFAULT 1.000000
+);
+CREATE TABLE "_treeitems" (
+       "tree"    CHARACTER LARGE OBJECT,
+       "subject" INTEGER,
+       "pre"     BIGINT,
+       "post"    BIGINT,
+       "size"    BIGINT,
+       "level"   TINYINT,
+       "prob"    DOUBLE        DEFAULT 1.000000,
+       CONSTRAINT "_treeitems_tree_pre_unique" UNIQUE ("tree", "pre"),
+       CONSTRAINT "_treeitems_tree_post_unique" UNIQUE ("tree", "post")
+);
+CREATE TABLE "_term_doc" (
+       "doc"   INTEGER,
+       "term"  INTEGER,
+       "count" INTEGER,
+       "prob"  DOUBLE
+);
+CREATE TABLE "_dict" (
+       "idstr" CHARACTER LARGE OBJECT,
+       "id"    INTEGER       NOT NULL,
+       "type"  CHARACTER LARGE OBJECT,
+       CONSTRAINT "_dict_id_pkey" PRIMARY KEY ("id")
+);
+CREATE TABLE "_info" (
+       "key"   CHARACTER LARGE OBJECT,
+       "value" CHARACTER LARGE OBJECT
+);
+CREATE TABLE "_relcache" (
+       "name"  CHARACTER LARGE OBJECT,
+       "value" INTEGER,
+       "prob"  DOUBLE
+);
+CREATE TABLE "params_str" (
+       "paramname" CHARACTER LARGE OBJECT,
+       "value"     CHARACTER LARGE OBJECT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "params_date" (
+       "paramname" CHARACTER LARGE OBJECT,
+       "value"     DATE,
+       "prob"      DOUBLE
+);
+CREATE TABLE "params_int" (
+       "paramname" CHARACTER LARGE OBJECT,
+       "value"     BIGINT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "params_double" (
+       "paramname" CHARACTER LARGE OBJECT,
+       "value"     DOUBLE,
+       "prob"      DOUBLE
+);
+CREATE TABLE "params_point" (
+       "paramname" CHARACTER LARGE OBJECT,
+       "value"     POINT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "termdict" (
+       "termid" INTEGER       NOT NULL,
+       "term"   CHARACTER LARGE OBJECT,
+       "prob"   DOUBLE        DEFAULT 1.000000,
+       CONSTRAINT "termdict_termid_pkey" PRIMARY KEY ("termid")
+);
+CREATE TABLE "dict" (
+       "idstr" CHARACTER LARGE OBJECT,
+       "id"    INTEGER       NOT NULL,
+       "type"  CHARACTER LARGE OBJECT,
+       "prob"  FLOAT(51),
+       CONSTRAINT "dict_id_pkey" PRIMARY KEY ("id")
+);
+CREATE TABLE "obj_string" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     CHARACTER LARGE OBJECT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "obj_integer" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     BIGINT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "obj_double" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     DOUBLE,
+       "prob"      DOUBLE
+);
+CREATE TABLE "obj_date" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     DATE,
+       "prob"      DOUBLE
+);
+CREATE TABLE "obj_point" (
+       "subject"   INTEGER,
+       "attribute" CHARACTER LARGE OBJECT,
+       "value"     POINT,
+       "prob"      DOUBLE
+);
+CREATE TABLE "obj_relation" (
+       "subject"   INTEGER,
+       "predicate" CHARACTER LARGE OBJECT,
+       "object"    INTEGER,
+       "prob"      DOUBLE
+);
+CREATE TABLE "materialized" (
+       "id"    INTEGER,
+       "pid"   CHARACTER LARGE OBJECT,
+       "level" INTEGER,
+       "class" CHARACTER LARGE OBJECT,
+       "json"  CHARACTER LARGE OBJECT,
+       "xml"   CHARACTER LARGE OBJECT
+);
+create view s13f62054e14_params_str as select paramname as a1, value as a2, 
prob as prob from params_str;
+create view s13f62054e14_params_int as select paramname as a1, value as a2, 
prob as prob from params_int;
+create view s13f62054e14_params_double as select paramname as a1, value as a2, 
prob as prob from params_double;
+create view s13f62054e14_params_date as select paramname as a1, value as a2, 
prob as prob from params_date;
+create view s13f62054e14_params_point as select paramname as a1, value as a2, 
prob as prob from params_point;
+create view s13f62054e14_genericindex_data_dict as select idstr as a1, id as 
a2, type as a3, prob as prob from dict;
+create view s13f62054e14_genericindex_data_obj_relation as select subject as 
a1, predicate as a2, object as a3, prob as prob from obj_relation;
+create view s13f62054e14_genericindex_data_obj_string as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_string;
+create view s13f62054e14_genericindex_data_obj_date as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_date;
+create view s13f62054e14_genericindex_data_obj_integer as select subject as 
a1, attribute as a2, value as a3, prob as prob from obj_integer;
+create view s13f62054e14_genericindex_data_result as select a2 as a1, prob as 
prob from s13f62054e14_genericindex_data_dict where prob > 0.0;
+create view s13f62055e38_params_str as select paramname as a1, value as a2, 
prob as prob from params_str;
+create view s13f62055e38_params_int as select paramname as a1, value as a2, 
prob as prob from params_int;
+create view s13f62055e38_params_double as select paramname as a1, value as a2, 
prob as prob from params_double;
+create view s13f62055e38_params_date as select paramname as a1, value as a2, 
prob as prob from params_date;
+create view s13f62055e38_params_point as select paramname as a1, value as a2, 
prob as prob from params_point;
+create view s13f62055e38_genericindex_data_dict as select idstr as a1, id as 
a2, type as a3, prob as prob from dict;
+create view s13f62055e38_genericindex_data_obj_relation as select subject as 
a1, predicate as a2, object as a3, prob as prob from obj_relation;
+create view s13f62055e38_genericindex_data_obj_string as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_string;
+create view s13f62055e38_genericindex_data_obj_date as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_date;
+create view s13f62055e38_genericindex_data_obj_integer as select subject as 
a1, attribute as a2, value as a3, prob as prob from obj_integer;
+create view s13f62055e38_genericindex_data_result as select a2 as a1, prob as 
prob from s13f62055e38_genericindex_data_dict where prob > 0.0;
+create view s13f62055e38_find_obj_from_obj_result_result as select a3 as a1, 
1.0 - prod(1.0 - prob) as prob from (select a1 as a1, a2 as a2, a3 as a3, prob 
as prob from (select a2 as a1, a3 as a2, a4 as a3, prob as prob from (select 
s13f62055e38_genericindex_data_result.a1 as a1, 
s13f62055e38_genericindex_data_obj_relation.a1 as a2, 
s13f62055e38_genericindex_data_obj_relation.a2 as a3, 
s13f62055e38_genericindex_data_obj_relation.a3 as a4, 
s13f62055e38_genericindex_data_result.prob * 
s13f62055e38_genericindex_data_obj_relation.prob as prob from 
s13f62055e38_genericindex_data_result,s13f62055e38_genericindex_data_obj_relation
 where s13f62055e38_genericindex_data_result.a1 = 
s13f62055e38_genericindex_data_obj_relation.a1) as tmp_1643609225 where prob > 
0.0) as tmp_798472767 where a2 = 'cites') as tmp_1668268038 where prob > 0.0 
group by a3;
+create view s13f62055e38_filter_str_casesensitive_equal_1_retrieve_result as 
select a1 as a1, 1.0 - prod(1.0 - prob) as prob from (select a1 as a1, prob as 
prob from (select a1 as a1, a2 as a2, a3 as a3, a4 as a4, a5 as a5, a6 as a6, 
a7 as a7, prob as prob from (select tmp_1242582850.a1 as a1, tmp_1242582850.a2 
as a2, tmp_1242582850.a3 as a3, tmp_1242582850.a4 as a4, tmp_1242582850.a5 as 
a5, tmp_1765778109.a1 as a6, tmp_1765778109.a2 as a7, tmp_1242582850.prob * 
tmp_1765778109.prob as prob from (select tmp__818825389.a1 as a1, 
tmp__818825389.a2 as a2, tmp__818825389.a3 as a3, tmp_2023894313.a1 as a4, 
tmp_2023894313.a2 as a5, tmp__818825389.prob * tmp_2023894313.prob as prob from 
(select a1 as a1, a2 as a2, a3 as a3, prob as prob from (select 
s13f62055e38_genericindex_data_obj_string.a1 as a1, 
s13f62055e38_genericindex_data_obj_string.a2 as a2, 
s13f62055e38_genericindex_data_obj_string.a3 as a3, 
s13f62055e38_find_obj_from_obj_result_result.a1 as a4, 
s13f62055e38_genericindex_data_obj
 _string.prob * s13f62055e38_find_obj_from_obj_result_result.prob as prob from 
s13f62055e38_genericindex_data_obj_string,s13f62055e38_find_obj_from_obj_result_result
 where s13f62055e38_genericindex_data_obj_string.a1 = 
s13f62055e38_find_obj_from_obj_result_result.a1) as tmp_968500680 where prob > 
0.0) as tmp__818825389,(select a1 as a1, a2 as a2, prob as prob from 
s13f62055e38_params_str where a1 = 
's13f62055e38_filter_str_casesensitive_equal_1_ATTRIBUTE') as tmp_2023894313 
where tmp__818825389.a2 = tmp_2023894313.a2) as tmp_1242582850,(select a1 as 
a1, a2 as a2, prob as prob from s13f62055e38_params_str where a1 = 
's13f62055e38_filter_str_casesensitive_equal_1_VALUE') as tmp_1765778109) as 
tmp_1993754714 where a3 = a7) as tmp_1773944891 where prob > 0.0) as 
tmp__639942380 where prob > 0.0 group by a1;
+create view s13f62055e38_find_obj_from_obj_reverse_result_result as select a1 
as a1, 1.0 - prod(1.0 - prob) as prob from (select a1 as a1, a2 as a2, a3 as 
a3, prob as prob from (select a2 as a1, a3 as a2, a4 as a3, prob as prob from 
(select s13f62055e38_filter_str_casesensitive_equal_1_retrieve_result.a1 as a1, 
s13f62055e38_genericindex_data_obj_relation.a1 as a2, 
s13f62055e38_genericindex_data_obj_relation.a2 as a3, 
s13f62055e38_genericindex_data_obj_relation.a3 as a4, 
s13f62055e38_filter_str_casesensitive_equal_1_retrieve_result.prob * 
s13f62055e38_genericindex_data_obj_relation.prob as prob from 
s13f62055e38_filter_str_casesensitive_equal_1_retrieve_result,s13f62055e38_genericindex_data_obj_relation
 where s13f62055e38_filter_str_casesensitive_equal_1_retrieve_result.a1 = 
s13f62055e38_genericindex_data_obj_relation.a3) as tmp__965364767 where prob > 
0.0) as tmp__676521352 where a2 = 'cites') as tmp__2082293943 where prob > 0.0 
group by a1;
+create view s13f62fa36e4_params_str as select paramname as a1, value as a2, 
prob as prob from params_str;
+create view s13f62fa36e4_params_int as select paramname as a1, value as a2, 
prob as prob from params_int;
+create view s13f62fa36e4_params_double as select paramname as a1, value as a2, 
prob as prob from params_double;
+create view s13f62fa36e4_params_date as select paramname as a1, value as a2, 
prob as prob from params_date;
+create view s13f62fa36e4_params_point as select paramname as a1, value as a2, 
prob as prob from params_point;
+create view s13f62fa36e4_genericindex_data_dict as select idstr as a1, id as 
a2, type as a3, prob as prob from dict;
+create view s13f62fa36e4_genericindex_data_obj_relation as select subject as 
a1, predicate as a2, object as a3, prob as prob from obj_relation;
+create view s13f62fa36e4_genericindex_data_obj_string as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_string;
+create view s13f62fa36e4_genericindex_data_obj_date as select subject as a1, 
attribute as a2, value as a3, prob as prob from obj_date;
+create view s13f62fa36e4_genericindex_data_obj_integer as select subject as 
a1, attribute as a2, value as a3, prob as prob from obj_integer;
+create view s13f62fa36e4_genericindex_data_result as select a2 as a1, prob as 
prob from s13f62fa36e4_genericindex_data_dict where prob > 0.0;
+create view s13f62fa36e4_filter_class_equal_retrieve_result as select a1 as 
a1, 1.0 - prod(1.0 - prob) as prob from (select tmp__37434389.a1 as a1, 
tmp__37434389.a2 as a2, tmp__2070553699.a1 as a3, tmp__2070553699.a2 as a4, 
tmp__37434389.prob * tmp__2070553699.prob as prob from (select a2 as a1, a3 as 
a2, prob as prob from (select s13f62fa36e4_genericindex_data_dict.a1 as a1, 
s13f62fa36e4_genericindex_data_dict.a2 as a2, 
s13f62fa36e4_genericindex_data_dict.a3 as a3, 
s13f62fa36e4_genericindex_data_result.a1 as a4, 
s13f62fa36e4_genericindex_data_dict.prob * 
s13f62fa36e4_genericindex_data_result.prob as prob from 
s13f62fa36e4_genericindex_data_dict,s13f62fa36e4_genericindex_data_result where 
s13f62fa36e4_genericindex_data_dict.a2 = 
s13f62fa36e4_genericindex_data_result.a1) as tmp_884674928 where prob > 0.0) as 
tmp__37434389,(select a1 as a1, a2 as a2, prob as prob from 
s13f62fa36e4_params_str where a1 = 's13f62fa36e4_filter_class_equal_VALUE') as 
tmp__2070553699 where tmp__37434389.a2 
 = tmp__2070553699.a2) as tmp_1462207098 where prob > 0.0 group by a1;
+
+SELECT d.id as id, d.idstr as pid, d.type as class, '<attributes/>' as xml, '{ 
"pid":"'||d.idstr||'" }' as json, s.prob as prob FROM 
s13f62fa36e4_filter_class_equal_RETRIEVE_result as s, dict as d WHERE s.a1=d.id 
ORDER BY s.prob DESC;
+
diff --git a/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.err 
b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'hashed_exp.Bug-3313` in directory 'sql/test/BugTracker-2013` 
itself:
+
+
+# 17:45:40 >  
+# 17:45:40 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30649" "--set" 
"mapi_usock=/var/tmp/mtest-11385/.s.monetdb.30649" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013"
 "--set" "mal_listing=0"
+# 17:45:40 >  
+
+# 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 = yes
+# 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 = 30649
+# cmdline opt  mapi_usock = /var/tmp/mtest-11385/.s.monetdb.30649
+# 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_BugTracker-2013
+# cmdline opt  mal_listing = 0
+
+# 17:45:40 >  
+# 17:45:40 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-11385" "--port=30649"
+# 17:45:40 >  
+
+
+# 17:45:40 >  
+# 17:45:40 >  "Done."
+# 17:45:40 >  
+
diff --git a/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.out 
b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2013/Tests/hashed_exp.Bug-3313.stable.out
@@ -0,0 +1,239 @@
+stdout of test 'hashed_exp.Bug-3313` in directory 'sql/test/BugTracker-2013` 
itself:
+
+
+# 17:45:40 >  
+# 17:45:40 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30649" "--set" 
"mapi_usock=/var/tmp/mtest-11385/.s.monetdb.30649" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013"
 "--set" "mal_listing=0"
+# 17:45:40 >  
+
+# MonetDB 5 server v11.15.4
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2013', 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-2013 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:30649/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-11385/.s.monetdb.30649
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to