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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11082
Merged at revision: 11413
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 158 lines (+113/-1)
5 files modified
src/compiler/expression/function_item_expr.h (+1/-1)
src/compiler/rewriter/tools/expr_tools.cpp (+28/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter (+52/-0)
test/rbkt/Queries/zorba/index/match_vrange_04.xq (+20/-0)
test/rbkt/Queries/zorba/index/match_vrange_04.xqlib (+12/-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+161292@code.launchpad.net

Commit message

added dynamic_function_invocation_expr to the exprs handled by expr_tools::match_exact()

Description of the change

added dynamic_function_invocation_expr to the exprs handled by expr_tools::match_exact()

To post a comment you must log in.
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-04-27T16-53-47.526Z 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 'src/compiler/expression/function_item_expr.h'
2--- src/compiler/expression/function_item_expr.h 2013-04-24 01:35:58 +0000
3+++ src/compiler/expression/function_item_expr.h 2013-04-27 16:45:32 +0000
4@@ -95,7 +95,7 @@
5 const std::vector<expr*>& args);
6
7 public:
8- const expr* get_function() const { return theExpr; }
9+ expr* get_function() const { return theExpr; }
10
11 const std::vector<expr*>& get_args() const { return theArgs; }
12
13
14=== modified file 'src/compiler/rewriter/tools/expr_tools.cpp'
15--- src/compiler/rewriter/tools/expr_tools.cpp 2013-02-28 11:15:32 +0000
16+++ src/compiler/rewriter/tools/expr_tools.cpp 2013-04-27 16:45:32 +0000
17@@ -22,6 +22,7 @@
18 #include "compiler/expression/script_exprs.h"
19 #include "compiler/expression/ft_expr.h"
20 #include "compiler/expression/ftnode.h"
21+#include "compiler/expression/function_item_expr.h"
22 #include "compiler/expression/expr_iter.h"
23 #include "compiler/api/compilercb.h"
24
25@@ -368,6 +369,33 @@
26 return true;
27 }
28
29+ case dynamic_function_invocation_expr_kind:
30+ {
31+ const dynamic_function_invocation_expr* qe =
32+ static_cast<const dynamic_function_invocation_expr*>(query);
33+
34+ const dynamic_function_invocation_expr* ve =
35+ static_cast<const dynamic_function_invocation_expr*>(view);
36+
37+ if (!match_exact(qe->get_function(), ve->get_function(), subst))
38+ return false;
39+
40+ if (qe->get_args().size() != ve->get_args().size())
41+ return false;
42+
43+ std::vector<expr*>::const_iterator qite = qe->get_args().begin();
44+ std::vector<expr*>::const_iterator qend = qe->get_args().end();
45+ std::vector<expr*>::const_iterator vite = ve->get_args().begin();
46+
47+ for (; qite != qend; ++qite, ++vite)
48+ {
49+ if (!match_exact(*qite, *vite, subst))
50+ return false;
51+ }
52+
53+ return true;
54+ }
55+
56 case relpath_expr_kind:
57 {
58 relpath_expr* qe = static_cast<relpath_expr*>(query);
59
60=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter'
61--- test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter 1970-01-01 00:00:00 +0000
62+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter 2013-04-27 16:45:32 +0000
63@@ -0,0 +1,52 @@
64+Iterator tree for index:
65+<flwor::FLWORIterator>
66+ <ForVariable name="$$context-item">
67+ <ZorbaCollectionIterator>
68+ <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo)"/>
69+ </ZorbaCollectionIterator>
70+ </ForVariable>
71+ <ReturnClause>
72+ <ValueIndexEntryBuilderIterator>
73+ <ForVarIterator varname="$$context-item"/>
74+ <PromoteIterator type="xs:string">
75+ <FnDataIterator>
76+ <DynamicFnCallIterator>
77+ <ForVarIterator varname="$$context-item"/>
78+ <SingletonIterator value="xs:string(_id)"/>
79+ </DynamicFnCallIterator>
80+ </FnDataIterator>
81+ </PromoteIterator>
82+ </ValueIndexEntryBuilderIterator>
83+ </ReturnClause>
84+</flwor::FLWORIterator>
85+
86+Iterator tree for main query:
87+<SequentialIterator>
88+ <ApplyIterator>
89+ <ZorbaCreateCollectionIterator>
90+ <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo)"/>
91+ </ZorbaCreateCollectionIterator>
92+ </ApplyIterator>
93+ <ApplyIterator>
94+ <CreateIndexIterator>
95+ <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo__id_)"/>
96+ </CreateIndexIterator>
97+ </ApplyIterator>
98+ <flwor::FLWORIterator>
99+ <ForVariable name="i">
100+ <ProbeIndexRangeValueIterator>
101+ <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo__id_)"/>
102+ <SingletonIterator value="xs:string(3)"/>
103+ <SingletonIterator value="xs:string(3)"/>
104+ <SingletonIterator value="xs:boolean(true)"/>
105+ <SingletonIterator value="xs:boolean(true)"/>
106+ <SingletonIterator value="xs:boolean(true)"/>
107+ <SingletonIterator value="xs:boolean(true)"/>
108+ </ProbeIndexRangeValueIterator>
109+ </ForVariable>
110+ <ReturnClause>
111+ <ForVarIterator varname="i"/>
112+ </ReturnClause>
113+ </flwor::FLWORIterator>
114+</SequentialIterator>
115+
116
117=== added file 'test/rbkt/ExpQueryResults/zorba/index/match_vrange_04.xml.res'
118=== added file 'test/rbkt/Queries/zorba/index/match_vrange_04.xq'
119--- test/rbkt/Queries/zorba/index/match_vrange_04.xq 1970-01-01 00:00:00 +0000
120+++ test/rbkt/Queries/zorba/index/match_vrange_04.xq 2013-04-27 16:45:32 +0000
121@@ -0,0 +1,20 @@
122+
123+import module namespace db28 = "http://28.io/collections" at "match_vrange_04.xqlib";
124+
125+import module namespace ddl =
126+"http://www.zorba-xquery.com/modules/store/static/collections/ddl";
127+
128+import module namespace dml =
129+"http://www.zorba-xquery.com/modules/store/static/collections/dml";
130+
131+import module namespace iddl =
132+"http://www.zorba-xquery.com/modules/store/static/indexes/ddl";
133+
134+
135+ddl:create(xs:QName("db28:foo"));
136+
137+iddl:create(xs:QName("db28:foo__id_"));
138+
139+for $i in dml:collection(xs:QName("db28:foo"))
140+where $i("_id") eq "3"
141+return $i
142
143=== added file 'test/rbkt/Queries/zorba/index/match_vrange_04.xqlib'
144--- test/rbkt/Queries/zorba/index/match_vrange_04.xqlib 1970-01-01 00:00:00 +0000
145+++ test/rbkt/Queries/zorba/index/match_vrange_04.xqlib 2013-04-27 16:45:32 +0000
146@@ -0,0 +1,12 @@
147+
148+module namespace db28 = "http://28.io/collections";
149+
150+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
151+
152+declare namespace an = "http://www.zorba-xquery.com/annotations";
153+
154+declare %an:mutable %an:unordered %an:mutable-nodes collection db28:foo;
155+
156+declare %an:manual %an:value-range index db28:foo__id_
157+on nodes dml:collection(xs:QName("db28:foo"))
158+by .("_id") as Q{http://www.w3.org/2001/XMLSchema}string;

Subscribers

People subscribed via source and target branches