Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Commit message:
Fixed bug in index join rule (no index join if inner clause has positional var).


Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/153669

Fixed bug in index join rule (no index join if inner clause has positional var).

-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/153669
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-03-12 17:03:31 +0000
+++ ChangeLog	2013-03-16 20:25:24 +0000
@@ -29,6 +29,7 @@
   * Fixed bug #1124273 (xqdoc crash because of annotation literals)
   * Fixed bug #867027 (XQST0059 error messages inconsistent)
   * Fixed bug #1095889 (Improve error message for xml-parsing error).
+  * Fixed bug in index join rule (no index join if inner clause has positional var).
   * Fixed bug in index join rule (copy var ids after cloning index domain expr).
   * Added missing wrapper expressions around some variable references.
   * Fixed bug in the throwing of error XQTY0086 during node construction.

=== modified file 'src/compiler/rewriter/rules/index_join_rule.cpp'
--- src/compiler/rewriter/rules/index_join_rule.cpp	2013-03-05 17:23:18 +0000
+++ src/compiler/rewriter/rules/index_join_rule.cpp	2013-03-16 20:25:24 +0000
@@ -421,8 +421,7 @@
   RootTypeManager& rtm = GENV_TYPESYSTEM;
 
   // Make sure that the inner loop var has a domain expression
-  if (predInfo.theInnerVar->get_kind() != var_expr::for_var &&
-      predInfo.theInnerVar->get_kind() != var_expr::pos_var)
+  if (predInfo.theInnerVar->get_kind() != var_expr::for_var)
     return false;
 
   if (predInfo.theInnerVar->get_flwor_clause() ==
@@ -431,6 +430,9 @@
 
   forlet_clause* innerVarClause = predInfo.theInnerVar->get_forlet_clause();
 
+  if (innerVarClause->get_pos_var() != NULL)
+    return false;
+
   // The inner var must not be an outer FOR var
   if (innerVarClause->is_allowing_empty())
     return false;

=== added file 'test/rbkt/ExpQueryResults/zorba/hashjoins/no_idx4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/hashjoins/no_idx4.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/hashjoins/no_idx4.xml.res	2013-03-16 20:25:24 +0000
@@ -0,0 +1,1 @@
+3 7

=== added file 'test/rbkt/Queries/zorba/hashjoins/no_idx4.xq'
--- test/rbkt/Queries/zorba/hashjoins/no_idx4.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/hashjoins/no_idx4.xq	2013-03-16 20:25:24 +0000
@@ -0,0 +1,9 @@
+
+let $values := (3, 3, 5, 6, 7, 7, 7)
+
+return $values[(for $val at $pos in $values where $val eq . return $pos)[2]]
+
+(:
+return $values[index-of($values, .)[2]]
+:)
+

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to