Update of /cvsroot/monetdb/pathfinder/compiler/debug
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17421/debug
Modified Files:
logdebug.c physdebug.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: logdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/logdebug.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- logdebug.c 11 Jan 2008 10:47:01 -0000 1.85
+++ logdebug.c 11 Jan 2008 12:49:09 -0000 1.86
@@ -331,7 +331,7 @@
, [la_serialize_rel] = "#C0C0C0"
, [la_lit_tbl] = "#C0C0C0"
, [la_empty_tbl] = "#C0C0C0"
- , [la_ref_tbl ] = "#C0C0C0"
+ , [la_ref_tbl] = "#C0C0C0"
, [la_attach] = "#EEEEEE"
, [la_cross] = "#990000"
, [la_eqjoin] = "#00FF00"
@@ -475,19 +475,22 @@
PFarray_printf (dot, ")");
break;
- /*todo: implement me*/
case la_ref_tbl :
- /* list the attributes of this table */
- PFarray_printf (dot, "%s: (%s", a_id[n->kind],
- PFatt_str (n->schema.items[0].name));
-
- /*
- for (c = 1; c < n->schema.count;c++)
- PFarray_printf (dot, " | %s",
+ PFarray_printf (dot, "%s: ", a_id[n->kind]);
+ for (c = 0; c < n->schema.count;c++)
+ PFarray_printf (dot, "%s%s", c ? " | " : "(",
PFatt_str (n->schema.items[c].name));
-
+ PFarray_printf (dot, ")\\ncolumn name ");
+ for (c = 0; c < n->schema.count;c++)
+ PFarray_printf (dot, "%s%s", c ? " | " : "(",
+ *((char**) PFarray_at (n->sem.ref_tbl.tatts,
+ c)));
+ PFarray_printf (dot, ")\\ntype ");
+ for (c = 0; c < n->schema.count;c++)
+ PFarray_printf (dot, "%s%s", c ? " | " : "(",
+ PFalg_simple_type_str (
+ n->schema.items[c].type));
PFarray_printf (dot, ")");
- */
break;
case la_attach:
@@ -1022,15 +1025,56 @@
PFatt_str (keys.atts[i]));
}
if (*fmt == '+' || *fmt == 'V') {
+ bool fst;
+ fst = true;
/* list required value columns and their values */
- for (unsigned int pre = 0, i = 0; i < n->schema.count; i++) {
+ for (unsigned int i = 0; i < n->schema.count; i++) {
PFalg_att_t att = n->schema.items[i].name;
- if (PFprop_reqval (n->prop, att))
+ if (PFprop_req_bool_val (n->prop, att)) {
PFarray_printf (
dot,
- pre++ ? ", %s=%s " : "\\nreq. val: %s=%s ",
+ fst ? "\\nreq. val: %s=%s " : ", %s=%s ",
PFatt_str (att),
- PFprop_reqval_val (n->prop, att)?"true":"false");
+ PFprop_req_bool_val_val (n->prop, att)
+ ?"true":"false");
+ fst = false;
+ }
+ }
+ fst = true;
+ /* list distribution columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_distr_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\ndistr col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
+ }
+ fst = true;
+ /* list multi-col columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_multi_col_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\nmulti-col col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
+ }
+ fst = true;
+ /* list value columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_value_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\nvalue col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
}
}
if (*fmt == '+' || *fmt == 'D') {
@@ -1381,12 +1425,13 @@
/* list required value columns and their values */
for (unsigned int i = 0; i < n->schema.count; i++) {
PFalg_att_t att = n->schema.items[i].name;
- if (PFprop_reqval (n->prop, att))
+ if (PFprop_req_bool_val (n->prop, att))
PFarray_printf (
xml,
" <required attr=\"%s\" value=\"%s\"/>\n",
PFatt_str (att),
- PFprop_reqval_val (n->prop, att)?"true":"false");
+ PFprop_req_bool_val_val (n->prop, att)
+ ?"true":"false");
}
}
if (*fmt == '+' || *fmt == 'D') {
@@ -1405,7 +1450,8 @@
if (*fmt == '+' || *fmt == 'S') {
/* print whether columns do have to respect duplicates */
if (PFprop_set (n->prop))
- PFarray_printf (xml, " <duplicates
allowed=\"yes\"/>\n");
+ PFarray_printf (xml, " <duplicates"
+ " allowed=\"yes\"/>\n");
}
if (*fmt == '+') {
/* print the number of referenced columns */
@@ -1496,12 +1542,15 @@
/* todo: only print the properties here, if the
"general property output" is not enabled (e.g. via -f<format>)
- NB: the keys-property is an inherent information for the
la_ref_tbl-op
+ NB: the keys-property is an inherent information
+ for the la_ref_tbl-op
*/
PFarray_printf (xml, " <properties>\n");
PFarray_printf (xml, " <keys>\n");
/* list the keys of this table */
- for (unsigned int c = 0; c < PFarray_last (n->sem.ref_tbl.keys);
c++)
+ for (unsigned int c = 0;
+ c < PFarray_last (n->sem.ref_tbl.keys);
+ c++)
{
int keyPos = *((int*) PFarray_at (n->sem.ref_tbl.keys, c));
@@ -1510,7 +1559,8 @@
PFarray_printf (xml, " <key>\n");
PFarray_printf (xml,
- " <column name=\"%s\"
position=\"%i\"/>\n",
+ " <column name=\"%s\""
+ " position=\"%i\"/>\n",
PFatt_str(keyName),
1);
PFarray_printf (xml, " </key>\n");
@@ -1526,10 +1576,13 @@
for (c = 0; c < n->schema.count;c++)
{
PFarray_printf (xml,
- " <column name=\"%s\" tname=\"%s\"
type=\"%s\"/>\n",
- PFatt_str (n->schema.items[c].name),
- *((char**) PFarray_at (n->sem.ref_tbl.tatts,
c)),
- PFalg_simple_type_str
(n->schema.items[c].type));
+ " <column name=\"%s\""
+ " tname=\"%s\" type=\"%s\"/>\n",
+ PFatt_str (n->schema.items[c].name),
+ *((char**) PFarray_at (n->sem.ref_tbl.tatts,
+ c)),
+ PFalg_simple_type_str (
+ n->schema.items[c].type));
}
PFarray_printf (xml, " </table>\n");
PFarray_printf (xml, " </content>\n");
@@ -1641,8 +1694,9 @@
if (n->sem.pos_sel.part != att_NULL)
PFarray_printf (xml,
- " <column name=\"%s\"
function=\"partition\""
- " new=\"false\"/>\n",
+ " <column name=\"%s\""
+ " function=\"partition\""
+ " new=\"false\"/>\n",
PFatt_str (n->sem.pos_sel.part));
PFarray_printf (xml, " </content>\n");
@@ -1768,7 +1822,8 @@
if (n->sem.sort.part != att_NULL)
PFarray_printf (xml,
- " <column name=\"%s\"
function=\"partition\""
+ " <column name=\"%s\""
+ " function=\"partition\""
" new=\"false\"/>\n",
PFatt_str (n->sem.sort.part));
@@ -1884,8 +1939,10 @@
if (n->kind == la_step || n->kind == la_guide_step)
PFarray_printf (xml,
"/>\n"
- " <column name=\"%s\"
function=\"iter\"/>\n"
- " <column name=\"%s\"
function=\"item\"/>\n"
+ " <column name=\"%s\""
+ " function=\"iter\"/>\n"
+ " <column name=\"%s\""
+ " function=\"item\"/>\n"
" </content>\n",
PFatt_str (n->sem.step.iter),
PFatt_str (n->sem.step.item));
@@ -1893,7 +1950,8 @@
PFarray_printf (xml,
"/>\n"
" <column name=\"%s\" new=\"true\"/>\n"
- " <column name=\"%s\"
function=\"item\"/>\n"
+ " <column name=\"%s\""
+ " function=\"item\"/>\n"
" </content>\n",
PFatt_str (n->sem.step.item_res),
PFatt_str (n->sem.step.item));
@@ -1994,8 +2052,8 @@
" <column name=\"%s\" function=\"iter\"/>\n"
" <column name=\"%s\" function=\"qname item\""
"/>\n"
- " <column name=\"%s\" function=\"content
item\""
- "/>\n"
+ " <column name=\"%s\""
+ " function=\"content item\"/>\n"
" </content>\n",
PFatt_str (n->sem.iter_item1_item2.iter),
PFatt_str (n->sem.iter_item1_item2.item1),
@@ -2237,7 +2295,9 @@
PFarray_printf (xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
PFarray_printf (xml, "<logical_query_plan unique_names=\"%s\">\n",
- (PFalg_is_unq_name(root->schema.items[0].name) ?
"true" : "false"));
+ PFalg_is_unq_name (root->schema.items[0].name)
+ ? "true" : "false");
+
/* add domain subdomain relationships if required */
if (PFstate.format) {
char *fmt = PFstate.format;
Index: physdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/physdebug.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- physdebug.c 11 Jan 2008 10:47:01 -0000 1.48
+++ physdebug.c 11 Jan 2008 12:49:09 -0000 1.49
@@ -813,49 +813,104 @@
if (PFstate.format) {
char *fmt = PFstate.format;
+ /* format character '+' overwrites all others */
bool all = false;
+ while (*fmt) {
+ if (*fmt == '+') {
+ all = true;
+ break;
+ }
+ fmt++;
+ }
+ /* iterate over all format characters
+ if we haven't found a '+' character */
+ if (!all)
+ fmt = PFstate.format;
- while (*fmt) {
- if (*fmt == '+')
- {
- PFalg_attlist_t icols = PFprop_icols_to_attlist (n->prop);
- PFalg_attlist_t keys = PFprop_keys_to_attlist (n->prop);
-
- /* list costs if requested */
- PFarray_printf (dot, "\\ncost: %lu", n->cost);
-
+ while (*fmt) {
+ if (*fmt == '+' || *fmt == 'A') {
/* if present print cardinality */
if (PFprop_card (n->prop))
PFarray_printf (dot, "\\ncard: %i", PFprop_card (n->prop));
-
+ }
+ if (*fmt == '+' || *fmt == 'O') {
/* list attributes marked const */
for (unsigned int i = 0;
i < PFprop_const_count (n->prop); i++)
PFarray_printf (dot, i ? ", %s" : "\\nconst: %s",
PFatt_str (
PFprop_const_at (n->prop, i)));
+ }
+ if (*fmt == '+' || *fmt == 'I') {
+ PFalg_attlist_t icols = PFprop_icols_to_attlist (n->prop);
/* list icols attributes */
for (unsigned int i = 0; i < icols.count; i++)
PFarray_printf (dot, i ? ", %s" : "\\nicols: %s",
PFatt_str (icols.atts[i]));
+ }
+ if (*fmt == '+' || *fmt == 'K') {
+ PFalg_attlist_t keys = PFprop_keys_to_attlist (n->prop);
/* list keys attributes */
for (unsigned int i = 0; i < keys.count; i++)
PFarray_printf (dot, i ? ", %s" : "\\nkeys: %s",
PFatt_str (keys.atts[i]));
-
+ }
+ if (*fmt == '+' || *fmt == 'V') {
+ bool fst;
+ fst = true;
/* list required value columns and their values */
- for (unsigned int pre = 0, i = 0; i < n->schema.count; i++) {
+ for (unsigned int i = 0; i < n->schema.count; i++) {
PFalg_att_t att = n->schema.items[i].name;
- if (PFprop_reqval (n->prop, att))
+ if (PFprop_req_bool_val (n->prop, att)) {
PFarray_printf (
dot,
- pre++ ? ", %s=%s " : "\\nreq. val: %s=%s ",
+ fst ? "\\nreq. val: %s=%s " : ", %s=%s ",
PFatt_str (att),
- PFprop_reqval_val (n->prop, att)?"true":"false");
+ PFprop_req_bool_val_val (n->prop, att)
+ ?"true":"false");
+ fst = false;
+ }
}
-
+ fst = true;
+ /* list distribution columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_distr_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\ndistr col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
+ }
+ fst = true;
+ /* list multi-col columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_multi_col_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\nmulti-col col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
+ }
+ fst = true;
+ /* list value columns */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ if (PFprop_req_value_col (n->prop, att)) {
+ PFarray_printf (
+ dot,
+ fst ? "\\nvalue col: %s" : ", %s",
+ PFatt_str (att));
+ fst = false;
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == 'D') {
/* list attributes and their corresponding domains */
for (unsigned int i = 0; i < n->schema.count; i++)
if (PFprop_dom (n->prop, n->schema.items[i].name)) {
@@ -865,8 +920,131 @@
dot,
PFprop_dom (n->prop, n->schema.items[i].name));
}
+ }
+ if (*fmt == '+' || *fmt == '[') {
+ /* list attributes and their unique names */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t ori = n->schema.items[i].name;
+ PFalg_att_t unq = PFprop_unq_name (n->prop, ori);
+ if (unq) {
+ PFalg_att_t l_unq, r_unq;
+ PFarray_printf (
+ dot,
+ i ? " , %s=%s" : "\\nO->U names: %s=%s",
+ PFatt_str (ori), PFatt_str (unq));
- /* list orderings if requested */
+ l_unq = PFprop_unq_name_left (n->prop, ori);
+ r_unq = PFprop_unq_name_right (n->prop, ori);
+
+ if (l_unq && l_unq != unq && r_unq && r_unq != unq)
+ PFarray_printf (dot,
+ " [%s|%s]",
+ PFatt_str(l_unq),
+ PFatt_str(r_unq));
+ else if (l_unq && l_unq != unq)
+ PFarray_printf (dot, " [%s|", PFatt_str(l_unq));
+ else if (r_unq && r_unq != unq)
+ PFarray_printf (dot, " |%s]", PFatt_str(r_unq));
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == ']') {
+ /* list attributes and their original names */
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t unq = n->schema.items[i].name;
+ PFalg_att_t ori = PFprop_ori_name (n->prop, unq);
+ if (ori) {
+ PFalg_att_t l_ori, r_ori;
+ PFarray_printf (
+ dot,
+ i ? " , %s=%s" : "\\nU->O names: %s=%s",
+ PFatt_str (unq), PFatt_str (ori));
+
+ l_ori = PFprop_ori_name_left (n->prop, unq);
+ r_ori = PFprop_ori_name_right (n->prop, unq);
+
+ if (l_ori && l_ori != ori && r_ori && r_ori != ori)
+ PFarray_printf (dot,
+ " [%s|%s]",
+ PFatt_str(l_ori),
+ PFatt_str(r_ori));
+ else if (l_ori && l_ori != ori)
+ PFarray_printf (dot, " [%s|", PFatt_str(l_ori));
+ else if (r_ori && r_ori != ori)
+ PFarray_printf (dot, " |%s]", PFatt_str(r_ori));
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == 'S') {
+ /* print whether columns do have to respect duplicates */
+ if (PFprop_set (n->prop))
+ PFarray_printf (dot, "\\nset");
+ }
+ if (*fmt == '+' || *fmt == 'L') {
+ /* print columns that have a level information attached */
+ bool first = true;
+ for (unsigned int i = 0; i < n->schema.count; i++) {
+ PFalg_att_t att = n->schema.items[i].name;
+ int level = PFprop_level (n->prop, att);
+ if (level >= 0) {
+ PFarray_printf (
+ dot,
+ "%s %s=%i",
+ first ? "\\nlevel:" : ",",
+ PFatt_str (att),
+ level);
+ first = false;
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == 'U') {
+ PFguide_tree_t **guides;
+ PFalg_att_t att;
+ unsigned int i, j, count;
+ bool first = true;
+
+ for (i = 0; i < n->schema.count; i++) {
+ att = n->schema.items[i].name;
+ if (PFprop_guide (n->prop, att)) {
+
+ PFarray_printf (dot, "%s %s:",
+ first ? "\\nGUIDE:" : ",",
+ PFatt_str(att));
+ first = false;
+
+ /* print guides */
+ count = PFprop_guide_count (n->prop, att);
+ guides = PFprop_guide_elements (n->prop, att);
+ for (j = 0; j < count; j++)
+ PFarray_printf (dot, " %i", guides[j]->guide);
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == 'Y') {
+ if (PFprop_ckeys_count (n->prop)) {
+ PFalg_attlist_t list;
+ unsigned int i, j;
+ bool first = true;
+
+ PFarray_printf (dot, "\\ncomposite keys:");
+
+ for (i = 0; i < PFprop_ckeys_count (n->prop); i++) {
+ list = PFprop_ckey_at (n->prop, i);
+ first = true;
+ for (j = 0; j < list.count; j++) {
+ PFarray_printf (dot, "%s%s",
+ first ? "\\n<" : ", ",
+ PFatt_str(list.atts[j]));
+ first = false;
+ }
+ PFarray_printf (dot, ">");
+ }
+ }
+ }
+ if (*fmt == '+' || *fmt == 'c') {
+ PFarray_printf (dot, "\\ncost: %lu", n->cost);
+ }
+ if (*fmt == '+' || *fmt == 'o') {
PFarray_printf (dot, "\\norderings:");
for (unsigned int i = 0;
i < PFarray_last (n->orderings); i++)
@@ -875,34 +1053,13 @@
PFord_str (
*(PFord_ordering_t *)
PFarray_at (n->orderings,i)));
-
- all = true;
}
- fmt++;
- }
- fmt = PFstate.format;
- while (!all && *fmt) {
- switch (*fmt) {
-
- /* list costs if requested */
- case 'c':
- PFarray_printf (dot, "\\ncost: %lu", n->cost);
- break;
-
- /* list orderings if requested */
- case 'o':
- PFarray_printf (dot, "\\norderings:");
- for (unsigned int i = 0;
- i < PFarray_last (n->orderings); i++)
- PFarray_printf (
- dot, "\\n%s",
- PFord_str (
- *(PFord_ordering_t *)
- PFarray_at (n->orderings,i)));
- break;
- }
- fmt++;
+ /* stop after all properties have been printed */
+ if (*fmt == '+')
+ break;
+ else
+ fmt++;
}
}
-------------------------------------------------------------------------
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