Merge lp:~zorba-coders/zorba/gen-flwor-opt into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10690
Merged at revision: 11473
Proposed branch: lp:~zorba-coders/zorba/gen-flwor-opt
Merge into: lp:zorba
Diff against target: 1466 lines (+378/-418)
21 files modified
ChangeLog (+2/-0)
src/compiler/expression/expr_base.cpp (+0/-1)
src/compiler/expression/expr_base.h (+0/-3)
src/compiler/expression/expr_clone.cpp (+1/-3)
src/compiler/expression/expr_iter.cpp (+0/-1)
src/compiler/expression/expr_manager.cpp (+2/-3)
src/compiler/expression/expr_manager.h (+1/-10)
src/compiler/expression/expr_type.cpp (+0/-1)
src/compiler/expression/flwor_expr.cpp (+29/-6)
src/compiler/expression/flwor_expr.h (+18/-10)
src/compiler/rewriter/rules/flwor_rules.cpp (+29/-55)
src/compiler/rewriter/rules/fold_rules.cpp (+2/-5)
src/compiler/rewriter/rules/hoist_rules.cpp (+14/-16)
src/compiler/rewriter/rules/index_join_rule.cpp (+5/-5)
src/compiler/rewriter/rules/index_matching_rule.cpp (+1/-2)
src/compiler/rewriter/rules/nodeid_rules.cpp (+0/-3)
src/compiler/rewriter/tools/dataflow_annotations.cpp (+0/-3)
src/compiler/rewriter/tools/expr_tools.cpp (+2/-5)
src/compiler/translator/translator.cpp (+21/-34)
src/compiler/xqddf/value_index.cpp (+3/-4)
test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter (+248/-248)
To merge this branch: bzr merge lp:~zorba-coders/zorba/gen-flwor-opt
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+165694@code.launchpad.net

Commit message

1. Implemented flwor-merge optimization for general FLWOR.
2. Removed gflwor_expr_kind

Description of the change

