Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17421/algebra/opt
Modified Files:
opt_complex.c opt_reqval.c
Log Message:
-- Extended the required value property
to also infer for which columns
(1) we need the real values,
(2) the same value distribution only, or
(3) whether columns can be split into two columns.
-- Added optimization rules that get rid of rownum operators
(in opt_complex.c) and rowrank operators (in opt_reqval.c)
if they only have to produce the correct value distribution.
-- Fixed dot printing for the ref_tbl operator in logdebug.c.
-- Aligned the property printing in the physical algebra
(physdebug.c) with the one in the logical algebra.
Index: opt_reqval.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_reqval.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- opt_reqval.c 11 Jan 2008 10:46:58 -0000 1.11
+++ opt_reqval.c 11 Jan 2008 12:49:09 -0000 1.12
@@ -76,19 +76,19 @@
for (unsigned int i = 0; i < p->schema.count; i++) {
PFalg_att_t cur_att = p->schema.items[i].name;
- if (PFprop_reqval (p->prop, cur_att) &&
+ if (PFprop_req_bool_val (p->prop, cur_att) &&
PFprop_const (p->prop, cur_att) &&
(PFprop_const_val (p->prop, cur_att)).val.bln !=
- PFprop_reqval_val (p->prop, cur_att)) {
+ PFprop_req_bool_val_val (p->prop, cur_att)) {
/* create an empty table instead */
*p = *PFla_empty_tbl_ (p->schema);
return;
}
- if (PFprop_reqval (p->prop, cur_att)) {
+ if (PFprop_req_bool_val (p->prop, cur_att)) {
count++;
att = cur_att;
- val = PFprop_reqval_val (p->prop, cur_att);
+ val = PFprop_req_bool_val_val (p->prop, cur_att);
}
}
@@ -130,6 +130,12 @@
}
}
+ /* replace rowrank operators whose real values
+ are not needed by rank operators */
+ if (p->kind == la_rowrank &&
+ PFprop_req_distr_col (p->prop, p->sem.sort.res))
+ *p = *PFla_rank (L(p), p->sem.sort.res, p->sem.sort.sortby);
+
/* infer properties for children */
for (unsigned int i = 0; i < PFLA_OP_MAXCHILD && p->child[i]; i++)
opt_reqvals (p->child[i]);
Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- opt_complex.c 11 Jan 2008 10:46:57 -0000 1.35
+++ opt_complex.c 11 Jan 2008 12:49:09 -0000 1.36
@@ -1020,8 +1020,8 @@
select operators above comparisons whose required
value is true. */
case la_bool_and:
- if (PFprop_reqval (p->prop, p->sem.binary.res) &&
- PFprop_reqval_val (p->prop, p->sem.binary.res) &&
+ if (PFprop_req_bool_val (p->prop, p->sem.binary.res) &&
+ PFprop_req_bool_val_val (p->prop, p->sem.binary.res) &&
PFprop_set (p->prop)) {
*p = *PFla_attach (
PFla_select (
@@ -1034,6 +1034,38 @@
}
break;
+ case la_rownum:
+ /* Replace the rownumber operator by a projection
+ if only its order and value distribution (keys)
+ are required instead of its values. */
+ if (PFprop_req_distr_col (p->prop, p->sem.sort.res) &&
+ PFord_count (p->sem.sort.sortby) == 1 &&
+ PFord_order_dir_at (p->sem.sort.sortby, 0) == DIR_ASC &&
+ PFprop_key (p->prop,
+ PFord_order_col_at (p->sem.sort.sortby, 0))) {
+ /* create projection list */
+ PFalg_proj_t *proj_list = PFmalloc (p->schema.count *
+ sizeof (*(proj_list)));
+
+ /* copy the schema and replace the rownum result column
+ by its input */
+ for (unsigned int i = 0; i < p->schema.count; i++)
+ if (p->schema.items[i].name !=
+ p->sem.sort.res)
+ proj_list[i] = PFalg_proj (
+ p->schema.items[i].name,
+ p->schema.items[i].name);
+ else
+ proj_list[i] = PFalg_proj (
+ p->sem.sort.res,
+ PFord_order_col_at (
+ p->sem.sort.sortby,
+ 0));
+
+ *p = *PFla_project_ (L(p), p->schema.count, proj_list);
+ }
+ break;
+
case la_rank:
/* match the pattern rank - (project -) rank and
try to merge both rank operators if the nested
-------------------------------------------------------------------------
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