Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11020
Merged at revision: 11263
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 77 lines (+40/-4)
3 files modified
ChangeLog (+2/-0)
src/compiler/rewriter/tools/expr_tools.cpp (+13/-4)
test/rbkt/Queries/zorba/gflwor/gflwor07.xq (+25/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+150789@code.launchpad.net

Commit message

Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars() functoin, leading to erroneous loop hoisting).

Description of the change

Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars() functoin, leading to erroneous loop hoisting).

To post a comment you must log in.
11019. By Markos Zaharioudakis

Fixed bug #1125444

11020. By Markos Zaharioudakis

Fixed bug #1125444

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2013-02-27T15-59-48.996Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-02-26 22:28:33 +0000
3+++ ChangeLog 2013-02-27 15:35:42 +0000
4@@ -37,6 +37,8 @@
5 * Fixed bug #1099648 and #1088886 (XML parsing failures on Red Hat)
6 * Fixed bug #1099535 (xml:parse endless loop)
7 * Fixed bug #866958 (Parsing error not explicit enough)
8+ * Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars()
9+ functoin, leading to erroneous loop hoisting).
10 * Fixed bug #867068 (Incorrect usage of XQDY0027)
11 * Fixed bug #1023362 (xsi:type attribute ignored during validation)
12
13
14=== modified file 'src/compiler/rewriter/tools/expr_tools.cpp'
15--- src/compiler/rewriter/tools/expr_tools.cpp 2012-12-29 20:25:12 +0000
16+++ src/compiler/rewriter/tools/expr_tools.cpp 2013-02-27 15:35:42 +0000
17@@ -785,16 +785,25 @@
18 const groupby_clause* gc = static_cast<const groupby_clause *>(c);
19
20 const flwor_clause::rebind_list_t& gvars = gc->get_grouping_vars();
21+ const flwor_clause::rebind_list_t& ngvars = gc->get_nongrouping_vars();
22 csize numGroupVars = gvars.size();
23+ csize numNonGroupVars = ngvars.size();
24+
25+ for (csize i = 0; i < numGroupVars; ++i)
26+ {
27+ index_flwor_vars(gvars[i].first, numVars, varidmap, idvarmap);
28+ }
29+
30+ for (csize i = 0; i < numNonGroupVars; ++i)
31+ {
32+ index_flwor_vars(ngvars[i].first, numVars, varidmap, idvarmap);
33+ }
34
35 for (csize i = 0; i < numGroupVars; ++i)
36 {
37 add_var(gvars[i].second, numVars, varidmap, idvarmap);
38 }
39-
40- const flwor_clause::rebind_list_t& ngvars = gc->get_nongrouping_vars();
41- csize numNonGroupVars = ngvars.size();
42-
43+
44 for (csize i = 0; i < numNonGroupVars; ++i)
45 {
46 add_var(ngvars[i].second, numVars, varidmap, idvarmap);
47
48=== added file 'test/rbkt/ExpQueryResults/zorba/gflwor/gflwor07.xml.res'
49=== added file 'test/rbkt/Queries/zorba/gflwor/gflwor07.xq'
50--- test/rbkt/Queries/zorba/gflwor/gflwor07.xq 1970-01-01 00:00:00 +0000
51+++ test/rbkt/Queries/zorba/gflwor/gflwor07.xq 2013-02-27 15:35:42 +0000
52@@ -0,0 +1,25 @@
53+import module namespace ddl =
54+"http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
55+
56+import module namespace dml =
57+"http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
58+
59+
60+variable $foo := 1;
61+
62+ddl:create(xs:QName("FOO"));
63+
64+
65+for $zip in dml:collection(xs:QName("FOO"))//foo
66+let $zip := jn:parse-json(xs:string($zip))
67+let $state := $zip("state")
68+group by $state
69+let $pop := sum($zip("pop"))
70+where $pop > 10000000
71+order by $pop descending
72+return
73+{
74+ "state": $state,
75+ "population" : $pop,
76+ "seq" : { $foo := $foo+1; $foo }
77+}

Subscribers

People subscribed via source and target branches