1. Implemented flwor-merge optimization for general FLWOR.
2. Removed gflwor_expr_kind

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 gen-flwor-opt-2013-05-24T20-21-01.305Z 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-05-24 00:34:25 +0000
3+++ ChangeLog 2013-05-24 20:18:27 +0000
4@@ -7,7 +7,9 @@
5
6 Optimizations:
7 * Implemented hoisting optimization for general FLWOR.
8+ * Implemented flwor-merge optimization for general FLWOR.
9 * Implemented document-ordering elimination for general FLWOR.
10+ * Applied count optimization to the return clause of general FLWORs.
11 * Optimized implementation of fn:deep-equal
12 * No need to apply document ordering on the domain expression of a FOR clause
13 if the FOR clause is followed by an orderby or groupby clause.
14
15=== modified file 'src/compiler/expression/expr_base.cpp'
16--- src/compiler/expression/expr_base.cpp 2013-03-15 08:22:41 +0000
17+++ src/compiler/expression/expr_base.cpp 2013-05-24 20:18:27 +0000
18@@ -898,7 +898,6 @@
19 }
20
21 case flwor_expr_kind:
22- case gflwor_expr_kind:
23 {
24 const flwor_expr* flworExpr = static_cast<const flwor_expr *>(this);
25 bool haveOrderBy = false;
26
27=== modified file 'src/compiler/expression/expr_base.h'
28--- src/compiler/expression/expr_base.h 2013-03-15 08:22:41 +0000
29+++ src/compiler/expression/expr_base.h 2013-05-24 20:18:27 +0000
30@@ -29,8 +29,6 @@
31
32 #include "functions/function_consts.h"
33
34-//#include "types/typeimpl.h"
35-
36 #include "context/static_context_consts.h"
37
38
39@@ -65,7 +63,6 @@
40 match_expr_kind,
41
42 flwor_expr_kind,
43- gflwor_expr_kind,
44 if_expr_kind,
45 trycatch_expr_kind,
46
47
48=== modified file 'src/compiler/expression/expr_clone.cpp'
49--- src/compiler/expression/expr_clone.cpp 2013-04-24 01:35:58 +0000
50+++ src/compiler/expression/expr_clone.cpp 2013-05-24 20:18:27 +0000
51@@ -261,12 +261,10 @@
52 }
53
54 case flwor_expr_kind:
55- case gflwor_expr_kind:
56 {
57 const flwor_expr* e = static_cast<const flwor_expr*>(this);
58
59- flwor_expr* cloneExpr = theCCB->theEM->
60- create_flwor_expr(theSctx, udf, theLoc, e->is_general());
61+ flwor_expr* cloneExpr = theCCB->theEM->create_flwor_expr(theSctx, udf, theLoc);
62
63 csize numClauses = e->num_clauses();
64
65
66=== modified file 'src/compiler/expression/expr_iter.cpp'
67--- src/compiler/expression/expr_iter.cpp 2013-04-24 01:35:58 +0000
68+++ src/compiler/expression/expr_iter.cpp 2013-05-24 20:18:27 +0000
69@@ -97,7 +97,6 @@
70 switch (theExpr->get_expr_kind())
71 {
72 case flwor_expr_kind:
73- case gflwor_expr_kind:
74 {
75 flwor_expr* flworExpr = static_cast<flwor_expr*>(theExpr);
76
77
78=== modified file 'src/compiler/expression/expr_manager.cpp'
79--- src/compiler/expression/expr_manager.cpp 2013-05-08 20:14:47 +0000
80+++ src/compiler/expression/expr_manager.cpp 2013-05-24 20:18:27 +0000
81@@ -1017,10 +1017,9 @@
82 flwor_expr* ExprManager::create_flwor_expr(
83 static_context* sctx,
84 user_function* udf,
85- const QueryLoc& loc,
86- bool general)
87+ const QueryLoc& loc)
88 {
89- CREATE_AND_RETURN_EXPR(flwor_expr, sctx, udf, loc, general);
90+ CREATE_AND_RETURN_EXPR(flwor_expr, sctx, udf, loc);
91 }
92
93
94
95=== modified file 'src/compiler/expression/expr_manager.h'
96--- src/compiler/expression/expr_manager.h 2013-04-16 20:06:08 +0000
97+++ src/compiler/expression/expr_manager.h 2013-05-24 20:18:27 +0000
98@@ -341,8 +341,6 @@
99
100 ////////////////////////////////////////////////////////////////////////////////
101
102-#ifdef ZORBA_WITH_JSON
103-
104 json_array_expr* create_json_array_expr(
105 static_context* sctx,
106 user_function* udf,
107@@ -363,8 +361,6 @@
108 std::vector<expr*>& names,
109 std::vector<expr*>& values);
110
111-#endif
112-
113 ////////////////////////////////////////////////////////////////////////////////
114
115 insert_expr* create_insert_expr(
116@@ -614,8 +610,7 @@
117 flwor_expr* create_flwor_expr(
118 static_context* sctx,
119 user_function* udf,
120- const QueryLoc& loc,
121- bool general);
122+ const QueryLoc& loc);
123
124 pragma* create_pragma(
125 const store::Item_t&,
126@@ -624,8 +619,6 @@
127
128 ////////////////////////////////////////////////////////////////////////////////
129
130-#ifdef ZORBA_WITH_JSON
131-
132 json_array_expr* create_json_array_expr(
133 static_context* sctx,
134 user_function* udf,
135@@ -646,8 +639,6 @@
136 std::vector<expr*>& names,
137 std::vector<expr*>& values);
138
139-#endif
140-
141 } // namespace zorba
142
143 #endif // ZORBA_COMPILER_EXPRMANAGER_H
144
145=== modified file 'src/compiler/expression/expr_type.cpp'
146--- src/compiler/expression/expr_type.cpp 2013-05-06 08:47:57 +0000
147+++ src/compiler/expression/expr_type.cpp 2013-05-24 20:18:27 +0000
148@@ -116,7 +116,6 @@
149 }
150
151 case flwor_expr_kind:
152- case gflwor_expr_kind:
153 {
154 flwor_expr* e = static_cast<flwor_expr*>(this);
155
156
157=== modified file 'src/compiler/expression/flwor_expr.cpp'
158--- src/compiler/expression/flwor_expr.cpp 2013-05-13 13:58:24 +0000
159+++ src/compiler/expression/flwor_expr.cpp 2013-05-24 20:18:27 +0000
160@@ -756,12 +756,11 @@
161 CompilerCB* ccb,
162 static_context* sctx,
163 user_function* udf,
164- const QueryLoc& loc,
165- bool general)
166+ const QueryLoc& loc)
167 :
168- expr(ccb, sctx, udf, loc, (general ? gflwor_expr_kind : flwor_expr_kind)),
169- theHasSequentialClauses(false),
170- theReturnExpr(NULL)
171+ expr(ccb, sctx, udf, loc, flwor_expr_kind),
172+ theReturnExpr(NULL),
173+ theFlworFlags(0)
174 {
175 theScriptingKind = SIMPLE_EXPR;
176 }
177@@ -770,6 +769,30 @@
178 /*******************************************************************************
179
180 ********************************************************************************/
181+void flwor_expr::set_general(bool v)
182+{
183+ if (v)
184+ theFlworFlags |= IS_GENERAL;
185+ else
186+ theFlworFlags &= ~IS_GENERAL;
187+}
188+
189+
190+/*******************************************************************************
191+
192+********************************************************************************/
193+void flwor_expr::set_sequential_clauses(bool v)
194+{
195+ if (v)
196+ theFlworFlags |= HAS_SEQUENTIAL_CLAUSES;
197+ else
198+ theFlworFlags &= ~HAS_SEQUENTIAL_CLAUSES;
199+}
200+
201+
202+/*******************************************************************************
203+
204+********************************************************************************/
205 flwor_clause* flwor_expr::get_clause(csize i) const
206 {
207 assert(i < theClauses.size());
208@@ -1094,7 +1117,7 @@
209 theScriptingKind |= c2->get_expr()->get_scripting_detail();
210
211 if (c2->get_expr()->is_sequential())
212- theHasSequentialClauses = true;
213+ set_sequential_clauses(true);
214 }
215 }
216
217
218=== modified file 'src/compiler/expression/flwor_expr.h'
219--- src/compiler/expression/flwor_expr.h 2013-05-13 13:58:24 +0000
220+++ src/compiler/expression/flwor_expr.h 2013-05-24 20:18:27 +0000
221@@ -661,22 +661,34 @@
222 typedef std::vector<flwor_clause*> clause_list_t;
223
224 protected:
225- bool theHasSequentialClauses;
226+ enum FlworFlags
227+ {
228+ HAS_SEQUENTIAL_CLAUSES = 0x1,
229+ IS_GENERAL = 0x2
230+ };
231+
232+protected:
233 clause_list_t theClauses;
234 expr * theReturnExpr;
235+ ulong theFlworFlags;
236
237 protected:
238 flwor_expr(
239 CompilerCB* ccb,
240 static_context* sctx,
241 user_function* udf,
242- const QueryLoc& loc,
243- bool general);
244+ const QueryLoc& loc);
245
246 public:
247- bool is_general() const { return get_expr_kind() == gflwor_expr_kind; }
248-
249- void set_general(bool v) { theKind = (v ? gflwor_expr_kind : flwor_expr_kind); }
250+ void compute_scripting_kind();
251+
252+ bool has_sequential_clauses() const { return theFlworFlags & HAS_SEQUENTIAL_CLAUSES; }
253+
254+ void set_sequential_clauses(bool v);
255+
256+ bool is_general() const { return theFlworFlags & IS_GENERAL; }
257+
258+ void set_general(bool v);
259
260 bool compute_is_general();
261
262@@ -690,10 +702,6 @@
263 compute_scripting_kind();
264 }
265
266- bool has_sequential_clauses() const { return theHasSequentialClauses; }
267-
268- void compute_scripting_kind();
269-
270 csize num_clauses() const { return theClauses.size(); }
271
272 void add_clause(flwor_clause* c, bool computeScriptingKind = true);
273
274=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
275--- src/compiler/rewriter/rules/flwor_rules.cpp 2013-04-29 14:39:04 +0000
276+++ src/compiler/rewriter/rules/flwor_rules.cpp 2013-05-24 20:18:27 +0000
277@@ -189,8 +189,7 @@
278 *******************************************************************************/
279 RULE_REWRITE_PRE(EliminateUnusedLetVars)
280 {
281- if (node->get_expr_kind() != flwor_expr_kind &&
282- node->get_expr_kind() != gflwor_expr_kind)
283+ if (node->get_expr_kind() != flwor_expr_kind)
284 return NULL;
285
286 const QueryLoc& loc = node->get_loc();
287@@ -585,7 +584,6 @@
288 switch (node->get_expr_kind())
289 {
290 case flwor_expr_kind:
291- case gflwor_expr_kind:
292 {
293 bool unsafe1 = unsafe || !isSafeVar;
294
295@@ -1003,11 +1001,8 @@
296 ******************************************************************************/
297 RULE_REWRITE_PRE(RefactorPredFLWOR)
298 {
299- if (node->get_expr_kind() != flwor_expr_kind &&
300- node->get_expr_kind() != gflwor_expr_kind)
301- {
302+ if (node->get_expr_kind() != flwor_expr_kind)
303 return NULL;
304- }
305
306 bool modified = false;
307 flwor_expr* flwor = static_cast<flwor_expr*>(node);
308@@ -1577,8 +1572,7 @@
309 *******************************************************************************/
310 expr* MergeFLWOR::apply(RewriterContext& rCtx, expr* node, bool& modified)
311 {
312- if (node->get_expr_kind() == flwor_expr_kind ||
313- node->get_expr_kind() == gflwor_expr_kind)
314+ if (node->get_expr_kind() == flwor_expr_kind)
315 {
316 flwor_expr* flwor = static_cast<flwor_expr *>(node);
317
318@@ -1592,37 +1586,23 @@
319
320 flwor_expr* returnFlwor = static_cast<flwor_expr*>(flwor->get_return_expr());
321
322- // If the outer flwor is not general, and it contains where, groupby, or
323- // orderby clauses, we cannot merge because for/let clauses cannot appear
324- // after where, groupby, or orderby clauses,
325- if (!flwor->is_general())
326- {
327- csize numClauses = flwor->num_clauses();
328-
329- for (csize i = 0; i < numClauses; ++i)
330- {
331- const flwor_clause* c = flwor->get_clause(i);
332-
333- if (c->get_kind() == flwor_clause::where_clause ||
334- c->get_kind() == flwor_clause::groupby_clause ||
335- c->get_kind() == flwor_clause::orderby_clause)
336- {
337- goto next1;
338- }
339- }
340- }
341-
342 csize numClauses = returnFlwor->num_clauses();
343
344 for (csize i = 0; i < numClauses; ++i)
345 {
346 const flwor_clause* c = returnFlwor->get_clause(i);
347
348- if (c->get_kind() == flwor_clause::groupby_clause ||
349- c->get_kind() == flwor_clause::orderby_clause)
350+ switch (c->get_kind())
351+ {
352+ case flwor_clause::groupby_clause:
353+ case flwor_clause::orderby_clause:
354+ case flwor_clause::count_clause:
355 {
356 goto next1;
357 }
358+ default:
359+ break;
360+ }
361 }
362
363 for (csize i = 0; i < numClauses; ++i)
364@@ -1700,30 +1680,31 @@
365 numNestedClauses = nestedFlwor->num_clauses();
366 merge = true;
367
368- for (csize j = 0; j < numNestedClauses; ++j)
369+ for (csize j = 0; j < numNestedClauses && merge; ++j)
370 {
371 flwor_clause* nestedClause = nestedFlwor->get_clause(j);
372- flwor_clause::ClauseKind nestedClauseKind = nestedClause->get_kind();
373-
374- if (nestedClauseKind == flwor_clause::let_clause)
375- continue;
376
377- if (nestedClauseKind == flwor_clause::for_clause ||
378- nestedClauseKind == flwor_clause::where_clause)
379+ switch (nestedClause->get_kind())
380+ {
381+ case flwor_clause::let_clause:
382+ {
383+ break;
384+ }
385+ case flwor_clause::for_clause:
386+ case flwor_clause::window_clause:
387+ case flwor_clause::where_clause:
388 {
389 if (isOuter || hasPosVar)
390- {
391 merge = false;
392- break;
393- }
394- else
395- {
396- continue;
397- }
398- }
399
400- merge = false;
401- break;
402+ break;
403+ }
404+ default:
405+ {
406+ merge = false;
407+ break;
408+ }
409+ }
410 }
411 }
412 }
413@@ -1734,13 +1715,6 @@
414 {
415 flwor_clause* nestedClause = nestedFlwor->get_clause(j);
416 flwor->add_clause(i+j, nestedClause);
417-
418- if (!flwor->is_general() &&
419- nestedClause->get_kind() == flwor_clause::where_clause &&
420- i != numClauses - 1)
421- {
422- flwor->set_general(true);
423- }
424 }
425
426 c->set_expr(nestedFlwor->get_return_expr());
427
428=== modified file 'src/compiler/rewriter/rules/fold_rules.cpp'
429--- src/compiler/rewriter/rules/fold_rules.cpp 2013-05-22 21:03:15 +0000
430+++ src/compiler/rewriter/rules/fold_rules.cpp 2013-05-24 20:18:27 +0000
431@@ -332,7 +332,6 @@
432 // the flwor expr itself
433
434 case flwor_expr_kind:
435- case gflwor_expr_kind:
436 {
437 flwor_expr* flwor = static_cast<flwor_expr *> (node);
438
439@@ -746,8 +745,7 @@
440 }
441 }
442
443- if (arg->get_expr_kind() == flwor_expr_kind ||
444- arg->get_expr_kind() == gflwor_expr_kind)
445+ if (arg->get_expr_kind() == flwor_expr_kind)
446 {
447 bool modified = false;
448 expr* newArg = partial_eval_return_clause(static_cast<flwor_expr*>(arg),
449@@ -1022,8 +1020,7 @@
450 }
451 }
452
453- if (returnExpr->get_expr_kind() == flwor_expr_kind ||
454- returnExpr->get_expr_kind() == gflwor_expr_kind)
455+ if (returnExpr->get_expr_kind() == flwor_expr_kind)
456 {
457 expr* newRet =
458 partial_eval_return_clause(static_cast<flwor_expr*>(returnExpr), modified, rCtx);
459
460=== modified file 'src/compiler/rewriter/rules/hoist_rules.cpp'
461--- src/compiler/rewriter/rules/hoist_rules.cpp 2013-05-16 09:13:48 +0000
462+++ src/compiler/rewriter/rules/hoist_rules.cpp 2013-05-24 20:18:27 +0000
463@@ -115,8 +115,7 @@
464 {
465 bool status = false;
466
467- if (e->get_expr_kind() == flwor_expr_kind ||
468- e->get_expr_kind() == gflwor_expr_kind)
469+ if (e->get_expr_kind() == flwor_expr_kind)
470 {
471 flwor_expr* flwor = static_cast<flwor_expr *>(e);
472
473@@ -484,9 +483,7 @@
474 PathHolder* nextstep = NULL;
475
476 bool inloop = false;
477- bool foundReferencedFLWORVar = false;
478- bool foundSequentialClause = false;
479- int i = 0;
480+ int clauseNo = 0;
481
482 // step->prev == NULL means that expr e is not inside any flwor expr, and as a
483 // result, there is nothing to hoist.
484@@ -518,20 +515,22 @@
485 }
486 else
487 {
488- assert(step->theExpr->get_expr_kind() == flwor_expr_kind ||
489- step->theExpr->get_expr_kind() == gflwor_expr_kind);
490+ assert(step->theExpr->get_expr_kind() == flwor_expr_kind);
491
492 flwor_expr* flwor = static_cast<flwor_expr*>(step->theExpr);
493
494+ bool foundReferencedFLWORVar = false;
495+ bool foundSequentialClause = false;
496+
497 // Check whether expr e references any variables from the current flwor. If
498 // not, then e can be hoisted out of the current flwor and we repeat the
499 // while-loop to see if e can be hoisted w.r.t. the previous (outer) flwor.
500 // If yes, then let V be the inner-most var referenced by e. If there are any
501 // FOR vars after V, e can be hoisted out of any such FOR vars. Otherwise, e
502 // cannot be hoisted.
503- for (i = step->clauseCount - 1; i >= 0; --i)
504+ for (clauseNo = step->clauseCount - 1; clauseNo >= 0; --clauseNo)
505 {
506- flwor_clause* c = flwor->get_clause(i);
507+ flwor_clause* c = flwor->get_clause(clauseNo);
508
509 switch (c->get_kind())
510 {
511@@ -587,7 +586,7 @@
512 {
513 ZORBA_ASSERT(nextstep);
514 step = nextstep;
515- i = -1;
516+ clauseNo = -1;
517 }
518
519 break;
520@@ -620,7 +619,7 @@
521 {
522 ZORBA_ASSERT(nextstep);
523 step = nextstep;
524- i = -1;
525+ clauseNo = -1;
526 }
527
528 break;
529@@ -712,7 +711,7 @@
530 // var: $$temp := op:hoist(e) (b) we place the $$temp declaration right after
531 // variable V, and (c) we replace e with op:unhoist($$temp).
532
533- var_expr* letvar(rCtx.createTempVar(sctx, loc, var_expr::let_var));
534+ var_expr* letvar = rCtx.createTempVar(sctx, loc, var_expr::let_var);
535
536 expr* hoisted = rCtx.theEM->
537 create_fo_expr(sctx, udf, loc, BUILTIN_FUNC(OP_HOIST_1), e);
538@@ -725,21 +724,20 @@
539 letvar->set_flwor_clause(flref);
540
541 ZORBA_ASSERT(step->theExpr == NULL ||
542- step->theExpr->get_expr_kind() == flwor_expr_kind ||
543- step->theExpr->get_expr_kind() == gflwor_expr_kind);
544+ step->theExpr->get_expr_kind() == flwor_expr_kind);
545
546 if (step->prev == NULL)
547 {
548 if (step->theExpr == NULL)
549 {
550- step->theExpr = rCtx.theEM->create_flwor_expr(sctx, udf, loc, false);
551+ step->theExpr = rCtx.theEM->create_flwor_expr(sctx, udf, loc);
552 }
553
554 static_cast<flwor_expr*>(step->theExpr)->add_clause(flref);
555 }
556 else
557 {
558- static_cast<flwor_expr*>(step->theExpr)->add_clause(i + 1, flref);
559+ static_cast<flwor_expr*>(step->theExpr)->add_clause(clauseNo + 1, flref);
560 ++step->clauseCount;
561 }
562
563
564=== modified file 'src/compiler/rewriter/rules/index_join_rule.cpp'
565--- src/compiler/rewriter/rules/index_join_rule.cpp 2013-03-16 20:19:39 +0000
566+++ src/compiler/rewriter/rules/index_join_rule.cpp 2013-05-24 20:18:27 +0000
567@@ -113,7 +113,7 @@
568
569 expr_kind_t nodeKind = node->get_expr_kind();
570
571- if (nodeKind == flwor_expr_kind || nodeKind == gflwor_expr_kind)
572+ if (nodeKind == flwor_expr_kind)
573 {
574 flworExpr = static_cast<flwor_expr *>(node);
575
576@@ -190,7 +190,7 @@
577
578 // No index-join rewrite done, so drill down.
579
580- if (nodeKind == flwor_expr_kind || nodeKind == gflwor_expr_kind)
581+ if (nodeKind == flwor_expr_kind)
582 {
583 csize numClauses = flworExpr->num_clauses();
584 csize clausePos = 0;
585@@ -730,7 +730,7 @@
586 expr* currExpr = theVarDefExprs[i];
587 expr_kind_t currKind = currExpr->get_expr_kind();
588
589- if (currKind == flwor_expr_kind || currKind == gflwor_expr_kind)
590+ if (currKind == flwor_expr_kind)
591 {
592 flwor_expr* flwor = static_cast<flwor_expr*>(currExpr);
593 csize numClauses = flwor->num_clauses();
594@@ -868,7 +868,7 @@
595 expr* currExpr = theVarDefExprs[i];
596 expr_kind_t currKind = currExpr->get_expr_kind();
597
598- if (currKind == flwor_expr_kind || currKind == gflwor_expr_kind)
599+ if (currKind == flwor_expr_kind)
600 {
601 flwor_expr* flwor = static_cast<flwor_expr*>(currExpr);
602 csize numClauses = flwor->num_clauses();
603@@ -1050,7 +1050,7 @@
604
605 block->add(targetPos, createExpr);
606 }
607- else if (targetKind == flwor_expr_kind || targetKind == gflwor_expr_kind)
608+ else if (targetKind == flwor_expr_kind)
609 {
610 flwor_expr* flwor = static_cast<flwor_expr*>(targetExpr);
611 csize numClauses = flwor->num_clauses();
612
613=== modified file 'src/compiler/rewriter/rules/index_matching_rule.cpp'
614--- src/compiler/rewriter/rules/index_matching_rule.cpp 2013-05-04 20:20:05 +0000
615+++ src/compiler/rewriter/rules/index_matching_rule.cpp 2013-05-24 20:18:27 +0000
616@@ -129,8 +129,7 @@
617 if (theIndexDecl->isGeneral())
618 return node;
619
620- if (node->get_expr_kind() == flwor_expr_kind ||
621- node->get_expr_kind() == gflwor_expr_kind)
622+ if (node->get_expr_kind() == flwor_expr_kind)
623 {
624 theQueryExpr = static_cast<flwor_expr*>(node);
625
626
627=== modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp'
628--- src/compiler/rewriter/rules/nodeid_rules.cpp 2013-05-23 02:27:38 +0000
629+++ src/compiler/rewriter/rules/nodeid_rules.cpp 2013-05-24 20:18:27 +0000
630@@ -183,7 +183,6 @@
631 }
632
633 case flwor_expr_kind:
634- case gflwor_expr_kind:
635 {
636 flwor_expr* flwor = static_cast<flwor_expr *>(node);
637
638@@ -970,7 +969,6 @@
639 break;
640 }
641
642- case gflwor_expr_kind:
643 case flwor_expr_kind:
644 case if_expr_kind:
645 case trycatch_expr_kind:
646@@ -1356,7 +1354,6 @@
647 return;
648 }
649
650- case gflwor_expr_kind:
651 case flwor_expr_kind:
652 {
653 flwor_expr* e = static_cast<flwor_expr *>(node);
654
655=== modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp'
656--- src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-05-23 02:27:38 +0000
657+++ src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-05-24 20:18:27 +0000
658@@ -156,7 +156,6 @@
659 compute_var_expr(static_cast<var_expr *>(e));
660 break;
661
662- case gflwor_expr_kind:
663 case flwor_expr_kind:
664 compute_flwor_expr(static_cast<flwor_expr *>(e));
665 break;
666@@ -1005,7 +1004,6 @@
667 return;
668 }
669
670- case gflwor_expr_kind:
671 case flwor_expr_kind:
672 {
673 flwor_expr* e = static_cast<flwor_expr *>(node);
674@@ -1345,7 +1343,6 @@
675 return;
676 }
677
678- case gflwor_expr_kind:
679 case flwor_expr_kind:
680 {
681 flwor_expr* e = static_cast<flwor_expr *>(node);
682
683=== modified file 'src/compiler/rewriter/tools/expr_tools.cpp'
684--- src/compiler/rewriter/tools/expr_tools.cpp 2013-05-09 18:50:15 +0000
685+++ src/compiler/rewriter/tools/expr_tools.cpp 2013-05-24 20:18:27 +0000
686@@ -476,7 +476,6 @@
687 }
688
689 case flwor_expr_kind:
690- case gflwor_expr_kind:
691 {
692 flwor_expr* qe = static_cast<flwor_expr*>(query);
693 flwor_expr* ve = static_cast<flwor_expr*>(view);
694@@ -962,8 +961,7 @@
695 VarIdMap& varidmap,
696 IdVarMap* idvarmap)
697 {
698- if (e->get_expr_kind() == flwor_expr_kind ||
699- e->get_expr_kind() == gflwor_expr_kind)
700+ if (e->get_expr_kind() == flwor_expr_kind)
701 {
702 const flwor_expr* flwor = static_cast<const flwor_expr *>(e);
703
704@@ -1211,8 +1209,7 @@
705 // A flwor does not depend on the vars that are defined inside the flwor itself,
706 // so remove these vars from the freeset of the flwor, if they have been added
707 // there.
708- if (e->get_expr_kind() == flwor_expr_kind ||
709- e->get_expr_kind() == gflwor_expr_kind)
710+ if (e->get_expr_kind() == flwor_expr_kind)
711 {
712 flwor_expr* flwor = static_cast<flwor_expr *>(e);
713
714
715=== modified file 'src/compiler/translator/translator.cpp'
716--- src/compiler/translator/translator.cpp 2013-05-15 23:22:01 +0000
717+++ src/compiler/translator/translator.cpp 2013-05-24 20:18:27 +0000
718@@ -1637,7 +1637,7 @@
719 push_scope();
720
721 // for $fi in argExpr
722- flwor_expr* coersionFlwor = CREATE(flwor)(theRootSctx, theUDF, loc, false);
723+ flwor_expr* coersionFlwor = CREATE(flwor)(theRootSctx, theUDF, loc);
724 for_clause* fiClause = wrap_in_forclause(argExpr, NULL);
725 var_expr* fiVar = fiClause->get_var();
726 coersionFlwor->add_clause(fiClause);
727@@ -1910,8 +1910,7 @@
728 var_expr* lv,
729 expr* retExpr)
730 {
731- flwor_expr* fe = theExprManager->
732- create_flwor_expr(theRootSctx, theUDF, lv->get_loc(), false);
733+ flwor_expr* fe = CREATE(flwor)(theRootSctx, theUDF, lv->get_loc());
734
735 fe->add_clause(wrap_in_letclause(domExpr, lv));
736
737@@ -1943,8 +1942,7 @@
738
739 push_scope();
740
741- flwor_expr* flworExpr = theExprManager->
742- create_flwor_expr(theRootSctx, theUDF, loc, false);
743+ flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
744
745 if (withContextSize)
746 {
747@@ -4497,8 +4495,7 @@
748
749 if (v.size() > 0)
750 {
751- flwor_expr* flwor = theExprManager->
752- create_flwor_expr(theRootSctx, theUDF, loc, false);
753+ flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
754
755 push_nodestack(flwor);
756 }
757@@ -5569,8 +5566,7 @@
758 let_clause* lc = theExprManager->
759 create_let_clause(theRootSctx, loc, varExpr, collExpr);
760
761- flwor_expr* flworExpr = theExprManager->
762- create_flwor_expr(theRootSctx, theUDF, loc, false);
763+ flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
764
765 flworExpr->add_clause(lc);
766 // flworExpr-> return clause to be set in end_visitor
767@@ -5650,8 +5646,7 @@
768 // every is implemented as a flowr expr
769 push_scope();
770
771- flwor_expr* evFlworExpr = theExprManager->
772- create_flwor_expr(theRootSctx, theUDF, loc, false);
773+ flwor_expr* evFlworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
774
775 evFlworExpr->set_return_expr(CREATE(const)(theRootSctx, theUDF, loc, true));
776
777@@ -5671,7 +5666,7 @@
778 let_clause* letClause = theExprManager->
779 create_let_clause(theRootSctx, loc, varExpr, collExpr);
780
781- flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc, false);
782+ flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
783
784 flworExpr->add_clause(letClause);
785 // flworExpr->set_return_expr( andExpr ); done in end_visit
786@@ -5734,13 +5729,10 @@
787 // every $x_ in $x satisfies exists ...
788 // every is implemented as a flowr expr
789 //push_scope();
790- flwor_expr* evFlworExpr = theExprManager->
791- create_flwor_expr(theRootSctx, theUDF, loc, false);
792-
793- evFlworExpr->set_return_expr(theExprManager->create_const_expr(theRootSctx,
794- theUDF,
795- loc,
796- true));
797+ flwor_expr* evFlworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
798+
799+ evFlworExpr->set_return_expr(CREATE(const)(theRootSctx, theUDF, loc, true));
800+
801 // $x
802 const QName* varQName = ic.getCollVarName();
803
804@@ -5748,9 +5740,7 @@
805 var_expr* evVarExpr = bind_var(loc, varQName, var_expr::for_var, NULL);
806
807 // maybe make one more collExpr?
808- evFlworExpr->add_clause(wrap_in_forclause(collExpr,
809- evVarExpr,
810- NULL));
811+ evFlworExpr->add_clause(wrap_in_forclause(collExpr, evVarExpr, NULL));
812
813 //pop_scope();
814 // end every
815@@ -5816,8 +5806,7 @@
816 // some $y in dc:collection( xs:QName("org:employees") )
817 // satisfies ... eq ...
818 // implemented using flowr
819- flwor_expr* someFlworExpr = theExprManager->
820- create_flwor_expr(theRootSctx, theUDF, loc, false);
821+ flwor_expr* someFlworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
822
823 someFlworExpr->set_return_expr(theExprManager->create_const_expr(theRootSctx,
824 theUDF,
825@@ -5869,8 +5858,7 @@
826 // every $x in dc:collection( xs:QName("org:transactions") )
827 // satisfies ...
828 // implemented using flowr
829- flwor_expr* evFlworExpr = theExprManager->
830- create_flwor_expr(theRootSctx, theUDF, loc, false);
831+ flwor_expr* evFlworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
832
833 evFlworExpr->set_return_expr(theExprManager->create_const_expr(theRootSctx,
834 theUDF,
835@@ -6885,8 +6873,7 @@
836 ERROR_PARAMS(ZED(XPST0003_XQueryVersionAtLeast30_2), theSctx->xquery_version()));
837 }
838
839- flwor_expr* flwor = theExprManager->
840- create_flwor_expr(theRootSctx, theUDF, loc, v.is_general());
841+ flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
842
843 expr* retExpr = pop_nodestack();
844
845@@ -8585,9 +8572,9 @@
846 {
847 TRACE_VISIT();
848
849- flwor_expr* flwor(theExprManager->create_flwor_expr(theRootSctx, theUDF, loc, false));
850+ flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
851
852- flwor->set_return_expr(theExprManager->create_const_expr(theRootSctx, theUDF, loc, true));
853+ flwor->set_return_expr(CREATE(const)(theRootSctx, theUDF, loc, true));
854
855 push_nodestack(flwor);
856
857@@ -11736,7 +11723,7 @@
858 }
859
860 // create a flwor with LETs to hold the parameters
861- flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc, false);
862+ flwor_expr* flworExpr = CREATE(flwor)(theRootSctx, theUDF, loc);
863
864 // wrap function's QName
865 expr* qnameExpr = wrap_in_type_promotion(arguments[0],
866@@ -12196,7 +12183,7 @@
867
868 arguments[0] = normalize_fo_arg(0, arguments[0], f, loc);
869
870- flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc, false);
871+ flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
872 for_clause* seq_fc = wrap_in_forclause(arguments[1], false);
873 flwor->add_clause(seq_fc);
874
875@@ -12225,7 +12212,7 @@
876
877 arguments[0] = normalize_fo_arg(0, arguments[0], f, loc);
878
879- flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc, false);
880+ flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
881 for_clause* seq_fc = wrap_in_forclause(arguments[1], true);
882 flwor->add_clause(seq_fc);
883
884@@ -12794,7 +12781,7 @@
885 }
886 else
887 {
888- flwor = CREATE(flwor)(theRootSctx, theUDF, loc, false);
889+ flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
890 }
891
892 // Handle inscope variables.
893
894=== modified file 'src/compiler/xqddf/value_index.cpp'
895--- src/compiler/xqddf/value_index.cpp 2013-02-07 17:24:36 +0000
896+++ src/compiler/xqddf/value_index.cpp 2013-05-24 20:18:27 +0000
897@@ -430,7 +430,6 @@
898 break;
899 }
900 case flwor_expr_kind:
901- case gflwor_expr_kind:
902 {
903 static_cast<const flwor_expr*>(e)->get_vars(varExprs);
904
905@@ -522,7 +521,7 @@
906
907 expr* returnExpr = theCCB->theEM->create_wrapper_expr(sctx, udf, domloc, newdot);
908
909- flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, domloc, false);
910+ flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, domloc);
911 flworExpr->set_return_expr(returnExpr);
912 flworExpr->add_clause(fc);
913
914@@ -699,7 +698,7 @@
915
916 fo_expr* returnExpr = theCCB->theEM->create_fo_expr(sctx, udf, loc, f, clonedExprs);
917
918- flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, loc, false);
919+ flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, loc);
920 flworExpr->set_return_expr(returnExpr);
921 flworExpr->add_clause(fc);
922
923@@ -849,7 +848,7 @@
924
925 fo_expr* returnExpr = theCCB->theEM->create_fo_expr(sctx, udf, loc, f, clonedExprs);
926
927- flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, loc, false);
928+ flwor_expr* flworExpr = theCCB->theEM->create_flwor_expr(sctx, udf, loc);
929 flworExpr->set_return_expr(returnExpr);
930 flworExpr->add_clause(fc);
931
932
933=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter'
934--- test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter 2013-03-04 21:00:58 +0000
935+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter 2013-05-24 20:18:27 +0000
936@@ -1319,95 +1319,232 @@
937 </flwor::FLWORIterator>
938
939 Iterator tree for shapes:intersect-plane:
940-<flwor::FLWORIterator>
941- <ForVariable name="plane">
942- <LetVarIterator varname="plane"/>
943- </ForVariable>
944- <LetVariable name="normal" materialize="true">
945- <FunctionTraceIterator>
946- <flwor::FLWORIterator>
947- <ForVariable name="a">
948- <TreatIterator quant="">
949- <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,normal)" typename="*" nill allowed="0">
950+<flwor::TupleStreamIterator>
951+ <flwor::WhereIterator>
952+ <flwor::ForIterator>
953+ <ForVariable name="$$context-item"/>
954+ <flwor::WhereIterator>
955+ <flwor::ForIterator>
956+ <ForVariable name="denom"/>
957+ <flwor::LetIterator>
958+ <LetVariable name="normal" materialize="true"/>
959+ <flwor::ForIterator>
960+ <ForVariable name="plane"/>
961+ <flwor::TupleSourceIterator/>
962+ <LetVarIterator varname="plane"/>
963+ </flwor::ForIterator>
964+ <FunctionTraceIterator>
965+ <flwor::FLWORIterator>
966+ <ForVariable name="a">
967+ <TreatIterator quant="">
968+ <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,normal)" typename="*" nill allowed="0">
969+ <ForVarIterator varname="plane"/>
970+ </ChildAxisIterator>
971+ </TreatIterator>
972+ </ForVariable>
973+ <ReturnClause>
974+ <FnConcatIterator>
975+ <CastIterator type="xs:double">
976+ <FnDataIterator>
977+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,x)" typename="*" nill allowed="0">
978+ <ForVarIterator varname="a"/>
979+ </AttributeAxisIterator>
980+ </FnDataIterator>
981+ </CastIterator>
982+ <CastIterator type="xs:double">
983+ <FnDataIterator>
984+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,y)" typename="*" nill allowed="0">
985+ <ForVarIterator varname="a"/>
986+ </AttributeAxisIterator>
987+ </FnDataIterator>
988+ </CastIterator>
989+ <CastIterator type="xs:double">
990+ <FnDataIterator>
991+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,z)" typename="*" nill allowed="0">
992+ <ForVarIterator varname="a"/>
993+ </AttributeAxisIterator>
994+ </FnDataIterator>
995+ </CastIterator>
996+ </FnConcatIterator>
997+ </ReturnClause>
998+ </flwor::FLWORIterator>
999+ </FunctionTraceIterator>
1000+ </flwor::LetIterator>
1001+ <FunctionTraceIterator>
1002+ <FnSumDoubleIterator>
1003+ <flwor::FLWORIterator>
1004+ <ForVariable name="x">
1005+ <LetVarIterator varname="direction"/>
1006+ </ForVariable>
1007+ <ReturnClause>
1008+ <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1009+ <ForVarIterator varname="x"/>
1010+ <LetVarIterator varname="normal">
1011+ <ForVarIterator varname="p"/>
1012+ </LetVarIterator>
1013+ </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1014+ </ReturnClause>
1015+ </flwor::FLWORIterator>
1016+ </FnSumDoubleIterator>
1017+ </FunctionTraceIterator>
1018+ </flwor::ForIterator>
1019+ <TypedValueCompareIterator_DOUBLE>
1020+ <ForVarIterator varname="denom"/>
1021+ <SingletonIterator value="xs:double(0)"/>
1022+ </TypedValueCompareIterator_DOUBLE>
1023+ </flwor::WhereIterator>
1024+ <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1025+ <CastIterator type="xs:double">
1026+ <FnDataIterator>
1027+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,offset)" typename="*" nill allowed="0">
1028 <ForVarIterator varname="plane"/>
1029- </ChildAxisIterator>
1030- </TreatIterator>
1031- </ForVariable>
1032- <ReturnClause>
1033- <FnConcatIterator>
1034- <CastIterator type="xs:double">
1035- <FnDataIterator>
1036- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,x)" typename="*" nill allowed="0">
1037- <ForVarIterator varname="a"/>
1038- </AttributeAxisIterator>
1039- </FnDataIterator>
1040- </CastIterator>
1041- <CastIterator type="xs:double">
1042- <FnDataIterator>
1043- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,y)" typename="*" nill allowed="0">
1044- <ForVarIterator varname="a"/>
1045- </AttributeAxisIterator>
1046- </FnDataIterator>
1047- </CastIterator>
1048- <CastIterator type="xs:double">
1049- <FnDataIterator>
1050- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,z)" typename="*" nill allowed="0">
1051- <ForVarIterator varname="a"/>
1052- </AttributeAxisIterator>
1053- </FnDataIterator>
1054- </CastIterator>
1055- </FnConcatIterator>
1056- </ReturnClause>
1057- </flwor::FLWORIterator>
1058- </FunctionTraceIterator>
1059- </LetVariable>
1060- <ForVariable name="denom">
1061- <FunctionTraceIterator>
1062- <FnSumDoubleIterator>
1063- <flwor::FLWORIterator>
1064- <ForVariable name="x">
1065- <LetVarIterator varname="direction"/>
1066- </ForVariable>
1067- <ReturnClause>
1068- <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1069- <ForVarIterator varname="x"/>
1070- <LetVarIterator varname="normal">
1071- <ForVarIterator varname="p"/>
1072- </LetVarIterator>
1073- </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1074- </ReturnClause>
1075- </flwor::FLWORIterator>
1076- </FnSumDoubleIterator>
1077- </FunctionTraceIterator>
1078- </ForVariable>
1079- <WhereClause>
1080+ </AttributeAxisIterator>
1081+ </FnDataIterator>
1082+ </CastIterator>
1083+ <SpecificNumArithIterator_DivideOperation_DOUBLE>
1084+ <FunctionTraceIterator>
1085+ <FnSumDoubleIterator>
1086+ <flwor::FLWORIterator>
1087+ <ForVariable name="x">
1088+ <LetVarIterator varname="start"/>
1089+ </ForVariable>
1090+ <ReturnClause>
1091+ <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1092+ <ForVarIterator varname="x"/>
1093+ <LetVarIterator varname="normal">
1094+ <ForVarIterator varname="p"/>
1095+ </LetVarIterator>
1096+ </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1097+ </ReturnClause>
1098+ </flwor::FLWORIterator>
1099+ </FnSumDoubleIterator>
1100+ </FunctionTraceIterator>
1101+ <ForVarIterator varname="denom"/>
1102+ </SpecificNumArithIterator_DivideOperation_DOUBLE>
1103+ </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1104+ </flwor::ForIterator>
1105 <TypedValueCompareIterator_DOUBLE>
1106- <ForVarIterator varname="denom"/>
1107+ <ForVarIterator varname="$$context-item"/>
1108 <SingletonIterator value="xs:double(0)"/>
1109 </TypedValueCompareIterator_DOUBLE>
1110- </WhereClause>
1111- <ReturnClause>
1112- <flwor::FLWORIterator>
1113- <ForVariable name="$$context-item">
1114+ </flwor::WhereIterator>
1115+ <ForVarIterator varname="$$context-item"/>
1116+</flwor::TupleStreamIterator>
1117+
1118+Iterator tree for shapes:intersect-sphere:
1119+<flwor::TupleStreamIterator>
1120+ <flwor::LetIterator>
1121+ <LetVariable name="sqrt" materialize="true"/>
1122+ <flwor::WhereIterator>
1123+ <flwor::LetIterator>
1124+ <LetVariable name="descriminant" materialize="true"/>
1125+ <flwor::ForIterator>
1126+ <ForVariable name="beta"/>
1127+ <flwor::LetIterator>
1128+ <LetVariable name="y" materialize="true"/>
1129+ <flwor::LetIterator>
1130+ <LetVariable name="radius" materialize="true"/>
1131+ <flwor::ForIterator>
1132+ <ForVariable name="sphere"/>
1133+ <flwor::TupleSourceIterator/>
1134+ <LetVarIterator varname="sphere"/>
1135+ </flwor::ForIterator>
1136+ <CastIterator type="xs:double">
1137+ <FnDataIterator>
1138+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,radius)" typename="*" nill allowed="0">
1139+ <ForVarIterator varname="sphere"/>
1140+ </AttributeAxisIterator>
1141+ </FnDataIterator>
1142+ </CastIterator>
1143+ </flwor::LetIterator>
1144+ <FunctionTraceIterator>
1145+ <flwor::FLWORIterator>
1146+ <LetVariable name="v2" materialize="true">
1147+ <FunctionTraceIterator>
1148+ <flwor::FLWORIterator>
1149+ <ForVariable name="a">
1150+ <TreatIterator quant="">
1151+ <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,center)" typename="*" nill allowed="0">
1152+ <ForVarIterator varname="sphere"/>
1153+ </ChildAxisIterator>
1154+ </TreatIterator>
1155+ </ForVariable>
1156+ <ReturnClause>
1157+ <FnConcatIterator>
1158+ <CastIterator type="xs:double">
1159+ <FnDataIterator>
1160+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,x)" typename="*" nill allowed="0">
1161+ <ForVarIterator varname="a"/>
1162+ </AttributeAxisIterator>
1163+ </FnDataIterator>
1164+ </CastIterator>
1165+ <CastIterator type="xs:double">
1166+ <FnDataIterator>
1167+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,y)" typename="*" nill allowed="0">
1168+ <ForVarIterator varname="a"/>
1169+ </AttributeAxisIterator>
1170+ </FnDataIterator>
1171+ </CastIterator>
1172+ <CastIterator type="xs:double">
1173+ <FnDataIterator>
1174+ <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,z)" typename="*" nill allowed="0">
1175+ <ForVarIterator varname="a"/>
1176+ </AttributeAxisIterator>
1177+ </FnDataIterator>
1178+ </CastIterator>
1179+ </FnConcatIterator>
1180+ </ReturnClause>
1181+ </flwor::FLWORIterator>
1182+ </FunctionTraceIterator>
1183+ </LetVariable>
1184+ <ForVariable name="x">
1185+ <LetVarIterator varname="start"/>
1186+ </ForVariable>
1187+ <ReturnClause>
1188+ <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1189+ <ForVarIterator varname="x"/>
1190+ <LetVarIterator varname="v2">
1191+ <ForVarIterator varname="p"/>
1192+ </LetVarIterator>
1193+ </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1194+ </ReturnClause>
1195+ </flwor::FLWORIterator>
1196+ </FunctionTraceIterator>
1197+ </flwor::LetIterator>
1198+ <FunctionTraceIterator>
1199+ <FnSumDoubleIterator>
1200+ <flwor::FLWORIterator>
1201+ <ForVariable name="x">
1202+ <LetVarIterator varname="direction"/>
1203+ </ForVariable>
1204+ <ReturnClause>
1205+ <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1206+ <ForVarIterator varname="x"/>
1207+ <LetVarIterator varname="y">
1208+ <ForVarIterator varname="p"/>
1209+ </LetVarIterator>
1210+ </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1211+ </ReturnClause>
1212+ </flwor::FLWORIterator>
1213+ </FnSumDoubleIterator>
1214+ </FunctionTraceIterator>
1215+ </flwor::ForIterator>
1216 <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1217- <CastIterator type="xs:double">
1218- <FnDataIterator>
1219- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,offset)" typename="*" nill allowed="0">
1220- <ForVarIterator varname="plane"/>
1221- </AttributeAxisIterator>
1222- </FnDataIterator>
1223- </CastIterator>
1224- <SpecificNumArithIterator_DivideOperation_DOUBLE>
1225+ <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1226+ <ForVarIterator varname="beta"/>
1227+ <ForVarIterator varname="beta"/>
1228+ </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1229+ <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1230 <FunctionTraceIterator>
1231 <FnSumDoubleIterator>
1232 <flwor::FLWORIterator>
1233 <ForVariable name="x">
1234- <LetVarIterator varname="start"/>
1235+ <LetVarIterator varname="y"/>
1236 </ForVariable>
1237 <ReturnClause>
1238 <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1239 <ForVarIterator varname="x"/>
1240- <LetVarIterator varname="normal">
1241+ <LetVarIterator varname="y">
1242 <ForVarIterator varname="p"/>
1243 </LetVarIterator>
1244 </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1245@@ -1415,9 +1552,39 @@
1246 </flwor::FLWORIterator>
1247 </FnSumDoubleIterator>
1248 </FunctionTraceIterator>
1249- <ForVarIterator varname="denom"/>
1250- </SpecificNumArithIterator_DivideOperation_DOUBLE>
1251+ <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1252+ <LetVarIterator varname="radius"/>
1253+ <LetVarIterator varname="radius"/>
1254+ </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1255+ </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1256 </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1257+ </flwor::LetIterator>
1258+ <CompareIterator>
1259+ <LetVarIterator varname="descriminant"/>
1260+ <SingletonIterator value="xs:integer(0)"/>
1261+ </CompareIterator>
1262+ </flwor::WhereIterator>
1263+ <SqrtIterator>
1264+ <LetVarIterator varname="descriminant"/>
1265+ </SqrtIterator>
1266+ </flwor::LetIterator>
1267+ <SequencePointAccessIterator>
1268+ <flwor::FLWORIterator>
1269+ <ForVariable name="$$context-item">
1270+ <FnConcatIterator>
1271+ <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1272+ <OpDoubleUnaryIterator>
1273+ <ForVarIterator varname="beta"/>
1274+ </OpDoubleUnaryIterator>
1275+ <LetVarIterator varname="sqrt"/>
1276+ </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1277+ <SpecificNumArithIterator_AddOperation_DOUBLE>
1278+ <OpDoubleUnaryIterator>
1279+ <ForVarIterator varname="beta"/>
1280+ </OpDoubleUnaryIterator>
1281+ <LetVarIterator varname="sqrt"/>
1282+ </SpecificNumArithIterator_AddOperation_DOUBLE>
1283+ </FnConcatIterator>
1284 </ForVariable>
1285 <WhereClause>
1286 <TypedValueCompareIterator_DOUBLE>
1287@@ -1429,176 +1596,9 @@
1288 <ForVarIterator varname="$$context-item"/>
1289 </ReturnClause>
1290 </flwor::FLWORIterator>
1291- </ReturnClause>
1292-</flwor::FLWORIterator>
1293-
1294-Iterator tree for shapes:intersect-sphere:
1295-<flwor::FLWORIterator>
1296- <ForVariable name="sphere">
1297- <LetVarIterator varname="sphere"/>
1298- </ForVariable>
1299- <LetVariable name="radius" materialize="true">
1300- <CastIterator type="xs:double">
1301- <FnDataIterator>
1302- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,radius)" typename="*" nill allowed="0">
1303- <ForVarIterator varname="sphere"/>
1304- </AttributeAxisIterator>
1305- </FnDataIterator>
1306- </CastIterator>
1307- </LetVariable>
1308- <LetVariable name="y" materialize="true">
1309- <FunctionTraceIterator>
1310- <flwor::FLWORIterator>
1311- <LetVariable name="v2" materialize="true">
1312- <FunctionTraceIterator>
1313- <flwor::FLWORIterator>
1314- <ForVariable name="a">
1315- <TreatIterator quant="">
1316- <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,center)" typename="*" nill allowed="0">
1317- <ForVarIterator varname="sphere"/>
1318- </ChildAxisIterator>
1319- </TreatIterator>
1320- </ForVariable>
1321- <ReturnClause>
1322- <FnConcatIterator>
1323- <CastIterator type="xs:double">
1324- <FnDataIterator>
1325- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,x)" typename="*" nill allowed="0">
1326- <ForVarIterator varname="a"/>
1327- </AttributeAxisIterator>
1328- </FnDataIterator>
1329- </CastIterator>
1330- <CastIterator type="xs:double">
1331- <FnDataIterator>
1332- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,y)" typename="*" nill allowed="0">
1333- <ForVarIterator varname="a"/>
1334- </AttributeAxisIterator>
1335- </FnDataIterator>
1336- </CastIterator>
1337- <CastIterator type="xs:double">
1338- <FnDataIterator>
1339- <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,z)" typename="*" nill allowed="0">
1340- <ForVarIterator varname="a"/>
1341- </AttributeAxisIterator>
1342- </FnDataIterator>
1343- </CastIterator>
1344- </FnConcatIterator>
1345- </ReturnClause>
1346- </flwor::FLWORIterator>
1347- </FunctionTraceIterator>
1348- </LetVariable>
1349- <ForVariable name="x">
1350- <LetVarIterator varname="start"/>
1351- </ForVariable>
1352- <ReturnClause>
1353- <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1354- <ForVarIterator varname="x"/>
1355- <LetVarIterator varname="v2">
1356- <ForVarIterator varname="p"/>
1357- </LetVarIterator>
1358- </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1359- </ReturnClause>
1360- </flwor::FLWORIterator>
1361- </FunctionTraceIterator>
1362- </LetVariable>
1363- <ForVariable name="beta">
1364- <FunctionTraceIterator>
1365- <FnSumDoubleIterator>
1366- <flwor::FLWORIterator>
1367- <ForVariable name="x">
1368- <LetVarIterator varname="direction"/>
1369- </ForVariable>
1370- <ReturnClause>
1371- <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1372- <ForVarIterator varname="x"/>
1373- <LetVarIterator varname="y">
1374- <ForVarIterator varname="p"/>
1375- </LetVarIterator>
1376- </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1377- </ReturnClause>
1378- </flwor::FLWORIterator>
1379- </FnSumDoubleIterator>
1380- </FunctionTraceIterator>
1381- </ForVariable>
1382- <LetVariable name="descriminant" materialize="true">
1383- <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1384- <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1385- <ForVarIterator varname="beta"/>
1386- <ForVarIterator varname="beta"/>
1387- </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1388- <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1389- <FunctionTraceIterator>
1390- <FnSumDoubleIterator>
1391- <flwor::FLWORIterator>
1392- <ForVariable name="x">
1393- <LetVarIterator varname="y"/>
1394- </ForVariable>
1395- <ReturnClause>
1396- <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1397- <ForVarIterator varname="x"/>
1398- <LetVarIterator varname="y">
1399- <ForVarIterator varname="p"/>
1400- </LetVarIterator>
1401- </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1402- </ReturnClause>
1403- </flwor::FLWORIterator>
1404- </FnSumDoubleIterator>
1405- </FunctionTraceIterator>
1406- <SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1407- <LetVarIterator varname="radius"/>
1408- <LetVarIterator varname="radius"/>
1409- </SpecificNumArithIterator_MultiplyOperation_DOUBLE>
1410- </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1411- </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1412- </LetVariable>
1413- <WhereClause>
1414- <CompareIterator>
1415- <LetVarIterator varname="descriminant"/>
1416- <SingletonIterator value="xs:integer(0)"/>
1417- </CompareIterator>
1418- </WhereClause>
1419- <ReturnClause>
1420- <flwor::FLWORIterator>
1421- <LetVariable name="sqrt" materialize="true">
1422- <SqrtIterator>
1423- <LetVarIterator varname="descriminant"/>
1424- </SqrtIterator>
1425- </LetVariable>
1426- <ReturnClause>
1427- <SequencePointAccessIterator>
1428- <flwor::FLWORIterator>
1429- <ForVariable name="$$context-item">
1430- <FnConcatIterator>
1431- <SpecificNumArithIterator_SubtractOperation_DOUBLE>
1432- <OpDoubleUnaryIterator>
1433- <ForVarIterator varname="beta"/>
1434- </OpDoubleUnaryIterator>
1435- <LetVarIterator varname="sqrt"/>
1436- </SpecificNumArithIterator_SubtractOperation_DOUBLE>
1437- <SpecificNumArithIterator_AddOperation_DOUBLE>
1438- <OpDoubleUnaryIterator>
1439- <ForVarIterator varname="beta"/>
1440- </OpDoubleUnaryIterator>
1441- <LetVarIterator varname="sqrt"/>
1442- </SpecificNumArithIterator_AddOperation_DOUBLE>
1443- </FnConcatIterator>
1444- </ForVariable>
1445- <WhereClause>
1446- <TypedValueCompareIterator_DOUBLE>
1447- <ForVarIterator varname="$$context-item"/>
1448- <SingletonIterator value="xs:double(0)"/>
1449- </TypedValueCompareIterator_DOUBLE>
1450- </WhereClause>
1451- <ReturnClause>
1452- <ForVarIterator varname="$$context-item"/>
1453- </ReturnClause>
1454- </flwor::FLWORIterator>
1455- <SingletonIterator value="xs:integer(1)"/>
1456- </SequencePointAccessIterator>
1457- </ReturnClause>
1458- </flwor::FLWORIterator>
1459- </ReturnClause>
1460-</flwor::FLWORIterator>
1461+ <SingletonIterator value="xs:integer(1)"/>
1462+ </SequencePointAccessIterator>
1463+</flwor::TupleStreamIterator>
1464
1465 Iterator tree for shapes:normal:
1466 <flwor::FLWORIterator>

Subscribers

People subscribed via source and target branches