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

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug-945241
Merge into: lp:zorba
Diff against target: 195 lines (+88/-23)
5 files modified
ChangeLog (+1/-0)
src/runtime/collections/collections_impl.cpp (+11/-5)
test/unit/module1.xq (+1/-1)
test/unit/module2.xq (+11/-0)
test/unit/staticcollectionmanager.cpp (+64/-17)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-945241
Reviewer Review Type Date Requested Status
Till Westmann Pending
Matthias Brantner Pending
Review via email: mp+95704@code.launchpad.net

This proposal supersedes a proposal from 2012-03-02.

This proposal has been superseded by a proposal from 2012-03-07.

Commit message

fix bug #945241 (StaticCollectionManager::declaredIndexes() and temporary indexes)

Description of the change

StaticCollectionManager::declaredIndexes() doesn't return temporary indexes anymore. Also isDeclaredIndex also doesn't return true if asked whether a temporary index is declared.

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-945241-2012-03-02T23-40-07.785Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-945241-2012-03-02T23-52-06.271Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

The attempt to merge lp:~zorba-coders/zorba/bug-945241 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug-945241-2012-03-02T23-59-02.503Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

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

text conflict in test/unit/staticcollectionmanager.cpp

lp:~zorba-coders/zorba/bug-945241 updated
10690. By Matthias Brantner

merge

10691. By Matthias Brantner

fixed bug that occurred during the merge

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-03-06 22:43:17 +0000
3+++ ChangeLog 2012-03-07 01:29:24 +0000
4@@ -26,6 +26,7 @@
5 case of early-out)
6 * More efficient implementation for base64Binary items
7 * Added index management function to the C++ api's StaticCollectionManager.
8+ * Fixed bug #945241 (StaticCollectionManager::declaredIndexes() and temporary indexes)
9 * Fixed bug #872288 (reset recursive flag during node rename)
10 * Fixed bug #905041 (allow for the default element and function namespaces to be
11 set multiple times via the c++ api).
12
13=== modified file 'src/runtime/collections/collections_impl.cpp'
14--- src/runtime/collections/collections_impl.cpp 2012-02-16 12:48:17 +0000
15+++ src/runtime/collections/collections_impl.cpp 2012-03-07 01:29:24 +0000
16@@ -30,6 +30,7 @@
17 #include "context/uri_resolver.h"
18 #include "context/static_context_consts.h"
19
20+#include "compiler/xqddf/value_index.h"
21 #include "compiler/xqddf/value_ic.h"
22
23 #include "runtime/collections/collections.h"
24@@ -2331,20 +2332,21 @@
25 PlanState& aPlanState) const
26 {
27 store::Item_t lName;
28+ zorba::IndexDecl* lDecl;
29
30 PlanIteratorState* lState;
31 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
32
33 consumeNext(lName, theChildren[0].getp(), aPlanState);
34
35- if (theSctx->lookup_index(lName.getp()) == 0)
36+ if ((lDecl = theSctx->lookup_index(lName.getp())) && !lDecl->isTemp())
37+ {
38+ STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, true), lState);
39+ }
40+ else
41 {
42 STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, false), lState);
43 }
44- else
45- {
46- STACK_PUSH(GENV_ITEMFACTORY->createBoolean(aResult, true), lState);
47- }
48
49 STACK_END(lState);
50 }
51@@ -2386,6 +2388,10 @@
52 for ((lState->nameItState = theSctx->index_names())->open();
53 lState->nameItState->next(lName); )
54 {
55+ if (theSctx->lookup_index(lName.getp())->isTemp())
56+ {
57+ continue;
58+ }
59 aResult = lName;
60 STACK_PUSH(true, lState);
61 }
62
63=== modified file 'test/unit/module1.xq'
64--- test/unit/module1.xq 2011-08-05 02:21:55 +0000
65+++ test/unit/module1.xq 2012-03-07 01:29:24 +0000
66@@ -18,4 +18,4 @@
67
68 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
69
70-1+1
71+mod2:foo()
72
73=== modified file 'test/unit/module2.xq'
74--- test/unit/module2.xq 2011-12-21 14:40:33 +0000
75+++ test/unit/module2.xq 2012-03-07 01:29:24 +0000
76@@ -27,3 +27,14 @@
77 declare index mod2:index
78 on nodes ddl:collection(xs:QName("mod2:coll"))
79 by data(@id) as xs:string;
80+
81+
82+(: test that a temp index doesn't have impact on the indexes
83+ returned by the static collection mgr :)
84+declare function mod2:foo()
85+{
86+ for $i in 1 to 10
87+ for $j in 1 to 10
88+ where $i eq $j
89+ return $i
90+};
91
92=== modified file 'test/unit/staticcollectionmanager.cpp'
93--- test/unit/staticcollectionmanager.cpp 2012-03-05 23:44:54 +0000
94+++ test/unit/staticcollectionmanager.cpp 2012-03-07 01:29:24 +0000
95@@ -206,23 +206,25 @@
96 Item lCollName2 = lFac->createQName("http://www.mod2.com/", "coll");
97
98 lColMgr->createCollection(lCollName2);
99- Collection_t lColl = lColMgr->getCollection(lCollName2);
100-
101- std::vector<Annotation_t> lAnnotations;
102- lColl->getAnnotations(lAnnotations);
103- size_t num_annotations = 0;
104- for (std::vector<Annotation_t>::const_iterator lIter = lAnnotations.begin();
105- lIter != lAnnotations.end(); ++lIter)
106- {
107- std::cout << "Annotation QName " << (*lIter)->getQName().getStringValue() << std::endl;
108- ++num_annotations;
109- }
110-
111- if (num_annotations != 3)
112- {
113- return false;
114- }
115-
116+ {
117+ Collection_t lColl = lColMgr->getCollection(lCollName2);
118+
119+ std::vector<Annotation_t> lAnnotations;
120+ lColl->getAnnotations(lAnnotations);
121+ size_t num_annotations = 0;
122+ for (std::vector<Annotation_t>::const_iterator lIter = lAnnotations.begin();
123+ lIter != lAnnotations.end(); ++lIter)
124+ {
125+ std::cout << "Annotation QName " << (*lIter)->getQName().getStringValue() << std::endl;
126+ ++num_annotations;
127+ }
128+
129+ if (num_annotations != 3)
130+ {
131+ return false;
132+ }
133+ }
134+ lColMgr->deleteCollection(lCollName2);
135
136 return true;
137 }
138@@ -418,6 +420,46 @@
139 return true;
140 }
141
142+/**
143+ * test that declaredIndexes doesn't return temporary indexes and crashes
144+ * if one tries to create one
145+ */
146+bool
147+staticcollectionmanager6(zorba::Zorba* z)
148+{
149+ std::ifstream lIn("module1.xq");
150+
151+ zorba::XQuery_t lQuery = z->createQuery();
152+ Zorba_CompilerHints lHints;
153+ lQuery->compile(lIn, lHints);
154+
155+ StaticCollectionManager* lColMgr = lQuery->getStaticCollectionManager();
156+
157+ ItemFactory* lFac = z->getItemFactory();
158+ Item lCollName2 = lFac->createQName("http://www.mod2.com/", "coll");
159+ Item lIdxName = lFac->createQName("http://www.mod2.com/", "index");
160+ Item lCollName3 = lFac->createQName("http://www.mod3.com/", "coll");
161+
162+ ItemSequence_t lSeq = lColMgr->declaredCollections();
163+ Iterator_t lIter = lSeq->getIterator();
164+ lIter->open();
165+ Item lTmp;
166+ while (lIter->next(lTmp)) {
167+ std::cout << "name " << lTmp.getStringValue() << std::endl;
168+ lColMgr->createCollection(lTmp);
169+ }
170+
171+ lSeq = lColMgr->declaredIndexes();
172+ lIter = lSeq->getIterator();
173+ lIter->open();
174+ while (lIter->next(lTmp)) {
175+ std::cout << "name " << lTmp.getStringValue() << std::endl;
176+ lColMgr->createIndex(lTmp);
177+ }
178+
179+ return true;
180+}
181+
182 int
183 staticcollectionmanager(int argc, char* argv[])
184 {
185@@ -451,6 +493,11 @@
186 return 5;
187 std::cout << std::endl;
188
189+ std::cout << "executing example 6" << std::endl;
190+ if (!staticcollectionmanager6(z))
191+ return 6;
192+ std::cout << std::endl;
193+
194 return 0;
195 }
196

Subscribers

People subscribed via source and target branches