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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10996
Merged at revision: 11143
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 247 lines (+58/-37)
9 files modified
ChangeLog (+4/-0)
src/compiler/expression/expr_iter.cpp (+4/-4)
src/compiler/rewriter/rules/type_rules.cpp (+2/-0)
src/compiler/translator/translator.cpp (+1/-1)
src/functions/func_accessors_impl.cpp (+4/-0)
src/types/typeimpl.cpp (+22/-9)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter (+7/-9)
test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter (+7/-9)
test/rbkt/Queries/zorba/xmark/q19.xq (+7/-5)
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+139392@code.launchpad.net

Commit message

1. Improved computation of static type for fn:data function,
2. Improved XQType::toSchemaString() method,
3. No need to cast xs:untypedAtomic to xs:string in order-by expression,
4. Fixed iteration over the components of a window clause; this improves static type computation of expressions referencing window vars.

Description of the change

1. Improved computation of static type for fn:data function,
2. Improved XQType::toSchemaString() method,
3. No need to cast xs:untypedAtomic to xs:string in order-by expression,
4. Fixed iteration over the components of a window clause; this improves static type computation of expressions referencing window vars.

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 :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2012-12-12T07-47-09.852Z 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
=== modified file 'ChangeLog'
--- ChangeLog 2012-12-11 19:23:08 +0000
+++ ChangeLog 2012-12-12 07:38:30 +0000
@@ -14,6 +14,10 @@
14 * Various optimizations in the implementation of the optimizer rules.14 * Various optimizations in the implementation of the optimizer rules.
15 * Better computation of the static type for global variables.15 * Better computation of the static type for global variables.
16 * Optimization of comparison operators when untypedAtomic items are involved.16 * Optimization of comparison operators when untypedAtomic items are involved.
17 * Improved computation of static type for fn:data function.
18 * Fixed iteration over the components of a window clause; this improves static
19 type computation of expressions referencing window vars.
20 * No need to cast xs:untypedAtomic to xs:string in order-by expression.
1721
18Bug Fixes/Other Changes:22Bug Fixes/Other Changes:
19 * Change XQXQ (XQuery-for-XQuery) module now part of Zorba core23 * Change XQXQ (XQuery-for-XQuery) module now part of Zorba core
2024
=== modified file 'src/compiler/expression/expr_iter.cpp'
--- src/compiler/expression/expr_iter.cpp 2012-12-06 22:49:35 +0000
+++ src/compiler/expression/expr_iter.cpp 2012-12-12 07:38:30 +0000
@@ -345,6 +345,10 @@
345345
346 else if (c->get_kind() == flwor_clause::window_clause)346 else if (c->get_kind() == flwor_clause::window_clause)
347 {347 {
348 wc = static_cast<window_clause *>(*theClausesIter);
349
350 EXPR_ITER_NEXT(wc->theDomainExpr);
351
348 for (theWincondIter = 0; theWincondIter < 2; ++theWincondIter)352 for (theWincondIter = 0; theWincondIter < 2; ++theWincondIter)
349 {353 {
350 wc = static_cast<window_clause *>(*theClausesIter);354 wc = static_cast<window_clause *>(*theClausesIter);
@@ -356,10 +360,6 @@
356 if (wincond != 0)360 if (wincond != 0)
357 EXPR_ITER_NEXT(wincond->theCondExpr);361 EXPR_ITER_NEXT(wincond->theCondExpr);
358 }362 }
359
360 wc = static_cast<window_clause *>(*theClausesIter);
361
362 EXPR_ITER_NEXT(wc->theDomainExpr);
363 }363 }
364364
365 else if (c->get_kind() == flwor_clause::group_clause)365 else if (c->get_kind() == flwor_clause::group_clause)
366366
=== modified file 'src/compiler/rewriter/rules/type_rules.cpp'
--- src/compiler/rewriter/rules/type_rules.cpp 2012-12-06 22:49:35 +0000
+++ src/compiler/rewriter/rules/type_rules.cpp 2012-12-12 07:38:30 +0000
@@ -427,6 +427,7 @@
427 }427 }
428 }428 }
429 }429 }
430#if 0
430 else if (node->get_expr_kind() == flwor_expr_kind ||431 else if (node->get_expr_kind() == flwor_expr_kind ||
431 node->get_expr_kind() == gflwor_expr_kind)432 node->get_expr_kind() == gflwor_expr_kind)
432 {433 {
@@ -465,6 +466,7 @@
465 if (modified)466 if (modified)
466 return node;467 return node;
467 }468 }
469#endif
468470
469 return NULL;471 return NULL;
470}472}
471473
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2012-12-11 20:27:40 +0000
+++ src/compiler/translator/translator.cpp 2012-12-12 07:38:30 +0000
@@ -4058,7 +4058,7 @@
4058 expr::checkSimpleExpr(initExpr);4058 expr::checkSimpleExpr(initExpr);
4059 ve->set_has_initializer(true);4059 ve->set_has_initializer(true);
40604060
4061 if (!ve->is_mutable())4061 if (!ve->is_mutable() && !ve->is_external())
4062 {4062 {
4063 xqtref_t derivedType = initExpr->get_return_type();4063 xqtref_t derivedType = initExpr->get_return_type();
40644064
40654065
=== modified file 'src/functions/func_accessors_impl.cpp'
--- src/functions/func_accessors_impl.cpp 2012-10-10 13:35:24 +0000
+++ src/functions/func_accessors_impl.cpp 2012-12-12 07:38:30 +0000
@@ -105,6 +105,10 @@
105 getListItemType();105 getListItemType();
106 return tm->create_type(*itemType, TypeConstants::QUANT_STAR);106 return tm->create_type(*itemType, TypeConstants::QUANT_STAR);
107 }107 }
108 else if (TypeOps::is_equal(tm, *cType, *RTM.UNTYPED_ATOMIC_TYPE_ONE))
109 {
110 return tm->create_builtin_atomic_type(store::XS_UNTYPED_ATOMIC, q);
111 }
108 else if (TypeOps::is_equal(tm, *cType, *RTM.UNTYPED_TYPE))112 else if (TypeOps::is_equal(tm, *cType, *RTM.UNTYPED_TYPE))
109 {113 {
110 return tm->create_builtin_atomic_type(store::XS_UNTYPED_ATOMIC, q);114 return tm->create_builtin_atomic_type(store::XS_UNTYPED_ATOMIC, q);
111115
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2012-09-19 21:16:15 +0000
+++ src/types/typeimpl.cpp 2012-12-12 07:38:30 +0000
@@ -270,6 +270,11 @@
270270
271 switch (type_kind())271 switch (type_kind())
272 {272 {
273 case NONE_KIND:
274 {
275 result = "none";
276 break;
277 }
273 case EMPTY_KIND:278 case EMPTY_KIND:
274 {279 {
275 result = "empty-sequence()";280 result = "empty-sequence()";
@@ -283,11 +288,13 @@
283 case ITEM_KIND:288 case ITEM_KIND:
284 {289 {
285 result = "item()";290 result = "item()";
291 result += TypeOps::decode_quantifier(get_quantifier());
286 break;292 break;
287 }293 }
288 case STRUCTURED_ITEM_KIND:294 case STRUCTURED_ITEM_KIND:
289 {295 {
290 result = "structured-item()";296 result = "structured-item()";
297 result += TypeOps::decode_quantifier(get_quantifier());
291 break;298 break;
292 }299 }
293300
@@ -311,6 +318,7 @@
311 result = "array()";318 result = "array()";
312 }319 }
313320
321 result += TypeOps::decode_quantifier(get_quantifier());
314 break;322 break;
315 }323 }
316#endif324#endif
@@ -318,11 +326,19 @@
318 case NODE_TYPE_KIND:326 case NODE_TYPE_KIND:
319 {327 {
320 result = static_cast<const NodeXQType*>(this)->toSchemaStringInternal();328 result = static_cast<const NodeXQType*>(this)->toSchemaStringInternal();
329 result += TypeOps::decode_quantifier(get_quantifier());
321 break;330 break;
322 }331 }
323 case FUNCTION_TYPE_KIND:332 case FUNCTION_TYPE_KIND:
324 {333 {
325 result = toString();334 result = toString();
335 result += TypeOps::decode_quantifier(get_quantifier());
336 break;
337 }
338 case ANY_FUNCTION_TYPE_KIND:
339 {
340 result = "function(*)";
341 result += TypeOps::decode_quantifier(get_quantifier());
326 break;342 break;
327 }343 }
328 case ANY_TYPE_KIND:344 case ANY_TYPE_KIND:
@@ -335,22 +351,19 @@
335 result = "xs:anySimpleType";351 result = "xs:anySimpleType";
336 break;352 break;
337 }353 }
338 case ANY_FUNCTION_TYPE_KIND:
339 {
340 result = "function(*)";
341 break;
342 }
343 case UNTYPED_KIND:354 case UNTYPED_KIND:
344 {355 {
356 result = "xs:untyped";
357 break;
358 }
359 default:
360 {
345 result = toString();361 result = toString();
362 result += TypeOps::decode_quantifier(get_quantifier());
346 break;363 break;
347 }364 }
348 default:
349 return toString();
350 break;
351 }365 }
352366
353 result += TypeOps::decode_quantifier(get_quantifier());
354 return result;367 return result;
355}368}
356369
357370
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter 2012-12-12 07:38:30 +0000
@@ -18,15 +18,13 @@
18 </DescendantAxisIterator>18 </DescendantAxisIterator>
19 </ForVariable>19 </ForVariable>
20 <OrderBySpec>20 <OrderBySpec>
21 <CastIterator type="xs:string">21 <FnDataIterator>
22 <FnDataIterator>22 <FnZeroOrOneIterator>
23 <FnZeroOrOneIterator>23 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
24 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">24 <ForVarIterator varname="b"/>
25 <ForVarIterator varname="b"/>25 </ChildAxisIterator>
26 </ChildAxisIterator>26 </FnZeroOrOneIterator>
27 </FnZeroOrOneIterator>27 </FnDataIterator>
28 </FnDataIterator>
29 </CastIterator>
30 </OrderBySpec>28 </OrderBySpec>
31 <ReturnClause>29 <ReturnClause>
32 <ElementIterator copyInputNodes="false">30 <ElementIterator copyInputNodes="false">
3331
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter 2012-12-12 07:38:30 +0000
@@ -18,15 +18,13 @@
18 </DescendantAxisIterator>18 </DescendantAxisIterator>
19 </ForVariable>19 </ForVariable>
20 <OrderBySpec>20 <OrderBySpec>
21 <CastIterator type="xs:string">21 <FnDataIterator>
22 <FnDataIterator>22 <FnZeroOrOneIterator>
23 <FnZeroOrOneIterator>23 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
24 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">24 <ForVarIterator varname="b"/>
25 <ForVarIterator varname="b"/>25 </ChildAxisIterator>
26 </ChildAxisIterator>26 </FnZeroOrOneIterator>
27 </FnZeroOrOneIterator>27 </FnDataIterator>
28 </FnDataIterator>
29 </CastIterator>
30 </OrderBySpec>28 </OrderBySpec>
31 <ReturnClause>29 <ReturnClause>
32 <ElementIterator>30 <ElementIterator>
3331
=== modified file 'test/rbkt/Queries/zorba/xmark/q19.xq'
--- test/rbkt/Queries/zorba/xmark/q19.xq 2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/xmark/q19.xq 2012-12-12 07:38:30 +0000
@@ -1,7 +1,9 @@
1declare variable $input-context external;1declare variable $input-context external;
2let $auction := doc($input-context) return2
3for $b in $auction/site/regions//item3let $auction := doc($input-context)
4let $k := $b/name/text()4return
5stable order by zero-or-one($b/location) ascending empty greatest5 for $b in $auction/site/regions//item
6return <item name="{$k}">{$b/location/text()}</item>6 let $k := $b/name/text()
7 stable order by zero-or-one($b/location) ascending empty greatest
8 return <item name="{$k}">{$b/location/text()}</item>
79

Subscribers

People subscribed via source and target branches