Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7084/compiler/algebra
Modified Files:
Tag: xrpcdemo
algebra.c algopt.c builtins.c core2alg.brg logical.c planner.c
properties.c
Log Message:
propagated changes of Saturday May 31 2008 - Monday Jun 02 2008
from the XQuery_0-24 branch to the xrpcdemo branch
U core2alg.brg
Index: core2alg.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/core2alg.brg,v
retrieving revision 1.71
retrieving revision 1.71.4.1
diff -u -d -r1.71 -r1.71.4.1
--- core2alg.brg 21 May 2008 11:03:43 -0000 1.71
+++ core2alg.brg 2 Jun 2008 20:54:10 -0000 1.71.4.1
@@ -287,8 +287,6 @@
/** mnemonic algebra constructors */
#include "logical_mnemonic.h"
-#define RANK_DUMMY 42
-
struct map_rel_info_t {
PFla_op_t *map; /* map relation */
unsigned int count; /* attribute counter of the map relation */
@@ -2834,12 +2832,8 @@
res_rec_param = rec_param (
rec_arg (
- attach (seed,
- att_pos,
- lit_int (RANK_DUMMY)),
- attach (res_body,
- att_pos,
- lit_int (RANK_DUMMY)),
+ rowid (seed, att_pos),
+ rowid (res_body, att_pos),
base
),
nil ());
@@ -3087,7 +3081,7 @@
.frag = p.frag };
else
return (struct PFla_pair_t) {
- .rel = attach (step, att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (step, att_pos),
.frag = p.frag };
}
U algopt.c
Index: algopt.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algopt.c,v
retrieving revision 1.35.4.1
retrieving revision 1.35.4.2
diff -u -d -r1.35.4.1 -r1.35.4.2
--- algopt.c 28 May 2008 20:53:25 -0000 1.35.4.1
+++ algopt.c 2 Jun 2008 20:54:08 -0000 1.35.4.2
@@ -45,6 +45,7 @@
#include "algebra_cse.h"
#include "la_proxy.h"
#include "la_thetajoin.h"
+#include "mem.h" /* for PFstrdup() */
#define MAP_ORI_NAMES(phase) \
if (unq_names) { \
@@ -56,6 +57,19 @@
\
root = PFmap_ori_names (root); \
\
+ /* in case we could not map back the plan \
+ we take the one before mapping to unique names */ \
+ if (!root) { \
+ assert (last_ori_col_plan); \
+ root = last_ori_col_plan; \
+ /* generate warning that some phases have been ignored */ \
+ *opt_args = '\0'; \
+ PFinfo (OOPS_WARNING, \
+ "could not make use of " \
+ "the following optimizations: %s]", \
+ first_unq_arg); \
+ } \
+ \
tm = PFtimer_stop (tm); \
\
if (timing) \
@@ -97,6 +111,17 @@
bool unq_names = false;
bool proxies_involved = false;
+ /* Here we add a fallback solution for query plans where we cannot
+ map back from unique names to bit encoded (ori) names. While
+ we still use some bit-encoded column names in the code this
+ work-around will avoid failing queries --- their performance
+ however might be 'suboptimal'. */
+ PFla_op_t *last_ori_col_plan = NULL;
+ char *first_unq_arg = NULL;
+ /* get a local copy of the optimization arguments to
+ safely apply side-effects (changing the string) */
+ opt_args = PFstrdup (opt_args);
+
if (PFalg_is_unq_name(root->schema.items[0].name))
{
root = PFmap_ori_names (root);
@@ -389,6 +414,11 @@
tm = PFtimer_start ();
+ /* save the original plan in case
+ we are not able to map back */
+ last_ori_col_plan = root;
+ first_unq_arg = opt_args;
+
root = PFmap_unq_names (root);
tm = PFtimer_stop (tm);
@@ -411,6 +441,19 @@
root = PFmap_ori_names (root);
+ /* in case we could not map back the plan
+ we take the one before mapping to unique names */
+ if (!root) {
+ assert (last_ori_col_plan);
+ root = last_ori_col_plan;
+ /* generate warning that some phases have been ignored */
+ *opt_args = '\0';
+ PFinfo (OOPS_WARNING,
+ "could not make use of "
+ "the following optimizations: %s]",
+ first_unq_arg);
+ }
+
tm = PFtimer_stop (tm);
if (timing)
PFlog (" map to original attribute names: %s",
@@ -458,6 +501,7 @@
break;
}
opt_args++;
+ assert (root);
}
if (debug_opt)
fputc ('\n', stderr);
U algebra.c
Index: algebra.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra.c,v
retrieving revision 1.84.4.1
retrieving revision 1.84.4.2
diff -u -d -r1.84.4.1 -r1.84.4.2
--- algebra.c 28 May 2008 20:53:24 -0000 1.84.4.1
+++ algebra.c 2 Jun 2008 20:54:07 -0000 1.84.4.2
@@ -1099,7 +1099,7 @@
case alg_fun_fn_round: return "fn:round";
case alg_fun_fn_concat: return "fn:concat";
case alg_fun_fn_substring: return "fn:substring";
- case alg_fun_fn_substring_dbl: return "fn:substring";
+ case alg_fun_fn_substring_dbl: return "fn:substring3";
case alg_fun_fn_string_length: return "fn:string-length";
case alg_fun_fn_normalize_space: return "fn:normalize-space";
case alg_fun_fn_upper_case: return "fn:upper-case";
U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.62.4.2
retrieving revision 1.62.4.3
diff -u -d -r1.62.4.2 -r1.62.4.3
--- planner.c 31 May 2008 08:47:08 -0000 1.62.4.2
+++ planner.c 2 Jun 2008 20:54:12 -0000 1.62.4.3
@@ -561,6 +561,7 @@
assert (L(n)->schema.count == 1);
assert (LL(n)->sem.thetajoin.count == 2);
assert (LL(n)->sem.thetajoin.pred[0].comp == alg_comp_eq);
+ assert (LL(n)->sem.thetajoin.pred[1].comp != alg_comp_ne);
assert (L(n)->sem.proj.items[0].old ==
LL(n)->sem.thetajoin.pred[0].left ||
L(n)->sem.proj.items[0].old ==
@@ -630,8 +631,10 @@
static PFplanlist_t *
plan_unique_thetajoin (const PFla_op_t *n)
{
- PFplanlist_t *ret = new_planlist ();
- PFalg_att_t ldist, rdist;
+ PFplanlist_t *ret = new_planlist (),
+ *lsorted = new_planlist (),
+ *rsorted = new_planlist ();
+ PFalg_att_t ldist, rdist;
PFalg_simple_type_t cur_type;
@@ -668,8 +671,23 @@
cur_type & aat_node)
return ret;
- for (unsigned int l = 0; l < PFarray_last (L(LL(n))->plans); l++)
- for (unsigned int r = 0; r < PFarray_last (R(LL(n))->plans); r++) {
+ /* make sure the left input is sorted by the left sort criterion */
+ for (unsigned int i = 0; i < PFarray_last (L(LL(n))->plans); i++)
+ add_plans (lsorted,
+ ensure_ordering (
+ *(plan_t **) PFarray_at (L(LL(n))->plans, i),
+ sortby (ldist)));
+
+ /* make sure the right input is sorted by the right sort criterion */
+ for (unsigned int i = 0; i < PFarray_last (R(LL(n))->plans); i++)
+ add_plans (rsorted,
+ ensure_ordering (
+ *(plan_t **) PFarray_at (R(LL(n))->plans, i),
+ sortby (rdist)));
+
+ /* combine each plan in R with each plan in S */
+ for (unsigned int l = 0; l < PFarray_last (lsorted); l++)
+ for (unsigned int r = 0; r < PFarray_last (rsorted); r++) {
add_plan (ret,
/* add the renaming projection afterwards */
project (
@@ -683,8 +701,8 @@
LL(n)->sem.thetajoin.pred[0].right,
ldist,
rdist,
- *(plan_t **) PFarray_at (L(LL(n))->plans, l),
- *(plan_t **) PFarray_at (R(LL(n))->plans, r)),
+ *(plan_t **) PFarray_at (lsorted, l),
+ *(plan_t **) PFarray_at (rsorted, r)),
2,
L(n)->sem.proj.items));
@@ -703,8 +721,8 @@
LL(n)->sem.thetajoin.pred[0].left,
rdist,
ldist,
- *(plan_t **) PFarray_at (R(LL(n))->plans, r),
- *(plan_t **) PFarray_at (L(LL(n))->plans,
l)),
+ *(plan_t **) PFarray_at (rsorted, r),
+ *(plan_t **) PFarray_at (lsorted, l)),
2,
L(n)->sem.proj.items));
}
@@ -3146,6 +3164,7 @@
if (n->schema.count == 1 &&
LL(n)->sem.thetajoin.count == 2 &&
LL(n)->sem.thetajoin.pred[0].comp == alg_comp_eq &&
+ LL(n)->sem.thetajoin.pred[1].comp != alg_comp_ne &&
(L(n)->sem.proj.items[0].old ==
LL(n)->sem.thetajoin.pred[0].left ||
L(n)->sem.proj.items[0].old ==
U properties.c
Index: properties.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/properties.c,v
retrieving revision 1.38
retrieving revision 1.38.4.1
diff -u -d -r1.38 -r1.38.4.1
--- properties.c 8 May 2008 20:13:21 -0000 1.38
+++ properties.c 2 Jun 2008 20:54:13 -0000 1.38.4.1
@@ -161,7 +161,7 @@
if (ocols)
PFprop_infer_ocol (root);
if (ori_names)
- PFprop_infer_ori_names (root);
+ (void) PFprop_infer_ori_names (root);
if (refctr)
PFprop_infer_refctr (root);
}
U logical.c
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.98.4.1
retrieving revision 1.98.4.2
diff -u -d -r1.98.4.1 -r1.98.4.2
--- logical.c 28 May 2008 20:53:26 -0000 1.98.4.1
+++ logical.c 2 Jun 2008 20:54:11 -0000 1.98.4.2
@@ -2368,11 +2368,18 @@
{
if (pos)
assert_ty = n->schema.items[i].type & ty;
- else
+ else {
/* the restricted type assert_ty is the original
type without type ty */
assert_ty = n->schema.items[i].type -
(n->schema.items[i].type & ty);
+ /* make sure that all node type bits are retained */
+ if (assert_ty & aat_nkind)
+ assert_ty = assert_ty | aat_pre | aat_frag;
+ /* make sure that all attr type bits are retained */
+ if (assert_ty & aat_attr)
+ assert_ty = assert_ty | aat_pre | aat_frag;
+ }
break;
}
U builtins.c
Index: builtins.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/builtins.c,v
retrieving revision 1.95.4.1
retrieving revision 1.95.4.2
diff -u -d -r1.95.4.1 -r1.95.4.2
--- builtins.c 27 May 2008 21:25:46 -0000 1.95.4.1
+++ builtins.c 2 Jun 2008 20:54:08 -0000 1.95.4.2
@@ -50,8 +50,6 @@
#include "logical.h"
#include "logical_mnemonic.h"
-#define RANK_DUMMY 42
-
/**
* Assign correct row numbers in case we need the real values.
*/
@@ -2959,12 +2957,12 @@
(void) loop; (void) ordering;
return (struct PFla_pair_t) {
- .rel = attach (
+ .rel = rowid (
distinct (
project (args[0].rel,
proj (att_iter, att_iter),
proj (att_item, att_item))),
- att_pos, lit_nat (RANK_DUMMY)),
+ att_pos),
.frag = args[0].frag };
}
@@ -3221,11 +3219,11 @@
* project away pos column
*/
return (struct PFla_pair_t) {
- .rel = attach (
+ .rel = rowid (
project (args[0].rel,
proj (att_iter, att_iter),
proj (att_item, att_item)),
- att_pos, lit_nat (RANK_DUMMY)),
+ att_pos),
.frag = args[0].frag };
}
@@ -3323,7 +3321,7 @@
.frag = PFla_set_union (args[0].frag, args[1].frag) };
else
return (struct PFla_pair_t) {
- .rel = attach (distinct, att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (distinct, att_pos),
.frag = PFla_set_union (args[0].frag, args[1].frag) };
}
@@ -3359,7 +3357,7 @@
.frag = PFla_set_union (args[0].frag, args[1].frag) };
else
return (struct PFla_pair_t) {
- .rel = attach (distinct, att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (distinct, att_pos),
.frag = PFla_set_union (args[0].frag, args[1].frag) };
}
@@ -3398,7 +3396,7 @@
.frag = args[0].frag };
else
return (struct PFla_pair_t) {
- .rel = attach (difference, att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (difference, att_pos),
/* result nodes can only originate from first argument */
.frag = args[0].frag };
}
@@ -3792,7 +3790,7 @@
.frag = args[1].frag };
else
return (struct PFla_pair_t) {
- .rel = attach (distinct (op), att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (distinct (op), att_pos),
.frag = args[1].frag };
}
@@ -3954,7 +3952,7 @@
.frag = args[0].frag };
else
return (struct PFla_pair_t) {
- .rel = attach (distinct, att_pos, lit_nat (RANK_DUMMY)),
+ .rel = rowid (distinct, att_pos),
.frag = args[0].frag };
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins