Update of /cvsroot/monetdb/pathfinder/runtime
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6545
Modified Files:
ll_upwards.mx
Log Message:
issue 2683759: parent may not return a sorted sequence
this is simply a consequence of the algorithm, which generates the
parents in the order of their context sequence
e.g. <a x="1"><a x="2"><b x="3"/></a><b x="4"/></a>//a/../@x
has context sequence (<b x="3"/>,<b x="4"/>) and generates ("2","1")
U ll_upwards.mx
Index: ll_upwards.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/ll_upwards.mx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- ll_upwards.mx 8 Jan 2009 16:54:18 -0000 1.32
+++ ll_upwards.mx 16 Apr 2009 11:09:37 -0000 1.33
@@ -133,6 +133,7 @@
if (pos >= result_size) break; /* SANITY */
iter_stack[depth-1][idx] = parent;
+ if (iter_parent > parent) tail_sorted = 0;
result_pre[pos] = (iter_parent == parent)?oid_nil:parent; /* nils are
later filtered out */
result_iter[pos] = iter;
@@ -181,6 +182,7 @@
oid pre = root;
oid cur = 0;
int depth = 0;
+ int tail_sorted = 2;
*stack++ = oid_nil; /* bogus parent, filtered out later */
(void) bounds_t;
@@ -241,7 +243,7 @@
pre = stack[--depth];
}
}
- return (cur == context_size);
+ return (cur == context_size) + tail_sorted;
}
@c
@@ -308,6 +310,7 @@
int status = GDK_FAIL;
BAT *bn = NULL;
oid *context_result_pre, *context_result_iter;
+ int tail_sorted = 1;
if (!ALIGNsynced(iter_bat,ctx_bat)) {
GDKerror("%s: iter and context bat should be in sync.\n", axis);
@@ -463,15 +466,14 @@
bn = BATnew(TYPE_oid, TYPE_oid, n);
if (bn) {
- if (ll_upwards_parent(
- context_result_iter = (oid*) Hloc(bn, BUNfirst(bn)),
- context_result_pre = (oid*) Tloc(bn, BUNfirst(bn)),
- n,
- bounds, NULL, iter_stack+1,
- pre_size, pre_level,
- BATcount(size_bat),
- min_iter, context, n))
- {
+ int r = ll_upwards_parent(
+ context_result_iter = (oid*) Hloc(bn,
BUNfirst(bn)),
+ context_result_pre = (oid*) Tloc(bn,
BUNfirst(bn)),
+ n, bounds, NULL, iter_stack+1,
+ pre_size, pre_level,
+ BATcount(size_bat),
+ min_iter, context, n);
+ if (r) {
/* filter out duplicates and non-existing fragment roots
(represented by oid_nils) */
for(m=i=0; i<n; i++) {
oid pre = context_result_pre[i];
@@ -483,7 +485,8 @@
status = GDK_SUCCEED;
/* for each context node, parent gives back 1 or 0 results
*/
- if (iter_bat->tkey) BATkey(bn, TRUE);
+ if (iter_bat->tkey) BATkey(bn, TRUE);
+ tail_sorted = r >> 1;
} else {
GDKerror("%s: illegal data in size column or context
list.\n", axis);
}
@@ -571,7 +574,7 @@
}
bn->tsorted = 0;
if (niters == 1) {
- bn->tsorted = GDK_SORTED;
+ bn->tsorted = tail_sorted;
BATkey(BATmirror(bn), 1);
}
*ret = bn;
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins