Merge lp:~zorba-coders/zorba/bug-1083006 into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11443
Merged at revision: 11444
Proposed branch: lp:~zorba-coders/zorba/bug-1083006
Merge into: lp:zorba
Diff against target: 82 lines (+23/-12)
2 files modified
ChangeLog (+1/-0)
src/runtime/sequences/sequences_impl.cpp (+22/-12)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1083006
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+162983@code.launchpad.net

Commit message

Fixed for large sequences.

Description of the change

Fixed for large sequences.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1083006-2013-05-08T14-22-44.359Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve.

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog

lp:~zorba-coders/zorba/bug-1083006 updated
11443. By Paul J. Lucas

Merge from trunk.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1083006-2013-05-08T20-49-43.652Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-05-08 20:14:47 +0000
3+++ ChangeLog 2013-05-08 20:43:36 +0000
4@@ -50,6 +50,7 @@
5 * Fixed bug #1102997 (Swapping referenced nodes)
6 * Fixed bug #1169908 (Zorba hangs with invalid utf-8 input)
7 * Fixed bug #1111487 (Swapping nodes that are in collections)
8+ * Fixed bug #1083006 (subsequence: large input values)
9 * Fixed bug #1123836 (overflows in date/time casts now return FODT0001 and
10 in durations return FODT0002)
11 * Fixed bug #1147518 (fn:round-half-to-even (at least 11 failures))
12
13=== modified file 'src/runtime/sequences/sequences_impl.cpp'
14--- src/runtime/sequences/sequences_impl.cpp 2013-05-03 14:12:53 +0000
15+++ src/runtime/sequences/sequences_impl.cpp 2013-05-08 20:43:36 +0000
16@@ -471,9 +471,8 @@
17
18 bool FnSubsequenceIterator::nextImpl(store::Item_t& result, PlanState& planState) const
19 {
20- store::Item_t startPosItem;
21+ store::Item_t item;
22 xs_long startPos;
23- store::Item_t lengthItem;
24 xs_double startPosDouble;
25 xs_double lengthDouble;
26
27@@ -482,8 +481,8 @@
28
29 state->theIsChildReset = false;
30
31- CONSUME(startPosItem, 1);
32- startPosDouble = startPosItem->getDoubleValue();
33+ CONSUME(item, 1);
34+ startPosDouble = item->getDoubleValue();
35
36 //If starting position is set to +INF return empty sequence
37 if (startPosDouble.isPosInf() || startPosDouble.isNaN())
38@@ -495,26 +494,37 @@
39
40 if (theChildren.size() == 3)
41 {
42- CONSUME(lengthItem, 2);
43- lengthDouble = lengthItem->getDoubleValue();
44- if (lengthDouble.isPosInf())
45- {
46- //if startPos is -INF and length is +INF return empty sequence because -INF + INF = NaN
47- if (startPosDouble.isNegInf())
48+ CONSUME(item, 2);
49+ lengthDouble = item->getDoubleValue();
50+ if ( lengthDouble.isPosInf() ) {
51+ if ( startPosDouble.isNegInf() ) {
52+ //
53+ // XQuery F&0 3.0 14.1.9: ... if $startingLoc is -INF and $length is
54+ // +INF, then fn:round($startingLoc) + fn:round($length) is NaN; since
55+ // position() lt NaN is always false, the result is an empty sequence.
56+ //
57 goto done;
58+ }
59
60 state->theRemaining = 1;
61 }
62 else
63+ {
64 state->theRemaining =
65 static_cast<xs_long>(lengthDouble.round().getNumber());
66+ if ( state->theRemaining < 0 && lengthDouble > 0 ) {
67+ // overflow happened
68+ state->theRemaining = numeric_limits<xs_long>::max();
69+ }
70+ }
71 }
72
73 if (startPos < 1)
74 {
75- if (theChildren.size() >= 3)
76+ if ( theChildren.size() == 3 &&
77+ state->theRemaining != numeric_limits<xs_long>::max() ) {
78 state->theRemaining += startPos - 1;
79-
80+ }
81 startPos = 0;
82 }
83

Subscribers

People subscribed via source and target branches