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
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-12-11 19:23:08 +0000
3+++ ChangeLog 2012-12-12 07:38:30 +0000
4@@ -14,6 +14,10 @@
5 * Various optimizations in the implementation of the optimizer rules.
6 * Better computation of the static type for global variables.
7 * Optimization of comparison operators when untypedAtomic items are involved.
8+ * Improved computation of static type for fn:data function.
9+ * Fixed iteration over the components of a window clause; this improves static
10+ type computation of expressions referencing window vars.
11+ * No need to cast xs:untypedAtomic to xs:string in order-by expression.
12
13 Bug Fixes/Other Changes:
14 * Change XQXQ (XQuery-for-XQuery) module now part of Zorba core
15
16=== modified file 'src/compiler/expression/expr_iter.cpp'
17--- src/compiler/expression/expr_iter.cpp 2012-12-06 22:49:35 +0000
18+++ src/compiler/expression/expr_iter.cpp 2012-12-12 07:38:30 +0000
19@@ -345,6 +345,10 @@
20
21 else if (c->get_kind() == flwor_clause::window_clause)
22 {
23+ wc = static_cast<window_clause *>(*theClausesIter);
24+
25+ EXPR_ITER_NEXT(wc->theDomainExpr);
26+
27 for (theWincondIter = 0; theWincondIter < 2; ++theWincondIter)
28 {
29 wc = static_cast<window_clause *>(*theClausesIter);
30@@ -356,10 +360,6 @@
31 if (wincond != 0)
32 EXPR_ITER_NEXT(wincond->theCondExpr);
33 }
34-
35- wc = static_cast<window_clause *>(*theClausesIter);
36-
37- EXPR_ITER_NEXT(wc->theDomainExpr);
38 }
39
40 else if (c->get_kind() == flwor_clause::group_clause)
41
42=== modified file 'src/compiler/rewriter/rules/type_rules.cpp'
43--- src/compiler/rewriter/rules/type_rules.cpp 2012-12-06 22:49:35 +0000
44+++ src/compiler/rewriter/rules/type_rules.cpp 2012-12-12 07:38:30 +0000
45@@ -427,6 +427,7 @@
46 }
47 }
48 }
49+#if 0
50 else if (node->get_expr_kind() == flwor_expr_kind ||
51 node->get_expr_kind() == gflwor_expr_kind)
52 {
53@@ -465,6 +466,7 @@
54 if (modified)
55 return node;
56 }
57+#endif
58
59 return NULL;
60 }
61
62=== modified file 'src/compiler/translator/translator.cpp'
63--- src/compiler/translator/translator.cpp 2012-12-11 20:27:40 +0000
64+++ src/compiler/translator/translator.cpp 2012-12-12 07:38:30 +0000
65@@ -4058,7 +4058,7 @@
66 expr::checkSimpleExpr(initExpr);
67 ve->set_has_initializer(true);
68
69- if (!ve->is_mutable())
70+ if (!ve->is_mutable() && !ve->is_external())
71 {
72 xqtref_t derivedType = initExpr->get_return_type();
73
74
75=== modified file 'src/functions/func_accessors_impl.cpp'
76--- src/functions/func_accessors_impl.cpp 2012-10-10 13:35:24 +0000
77+++ src/functions/func_accessors_impl.cpp 2012-12-12 07:38:30 +0000
78@@ -105,6 +105,10 @@
79 getListItemType();
80 return tm->create_type(*itemType, TypeConstants::QUANT_STAR);
81 }
82+ else if (TypeOps::is_equal(tm, *cType, *RTM.UNTYPED_ATOMIC_TYPE_ONE))
83+ {
84+ return tm->create_builtin_atomic_type(store::XS_UNTYPED_ATOMIC, q);
85+ }
86 else if (TypeOps::is_equal(tm, *cType, *RTM.UNTYPED_TYPE))
87 {
88 return tm->create_builtin_atomic_type(store::XS_UNTYPED_ATOMIC, q);
89
90=== modified file 'src/types/typeimpl.cpp'
91--- src/types/typeimpl.cpp 2012-09-19 21:16:15 +0000
92+++ src/types/typeimpl.cpp 2012-12-12 07:38:30 +0000
93@@ -270,6 +270,11 @@
94
95 switch (type_kind())
96 {
97+ case NONE_KIND:
98+ {
99+ result = "none";
100+ break;
101+ }
102 case EMPTY_KIND:
103 {
104 result = "empty-sequence()";
105@@ -283,11 +288,13 @@
106 case ITEM_KIND:
107 {
108 result = "item()";
109+ result += TypeOps::decode_quantifier(get_quantifier());
110 break;
111 }
112 case STRUCTURED_ITEM_KIND:
113 {
114 result = "structured-item()";
115+ result += TypeOps::decode_quantifier(get_quantifier());
116 break;
117 }
118
119@@ -311,6 +318,7 @@
120 result = "array()";
121 }
122
123+ result += TypeOps::decode_quantifier(get_quantifier());
124 break;
125 }
126 #endif
127@@ -318,11 +326,19 @@
128 case NODE_TYPE_KIND:
129 {
130 result = static_cast<const NodeXQType*>(this)->toSchemaStringInternal();
131+ result += TypeOps::decode_quantifier(get_quantifier());
132 break;
133 }
134 case FUNCTION_TYPE_KIND:
135 {
136 result = toString();
137+ result += TypeOps::decode_quantifier(get_quantifier());
138+ break;
139+ }
140+ case ANY_FUNCTION_TYPE_KIND:
141+ {
142+ result = "function(*)";
143+ result += TypeOps::decode_quantifier(get_quantifier());
144 break;
145 }
146 case ANY_TYPE_KIND:
147@@ -335,22 +351,19 @@
148 result = "xs:anySimpleType";
149 break;
150 }
151- case ANY_FUNCTION_TYPE_KIND:
152- {
153- result = "function(*)";
154- break;
155- }
156 case UNTYPED_KIND:
157 {
158+ result = "xs:untyped";
159+ break;
160+ }
161+ default:
162+ {
163 result = toString();
164+ result += TypeOps::decode_quantifier(get_quantifier());
165 break;
166 }
167- default:
168- return toString();
169- break;
170 }
171
172- result += TypeOps::decode_quantifier(get_quantifier());
173 return result;
174 }
175
176
177=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter'
178--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter 2012-10-08 12:09:36 +0000
179+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter 2012-12-12 07:38:30 +0000
180@@ -18,15 +18,13 @@
181 </DescendantAxisIterator>
182 </ForVariable>
183 <OrderBySpec>
184- <CastIterator type="xs:string">
185- <FnDataIterator>
186- <FnZeroOrOneIterator>
187- <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
188- <ForVarIterator varname="b"/>
189- </ChildAxisIterator>
190- </FnZeroOrOneIterator>
191- </FnDataIterator>
192- </CastIterator>
193+ <FnDataIterator>
194+ <FnZeroOrOneIterator>
195+ <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
196+ <ForVarIterator varname="b"/>
197+ </ChildAxisIterator>
198+ </FnZeroOrOneIterator>
199+ </FnDataIterator>
200 </OrderBySpec>
201 <ReturnClause>
202 <ElementIterator copyInputNodes="false">
203
204=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter'
205--- test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter 2012-10-08 12:09:36 +0000
206+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/xmark/q19.iter 2012-12-12 07:38:30 +0000
207@@ -18,15 +18,13 @@
208 </DescendantAxisIterator>
209 </ForVariable>
210 <OrderBySpec>
211- <CastIterator type="xs:string">
212- <FnDataIterator>
213- <FnZeroOrOneIterator>
214- <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
215- <ForVarIterator varname="b"/>
216- </ChildAxisIterator>
217- </FnZeroOrOneIterator>
218- </FnDataIterator>
219- </CastIterator>
220+ <FnDataIterator>
221+ <FnZeroOrOneIterator>
222+ <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,location)" typename="*" nill allowed="0">
223+ <ForVarIterator varname="b"/>
224+ </ChildAxisIterator>
225+ </FnZeroOrOneIterator>
226+ </FnDataIterator>
227 </OrderBySpec>
228 <ReturnClause>
229 <ElementIterator>
230
231=== modified file 'test/rbkt/Queries/zorba/xmark/q19.xq'
232--- test/rbkt/Queries/zorba/xmark/q19.xq 2012-09-19 21:16:15 +0000
233+++ test/rbkt/Queries/zorba/xmark/q19.xq 2012-12-12 07:38:30 +0000
234@@ -1,7 +1,9 @@
235 declare variable $input-context external;
236-let $auction := doc($input-context) return
237-for $b in $auction/site/regions//item
238-let $k := $b/name/text()
239-stable order by zero-or-one($b/location) ascending empty greatest
240-return <item name="{$k}">{$b/location/text()}</item>
241+
242+let $auction := doc($input-context)
243+return
244+ for $b in $auction/site/regions//item
245+ let $k := $b/name/text()
246+ stable order by zero-or-one($b/location) ascending empty greatest
247+ return <item name="{$k}">{$b/location/text()}</item>
248

Subscribers

People subscribed via source and target branches