zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #23142
[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba
Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.
Commit message:
"Fixed bug #1190407 (wrong rewrite of if-then-else return clause in case of general flwor)
Requested reviews:
Markos Zaharioudakis (markos-za)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/169335
"Fixed bug #1190407 (wrong rewrite of if-then-else return clause in case of general flwor)
--
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/169335
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2013-06-13 01:21:36 +0000
+++ ChangeLog 2013-06-14 04:35:36 +0000
@@ -31,6 +31,8 @@
* Fixed bug #1188100 (regex issues with 'q' flag in fn:tokenize)
* Fixed invalid memory access error occuring during sequence type matching
for user-defined types.
+ * Fixed bug #1190407 (wrong rewrite of if-then-else return clause in case
+ of general flwor)
* jn:members function takes item()* as aparameter (instead of item())
* jn:keys function takes item()* as aparameter (instead of item())
* Fixed bug #1189996 (Relocate some public API headers to util)
=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
--- src/compiler/rewriter/rules/flwor_rules.cpp 2013-05-24 16:34:11 +0000
+++ src/compiler/rewriter/rules/flwor_rules.cpp 2013-06-14 04:35:36 +0000
@@ -1028,63 +1028,7 @@
!elseExpr->isNonDiscardable() &&
elseExpr->get_return_type()->is_empty())
{
- if (flwor->is_general())
- {
- flwor->add_where(condExpr);
- }
- else
- {
- expr* whereExpr = flwor->get_where();
-
- if (whereExpr == NULL)
- {
- flwor->set_where(condExpr);
- }
- else if (whereExpr->get_function_kind() == FunctionConsts::OP_AND_N)
- {
- fo_expr* foWhereExpr = static_cast<fo_expr*>(whereExpr);
-
- if (condExpr->get_function_kind() == FunctionConsts::OP_AND_N)
- {
- fo_expr* foCondExpr = static_cast<fo_expr*>(condExpr);
-
- for (csize i = 0; i < foCondExpr->num_args(); ++i)
- {
- foWhereExpr->add_arg(foCondExpr->get_arg(i));
- expr_tools::fix_annotations(foWhereExpr, foCondExpr->get_arg(i));
- }
- }
- else
- {
- foWhereExpr->add_arg(condExpr);
- expr_tools::fix_annotations(foWhereExpr, condExpr);
- }
- }
- else if (condExpr->get_function_kind() == FunctionConsts::OP_AND_N)
- {
- fo_expr* foCondExpr = static_cast<fo_expr*>(condExpr);
- foCondExpr->add_arg(whereExpr);
- expr_tools::fix_annotations(foCondExpr, whereExpr);
-
- flwor->set_where(condExpr);
- }
- else
- {
- expr* newWhereExpr = rCtx.theEM->
- create_fo_expr(sctx,
- udf,
- whereExpr->get_loc(),
- BUILTIN_FUNC(OP_AND_N),
- whereExpr,
- condExpr);
-
- expr_tools::fix_annotations(newWhereExpr, whereExpr);
- expr_tools::fix_annotations(newWhereExpr, condExpr);
-
- flwor->set_where(newWhereExpr);
- }
- }
-
+ flwor->add_where(condExpr);
flwor->set_return_expr(thenExpr);
modified = true;
}
=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp 2013-06-11 23:38:49 +0000
+++ src/runtime/sequences/sequences_impl.cpp 2013-06-14 04:35:36 +0000
@@ -1838,8 +1838,6 @@
store::SchemaTypeCode lResultType;
store::SchemaTypeCode lTmpType;
- const TypeManager* tm = theSctx->get_typemanager();
-
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
=== added file 'test/rbkt/ExpQueryResults/zorba/gflwor/gflwor09.xml.res'
=== added file 'test/rbkt/Queries/zorba/gflwor/gflwor09.xq'
--- test/rbkt/Queries/zorba/gflwor/gflwor09.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/gflwor/gflwor09.xq 2013-06-14 04:35:36 +0000
@@ -0,0 +1,6 @@
+let $seq := for $i in 1 to 10 return <foo attribute="{$i}">{$i}</foo>
+for $child in $seq[1]/node()
+where not(fn:empty($child/text()))
+let $name := fn:name($child)
+return
+ if (fn:count($seq/node()[fn:name(.) = $name]) eq 10) then $name else ()
Follow ups