Update of /cvsroot/monetdb/pathfinder/compiler/algebra/map
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11514/algebra/map
Modified Files:
intro_proxy.c intro_thetajoin.c map_ori_names.c
map_unq_names.c
Log Message:
-- Replaced aggregate operators count, min, max, avg, sum, prod, seqty1,
and all in the algebra by a single aggregate operator ``aggr''
that can handle multiple aggregates. The aggregate entries
are of kind count, min, max, avg, sum, prod, seqty1, all, and dist.
-- Added new aggregate kind ``dist'' that allows to represent group by
columns that functionally depend on the partitioning criterion
in the result of the grouping aggregate.
-- Added rewrite that merges aggregates.
-- Added rewrite that removes superfluous aggregates.
-- Added rewrite that pushes a rank operator through an aggregate.
-- Extended the XML import to cope with the old
as well as the new representation of aggregates.
U intro_proxy.c
Index: intro_proxy.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/intro_proxy.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- intro_proxy.c 7 May 2009 14:23:38 -0000 1.49
+++ intro_proxy.c 12 Jun 2009 13:06:10 -0000 1.50
@@ -142,18 +142,11 @@
case la_bool_or:
case la_bool_not:
case la_to:
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- case la_count:
+ case la_aggr:
case la_rank:
case la_type:
case la_type_assert:
case la_cast:
- case la_seqty1:
- case la_all:
case la_doc_tbl:
case la_roots:
case la_dummy:
U intro_thetajoin.c
Index: intro_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/intro_thetajoin.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- intro_thetajoin.c 7 May 2009 14:23:43 -0000 1.28
+++ intro_thetajoin.c 12 Jun 2009 13:06:10 -0000 1.29
@@ -231,6 +231,7 @@
case la_side_effects:
/* a thetajoin cannot be pushed through
a side effect list operator */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -316,6 +317,7 @@
} break;
case la_pos_select:
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
break;
@@ -420,27 +422,11 @@
}
break;
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- case la_seqty1:
- case la_all:
- diff (BOOL_COLS(n), n->sem.aggr.res);
-
- if (in (LEFT_COLS(n), n->sem.aggr.res))
- union_ (LEFT_COLS(n), n->sem.aggr.col);
- if (in (RIGHT_COLS(n), n->sem.aggr.res))
- union_ (RIGHT_COLS(n), n->sem.aggr.col);
- diff (LEFT_COLS(n), n->sem.aggr.res);
- diff (RIGHT_COLS(n), n->sem.aggr.res);
-
- case la_count:
- /* keep partition columns for LEFT_COLS and RIGHT_COLS */
-
- /* BOOL_COLS can never occur as partitioning as there
- are no boolean partition criteria */
+ case la_aggr:
+ /* a theta-join cannot be pushed through an aggregate */
+ BOOL_COLS(n) = NULL;
+ LEFT_COLS(n) = NULL;
+ RIGHT_COLS(n) = NULL;
break;
case la_rownum:
@@ -558,6 +544,7 @@
case la_content:
/* FIXME: for now we assume that a theta-join
cannot be pushed through a constructor */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -565,6 +552,7 @@
case la_merge_adjacent:
/* FIXME: for now we assume that a theta-join
cannot be pushed through an element constructor */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -579,6 +567,7 @@
/* for the fragment information we do not need to introduce
column names as the thetajoin can never be moved along
its edges. */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -589,6 +578,7 @@
case la_trace_msg:
case la_trace_map:
/* a theta-join cannot be pushed through */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -599,6 +589,7 @@
case la_rec_fix:
/* FIXME: for now we assume that a theta-join
cannot be pushed through a recursion operator */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
@@ -613,6 +604,7 @@
case la_fun_frag_param:
/* FIXME: for now we assume that a theta-join
cannot be pushed through a function application */
+ BOOL_COLS(n) = NULL;
LEFT_COLS(n) = NULL;
RIGHT_COLS(n) = NULL;
break;
U map_ori_names.c
Index: map_ori_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_ori_names.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- map_ori_names.c 7 May 2009 14:23:47 -0000 1.44
+++ map_ori_names.c 12 Jun 2009 13:06:10 -0000 1.45
@@ -494,23 +494,44 @@
case la_to:
res = binary_op (PFla_to, p, map);
break;
+
+ case la_aggr:
+ {
+ PFla_op_t *left;
+ PFalg_aggr_t *aggr = PFmalloc (p->sem.aggr.count *
+ sizeof (PFalg_aggr_t));
+ PFalg_col_t col;
+ unsigned int count = 0;
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- res = aggr (p->kind, PROJ(LEFT, p),
- ONAME(p, p->sem.aggr.res),
- ONAME(p, p->sem.aggr.col),
- p->sem.aggr.part?ONAME(p, p->sem.aggr.part):col_NULL);
- break;
+ left = O(L(p));
- case la_count:
- res = count (PROJ(LEFT, p),
- ONAME(p, p->sem.aggr.res),
- p->sem.aggr.part?ONAME(p, p->sem.aggr.part):col_NULL);
- break;
+ for (unsigned int i = 0; i < left->schema.count; i++) {
+ col = left->schema.items[i].name;
+ for (unsigned int j = 0; j < p->sem.aggr.count; j++)
+ /* we may get multiple hits */
+ if (col == PFprop_ori_name_left (
+ p->prop,
+ p->sem.aggr.aggr[j].col)) {
+ aggr[count++] = PFalg_aggr (
+ p->sem.aggr.aggr[j].kind,
+ ONAME(p, p->sem.aggr.aggr[j].res),
+ col);
+ }
+ }
+ for (unsigned int j = 0; j < p->sem.aggr.count; j++)
+ if (p->sem.aggr.aggr[j].kind == alg_aggr_count)
+ aggr[count++] = PFalg_aggr (
+ p->sem.aggr.aggr[j].kind,
+ ONAME(p, p->sem.aggr.aggr[j].res),
+ col_NULL);
+
+ assert (count == p->sem.aggr.count);
+
+ res = aggr (left,
+ p->sem.aggr.part?ONAME(p, p->sem.aggr.part):col_NULL,
+ p->sem.aggr.count,
+ aggr);
+ } break;
case la_rownum:
case la_rowrank:
@@ -568,20 +589,6 @@
p->sem.type.ty);
break;
- case la_seqty1:
- res = seqty1 (PROJ(LEFT, p),
- ONAME(p, p->sem.aggr.res),
- ONAME(p, p->sem.aggr.col),
- p->sem.aggr.part?ONAME(p,
p->sem.aggr.part):col_NULL);
- break;
-
- case la_all:
- res = all (PROJ(LEFT, p),
- ONAME(p, p->sem.aggr.res),
- ONAME(p, p->sem.aggr.col),
- p->sem.aggr.part?ONAME(p, p->sem.aggr.part):col_NULL);
- break;
-
case la_step:
/* In case columns iter and item_in are identical columns
item_in and item_out cannot refer to the same original
U map_unq_names.c
Index: map_unq_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_unq_names.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- map_unq_names.c 7 May 2009 14:23:52 -0000 1.43
+++ map_unq_names.c 12 Jun 2009 13:06:11 -0000 1.44
@@ -483,23 +483,23 @@
res = binary_op (PFla_to, p, map);
break;
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- res = aggr (p->kind, U(L(p)),
- UNAME(p, p->sem.aggr.res),
- /* column col is stored only in child operator */
- UNAME(L(p), p->sem.aggr.col),
- p->sem.aggr.part?UNAME(p, p->sem.aggr.part):col_NULL);
- break;
+ case la_aggr:
+ {
+ PFalg_aggr_t *aggr = PFmalloc (p->sem.aggr.count *
+ sizeof (PFalg_aggr_t));
- case la_count:
- res = count (U(L(p)),
- UNAME(p, p->sem.aggr.res),
- p->sem.aggr.part?UNAME(p, p->sem.aggr.part):col_NULL);
- break;
+ for (unsigned int i = 0; i < p->sem.aggr.count; i++)
+ aggr[i] = PFalg_aggr (p->sem.aggr.aggr[i].kind,
+ UNAME(p, p->sem.aggr.aggr[i].res),
+ p->sem.aggr.aggr[i].col
+ ? UNAME(L(p), p->sem.aggr.aggr[i].col)
+ : col_NULL);
+
+ res = aggr (U(L(p)),
+ p->sem.aggr.part?UNAME(p, p->sem.aggr.part):col_NULL,
+ p->sem.aggr.count,
+ aggr);
+ } break;
case la_rownum:
case la_rowrank:
@@ -556,22 +556,6 @@
p->sem.type.ty);
break;
- case la_seqty1:
- res = seqty1 (U(L(p)),
- UNAME(p, p->sem.aggr.res),
- /* column col is stored only in child operator */
- UNAME(L(p), p->sem.aggr.col),
- p->sem.aggr.part?UNAME(p,
p->sem.aggr.part):col_NULL);
- break;
-
- case la_all:
- res = all (U(L(p)),
- UNAME(p, p->sem.aggr.res),
- /* column col is stored only in child operator */
- UNAME(L(p), p->sem.aggr.col),
- p->sem.aggr.part?UNAME(p, p->sem.aggr.part):col_NULL);
- break;
-
case la_step:
res = step (U(L(p)), U(R(p)),
p->sem.step.spec,
------------------------------------------------------------------------------
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