Update of /cvsroot/monetdb/pathfinder/compiler/algebra/map
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29987/algebra/map
Modified Files:
intro_proxy.c intro_thetajoin.c map_ori_names.c
map_unq_names.c resolve_proxy.c
Log Message:
-- Re-organized our set of numbering operators. We have now 4 different
operators with consistent semantics that cope with sorting and numbering:
- la_rownum behaves exactly like SQLs ROW_NUMBER. It is used to generate
position values.
- la_rowrank behaves exactly like SQLs DENSE_RANK. It is used to generate
the group by semantics of our functional source language. Up til now
we only need the unpartitioned variant. (In MIL it is implemented
using the sort extend.)
- la_rank -- beside one exception -- behaves like la_rowrank. It is also
implemented in our SQL compilation with a DENSE_RANK operation. la_rank's
important difference to la_rowrank is that its resulting values are used
solely for ordering. No operation should ever look at the generated
values.
While this difference is uninteresting in the resulting code it
simplifies
the algebraic optimizer a lot. Instead of repeatedly inferring a property
that checks for column usage we can optimize based on the operator kind.
- la_rowid generates unrepeatable unique numbers (as 'ROW_NUMBER() OVER ()'
does in SQL or 'mark()' does in MIL). It is used to generate a new key
column for mapping joins.
In comparison to the old version we introduced a new operator la_rowrank,
changed the semantic of la_rank from ROW_NUMBER to DENSE_RANK, and renamed
the formular la_number operator into la_rowid.
To implement positions in our Core to Algebra translation consistently we
now use only la_rownum (to generate real position values),
la_rank (to represent intermediate position order), and constant values
(to represent unordered sequences).
-- Introduced new SQL operator DENSE_RANK.
-- Splitted up the physical pa_number operator into the 3 operators:
pa_mark, pa_rank, and pa_mark_grp. The first and the last operator correspond
to the respective MIL primitives. The result column of pa_rank is generated
by the extend column of a CTrefine operation.
-- Added check for environment variable PF_DEBUG_PRINT_FRAG to disable the
fragment printing in the AT&T dot output of the logical algebra.
Index: intro_proxy.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/intro_proxy.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- intro_proxy.c 16 Oct 2007 15:46:42 -0000 1.29
+++ intro_proxy.c 6 Dec 2007 08:42:16 -0000 1.30
@@ -144,8 +144,8 @@
/**
*
* conflict resolving functions that are used by the
- * eqjoin - number proxy (kind=1) and the
- * semijoin - number - cross proxy
+ * eqjoin - rowid proxy (kind=1) and the
+ * semijoin - rowid - cross proxy
*
*/
@@ -418,7 +418,7 @@
/**
*
- * Functions specific to the semijoin - number - cross proxy
+ * Functions specific to the semijoin - rowid - cross proxy
* rewrite.
*
*/
@@ -452,7 +452,7 @@
rp = L(rp);
return ((lp->kind == la_distinct &&
- rp->kind == la_number &&
+ rp->kind == la_rowid &&
check_base(L(rp)) &&
L(p)->schema.count == 1 &&
lp->schema.count == 1 &&
@@ -465,10 +465,10 @@
PFprop_dom_right (p->prop,
p->sem.eqjoin.att2),
PFprop_dom (rp->prop,
- rp->sem.number.res)))
+ rp->sem.rowid.res)))
||
(rp->kind == la_distinct &&
- lp->kind == la_number &&
+ lp->kind == la_rowid &&
check_base(L(lp)) &&
R(p)->schema.count == 1 &&
rp->schema.count == 1 &&
@@ -481,18 +481,18 @@
PFprop_dom_left (p->prop,
p->sem.eqjoin.att1),
PFprop_dom (lp->prop,
- lp->sem.number.res))));
+ lp->sem.rowid.res))));
}
/**
- * semijoin_exit looks for the correct number operator.
+ * semijoin_exit looks for the correct rowid operator.
*/
static bool
semijoin_exit (PFla_op_t *p, PFla_op_t *entry)
{
PFla_op_t *lp, *rp;
- if (p->kind != la_number || !check_base (L(p)))
+ if (p->kind != la_rowid || !check_base (L(p)))
return false;
lp = L(entry);
@@ -548,7 +548,7 @@
PFprop_dom_right (p->prop,
p->sem.eqjoin.att2),
PFprop_dom (exit->prop,
- exit->sem.number.res)))
+ exit->sem.rowid.res)))
||
(PFprop_subdom (p->prop,
PFprop_dom_right (p->prop,
@@ -559,7 +559,7 @@
PFprop_dom_left (p->prop,
p->sem.eqjoin.att1),
PFprop_dom (exit->prop,
- exit->sem.number.res)))))
+ exit->sem.rowid.res)))))
cur_op = OP_JOIN;
else
cur_op = OP_NOJOIN;
@@ -610,18 +610,18 @@
* optional ones.
*
* The basic pattern (in (1)) consists of an equi-join (or a semi-join)
- * which has a number and a distinct argument. The pattern can be seen
+ * which has a rowid and a distinct argument. The pattern can be seen
* as some kind of semijoin. The distinct operator works on a single
- * column that is inferred from the column generated by the number operator.
- * Underneath the number operator a cross product is located.
- * The pattern is rewritten in such a way that the number operator # ends
+ * column that is inferred from the column generated by the rowid operator.
+ * Underneath the rowid operator a cross product is located.
+ * The pattern is rewritten in such a way that the rowid operator # ends
* up at the top of the DAG fragment. As input for the distinct operator we
- * use a combined key of two new number operators that reside in the cross
- * product arguments. An intermediate number + join operator pair maps the
+ * use a combined key of two new rowid operators that reside in the cross
+ * product arguments. An intermediate rowid + join operator pair maps the
* columns of #" and #"' such that the join pushdown optimization phase
* handles there correct integration in sub-DAG 1. The two equi-joins above
* map the columns of the cross product arguments to the pattern top and thus
- * replace the equi-join of (1). The number operator # and a final projection
+ * replace the equi-join of (1). The rowid operator # and a final projection
* that adjusts the required schema completes the new DAG.
* The optional projections in (1) pi_(left) and pi_(right) are both
* integrated into the new final projection pi_(entry) in (2)
@@ -663,14 +663,14 @@
*
* ( 1 ) ( 2 )
*
- * If the number operator # in (1) is referenced by another operator
+ * If the rowid operator # in (1) is referenced by another operator
* outside the proxy pattern we have to ensure the pattern in (3). The
* basic idea is to allow only references to # that don't require the
* exact cardinality but only use it for mapping the columns of sub-DAGs
* 2 and 3. (As a mapping equi-join was the only reference we observed
* the check is restricted to the pattern in (3).) In addition to the
* mapping of (1) -> (2) the reference to # in (3) is replaced by a
- * projection pi_(exit) that is connected to the new number operator #
+ * projection pi_(exit) that is connected to the new rowid operator #
* at the top of the new DAG.
*
*
@@ -726,7 +726,7 @@
PFalg_proj_t *exit_proj, *proxy_proj, *dist_proj, *left_proj,
*opt_base_proj = NULL;
PFla_op_t *lp, *rp, *lproject = NULL, *rproject = NULL,
- *num1, *num2, *number, *new_number, *lexit, *op;
+ *num1, *num2, *rowid, *new_rowid, *lexit, *op;
/* do not introduce proxy if some conflicts remain */
if (!(leaf_ref = join_resolve_conflicts (proxy_entry,
@@ -741,7 +741,7 @@
/* If the proxy exit is referenced from outside the proxy as well
and the references are NOT equi-joins we can not remove the
- number operator at the proxy exit and thus don't push up the
+ rowid operator at the proxy exit and thus don't push up the
cross product. Thus we would not benefit from a rewrite
and give up. */
if (leaf_ref == MULTIPLE &&
@@ -784,7 +784,7 @@
*/
/* name of the key column */
- num_col = proxy_exit->sem.number.res;
+ num_col = proxy_exit->sem.rowid.res;
exit_proj = PFmalloc (proxy_exit->schema.count * sizeof (PFalg_proj_t));
proxy_proj = PFmalloc (proxy_entry->schema.count * sizeof (PFalg_proj_t));
@@ -792,7 +792,7 @@
left_proj = PFmalloc (3 * sizeof (PFalg_proj_t));
/* Collect all the used column names and create the projection list
- that hides the new number columns inside the cross product for
+ that hides the new rowid columns inside the cross product for
all operators referencing the proxy exit. */
for (i = 0; i < proxy_exit->schema.count; i++) {
used_cols = used_cols | proxy_exit->schema.items[i].name;
@@ -817,7 +817,7 @@
renaming projections (rproject)) */
used_cols = used_cols | join_att2;
- /* Create 4 new column names for the two additional number operators
+ /* Create 4 new column names for the two additional rowid operators
and their backmapping equi-joins */
num_col1 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
used_cols = used_cols | num_col1;
@@ -828,7 +828,7 @@
num_col_alias2 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
used_cols = used_cols | num_col_alias2;
- /* Create a new alias for the mapping number operator if its
+ /* Create a new alias for the mapping rowid operator if its
name conflicts with the column name of the sub-DAG */
if (join_att2 == num_col) {
num_col_alias = PFalg_ori_name (
@@ -874,8 +874,8 @@
}
/* build the modified DAG */
- num1 = PFla_number (L(lexit), num_col1);
- num2 = PFla_number (R(lexit), num_col2);
+ num1 = PFla_rowid (L(lexit), num_col1);
+ num2 = PFla_rowid (R(lexit), num_col2);
if (lexit->kind == la_cross)
op = PFla_cross (num1, num2);
@@ -917,9 +917,9 @@
}
- number = PFla_number (op, num_col);
+ rowid = PFla_rowid (op, num_col);
- new_number = PFla_number (
+ new_rowid = PFla_rowid (
PFla_eqjoin (
num2,
PFla_eqjoin (
@@ -928,7 +928,7 @@
PFla_project_ (
PFla_eqjoin (
PFla_project_ (
- number,
+ rowid,
3, left_proj),
rp,
num_col_alias,
@@ -941,7 +941,7 @@
num_col);
*proxy_entry = *PFla_project_ (
- new_number,
+ new_rowid,
proxy_entry->schema.count,
proxy_proj);
@@ -953,7 +953,7 @@
the tuples pruned inside anyway. */
/* hide the two new columns num_col1 and num_col2 by
introducing the following projection */
- PFla_op_t *exit_op = PFla_project_ (number,
+ PFla_op_t *exit_op = PFla_project_ (rowid,
proxy_exit->schema.count,
exit_proj);
@@ -966,21 +966,21 @@
/* hide the two new columns num_col1 and num_col2 by
introducing the following projection */
- *proxy_exit = *PFla_project_ (new_number,
+ *proxy_exit = *PFla_project_ (new_rowid,
proxy_exit->schema.count,
exit_proj);
} else
/* hide the two new columns num_col1 and num_col2 by
introducing the following projection */
*proxy_exit = *PFla_project_ (
- number,
+ rowid,
proxy_exit->schema.count,
exit_proj);
/* add the new equi-joins to the list of already checked nodes */
- *(PFla_op_t **) PFarray_add (checked_nodes) = L(new_number);
- *(PFla_op_t **) PFarray_add (checked_nodes) = R(L(new_number));
- *(PFla_op_t **) PFarray_add (checked_nodes) = L(L(R(R(L(new_number)))));
+ *(PFla_op_t **) PFarray_add (checked_nodes) = L(new_rowid);
+ *(PFla_op_t **) PFarray_add (checked_nodes) = R(L(new_rowid));
+ *(PFla_op_t **) PFarray_add (checked_nodes) = L(L(R(R(L(new_rowid)))));
return true;
}
@@ -1026,7 +1026,7 @@
}
/**
- * proxy_nest_exit looks for the number operator that generated
+ * proxy_nest_exit looks for the rowid operator that generated
* the joins columns.
*/
static bool
@@ -1035,24 +1035,24 @@
PFla_op_t *cur;
dom_t att1_dom, att2_dom, super_dom;
- if (p->kind != la_number)
+ if (p->kind != la_rowid)
return false;
/* only unnest if the rewrite seems promising -- if a cross product
lies in wait for further optimization */
cur = p;
while (cur->kind == la_project ||
- cur->kind == la_number)
+ cur->kind == la_rowid)
cur = L(cur);
if (cur->kind != la_cross)
return false;
/* look up the newly generated domain and the join domains */
- super_dom = PFprop_dom (p->prop, p->sem.number.res);
+ super_dom = PFprop_dom (p->prop, p->sem.rowid.res);
att1_dom = PFprop_dom_left (entry->prop, entry->sem.eqjoin.att1);
att2_dom = PFprop_dom_right (entry->prop, entry->sem.eqjoin.att2);
- /* compare the equi-join and number domains on subdomain relationship */
+ /* compare the equi-join and rowid domains on subdomain relationship */
return PFprop_subdom (p->prop, att1_dom, super_dom) &&
PFprop_subdom (p->prop, att2_dom, super_dom);
}
@@ -1089,12 +1089,12 @@
* are allowed either).
*
* We replace the left branch by a projection (pi_(lower_left)) that
- * maps all columns available in the original number operator # through
+ * maps all columns available in the original rowid operator # through
* the new join into the new right branch of the upper join. Another
* projection (pi_(upper_right)) retrieves the original names except for
- * the number column -- the column generated by the new upper number
+ * the rowid column -- the column generated by the new upper rowid
* operator is used here -- and replaces the references to the original
- * number operator # in the original left branch.
+ * rowid operator # in the original left branch.
*
* The projection pi_(upper_left) transports the results of the original
* right branch to the top of the plan where the projection pi_(top)
@@ -1182,7 +1182,7 @@
and vice versa.
A side-effect is the list of exit references
of the left branch. It will be later used to replace
- the number operator. (We thus do not need the
+ the rowid operator. (We thus do not need the
list of exit references for both branches.) */
left_exit_refs = PFarray (sizeof (PFla_op_t *));
(void) exit_refs;
@@ -1226,7 +1226,7 @@
/* Generate the upper left projection and create a list
of used variables. This list is then used to avoid
- naming conflicts at the lower join and the above number
+ naming conflicts at the lower join and the above rowid
operator. */
used_cols = proxy_entry->sem.eqjoin.att1;
@@ -1241,9 +1241,9 @@
}
/* Generate a new column name that will hold the values of the
- new upper number operator... */
+ new upper rowid operator... */
new_num_col = PFalg_ori_name (
- PFalg_unq_name (proxy_exit->sem.number.res, 0),
+ PFalg_unq_name (proxy_exit->sem.rowid.res, 0),
~used_cols);
used_cols = used_cols | new_num_col;
@@ -1253,9 +1253,9 @@
upper_left_proj[R(proxy_entry)->schema.count] = PFalg_proj (new_num_col,
new_num_col);
- /* generate the top projection. It prunes the number columns
+ /* generate the top projection. It prunes the rowid columns
of the upper join and adds a new column holding the content
- of the original number column. */
+ of the original rowid column. */
for (i = 0; i < proxy_entry->schema.count; i++)
if (proxy_entry->sem.eqjoin.att1 !=
proxy_entry->schema.items[i].name)
@@ -1273,7 +1273,7 @@
for (i = 0; i < proxy_exit->schema.count; i++) {
cur_col = proxy_exit->schema.items[i].name;
- if (cur_col != proxy_exit->sem.number.res) {
+ if (cur_col != proxy_exit->sem.rowid.res) {
new_col = PFalg_ori_name (PFalg_unq_name (cur_col, 0), ~used_cols);
used_cols = used_cols | new_col;
@@ -1289,7 +1289,7 @@
/* create the new lower join containing only
the originally right branch */
- new_num = PFla_number (
+ new_num = PFla_rowid (
PFla_eqjoin (
PFla_project_ (
proxy_exit,
@@ -1382,7 +1382,7 @@
{
PFalg_att_t join_att;
PFla_op_t *cur,
- *number = NULL,
+ *rowid = NULL,
*step = NULL;
if (p->kind != la_eqjoin)
@@ -1401,9 +1401,9 @@
cur = L(cur);
}
- if (cur->kind == la_number &&
- cur->sem.number.res == join_att)
- number = cur;
+ if (cur->kind == la_rowid &&
+ cur->sem.rowid.res == join_att)
+ rowid = cur;
else if ((cur->kind == la_step || cur->kind == la_guide_step) &&
cur->sem.step.iter == join_att) {
cur = R(cur);
@@ -1418,8 +1418,8 @@
cur = L(cur);
}
- if (cur->kind == la_number &&
- cur->sem.number.res == join_att)
+ if (cur->kind == la_rowid &&
+ cur->sem.rowid.res == join_att)
step = cur;
} else
return false;
@@ -1437,10 +1437,10 @@
cur = L(cur);
}
- if (cur->kind == la_number &&
- cur->sem.number.res == join_att &&
- !number)
- number = cur;
+ if (cur->kind == la_rowid &&
+ cur->sem.rowid.res == join_att &&
+ !rowid)
+ rowid = cur;
else if ((cur->kind == la_step || cur->kind == la_guide_step) &&
cur->sem.step.iter == join_att &&
!step) {
@@ -1456,29 +1456,29 @@
cur = L(cur);
}
- if (cur->kind == la_number &&
- cur->sem.number.res == join_att)
+ if (cur->kind == la_rowid &&
+ cur->sem.rowid.res == join_att)
step = cur;
} else
return false;
- return step && step == number;
+ return step && step == rowid;
}
/**
* step_join_exit just tests whether the previously detected
- * number operator matches the current one.
+ * rowid operator matches the current one.
*/
static bool
step_join_exit (PFla_op_t *p, PFla_op_t *entry)
{
PFla_op_t *cur;
- if (p->kind != la_number)
+ if (p->kind != la_rowid)
return false;
cur = L(entry);
- while (cur && cur->kind != la_number) {
+ while (cur && cur->kind != la_rowid) {
switch (cur->kind) {
case la_project:
cur = L(cur);
@@ -1694,7 +1694,7 @@
/**
*
* Functions specific to the kind=1 proxy generation.
- * (eqjoin - number delimited)
+ * (eqjoin - rowid delimited)
*
*/
@@ -1742,7 +1742,7 @@
}
/**
- * join_exit looks for the number or rownum operator that generated
+ * join_exit looks for the rowid or rownum operator that generated
* the joins columns.
*/
static bool
@@ -1750,15 +1750,15 @@
{
dom_t entry_dom, dom;
- if (p->kind != la_rownum && p->kind != la_number)
+ if (p->kind != la_rownum && p->kind != la_rowid)
return false;
/* only allow key columns and look up the newly generated domain */
if (p->kind == la_rownum) {
- if (p->sem.rownum.part) return false;
- dom = PFprop_dom (p->prop, p->sem.rownum.res);
+ if (p->sem.sort.part) return false;
+ dom = PFprop_dom (p->prop, p->sem.sort.res);
} else {
- dom = PFprop_dom (p->prop, p->sem.number.res);
+ dom = PFprop_dom (p->prop, p->sem.rowid.res);
}
/* look up the super domain of the two join attributes */
@@ -1772,7 +1772,7 @@
else
entry_dom = PFprop_dom_left (entry->prop, entry->sem.eqjoin.att1);
- /* compare the equi-join and rownum/number domains
+ /* compare the equi-join and rownum/rowid domains
on equality */
return PFprop_subdom (p->prop, dom, entry_dom) &&
PFprop_subdom (p->prop, entry_dom, dom);
@@ -1783,18 +1783,18 @@
* rewriting large parts of the sub-DAG t1 we build a set of operators
* around it (see Figure (2)).
*
- * The number operator at the base of the fragment stays
+ * The rowid operator at the base of the fragment stays
* outside of the proxy pattern to correctly cope with references from
* outside of the new proxy. All references are linked to the new
- * projection pi_(exit). A new number operator (#_(new_num_col))
+ * projection pi_(exit). A new rowid operator (#_(new_num_col))
* introduces a new numbering that is only used for mapping inside the
* proxy. (It flows trough t1 as the projection pi_(exit) replaces
- * the number column num_col with the new one.) The projection pi_(left)
+ * the rowid column num_col with the new one.) The projection pi_(left)
* maps the 'old' num_col with a new equi-join and the projection pi_(entry)
* maps all columns to names of the base. The rational behind this decision
* is to make the proxy an 'operator' that only generates new columns (and
* possibly removes some), but does not rename a column. The projection
- * pi_(proxy) removes the intermediate new number columns (new_num_col
+ * pi_(proxy) removes the intermediate new rowid columns (new_num_col
* and its join alias). The proxy operator stores a reference to its base
* in its semantical field (see dotted lines in (2)) and a projection
* above replaces the old proxy entry and maps the column to its original
@@ -1900,7 +1900,7 @@
PFprop_infer_unq_names (root);
/* short-hand for the key column name */
- num_col = proxy_exit->sem.number.res;
+ num_col = proxy_exit->sem.rowid.res;
/* Skip the first entry of the exit_proj projection list
(-- it will be filled in after collecting all the used column
@@ -1911,7 +1911,7 @@
/* collect the list of differing column names at the base
of the proxy, all the used column names and create a projection
list that reconstructs the schema of the proxy base except for
- the number column. */
+ the rowid column. */
for (i = 0; i < proxy_exit->schema.count; i++) {
PFalg_att_t exit_col = proxy_exit->schema.items[i].name;
used_cols = used_cols | exit_col;
@@ -1936,18 +1936,18 @@
assert (proxy_exit->schema.count == count);
/* Generate a new column name that will hold the values of the
- new nested number operator... */
+ new nested rowid operator... */
new_num_col = PFalg_ori_name (
PFalg_unq_name (num_col, 0),
~used_cols);
used_cols = used_cols | new_num_col;
- /* ... and replace the number column by the column generated
- by the new nested number operator */
+ /* ... and replace the rowid column by the column generated
+ by the new nested rowid operator */
exit_proj[0] = PFalg_proj (num_col, new_num_col);
/* In addition create two names for mapping the old as well
- as the new number operators... */
+ as the new rowid operators... */
new_num_col_alias = PFalg_ori_name (
PFalg_unq_name (num_col, 0),
~used_cols);
@@ -2076,17 +2076,17 @@
}
/* Create a proxy base with a projection that removes duplicate
- columns on top of the proxy exit. (If this number operator
+ columns on top of the proxy exit. (If this rowid operator
is not referenced above it will be removed by a following icol
optimization phase.) */
base_op = PFla_proxy_base (
PFla_project_ (proxy_exit,
base_count,
base_proj));
- /* Create a new number operator which will replace the old key column
+ /* Create a new rowid operator which will replace the old key column
and will be used for the mapping of the old key column as well. */
- num_op = PFla_number (base_op, new_num_col);
- /* Create a projection that replaces the old by the new number column. */
+ num_op = PFla_rowid (base_op, new_num_col);
+ /* Create a projection that replaces the old by the new rowid column. */
exit_op = PFla_project_ (num_op, proxy_exit->schema.count, exit_proj);
/* Link the projection to all operators inside the proxy body which
@@ -2151,7 +2151,7 @@
/* 'num_col' only works because the entry projection
renames all columns to the column at the proxy
exit (based on the unmodified DAG). Thus it
- names the join column back to the old number
+ names the join column back to the old rowid
operator as it didn't know the new name during
the inference. */
num_col),
@@ -2253,7 +2253,7 @@
p = L(proxy->sem.proxy.base1);
while (p->kind == la_project ||
- p->kind == la_number ||
+ p->kind == la_rowid ||
p->kind == la_proxy_base)
p = L(p);
@@ -2463,14 +2463,14 @@
* iter information).
* If the conditions are all fulfilled we can rewrite our pattern from
* (1) to (2):
- * - We remove the number operators of both proxies and replace them
- * by a common number operator (plus additional projections to map
+ * - We remove the rowid operators of both proxies and replace them
+ * by a common rowid operator (plus additional projections to map
* the column names correctly).
* All columns referenced in proxy1 that are not required are linked
* to a dummy column to avoid dangling references -- these columns
* will be pruned by following icols optimization phase.
* - The result of both proxies is joined based on the values generated
- * in the common number operator. Again projections ensure the correct
+ * in the common rowid operator. Again projections ensure the correct
* column name mapping.
* As the optional operators between the original first and original
* second proxy (...) may have some spare columns (the required columns
@@ -2679,12 +2679,12 @@
- /* Get the number operators of the two proxies */
+ /* Get the rowid operators of the two proxies */
proxy1_num = L(L(L(L(proxy1))));
proxy2_num = L(L(L(L(proxy2))));
- assert (proxy1_num->kind == la_number &&
- proxy2_num->kind == la_number);
+ assert (proxy1_num->kind == la_rowid &&
+ proxy2_num->kind == la_rowid);
top_proj = PFmalloc (proxy1->schema.count *
sizeof (PFalg_proj_t));
@@ -2717,10 +2717,10 @@
num_col2 = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
/* used_cols = used_cols | num_col2; */
- /* create overall number operator */
- num_op = PFla_number (L(proxy2_base), num_col1);
+ /* create overall rowid operator */
+ num_op = PFla_rowid (L(proxy2_base), num_col1);
- /* create projection that replaces the number operator of the
+ /* create projection that replaces the rowid operator of the
'upper' proxy pattern */
assert (L(proxy1_num) = proxy1_base);
for (i = 0; i < proxy1_base->schema.count; i++) {
@@ -2734,24 +2734,24 @@
if (j == req_count)
base1_proj[i] = PFalg_proj (cur_col, num_col1);
}
- base1_proj[i] = PFalg_proj (proxy1_num->sem.number.res, num_col1);
+ base1_proj[i] = PFalg_proj (proxy1_num->sem.rowid.res, num_col1);
- /* replace the number operator */
+ /* replace the rowid operator */
*proxy1_num = *PFla_project_ (num_op,
proxy1_num->schema.count,
base1_proj);
- /* create projection that replaces the number operator of the
+ /* create projection that replaces the rowid operator of the
'lower' proxy pattern */
assert (L(proxy2_num) = proxy2_base);
for (i = 0; i < proxy2_base->schema.count; i++) {
cur_col = proxy2_base->schema.items[i].name;
base2_proj[i] = PFalg_proj (cur_col, cur_col);
}
- base2_proj[i] = PFalg_proj (proxy2_num->sem.number.res, num_col1);
+ base2_proj[i] = PFalg_proj (proxy2_num->sem.rowid.res, num_col1);
- /* replace the number operator */
+ /* replace the rowid operator */
*proxy2_num = *PFla_project_ (num_op,
proxy2_num->schema.count,
base2_proj);
@@ -3080,7 +3080,7 @@
remove_semijoin_operators (root);
/* find proxies and rewrite them in one go.
- They are based on semi-join - number/rownum pairs */
+ They are based on semi-join - rowid/rownum pairs */
if (intro_proxy_kind (root,
join_prepare,
semijoin_entry,
@@ -3121,7 +3121,7 @@
the list of checked nodes */
PFarray_last (checked_nodes) = 0;
- /* generate proxies consisting of equi-join - number/rownum pairs */
+ /* generate proxies consisting of equi-join - rowid/rownum pairs */
if (!intro_proxy_kind (root,
join_prepare,
join_entry,
@@ -3133,7 +3133,7 @@
/* As we match different nodes the current list is of no importance */
PFarray_last (checked_nodes) = 0;
- /* We require the superfluous number operators to be pruned. */
+ /* We require the superfluous rowid operators to be pruned. */
PFalgopt_icol (root);
#if 0
Index: intro_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/intro_thetajoin.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- intro_thetajoin.c 7 Nov 2007 22:00:44 -0000 1.8
+++ intro_thetajoin.c 6 Dec 2007 08:42:17 -0000 1.9
@@ -151,9 +151,9 @@
RIGHT_COLS(n) = intersect_ocol (RIGHT_COLS(n), n->schema);
/* If both the left side and the right side of a comparison
- reference the same column in a number operator
+ reference the same column in a rowid operator
we have (hopefully) reached our goal. */
- if (n->kind == la_number &&
+ if (n->kind == la_rowid &&
LEFT_COLS(n) && RIGHT_COLS(n) &&
((LEFT_COLS(n) & RIGHT_COLS(n)) == LEFT_COLS(n) ||
(LEFT_COLS(n) & RIGHT_COLS(n)) == RIGHT_COLS(n)))
@@ -354,66 +354,44 @@
break;
case la_rownum:
- if (LEFT_COLS(n) & n->sem.rownum.res) {
- LEFT_COLS(n) = diff (LEFT_COLS(n), n->sem.rownum.res);
+ case la_rowrank:
+ case la_rank:
+ if (LEFT_COLS(n) & n->sem.sort.res) {
+ LEFT_COLS(n) = diff (LEFT_COLS(n), n->sem.sort.res);
for (unsigned int i = 0;
- i < PFord_count (n->sem.rownum.sortby);
+ i < PFord_count (n->sem.sort.sortby);
i++)
LEFT_COLS(n) = union_ (LEFT_COLS(n),
PFord_order_col_at (
- n->sem.rownum.sortby, i));
+ n->sem.sort.sortby, i));
/* only infer part if available */
- if (n->sem.rownum.part != att_NULL)
+ if (n->sem.sort.part != att_NULL)
LEFT_COLS(n) = union_ (LEFT_COLS(n),
- n->sem.rownum.part);
+ n->sem.sort.part);
}
- if (RIGHT_COLS(n) & n->sem.rownum.res) {
- RIGHT_COLS(n) = diff (RIGHT_COLS(n), n->sem.rownum.res);
+ if (RIGHT_COLS(n) & n->sem.sort.res) {
+ RIGHT_COLS(n) = diff (RIGHT_COLS(n), n->sem.sort.res);
for (unsigned int i = 0;
- i < PFord_count (n->sem.rownum.sortby);
+ i < PFord_count (n->sem.sort.sortby);
i++)
RIGHT_COLS(n) = union_ (RIGHT_COLS(n),
PFord_order_col_at (
- n->sem.rownum.sortby, i));
+ n->sem.sort.sortby, i));
/* only infer part if available */
- if (n->sem.rownum.part != att_NULL)
- RIGHT_COLS(n) = union_ (RIGHT_COLS(n),
- n->sem.rownum.part);
- }
- break;
-
- case la_rank:
- if (LEFT_COLS(n) & n->sem.rank.res) {
- LEFT_COLS(n) = diff (LEFT_COLS(n), n->sem.rank.res);
-
- for (unsigned int i = 0;
- i < PFord_count (n->sem.rank.sortby);
- i++)
- LEFT_COLS(n) = union_ (LEFT_COLS(n),
- PFord_order_col_at (
- n->sem.rank.sortby, i));
- }
-
- if (RIGHT_COLS(n) & n->sem.rank.res) {
- RIGHT_COLS(n) = diff (RIGHT_COLS(n), n->sem.rank.res);
-
- for (unsigned int i = 0;
- i < PFord_count (n->sem.rank.sortby);
- i++)
+ if (n->sem.sort.part != att_NULL)
RIGHT_COLS(n) = union_ (RIGHT_COLS(n),
- PFord_order_col_at (
- n->sem.rank.sortby, i));
+ n->sem.sort.part);
}
break;
- case la_number:
- LEFT_COLS(n) = diff (LEFT_COLS(n), n->sem.number.res);
- RIGHT_COLS(n) = diff (RIGHT_COLS(n), n->sem.number.res);
+ case la_rowid:
+ LEFT_COLS(n) = diff (LEFT_COLS(n), n->sem.rowid.res);
+ RIGHT_COLS(n) = diff (RIGHT_COLS(n), n->sem.rowid.res);
break;
case la_type:
Index: map_ori_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_ori_names.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- map_ori_names.c 7 Nov 2007 22:00:44 -0000 1.21
+++ map_ori_names.c 6 Dec 2007 08:42:18 -0000 1.22
@@ -510,47 +510,39 @@
break;
case la_rownum:
- {
- PFord_ordering_t sortby = PFordering ();
-
- for (unsigned int i = 0;
- i < PFord_count (p->sem.rownum.sortby);
- i++)
- sortby = PFord_refine (
- sortby,
- ONAME(p, PFord_order_col_at (
- p->sem.rownum.sortby, i)),
- PFord_order_dir_at (
- p->sem.rownum.sortby, i));
-
- res = rownum (SEC_PROJ(LEFT, p, p->sem.rownum.res),
- ONAME(p, p->sem.rownum.res),
- sortby,
- ONAME(p, p->sem.rownum.part));
- } break;
-
+ case la_rowrank:
case la_rank:
{
PFord_ordering_t sortby = PFordering ();
for (unsigned int i = 0;
- i < PFord_count (p->sem.rank.sortby);
+ i < PFord_count (p->sem.sort.sortby);
i++)
sortby = PFord_refine (
sortby,
ONAME(p, PFord_order_col_at (
- p->sem.rank.sortby, i)),
+ p->sem.sort.sortby, i)),
PFord_order_dir_at (
- p->sem.rank.sortby, i));
+ p->sem.sort.sortby, i));
- res = rank (SEC_PROJ(LEFT, p, p->sem.rank.res),
- ONAME(p, p->sem.rank.res),
- sortby);
+ if (p->kind == la_rownum)
+ res = rownum (SEC_PROJ(LEFT, p, p->sem.sort.res),
+ ONAME(p, p->sem.sort.res),
+ sortby,
+ ONAME(p, p->sem.sort.part));
+ else if (p->kind == la_rowrank)
+ res = rowrank (SEC_PROJ(LEFT, p, p->sem.sort.res),
+ ONAME(p, p->sem.sort.res),
+ sortby);
+ else if (p->kind == la_rank)
+ res = rank (SEC_PROJ(LEFT, p, p->sem.sort.res),
+ ONAME(p, p->sem.sort.res),
+ sortby);
} break;
- case la_number:
- res = number (SEC_PROJ(LEFT, p, p->sem.number.res),
- ONAME(p, p->sem.number.res));
+ case la_rowid:
+ res = rowid (SEC_PROJ(LEFT, p, p->sem.rowid.res),
+ ONAME(p, p->sem.rowid.res));
break;
case la_type:
Index: map_unq_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_unq_names.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- map_unq_names.c 7 Nov 2007 22:00:44 -0000 1.20
+++ map_unq_names.c 6 Dec 2007 08:42:18 -0000 1.21
@@ -522,47 +522,38 @@
break;
case la_rownum:
- {
- PFord_ordering_t sortby = PFordering ();
-
- for (unsigned int i = 0;
- i < PFord_count (p->sem.rownum.sortby);
- i++)
- sortby = PFord_refine (
- sortby,
- UNAME(p, PFord_order_col_at (
- p->sem.rownum.sortby, i)),
- PFord_order_dir_at (
- p->sem.rownum.sortby, i));
-
- res = rownum (U(L(p)),
- UNAME(p, p->sem.rownum.res),
- sortby,
- UNAME(p, p->sem.rownum.part));
- } break;
-
+ case la_rowrank:
case la_rank:
{
PFord_ordering_t sortby = PFordering ();
for (unsigned int i = 0;
- i < PFord_count (p->sem.rank.sortby);
+ i < PFord_count (p->sem.sort.sortby);
i++)
sortby = PFord_refine (
sortby,
UNAME(p, PFord_order_col_at (
- p->sem.rank.sortby, i)),
+ p->sem.sort.sortby, i)),
PFord_order_dir_at (
- p->sem.rank.sortby, i));
+ p->sem.sort.sortby, i));
- res = rank (U(L(p)),
- UNAME(p, p->sem.rank.res),
- sortby);
+ if (p->kind == la_rownum)
+ res = rownum (U(L(p)),
+ UNAME(p, p->sem.sort.res),
+ sortby,
+ UNAME(p, p->sem.sort.part));
+ else if (p->kind == la_rowrank)
+ res = rowrank (U(L(p)),
+ UNAME(p, p->sem.sort.res),
+ sortby);
+ else if (p->kind == la_rank)
+ res = rank (U(L(p)),
+ UNAME(p, p->sem.sort.res),
+ sortby);
} break;
- case la_number:
- res = number (U(L(p)),
- UNAME(p, p->sem.number.res));
+ case la_rowid:
+ res = rowid (U(L(p)), UNAME(p, p->sem.rowid.res));
break;
case la_type:
Index: resolve_proxy.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/resolve_proxy.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- resolve_proxy.c 16 Oct 2007 15:46:43 -0000 1.8
+++ resolve_proxy.c 6 Dec 2007 08:42:19 -0000 1.9
@@ -85,7 +85,7 @@
#
*/
if (p->kind == la_step_join || p->kind == la_guide_step_join) {
- PFla_op_t *number, *step;
+ PFla_op_t *rowid, *step;
PFalg_att_t used_cols = 0,
join_att1,
join_att2,
@@ -106,8 +106,8 @@
used_cols = used_cols | join_att1;
join_att2 = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
- /* Generate a new number operator. */
- number = PFla_number (R(p), join_att2);
+ /* Generate a new rowid operator. */
+ rowid = PFla_rowid (R(p), join_att2);
/* Generate the pattern sketched above. The projection
underneath the path step operator renames the
@@ -116,7 +116,7 @@
step = PFla_step (
L(p),
PFla_project (
- number,
+ rowid,
PFalg_proj (join_att1, join_att2),
PFalg_proj (p->sem.step.item_res,
p->sem.step.item)),
@@ -130,7 +130,7 @@
step = PFla_guide_step (
L(p),
PFla_project (
- number,
+ rowid,
PFalg_proj (join_att1, join_att2),
PFalg_proj (p->sem.step.item_res,
p->sem.step.item)),
@@ -146,7 +146,7 @@
*p = *PFla_project_ (
PFla_eqjoin (
step,
- number,
+ rowid,
join_att1,
join_att2),
p->schema.count,
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins