Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5067/compiler/algebra
Modified Files:
Tag: M5XQ
planner.c
Log Message:
propagated changes of Wednesday May 20 2009
from the development trunk to the M5XQ branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/05/20 - tsheyar: compiler/algebra/planner.c,1.85
-- Renamed algebra/intro_rec_border.c into algebra/intro_borders.c.
-- Renamed include/intro_rec_border.h into include/intro_borders.h.
-- Extended the physical algebra with a dependent cross product operator
that only evaluates its right side if the left side produces at least
one row.
This change implicitely implements a control structure for some conditionals.
E.g., the following query conditionally evaluates the independent
expressions ('doc("xmark-sf0.001.xml")//*' and 'doc("xmark-sf100.xml")//*'):
if (1 = (1,2,3))
then doc("xmark-sf0.1.xml")//*
else doc("xmark-sf100.xml")//*
With the dependent cross product operator in place this leads to the
evaluation
of the (previously independent) then-branch and the avoidance of the
evaluation
of the (expensive) else-branch.
-- Adjusted stable output.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.83.2.1
retrieving revision 1.83.2.2
diff -u -d -r1.83.2.1 -r1.83.2.2
--- planner.c 7 May 2009 14:42:15 -0000 1.83.2.1
+++ planner.c 20 May 2009 16:28:24 -0000 1.83.2.2
@@ -347,6 +347,8 @@
plan_cross (const PFla_op_t *n)
{
PFplanlist_t *ret = new_planlist ();
+ bool l_indep = true,
+ r_indep = true;
assert (n); assert (n->kind == la_cross);
assert (L(n)); assert (L(n)->plans);
@@ -361,6 +363,31 @@
*(plan_t **) PFarray_at (L(n)->plans, r));
}
+ /* check if the output is independent of the left side */
+ for (unsigned int i = 0; i < L(n)->schema.count; i++)
+ l_indep &= !PFprop_icol (n->prop, L(n)->schema.items[i].name);
+ /* check if the output is independent of the right side */
+ for (unsigned int i = 0; i < R(n)->schema.count; i++)
+ r_indep &= !PFprop_icol (n->prop, R(n)->schema.items[i].name);
+
+ /* add plans with dependent cross products */
+ if (l_indep ||
+ L(n)->kind == la_distinct ||
+ L(n)->kind == la_rowid)
+ for (unsigned int l = 0; l < PFarray_last (L(n)->plans); l++)
+ for (unsigned int r = 0; r < PFarray_last (R(n)->plans); r++)
+ add_plan (ret,
+ dep_cross (*(plan_t **) PFarray_at (L(n)->plans, l),
+ *(plan_t **) PFarray_at (R(n)->plans,
r)));
+
+ if (r_indep ||
+ R(n)->kind == la_distinct ||
+ R(n)->kind == la_rowid)
+ for (unsigned int l = 0; l < PFarray_last (L(n)->plans); l++)
+ for (unsigned int r = 0; r < PFarray_last (R(n)->plans); r++)
+ add_plan (ret,
+ dep_cross (*(plan_t **) PFarray_at (R(n)->plans, r),
+ *(plan_t **) PFarray_at (L(n)->plans,
l)));
return ret;
}
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins