Merge lp:~zorba-coders/zorba/gen-flwor-opt into lp:zorba
- gen-flwor-opt
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Markos Zaharioudakis |
Approved revision: | 10688 |
Merged at revision: | 11469 |
Proposed branch: | lp:~zorba-coders/zorba/gen-flwor-opt |
Merge into: | lp:zorba |
Diff against target: |
633 lines (+260/-117) 12 files modified
ChangeLog (+5/-0) src/compiler/rewriter/rules/fold_rules.cpp (+4/-2) src/compiler/rewriter/rules/nodeid_rules.cpp (+108/-14) src/compiler/rewriter/rules/type_rules.cpp (+0/-41) src/compiler/rewriter/tools/dataflow_annotations.cpp (+5/-2) test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/gary1.iter (+33/-21) test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_04.iter (+3/-5) test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_05.iter (+11/-11) test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-gary1.iter (+33/-21) test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/doc_order_01.iter (+49/-0) test/rbkt/ExpQueryResults/zorba/optim/doc_order_01.xml.res (+1/-0) test/rbkt/Queries/zorba/optim/doc_order_01.xq (+8/-0) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/gen-flwor-opt |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markos Zaharioudakis | Approve | ||
Review via email: mp+165266@code.launchpad.net |
Commit message
1, Implemented document-ordering elimination for general FLWOR.
2. No need to apply document ordering on the domain expression of a FOR clause, if the FOR clause is followed by an orderby or groupby clause.
3. Must apply document ordering on the domain expression of a FOR clause, if the FOR clause is followed by a sequential clause.
4. Applied count optimization to the return clause of general FLWORs
Description of the change
1, Implemented document-ordering elimination for general FLWOR.
2. No need to apply document ordering on the domain expression of a FOR clause, if the FOR clause is followed by an orderby or groupby clause.
3. Must apply document ordering on the domain expression of a FOR clause, if the FOR clause is followed by a sequential clause.
4 Applied count optimization to the return clause of general FLWORs
- 10687. By Markos Zaharioudakis
-
No need to apply document ordering on the domain expression of a FOR clause, if the FOR clause is followed by an orderby or groupby clause
- 10688. By Markos Zaharioudakis
-
doc-ordering rules extended for general flwor
Markos Zaharioudakis (markos-za) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job gen-flwor-
All tests succeeded!
Preview Diff
1 | === modified file 'ChangeLog' |
2 | --- ChangeLog 2013-05-21 21:47:40 +0000 |
3 | +++ ChangeLog 2013-05-23 02:29:28 +0000 |
4 | @@ -7,11 +7,16 @@ |
5 | |
6 | Optimizations: |
7 | * Implemented hoisting optimization for general FLWOR. |
8 | + * Implemented document-ordering elimination for general FLWOR. |
9 | * Optimized implementation of fn:deep-equal |
10 | + * No need to apply document ordering on the domain expression of a FOR clause |
11 | + if the FOR clause is followed by an orderby or groupby clause. |
12 | |
13 | Bug Fixes/Other Changes: |
14 | * Fixed bug in hoisting through try-catch expr |
15 | * Fixed implementation of fn:deep-equal according to latest W3C spec. |
16 | + * Must apply document ordering on the domain expression of a FOR clause, if |
17 | + the FOR clause is followed by a sequential clause. |
18 | |
19 | |
20 | version 2.9 |
21 | |
22 | === modified file 'src/compiler/rewriter/rules/fold_rules.cpp' |
23 | --- src/compiler/rewriter/rules/fold_rules.cpp 2013-05-08 20:14:47 +0000 |
24 | +++ src/compiler/rewriter/rules/fold_rules.cpp 2013-05-23 02:29:28 +0000 |
25 | @@ -746,7 +746,8 @@ |
26 | } |
27 | } |
28 | |
29 | - if (arg->get_expr_kind() == flwor_expr_kind) |
30 | + if (arg->get_expr_kind() == flwor_expr_kind || |
31 | + arg->get_expr_kind() == gflwor_expr_kind) |
32 | { |
33 | bool modified = false; |
34 | expr* newArg = partial_eval_return_clause(static_cast<flwor_expr*>(arg), |
35 | @@ -1021,7 +1022,8 @@ |
36 | } |
37 | } |
38 | |
39 | - if (returnExpr->get_expr_kind() == flwor_expr_kind) |
40 | + if (returnExpr->get_expr_kind() == flwor_expr_kind || |
41 | + returnExpr->get_expr_kind() == gflwor_expr_kind) |
42 | { |
43 | expr* newRet = |
44 | partial_eval_return_clause(static_cast<flwor_expr*>(returnExpr), modified, rCtx); |
45 | |
46 | === modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp' |
47 | --- src/compiler/rewriter/rules/nodeid_rules.cpp 2013-04-24 01:35:58 +0000 |
48 | +++ src/compiler/rewriter/rules/nodeid_rules.cpp 2013-05-23 02:29:28 +0000 |
49 | @@ -183,20 +183,26 @@ |
50 | } |
51 | |
52 | case flwor_expr_kind: |
53 | + case gflwor_expr_kind: |
54 | { |
55 | flwor_expr* flwor = static_cast<flwor_expr *>(node); |
56 | |
57 | - // no need to do anything for the where expr or the orderby exprs because |
58 | - // they don't produce nodes. |
59 | + expr* retExpr = flwor->get_return_expr(); |
60 | |
61 | // The annotations for the return expr are the same as those of its |
62 | // containing flwor expr. |
63 | - pushdown_ignores_sorted_nodes(node, flwor->get_return_expr()); |
64 | - pushdown_ignores_duplicate_nodes(node, flwor->get_return_expr()); |
65 | + pushdown_ignores_sorted_nodes(node, retExpr); |
66 | + pushdown_ignores_duplicate_nodes(node, retExpr); |
67 | |
68 | // apply the rule recursively on the return expr |
69 | apply(rCtx, flwor->get_return_expr(), modified); |
70 | |
71 | + csize nextOrderingClause = 0; |
72 | + csize nextSequentialClause = 0; |
73 | + |
74 | + if (retExpr->is_sequential()) |
75 | + nextSequentialClause = flwor->num_clauses(); |
76 | + |
77 | // Process the clauses in reverse order so that by the time we reach the |
78 | // definition of a LET var, we know if the LET var sequence must be in |
79 | // doc order and/or without duplicates. |
80 | @@ -205,12 +211,17 @@ |
81 | { |
82 | flwor_clause* clause = flwor->get_clause(i-1); |
83 | |
84 | - if (clause->get_kind() == flwor_clause::let_clause) |
85 | + switch (clause->get_kind()) |
86 | + { |
87 | + case flwor_clause::let_clause: |
88 | { |
89 | let_clause* lc = static_cast<let_clause*>(clause); |
90 | expr* domainExpr = lc->get_expr(); |
91 | var_expr* var = lc->get_var(); |
92 | |
93 | + if (domainExpr->is_sequential()) |
94 | + nextSequentialClause = i - 1; |
95 | + |
96 | // The annotations for the domain expr are the same as those of its |
97 | // associated LET var. |
98 | domainExpr->setIgnoresSortedNodes(var->getIgnoresSortedNodes()); |
99 | @@ -218,13 +229,17 @@ |
100 | |
101 | // apply the rule recursively on the domainExpr |
102 | apply(rCtx, domainExpr, modified); |
103 | + |
104 | + break; |
105 | } |
106 | - else if (clause->get_kind() == flwor_clause::for_clause) |
107 | + case flwor_clause::for_clause: |
108 | { |
109 | for_clause* fc = static_cast<for_clause*>(clause); |
110 | expr* domainExpr = fc->get_expr(); |
111 | var_expr* posVar = fc->get_pos_var(); |
112 | - assert(posVar == NULL || posVar->get_kind() == var_expr::pos_var); |
113 | + |
114 | + if (domainExpr->is_sequential()) |
115 | + nextSequentialClause = i - 1; |
116 | |
117 | // If a flwor expr does not need to care about producing nodes in doc |
118 | // order, then the domain expr of a FOR variable does not need to care |
119 | @@ -234,7 +249,16 @@ |
120 | // to produce nodes in doc order as well. |
121 | if (posVar == NULL) |
122 | { |
123 | - domainExpr->setIgnoresSortedNodes(flwor->getIgnoresSortedNodes()); |
124 | + if (nextOrderingClause > i-1 && |
125 | + (nextSequentialClause == 0 || |
126 | + nextSequentialClause > nextOrderingClause)) |
127 | + { |
128 | + domainExpr->setIgnoresSortedNodes(ANNOTATION_TRUE); |
129 | + } |
130 | + else |
131 | + { |
132 | + domainExpr->setIgnoresSortedNodes(flwor->getIgnoresSortedNodes()); |
133 | + } |
134 | } |
135 | else if (rCtx.theIsInOrderedMode) |
136 | { |
137 | @@ -243,15 +267,53 @@ |
138 | |
139 | // apply the rule recursively on the domainExpr |
140 | apply(rCtx, domainExpr, modified); |
141 | - } |
142 | - else if (clause->get_kind() == flwor_clause::where_clause) |
143 | + |
144 | + break; |
145 | + } |
146 | + case flwor_clause::window_clause: |
147 | + { |
148 | + window_clause* wc = static_cast<window_clause*>(clause); |
149 | + expr* domainExpr = wc->get_expr(); |
150 | + |
151 | + if (domainExpr->is_sequential()) |
152 | + nextSequentialClause = i - 1; |
153 | + |
154 | + if (rCtx.theIsInOrderedMode) |
155 | + { |
156 | + domainExpr->setIgnoresSortedNodes(ANNOTATION_FALSE); |
157 | + domainExpr->setIgnoresDuplicateNodes(ANNOTATION_FALSE); |
158 | + } |
159 | + |
160 | + // apply the rule recursively on the domainExpr and the condition exprs |
161 | + apply(rCtx, domainExpr, modified); |
162 | + |
163 | + flwor_wincond* startCond = wc->get_win_start(); |
164 | + flwor_wincond* stopCond = wc->get_win_stop(); |
165 | + |
166 | + if (startCond && startCond->get_expr()) |
167 | + { |
168 | + apply(rCtx, startCond->get_expr(), modified); |
169 | + } |
170 | + |
171 | + if (stopCond && stopCond->get_expr()) |
172 | + { |
173 | + apply(rCtx, stopCond->get_expr(), modified); |
174 | + } |
175 | + |
176 | + break; |
177 | + } |
178 | + case flwor_clause::where_clause: |
179 | { |
180 | // apply the rule recursively on the whereExpr |
181 | where_clause* wc = static_cast<where_clause*>(clause); |
182 | apply(rCtx, wc->get_expr(), modified); |
183 | + |
184 | + break; |
185 | } |
186 | - else if (clause->get_kind() == flwor_clause::orderby_clause) |
187 | + case flwor_clause::orderby_clause: |
188 | { |
189 | + nextOrderingClause = i-1; |
190 | + |
191 | // apply the rule recursively on the orderby exprs |
192 | orderby_clause* oc = static_cast<orderby_clause*>(clause); |
193 | |
194 | @@ -261,6 +323,41 @@ |
195 | { |
196 | apply(rCtx, oc->get_column_expr(i), modified); |
197 | } |
198 | + |
199 | + break; |
200 | + } |
201 | + case flwor_clause::groupby_clause: |
202 | + { |
203 | + nextOrderingClause = i-1; |
204 | + |
205 | + // apply the rule recursively on the groupby exprs |
206 | + groupby_clause* gc = static_cast<groupby_clause*>(clause); |
207 | + |
208 | + var_rebind_list_t::const_iterator ite = gc->beginGroupVars(); |
209 | + var_rebind_list_t::const_iterator end = gc->endGroupVars(); |
210 | + for (; ite != end; ++ite) |
211 | + { |
212 | + apply(rCtx, (*ite).first, modified); |
213 | + } |
214 | + |
215 | + ite = gc->beginNonGroupVars(); |
216 | + end = gc->endNonGroupVars(); |
217 | + for (; ite != end; ++ite) |
218 | + { |
219 | + apply(rCtx, (*ite).first, modified); |
220 | + } |
221 | + |
222 | + break; |
223 | + } |
224 | + case flwor_clause::count_clause: |
225 | + case flwor_clause::materialize_clause: |
226 | + { |
227 | + break; |
228 | + } |
229 | + default: |
230 | + { |
231 | + ZORBA_ASSERT(false); |
232 | + } |
233 | } |
234 | } |
235 | return NULL; |
236 | @@ -429,7 +526,6 @@ |
237 | break; |
238 | } |
239 | |
240 | -#ifdef ZORBA_WITH_JSON |
241 | case json_object_expr_kind : |
242 | { |
243 | break; |
244 | @@ -448,7 +544,6 @@ |
245 | } |
246 | break; |
247 | } |
248 | -#endif |
249 | |
250 | case attr_expr_kind : |
251 | case namespace_expr_kind : |
252 | @@ -459,7 +554,6 @@ |
253 | |
254 | case extension_expr_kind : // TODO |
255 | case flowctl_expr_kind : // TODO |
256 | - case gflwor_expr_kind : // TODO |
257 | case name_cast_expr_kind : // TODO |
258 | case trycatch_expr_kind : // TODO |
259 | case validate_expr_kind : // TODO |
260 | |
261 | === modified file 'src/compiler/rewriter/rules/type_rules.cpp' |
262 | --- src/compiler/rewriter/rules/type_rules.cpp 2013-02-07 17:24:36 +0000 |
263 | +++ src/compiler/rewriter/rules/type_rules.cpp 2013-05-23 02:29:28 +0000 |
264 | @@ -20,7 +20,6 @@ |
265 | #include "types/root_typemanager.h" |
266 | #include "types/typeops.h" |
267 | |
268 | -#include "compiler/expression/flwor_expr.h" |
269 | #include "compiler/expression/expr_iter.h" |
270 | #include "compiler/expression/expr.h" |
271 | |
272 | @@ -445,46 +444,6 @@ |
273 | } |
274 | } |
275 | } |
276 | -#if 0 |
277 | - else if (node->get_expr_kind() == flwor_expr_kind || |
278 | - node->get_expr_kind() == gflwor_expr_kind) |
279 | - { |
280 | - flwor_expr* flworExpr = static_cast<flwor_expr*>(node); |
281 | - |
282 | - bool modified = false; |
283 | - |
284 | - csize numClauses = flworExpr->num_clauses(); |
285 | - for (csize i = 0; i < numClauses; ++i) |
286 | - { |
287 | - if (flworExpr->get_clause(i)->get_kind() == flwor_clause::order_clause) |
288 | - { |
289 | - orderby_clause* obc = |
290 | - static_cast<orderby_clause*>(flworExpr->get_clause(i)); |
291 | - |
292 | - csize numColumns = obc->num_columns(); |
293 | - for (csize j = 0; j < numColumns; ++j) |
294 | - { |
295 | - expr* colExpr = obc->get_column_expr(j); |
296 | - xqtref_t colType = colExpr->get_return_type(); |
297 | - const QueryLoc& colLoc = colExpr->get_loc(); |
298 | - |
299 | - if (!TypeOps::is_equal(tm, *colType, *rtm.EMPTY_TYPE, colLoc) && |
300 | - TypeOps::is_subtype(tm, *colType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, colLoc)) |
301 | - { |
302 | - expr* castExpr = rCtx.theEM-> |
303 | - create_cast_expr(sctx, udf, colLoc, colExpr, rtm.STRING_TYPE_QUESTION); |
304 | - |
305 | - obc->set_column_expr(j, castExpr); |
306 | - modified = true; |
307 | - } |
308 | - } |
309 | - } |
310 | - } |
311 | - |
312 | - if (modified) |
313 | - return node; |
314 | - } |
315 | -#endif |
316 | |
317 | return NULL; |
318 | } |
319 | |
320 | === modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp' |
321 | --- src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-04-24 01:35:58 +0000 |
322 | +++ src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-05-23 02:29:28 +0000 |
323 | @@ -365,13 +365,13 @@ |
324 | { |
325 | default_walk(e); |
326 | |
327 | - if (! generic_compute(e) && !e->is_general()) |
328 | + if (! generic_compute(e)) |
329 | { |
330 | flwor_expr::clause_list_t::const_iterator ite = e->clause_begin(); |
331 | flwor_expr::clause_list_t::const_iterator end = e->clause_end(); |
332 | |
333 | const forletwin_clause* fc = NULL; |
334 | - ulong numForClauses = 0; |
335 | + csize numForClauses = 0; |
336 | |
337 | for (; ite != end; ++ite) |
338 | { |
339 | @@ -398,9 +398,12 @@ |
340 | } |
341 | case flwor_clause::let_clause: |
342 | case flwor_clause::where_clause: |
343 | + case flwor_clause::count_clause: |
344 | + case flwor_clause::materialize_clause: |
345 | { |
346 | break; |
347 | } |
348 | + case flwor_clause::window_clause: |
349 | case flwor_clause::orderby_clause: |
350 | case flwor_clause::groupby_clause: |
351 | { |
352 | |
353 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/gary1.iter' |
354 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/gary1.iter 2013-02-07 17:24:36 +0000 |
355 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/gary1.iter 2013-05-23 02:29:28 +0000 |
356 | @@ -64,6 +64,25 @@ |
357 | </flwor::TupleStreamIterator> |
358 | </ChildAxisIterator> |
359 | </LetVariable> |
360 | + <LetVariable name="$$opt_temp_4" materialize="true"> |
361 | + <CreateInternalIndexIterator name="xs:QName(,,tempIndex0)"> |
362 | + <flwor::FLWORIterator> |
363 | + <ForVariable name="$$opt_temp_2"> |
364 | + <LetVarIterator varname="y"/> |
365 | + </ForVariable> |
366 | + <ReturnClause> |
367 | + <GeneralIndexEntryBuilderIterator> |
368 | + <ForVarIterator varname="$$opt_temp_2"/> |
369 | + <FnDataIterator> |
370 | + <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,unitid)" typename="*" nill allowed="0"> |
371 | + <ForVarIterator varname="$$opt_temp_2"/> |
372 | + </AttributeAxisIterator> |
373 | + </FnDataIterator> |
374 | + </GeneralIndexEntryBuilderIterator> |
375 | + </ReturnClause> |
376 | + </flwor::FLWORIterator> |
377 | + </CreateInternalIndexIterator> |
378 | + </LetVariable> |
379 | <ForVariable name="i"> |
380 | <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,inst)" typename="*" nill allowed="0"> |
381 | <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,institutions)" typename="*" nill allowed="0"> |
382 | @@ -80,30 +99,23 @@ |
383 | </LetVariable> |
384 | <LetVariable name="$$opt_temp_1" materialize="true"> |
385 | <HoistIterator> |
386 | - <NodeSortIterator distinct="true" ascending="true"> |
387 | - <AttributeAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
388 | - <flwor::FLWORIterator> |
389 | - <ForVariable name="$$context-item"> |
390 | - <LetVarIterator varname="y"/> |
391 | - </ForVariable> |
392 | - <WhereClause> |
393 | - <CompareIterator> |
394 | - <FnDataIterator> |
395 | - <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,unitid)" typename="*" nill allowed="0"> |
396 | - <ForVarIterator varname="$$context-item"/> |
397 | - </AttributeAxisIterator> |
398 | - </FnDataIterator> |
399 | + <AttributeAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
400 | + <flwor::FLWORIterator> |
401 | + <ForVariable name="$$context-item"> |
402 | + <NodeSortIterator distinct="true" ascending="true"> |
403 | + <ProbeIndexPointGeneralIterator> |
404 | + <SingletonIterator value="xs:QName(,,tempIndex0)"/> |
405 | <FnDataIterator> |
406 | <LetVarIterator varname="unitid"/> |
407 | </FnDataIterator> |
408 | - </CompareIterator> |
409 | - </WhereClause> |
410 | - <ReturnClause> |
411 | - <ForVarIterator varname="$$context-item"/> |
412 | - </ReturnClause> |
413 | - </flwor::FLWORIterator> |
414 | - </AttributeAxisIterator> |
415 | - </NodeSortIterator> |
416 | + </ProbeIndexPointGeneralIterator> |
417 | + </NodeSortIterator> |
418 | + </ForVariable> |
419 | + <ReturnClause> |
420 | + <ForVarIterator varname="$$context-item"/> |
421 | + </ReturnClause> |
422 | + </flwor::FLWORIterator> |
423 | + </AttributeAxisIterator> |
424 | </HoistIterator> |
425 | </LetVariable> |
426 | <ReturnClause> |
427 | |
428 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_04.iter' |
429 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_04.iter 2013-05-13 13:58:24 +0000 |
430 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_04.iter 2013-05-23 02:29:28 +0000 |
431 | @@ -219,11 +219,9 @@ |
432 | <LetVarIterator varname="id"/> |
433 | <SingletonIterator value="xs:string(no session with the given uuid)"/> |
434 | </TraceIterator> |
435 | - <NodeSortIterator distinct="true" ascending="true"> |
436 | - <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,data)" typename="*" nill allowed="0"> |
437 | - <LetVarIterator varname="session"/> |
438 | - </ChildAxisIterator> |
439 | - </NodeSortIterator> |
440 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,data)" typename="*" nill allowed="0"> |
441 | + <LetVarIterator varname="session"/> |
442 | + </ChildAxisIterator> |
443 | </IfThenElseIterator> |
444 | </ReturnClause> |
445 | </flwor::FLWORIterator> |
446 | |
447 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_05.iter' |
448 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_05.iter 2013-05-13 13:58:24 +0000 |
449 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_veq_05.iter 2013-05-23 02:29:28 +0000 |
450 | @@ -275,12 +275,14 @@ |
451 | <LetVariable name="session" materialize="true"> |
452 | <flwor::FLWORIterator> |
453 | <ForVariable name="$$context-item"> |
454 | - <ProbeIndexPointValueIterator> |
455 | - <SingletonIterator value="xs:QName(www.sessions.com,sessions,session-index)"/> |
456 | - <UnhoistIterator> |
457 | - <LetVarIterator varname="$$opt_temp_0"/> |
458 | - </UnhoistIterator> |
459 | - </ProbeIndexPointValueIterator> |
460 | + <NodeSortIterator distinct="false" ascending="true"> |
461 | + <ProbeIndexPointValueIterator> |
462 | + <SingletonIterator value="xs:QName(www.sessions.com,sessions,session-index)"/> |
463 | + <UnhoistIterator> |
464 | + <LetVarIterator varname="$$opt_temp_0"/> |
465 | + </UnhoistIterator> |
466 | + </ProbeIndexPointValueIterator> |
467 | + </NodeSortIterator> |
468 | </ForVariable> |
469 | <WhereClause> |
470 | <CompareIterator> |
471 | @@ -306,11 +308,9 @@ |
472 | <LetVarIterator varname="id"/> |
473 | <SingletonIterator value="xs:string(no session with the given uuid)"/> |
474 | </TraceIterator> |
475 | - <NodeSortIterator distinct="true" ascending="true"> |
476 | - <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,data)" typename="*" nill allowed="0"> |
477 | - <LetVarIterator varname="session"/> |
478 | - </ChildAxisIterator> |
479 | - </NodeSortIterator> |
480 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,data)" typename="*" nill allowed="0"> |
481 | + <LetVarIterator varname="session"/> |
482 | + </ChildAxisIterator> |
483 | </IfThenElseIterator> |
484 | </ReturnClause> |
485 | </flwor::FLWORIterator> |
486 | |
487 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-gary1.iter' |
488 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-gary1.iter 2013-02-07 17:24:36 +0000 |
489 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-gary1.iter 2013-05-23 02:29:28 +0000 |
490 | @@ -64,6 +64,25 @@ |
491 | </flwor::TupleStreamIterator> |
492 | </ChildAxisIterator> |
493 | </LetVariable> |
494 | + <LetVariable name="$$opt_temp_4" materialize="true"> |
495 | + <CreateInternalIndexIterator name="xs:QName(,,tempIndex0)"> |
496 | + <flwor::FLWORIterator> |
497 | + <ForVariable name="$$opt_temp_2"> |
498 | + <LetVarIterator varname="y"/> |
499 | + </ForVariable> |
500 | + <ReturnClause> |
501 | + <GeneralIndexEntryBuilderIterator> |
502 | + <ForVarIterator varname="$$opt_temp_2"/> |
503 | + <FnDataIterator> |
504 | + <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,unitid)" typename="*" nill allowed="0"> |
505 | + <ForVarIterator varname="$$opt_temp_2"/> |
506 | + </AttributeAxisIterator> |
507 | + </FnDataIterator> |
508 | + </GeneralIndexEntryBuilderIterator> |
509 | + </ReturnClause> |
510 | + </flwor::FLWORIterator> |
511 | + </CreateInternalIndexIterator> |
512 | + </LetVariable> |
513 | <ForVariable name="i"> |
514 | <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,inst)" typename="*" nill allowed="0"> |
515 | <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,institutions)" typename="*" nill allowed="0"> |
516 | @@ -80,30 +99,23 @@ |
517 | </LetVariable> |
518 | <LetVariable name="$$opt_temp_1" materialize="true"> |
519 | <HoistIterator> |
520 | - <NodeSortIterator distinct="true" ascending="true"> |
521 | - <AttributeAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
522 | - <flwor::FLWORIterator> |
523 | - <ForVariable name="$$context-item"> |
524 | - <LetVarIterator varname="y"/> |
525 | - </ForVariable> |
526 | - <WhereClause> |
527 | - <CompareIterator> |
528 | - <FnDataIterator> |
529 | - <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,unitid)" typename="*" nill allowed="0"> |
530 | - <ForVarIterator varname="$$context-item"/> |
531 | - </AttributeAxisIterator> |
532 | - </FnDataIterator> |
533 | + <AttributeAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
534 | + <flwor::FLWORIterator> |
535 | + <ForVariable name="$$context-item"> |
536 | + <NodeSortIterator distinct="true" ascending="true"> |
537 | + <ProbeIndexPointGeneralIterator> |
538 | + <SingletonIterator value="xs:QName(,,tempIndex0)"/> |
539 | <FnDataIterator> |
540 | <LetVarIterator varname="unitid"/> |
541 | </FnDataIterator> |
542 | - </CompareIterator> |
543 | - </WhereClause> |
544 | - <ReturnClause> |
545 | - <ForVarIterator varname="$$context-item"/> |
546 | - </ReturnClause> |
547 | - </flwor::FLWORIterator> |
548 | - </AttributeAxisIterator> |
549 | - </NodeSortIterator> |
550 | + </ProbeIndexPointGeneralIterator> |
551 | + </NodeSortIterator> |
552 | + </ForVariable> |
553 | + <ReturnClause> |
554 | + <ForVarIterator varname="$$context-item"/> |
555 | + </ReturnClause> |
556 | + </flwor::FLWORIterator> |
557 | + </AttributeAxisIterator> |
558 | </HoistIterator> |
559 | </LetVariable> |
560 | <ReturnClause> |
561 | |
562 | === added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/doc_order_01.iter' |
563 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/doc_order_01.iter 1970-01-01 00:00:00 +0000 |
564 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/doc_order_01.iter 2013-05-23 02:29:28 +0000 |
565 | @@ -0,0 +1,49 @@ |
566 | +Iterator tree for main query: |
567 | +<flwor::FLWORIterator> |
568 | + <ForVariable name="b"> |
569 | + <NodeDistinctIterator allow-atomics="false" check-only="false"> |
570 | + <DescendantAxisIterator test kind="match_name_test" qname="xs:QName(,,item)" typename="*" nill allowed="0"> |
571 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,regions)" typename="*" nill allowed="0"> |
572 | + <DescendantAxisIterator test kind="match_name_test" qname="xs:QName(,,site)" typename="*" nill allowed="0"> |
573 | + <FnDocIterator> |
574 | + <SingletonIterator value="xs:string(../xmark/auction.xml)"/> |
575 | + </FnDocIterator> |
576 | + </DescendantAxisIterator> |
577 | + </ChildAxisIterator> |
578 | + </DescendantAxisIterator> |
579 | + </NodeDistinctIterator> |
580 | + </ForVariable> |
581 | + <OrderBySpec> |
582 | + <FnDataIterator> |
583 | + <FnZeroOrOneIterator> |
584 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0"> |
585 | + <ForVarIterator varname="b"/> |
586 | + </ChildAxisIterator> |
587 | + </FnZeroOrOneIterator> |
588 | + </FnDataIterator> |
589 | + </OrderBySpec> |
590 | + <ReturnClause> |
591 | + <ElementIterator> |
592 | + <SingletonIterator value="xs:QName(,,item)"/> |
593 | + <AttributeIterator qname="xs:QName(,,name)"> |
594 | + <EnclosedIterator attr_cont="true"> |
595 | + <FnDataIterator> |
596 | + <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0"> |
597 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,name)" typename="*" nill allowed="0"> |
598 | + <ForVarIterator varname="b"/> |
599 | + </ChildAxisIterator> |
600 | + </ChildAxisIterator> |
601 | + </FnDataIterator> |
602 | + </EnclosedIterator> |
603 | + </AttributeIterator> |
604 | + <EnclosedIterator attr_cont="false"> |
605 | + <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0"> |
606 | + <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0"> |
607 | + <ForVarIterator varname="b"/> |
608 | + </ChildAxisIterator> |
609 | + </ChildAxisIterator> |
610 | + </EnclosedIterator> |
611 | + </ElementIterator> |
612 | + </ReturnClause> |
613 | +</flwor::FLWORIterator> |
614 | + |
615 | |
616 | === added file 'test/rbkt/ExpQueryResults/zorba/optim/doc_order_01.xml.res' |
617 | --- test/rbkt/ExpQueryResults/zorba/optim/doc_order_01.xml.res 1970-01-01 00:00:00 +0000 |
618 | +++ test/rbkt/ExpQueryResults/zorba/optim/doc_order_01.xml.res 2013-05-23 02:29:28 +0000 |
619 | @@ -0,0 +1,1 @@ |
620 | +<item name="scarce brook ">Denmark</item><item name="duteous nine eighteen ">United States</item><item name="great ">United States</item><item name="lived unsur ">United States</item><item name="wine prevention ">United States</item><item name="waters derive ">United States</item><item name="subornation precepts laboured gentleman ">United States</item><item name="secure desires ">United States</item><item name="choughs stains ">United States</item><item name="shall ingenious ">United States</item><item name="heart ">United States</item><item name="lessens promise ">United States</item><item name="nearer conquerors over pays ">United States</item><item name="abominable confession greet heaven ">United States</item><item name="mole bonfires ">United States</item><item name="compact paper ">United States</item><item name="sake ">United States</item><item name="strive octavius seals happiness ">United States</item><item name="gaze wages proving english ">United States</item><item name="practice space commune women ">United States</item><item name="holds perhaps despair amorous ">United States</item><item name="abhorr execution beckon rue ">Uzbekistan</item> |
621 | |
622 | === added file 'test/rbkt/Queries/zorba/optim/doc_order_01.xq' |
623 | --- test/rbkt/Queries/zorba/optim/doc_order_01.xq 1970-01-01 00:00:00 +0000 |
624 | +++ test/rbkt/Queries/zorba/optim/doc_order_01.xq 2013-05-23 02:29:28 +0000 |
625 | @@ -0,0 +1,8 @@ |
626 | + |
627 | + |
628 | +let $auction := doc("../xmark/auction.xml") |
629 | +return |
630 | + for $b in $auction//site/regions//item |
631 | + let $k := $b/name/text() |
632 | + stable order by zero-or-one($b/location) ascending empty greatest |
633 | + return <item name="{$k}">{$b/location/text()}</item> |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ gen-flwor- opt-2013- 05-23T02- 33-02.296Z/ log.html
Log at: http://