Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8404/algebra/opt
Modified Files:
Tag: XQuery_0-24
opt_complex.c
Log Message:
-- Add consistency check for a rewrite that merges adjacent twigs:
Only if the child twig provides for every iteration of the parent twig
a node we may merge the two twigs.
U opt_complex.c
Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.c,v
retrieving revision 1.45.2.2
retrieving revision 1.45.2.3
diff -u -d -r1.45.2.2 -r1.45.2.3
--- opt_complex.c 3 Jun 2008 11:53:40 -0000 1.45.2.2
+++ opt_complex.c 8 Jun 2008 16:50:48 -0000 1.45.2.3
@@ -1357,42 +1357,58 @@
}
break;
- case la_fcns:
- /**
- * match the following pattern
- * _ _ _ _ _
- * | \
- * content |
- * / \
- * frag_U attach |
- * / \ |
- * empty frag roots |
- * frag \ /
- * twig |
- * | _ _ _ _/
- *
- * and throw it away ( - - - )
- */
- if (L(p)->kind == la_content &&
- LR(p)->kind == la_attach &&
- LRL(p)->kind == la_roots &&
- LRLL(p)->kind == la_twig &&
- LL(p)->kind == la_frag_union &&
- LLL(p)->kind == la_empty_frag &&
- LLR(p)->kind == la_fragment &&
- LLRL(p) == LRLL(p) &&
- /* input columns match the output
- columns of the underlying twig */
- L(p)->sem.iter_pos_item.iter ==
- LRLL(p)->sem.iter_item.iter &&
- L(p)->sem.iter_pos_item.item ==
- LRLL(p)->sem.iter_item.item &&
- /* input twig is referenced only once */
- PFprop_refctr (LR(p)) == 1 &&
- PFprop_refctr (LRL(p)) == 1) {
- L(p) = L(LRLL(p));
+ case la_element:
+ {
+ PFla_op_t *fcns = R(p);
+
+ /* Traverse all children and try to merge more nodes into the twig
+ (as long as the input provides for every iteration a node). */
+ while (fcns->kind == la_fcns) {
+ /**
+ * match the following pattern
+ * _ _ _ _ _
+ * | \
+ * content |
+ * / \
+ * frag_U attach |
+ * / \ |
+ * empty frag roots |
+ * frag \ /
+ * twig |
+ * | _ _ _ _/
+ *
+ * and throw it away ( - - - )
+ */
+ if (L(fcns)->kind == la_content &&
+ /* Make sure that all iterations of the parent
+ are present (no subdomain relationship). */
+ PFprop_subdom (
+ p->prop,
+ PFprop_dom (p->prop,
+ p->sem.iter_item.iter),
+ PFprop_dom (L(fcns)->prop,
+ L(fcns)->sem.iter_pos_item.iter)) &&
+ LR(fcns)->kind == la_attach &&
+ LRL(fcns)->kind == la_roots &&
+ LRLL(fcns)->kind == la_twig &&
+ LL(fcns)->kind == la_frag_union &&
+ LLL(fcns)->kind == la_empty_frag &&
+ LLR(fcns)->kind == la_fragment &&
+ LLRL(fcns) == LRLL(fcns) &&
+ /* input columns match the output
+ columns of the underlying twig */
+ L(fcns)->sem.iter_pos_item.iter ==
+ LRLL(fcns)->sem.iter_item.iter &&
+ L(fcns)->sem.iter_pos_item.item ==
+ LRLL(fcns)->sem.iter_item.item &&
+ /* input twig is referenced only once */
+ PFprop_refctr (LR(fcns)) == 1 &&
+ PFprop_refctr (LRL(fcns)) == 1) {
+ L(fcns) = L(LRLL(fcns));
+ }
+ fcns = R(fcns);
}
- break;
+ } break;
case la_string_join:
if (PFprop_key_left (p->prop, p->sem.string_join.iter) &&
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins