Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9890/compiler/algebra/opt
Modified Files:
Tag: XQFT
opt_complex.c
Log Message:
propagated changes of Wednesday Mar 17 2010 - Thursday Mar 18 2010
from the development trunk to the XQFT branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010/03/17 - tsheyar: compiler/algebra/opt/opt_complex.c,1.87
-- Introduced a new column-name-origin property that enhances the column names
in the DOT generated algebra plans. If a column stems from a ref_tbl or a
path step we now keep the original name throughout the plan.
(Use pf-option -fN to print the mapping of original names.)
-- Make property usage a little bit more defensive. Instead of !PFprop_icol
a new function PFprop_not_icol is introduced that copes correctly with
missing property information.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010/03/17 - tsheyar: compiler/algebra/opt/opt_complex.c,1.88
-- Make the rewrite combining aggregates a bit less restrictive.
-- Exploit more properties (fds) in numbering operator rewrites
to get rid of more order criteria.
-- Exploit key information to rewrite equi-joins referencing the same node.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.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
--- opt_complex.c 7 Jan 2010 15:51:33 -0000 1.83.2.1
+++ opt_complex.c 18 Mar 2010 10:34:53 -0000 1.83.2.2
@@ -121,11 +121,19 @@
if (p->kind != la_eqjoin) return NULL;
/* make sure that all columns depend on the join argument */
- for (i = 0; i < p->schema.count; i++)
+ for (i = 0; i < p->schema.count; i++) {
+ /* In case the column is not referenced we don't have to
+ test its fd relationship. In case there exist columns
+ that are not in the icols list they may be incorrectly
+ turned into distinct aggregates. Subsequent icols
+ optimization however deletes these aggregates. */
+ if (PFprop_not_icol (p->prop, p->schema.items[i].name))
+ continue;
if (!PFprop_fd (p->prop,
p->sem.eqjoin.col1,
p->schema.items[i].name))
return NULL;
+ }
/* make sure that the result may return the join argument
as a key column */
@@ -1100,13 +1108,33 @@
modified = true;
continue;
}
- /* otherwise keep former criterion */
- res = PFord_refine (res, cur, PFord_order_dir_at (sortby, i-1));
+
+ /* Check if the ranking list already describes the new order (as the
+ new criterion functionally depends on the last added entry). */
+ if (!(PFord_count (res) &&
+ PFord_order_dir_at (res, PFord_count (res) - 1) == DIR_ASC &&
+ PFord_order_dir_at (sortby, i-1) == DIR_ASC &&
+ PFprop_fd (p->prop,
+ PFord_order_col_at (res, PFord_count (res) - 1),
+ cur)))
+ /* otherwise keep former criterion */
+ res = PFord_refine (res, cur, PFord_order_dir_at (sortby, i-1));
}
- /* add last criterion */
- res = PFord_refine (res,
- PFord_order_col_at (sortby, PFord_count (sortby) - 1),
- PFord_order_dir_at (sortby, PFord_count (sortby) - 1));
+ /* Check if the ranking list already describes the new order (as the
+ last criterion functionally depends on the last added entry). */
+ if (PFord_count (res) &&
+ PFord_order_dir_at (res, PFord_count (res) - 1) == DIR_ASC &&
+ PFord_order_dir_at (sortby, PFord_count (sortby) - 1) == DIR_ASC &&
+ PFprop_fd (p->prop,
+ PFord_order_col_at (res, PFord_count (res) - 1),
+ PFord_order_col_at (sortby, PFord_count (sortby) - 1)))
+ modified = true;
+ else
+ /* add last criterion */
+ res = PFord_refine (
+ res,
+ PFord_order_col_at (sortby, PFord_count (sortby) - 1),
+ PFord_order_dir_at (sortby, PFord_count (sortby) - 1));
/* modify operator in case we have removed one or more order criteria */
if (modified) {
@@ -1469,7 +1497,8 @@
no new row combinations may be generated and the equi-join
thus only introduces (superfluous) duplicate rows. */
/* set ok as rewrite can only result in equal or less rows */
- if (PFprop_set (p->prop) &&
+ if ((PFprop_set (p->prop) ||
+ PFprop_key (p->prop, p->sem.eqjoin.col1)) &&
PFprop_subdom (
p->prop,
PFprop_dom_left (p->prop,
@@ -1839,7 +1868,7 @@
for (i = 0; i < p->schema.count; i++) {
proj2[i] = PFalg_proj (p->schema.items[i].name,
p->schema.items[i].name);
- if (!PFprop_icol (p->prop, p->schema.items[i].name)) {
+ if (PFprop_not_icol (p->prop, p->schema.items[i].name)) {
for (j = 0; j < p->schema.count; j++)
if (i != j &&
PFprop_icol (p->prop, p->schema.items[j].name)
&&
@@ -2237,7 +2266,7 @@
and ensure that the column generated by the nested
row number operator is not used above the outer rank. */
if (rank->kind == la_rank &&
- !PFprop_icol (p->prop, rank->sem.sort.res)) {
+ PFprop_not_icol (p->prop, rank->sem.sort.res)) {
PFord_ordering_t sortby;
PFalg_proj_t *proj_list;
@@ -2358,7 +2387,7 @@
elsewhere. */
for (j = 0; j < clsize (collist); j++)
if (clat (collist, j) == p->sem.rowid.res ||
- !PFprop_icol (p->prop, clat (collist, j)))
+ PFprop_not_icol (p->prop, clat (collist, j)))
break;
if (j == clsize (collist)) {
PFord_ordering_t sortby = PFordering ();
@@ -2466,7 +2495,7 @@
else if (R(p)->kind == la_rowid &&
p->sem.step.spec.axis == alg_chld &&
p->sem.step.iter == R(p)->sem.rowid.res &&
- !PFprop_icol (p->prop, p->sem.step.iter) &&
+ PFprop_not_icol (p->prop, p->sem.step.iter) &&
PFprop_key (p->prop, p->sem.step.item)) {
R(p) = PFla_attach (RL(p),
R(p)->sem.rowid.res,
@@ -2544,7 +2573,7 @@
p->sem.step.spec.kind != node_kind_node &&
p->sem.step.spec.kind != node_kind_doc)) &&
RL(p)->sem.step.spec.kind == node_kind_node &&
- !PFprop_icol (p->prop, p->sem.step.item) &&
+ PFprop_not_icol (p->prop, p->sem.step.item) &&
/* set ok as rewrite can only result in equal or less rows */
(PFprop_set (p->prop) ||
PFprop_ckey (p->prop, p->schema) ||
@@ -2617,7 +2646,7 @@
p->sem.step.spec.kind != node_kind_node &&
p->sem.step.spec.kind != node_kind_doc)) &&
R(p)->sem.step.spec.kind == node_kind_node &&
- !PFprop_icol (p->prop, p->sem.step.item) &&
+ PFprop_not_icol (p->prop, p->sem.step.item) &&
/* set ok as rewrite can only result in equal or less rows */
(PFprop_set (p->prop) ||
PFprop_ckey (p->prop, p->schema) ||
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins