Update of /cvsroot/monetdb/pathfinder/compiler/algebra/prop
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21252/algebra/prop
Modified Files:
prop_req_node.c
Log Message:
-- Added a new optimization phase that is based on the required node
properties (introduced some days ago):
o The optimization phase unnests constant constructors if neither
their order nor their ids are needed. The following query
for $a in 1 to 1000 return <a>42</a>
is rewritten (on the algebraic level) into something comparable to
let $foo := <a>42</a> return for $a in 1 to 1000 return $foo
A constant tree is thus created only once.
o A further optimization removes the merge adjacent text nodes
operator in case the nodes are never queried. This leads to
results that consist of (potentially) more text nodes than
allowed. The serialization however will hide that fact.
U prop_req_node.c
Index: prop_req_node.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_req_node.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- prop_req_node.c 3 Apr 2008 11:03:36 -0000 1.3
+++ prop_req_node.c 4 Apr 2008 09:45:17 -0000 1.4
@@ -195,6 +195,34 @@
}
/**
+ * @brief Test if the node ids of column @a attr are required.
+ */
+bool
+PFprop_node_id_required (const PFprop_t *prop, PFalg_att_t attr)
+{
+ req_node_t *map = find_map (prop->req_node_vals, attr);
+
+ if (!map)
+ return true;
+ else
+ return map->id;
+}
+
+/**
+ * @brief Test if the node order of column @a attr are required.
+ */
+bool
+PFprop_node_order_required (const PFprop_t *prop, PFalg_att_t attr)
+{
+ req_node_t *map = find_map (prop->req_node_vals, attr);
+
+ if (!map)
+ return true;
+ else
+ return map->order;
+}
+
+/**
* @brief Test if the subtree of column @a attr is queried.
*/
bool
@@ -739,11 +767,41 @@
}
case la_merge_adjacent:
- add_constr_map (n, n->sem.merge_adjacent.item_in);
+ {
+ PFarray_t *new_map = PFarray (sizeof (req_node_t), 3);
+
+ map = find_map (MAP_LIST(n), n->sem.merge_adjacent.iter_res);
+
+ /* inherit the properties of the iter column */
+ if (map) {
+ req_node_t map_item = *map;
+ map_item.col = n->sem.merge_adjacent.iter_in;
+ ADD(new_map, map_item);
+ }
+
+ map = find_map (MAP_LIST(n), n->sem.merge_adjacent.pos_res);
+
+ /* inherit the properties of the pos column */
+ if (map) {
+ req_node_t map_item = *map;
+ map_item.col = n->sem.merge_adjacent.pos_in;
+ ADD(new_map, map_item);
+ }
+
+ map = find_map (MAP_LIST(n), n->sem.merge_adjacent.item_res);
+ assert (map);
+
+ /* inherit the properties of the item column */
+ if (map) {
+ req_node_t map_item = *map;
+ map_item.col = n->sem.merge_adjacent.item_in;
+ assert (map_item.constr == true);
+ ADD(new_map, map_item);
+ }
prop_infer_req_node_vals (L(n), NULL); /* fragments */
- prop_infer_req_node_vals (R(n), MAP_LIST(n));
- return; /* only infer once */
+ prop_infer_req_node_vals (R(n), new_map);
+ } return; /* only infer once */
case la_roots:
case la_proxy:
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins