Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Merged at revision: 11595
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 395 lines (+33/-141)
15 files modified
modules/org/jsoniq/www/functions.xq (+1/-11)
src/functions/func_jsoniq_functions_impl.cpp (+12/-0)
src/functions/pregenerated/func_jsoniq_functions.cpp (+2/-24)
src/functions/pregenerated/func_jsoniq_functions.h (+2/-15)
src/functions/pregenerated/function_enum.h (+0/-1)
src/runtime/json/jsoniq_functions_impl.cpp (+10/-7)
src/runtime/json/pregenerated/jsoniq_functions.cpp (+0/-24)
src/runtime/json/pregenerated/jsoniq_functions.h (+0/-30)
src/runtime/pregenerated/iterator_enum.h (+0/-1)
src/runtime/spec/json/jsoniq_functions.xml (+4/-4)
src/runtime/visitors/pregenerated/planiter_visitor.h (+0/-5)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+0/-14)
src/runtime/visitors/pregenerated/printer_visitor.h (+0/-3)
test/rbkt/Queries/zorba/jsoniq/null04.xq (+1/-1)
test/rbkt/Queries/zorba/jsoniq/null05.xq (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+179692@code.launchpad.net

Commit message

removed jn:null() + allow empty seq as input to jn:size()

Description of the change

removed jn:null() + allow empty seq as input to jn:size()

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/179692

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

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

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/179692

Stage "TestZorbaUbuntu" failed.
1 tests failed (8402 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/204/testReport/ to view the results.

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

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/179692

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

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

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/org/jsoniq/www/functions.xq'
2--- modules/org/jsoniq/www/functions.xq 2013-08-12 09:59:18 +0000
3+++ modules/org/jsoniq/www/functions.xq 2013-08-12 12:50:29 +0000
4@@ -215,7 +215,7 @@
5 : @param $j A JSON Array.
6 : @return The number of items in $j.
7 :)
8-declare function jn:size($j as array()) as xs:integer external;
9+declare function jn:size($j as array()?) as xs:integer? external;
10
11
12 (:~
13@@ -260,14 +260,4 @@
14 declare function jn:null() as js:null external;
15
16
17-(:~
18- : Tests whether the supplied atomic item is a JSON null.
19- :
20- : @param An atomic item.
21- :
22- : @return true if the item is of type js:null.
23- :)
24-declare function jn:is-null($i as xs:anyAtomicType) as xs:boolean external;
25-
26-
27
28
29=== modified file 'src/functions/func_jsoniq_functions_impl.cpp'
30--- src/functions/func_jsoniq_functions_impl.cpp 2013-08-09 10:23:10 +0000
31+++ src/functions/func_jsoniq_functions_impl.cpp 2013-08-12 12:50:29 +0000
32@@ -70,6 +70,18 @@
33 /*******************************************************************************
34
35 ********************************************************************************/
36+xqtref_t fn_jsoniq_size::getReturnType(const fo_expr* caller) const
37+{
38+ if (caller->get_arg(0)->get_return_type()->get_quantifier() == TypeConstants::QUANT_ONE)
39+ return GENV_TYPESYSTEM.INTEGER_TYPE_ONE;
40+
41+ return theSignature.returnType();
42+}
43+
44+
45+/*******************************************************************************
46+
47+********************************************************************************/
48 PlanIter_t fn_jsoniq_keys::codegen(
49 CompilerCB*,
50 static_context* sctx,
51
52=== modified file 'src/functions/pregenerated/func_jsoniq_functions.cpp'
53--- src/functions/pregenerated/func_jsoniq_functions.cpp 2013-08-12 10:27:18 +0000
54+++ src/functions/pregenerated/func_jsoniq_functions.cpp 2013-08-12 12:50:29 +0000
55@@ -154,16 +154,6 @@
56 return new JSONNullIterator(sctx, loc);
57 }
58
59-PlanIter_t fn_jsoniq_is_null::codegen(
60- CompilerCB*,
61- static_context* sctx,
62- const QueryLoc& loc,
63- std::vector<PlanIter_t>& argv,
64- expr& ann) const
65-{
66- return new JSONIsNullIterator(sctx, loc, argv[0]);
67-}
68-
69 PlanIter_t op_zorba_json_object_insert::codegen(
70 CompilerCB*,
71 static_context* sctx,
72@@ -431,8 +421,8 @@
73 {
74 DECL_WITH_KIND(sctx, fn_jsoniq_size,
75 (createQName("http://jsoniq.org/functions","","size"),
76- GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE,
77- GENV_TYPESYSTEM.INTEGER_TYPE_ONE),
78+ GENV_TYPESYSTEM.JSON_ARRAY_TYPE_QUESTION,
79+ GENV_TYPESYSTEM.INTEGER_TYPE_QUESTION),
80 FunctionConsts::FN_JSONIQ_SIZE_1);
81
82 }
83@@ -464,18 +454,6 @@
84
85
86 {
87- DECL_WITH_KIND(sctx, fn_jsoniq_is_null,
88- (createQName("http://jsoniq.org/functions","","is-null"),
89- GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_ONE,
90- GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
91- FunctionConsts::FN_JSONIQ_IS_NULL_1);
92-
93- }
94-
95-
96-
97-
98- {
99 DECL_WITH_KIND(sctx, op_zorba_json_object_insert,
100 (createQName("http://zorba.io/internal/zorba-ops","","json-object-insert"),
101 GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
102
103=== modified file 'src/functions/pregenerated/func_jsoniq_functions.h'
104--- src/functions/pregenerated/func_jsoniq_functions.h 2013-08-09 10:23:10 +0000
105+++ src/functions/pregenerated/func_jsoniq_functions.h 2013-08-12 12:50:29 +0000
106@@ -287,6 +287,8 @@
107
108 }
109
110+ xqtref_t getReturnType(const fo_expr* caller) const;
111+
112 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
113
114 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
115@@ -329,21 +331,6 @@
116 };
117
118
119-//fn-jsoniq:is-null
120-class fn_jsoniq_is_null : public function
121-{
122-public:
123- fn_jsoniq_is_null(const signature& sig, FunctionConsts::FunctionKind kind)
124- :
125- function(sig, kind)
126- {
127-
128- }
129-
130- CODEGEN_DECL();
131-};
132-
133-
134 //op-zorba:json-object-insert
135 class op_zorba_json_object_insert : public function
136 {
137
138=== modified file 'src/functions/pregenerated/function_enum.h'
139--- src/functions/pregenerated/function_enum.h 2013-08-09 10:23:10 +0000
140+++ src/functions/pregenerated/function_enum.h 2013-08-12 12:50:29 +0000
141@@ -271,7 +271,6 @@
142 FN_JSONIQ_SIZE_1,
143 FN_JSONIQ_FLATTEN_1,
144 FN_JSONIQ_NULL_0,
145- FN_JSONIQ_IS_NULL_1,
146 OP_ZORBA_JSON_OBJECT_INSERT_2,
147 OP_ZORBA_JSON_ARRAY_INSERT_3,
148 OP_ZORBA_JSON_DELETE_2,
149
150=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
151--- src/runtime/json/jsoniq_functions_impl.cpp 2013-08-09 10:23:10 +0000
152+++ src/runtime/json/jsoniq_functions_impl.cpp 2013-08-12 12:50:29 +0000
153@@ -1278,17 +1278,18 @@
154 store::Item_t& result,
155 PlanState& planState) const
156 {
157- store::Item_t lJSONItem;
158- xs_integer lSize;
159+ store::Item_t item;
160+ xs_integer size;
161
162 PlanIteratorState* state;
163 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
164
165- consumeNext(lJSONItem, theChild.getp(), planState);
166-
167- lSize = lJSONItem->getArraySize();
168-
169- STACK_PUSH(GENV_ITEMFACTORY->createInteger(result, lSize), state);
170+ if (consumeNext(item, theChild.getp(), planState))
171+ {
172+ size = item->getArraySize();
173+
174+ STACK_PUSH(GENV_ITEMFACTORY->createInteger(result, size), state);
175+ }
176
177 STACK_END(state);
178 }
179@@ -1516,6 +1517,7 @@
180 }
181
182
183+#if 0
184 /*******************************************************************************
185 jn:is-null(xs:anyAtomicType) as xs:boolean
186 ********************************************************************************/
187@@ -1537,6 +1539,7 @@
188
189 STACK_END(state);
190 }
191+#endif
192
193
194 /*******************************************************************************
195
196=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.cpp'
197--- src/runtime/json/pregenerated/jsoniq_functions.cpp 2013-06-18 18:55:33 +0000
198+++ src/runtime/json/pregenerated/jsoniq_functions.cpp 2013-08-12 12:50:29 +0000
199@@ -505,30 +505,6 @@
200 // </JSONNullIterator>
201
202
203-// <JSONIsNullIterator>
204-SERIALIZABLE_CLASS_VERSIONS(JSONIsNullIterator)
205-
206-void JSONIsNullIterator::serialize(::zorba::serialization::Archiver& ar)
207-{
208- serialize_baseclass(ar,
209- (UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>*)this);
210-}
211-
212-
213-void JSONIsNullIterator::accept(PlanIterVisitor& v) const
214-{
215- v.beginVisit(*this);
216-
217- theChild->accept(v);
218-
219- v.endVisit(*this);
220-}
221-
222-JSONIsNullIterator::~JSONIsNullIterator() {}
223-
224-// </JSONIsNullIterator>
225-
226-
227 // <JSONObjectInsertIterator>
228 SERIALIZABLE_CLASS_VERSIONS(JSONObjectInsertIterator)
229
230
231=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
232--- src/runtime/json/pregenerated/jsoniq_functions.h 2013-06-18 18:55:33 +0000
233+++ src/runtime/json/pregenerated/jsoniq_functions.h 2013-08-12 12:50:29 +0000
234@@ -655,36 +655,6 @@
235
236 /**
237 *
238- * Author:
239- */
240-class JSONIsNullIterator : public UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>
241-{
242-public:
243- SERIALIZABLE_CLASS(JSONIsNullIterator);
244-
245- SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONIsNullIterator,
246- UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>);
247-
248- void serialize( ::zorba::serialization::Archiver& ar);
249-
250- JSONIsNullIterator(
251- static_context* sctx,
252- const QueryLoc& loc,
253- PlanIter_t& child)
254- :
255- UnaryBaseIterator<JSONIsNullIterator, PlanIteratorState>(sctx, loc, child)
256- {}
257-
258- virtual ~JSONIsNullIterator();
259-
260- void accept(PlanIterVisitor& v) const;
261-
262- bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
263-};
264-
265-
266-/**
267- *
268 * internal function
269 *
270 * Author: Zorba Team
271
272=== modified file 'src/runtime/pregenerated/iterator_enum.h'
273--- src/runtime/pregenerated/iterator_enum.h 2013-07-26 21:05:40 +0000
274+++ src/runtime/pregenerated/iterator_enum.h 2013-08-12 12:50:29 +0000
275@@ -179,7 +179,6 @@
276 TYPE_JSONArraySizeIterator,
277 TYPE_JSONArrayFlattenIterator,
278 TYPE_JSONNullIterator,
279- TYPE_JSONIsNullIterator,
280 TYPE_JSONObjectInsertIterator,
281 TYPE_JSONArrayInsertIterator,
282 TYPE_JSONDeleteIterator,
283
284=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
285--- src/runtime/spec/json/jsoniq_functions.xml 2013-08-09 10:23:10 +0000
286+++ src/runtime/spec/json/jsoniq_functions.xml 2013-08-12 12:50:29 +0000
287@@ -479,11 +479,12 @@
288
289 <zorba:function isDeterministic="true">
290 <zorba:signature localname="size" prefix="fn-jsoniq">
291- <zorba:param>array()</zorba:param>
292- <zorba:output>xs:integer</zorba:output>
293+ <zorba:param>array()?</zorba:param>
294+ <zorba:output>xs:integer?</zorba:output>
295 </zorba:signature>
296
297 <zorba:methods>
298+ <zorba:getReturnType/>
299 <zorba:propagatesInputNodes value="false"/>
300 <zorba:mustCopyInputNodes value="false"/>
301 </zorba:methods>
302@@ -543,7 +544,6 @@
303 <!--
304 /*******************************************************************************
305 ********************************************************************************/
306--->
307 <zorba:iterator name="JSONIsNullIterator" arity="unary">
308
309 <zorba:function isDeterministic="true">
310@@ -555,7 +555,7 @@
311 </zorba:function>
312
313 </zorba:iterator>
314-
315+-->
316
317 <!--
318 /*******************************************************************************
319
320=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
321--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-07-26 21:05:40 +0000
322+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-08-12 12:50:29 +0000
323@@ -364,8 +364,6 @@
324
325 class JSONNullIterator;
326
327- class JSONIsNullIterator;
328-
329 class JSONObjectInsertIterator;
330
331 class JSONArrayInsertIterator;
332@@ -1252,9 +1250,6 @@
333 virtual void beginVisit ( const JSONNullIterator& ) = 0;
334 virtual void endVisit ( const JSONNullIterator& ) = 0;
335
336- virtual void beginVisit ( const JSONIsNullIterator& ) = 0;
337- virtual void endVisit ( const JSONIsNullIterator& ) = 0;
338-
339 virtual void beginVisit ( const JSONObjectInsertIterator& ) = 0;
340 virtual void endVisit ( const JSONObjectInsertIterator& ) = 0;
341
342
343=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
344--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-08-05 11:54:06 +0000
345+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-08-12 12:50:29 +0000
346@@ -2220,20 +2220,6 @@
347 // </JSONNullIterator>
348
349
350-// <JSONIsNullIterator>
351-void PrinterVisitor::beginVisit ( const JSONIsNullIterator& a) {
352- thePrinter.startBeginVisit("JSONIsNullIterator", ++theId);
353- printCommons( &a, theId );
354- thePrinter.endBeginVisit( theId );
355-}
356-
357-void PrinterVisitor::endVisit ( const JSONIsNullIterator& ) {
358- thePrinter.startEndVisit();
359- thePrinter.endEndVisit();
360-}
361-// </JSONIsNullIterator>
362-
363-
364 // <JSONObjectInsertIterator>
365 void PrinterVisitor::beginVisit ( const JSONObjectInsertIterator& a) {
366 thePrinter.startBeginVisit("JSONObjectInsertIterator", ++theId);
367
368=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
369--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-07-26 21:05:40 +0000
370+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-08-12 12:50:29 +0000
371@@ -556,9 +556,6 @@
372 void beginVisit( const JSONNullIterator& );
373 void endVisit ( const JSONNullIterator& );
374
375- void beginVisit( const JSONIsNullIterator& );
376- void endVisit ( const JSONIsNullIterator& );
377-
378 void beginVisit( const JSONObjectInsertIterator& );
379 void endVisit ( const JSONObjectInsertIterator& );
380
381
382=== modified file 'test/rbkt/Queries/zorba/jsoniq/null04.xq'
383--- test/rbkt/Queries/zorba/jsoniq/null04.xq 2012-09-13 12:51:41 +0000
384+++ test/rbkt/Queries/zorba/jsoniq/null04.xq 2013-08-12 12:50:29 +0000
385@@ -1,2 +1,2 @@
386-jn:is-null(jn:null())
387+jn:null() instance of js:null
388
389
390=== modified file 'test/rbkt/Queries/zorba/jsoniq/null05.xq'
391--- test/rbkt/Queries/zorba/jsoniq/null05.xq 2012-09-13 12:51:41 +0000
392+++ test/rbkt/Queries/zorba/jsoniq/null05.xq 2013-08-12 12:50:29 +0000
393@@ -1,2 +1,2 @@
394-jn:is-null("null")
395+"null" instance of js:null
396

Subscribers

People subscribed via source and target branches