Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/gen-flwor-opt 
into lp:zorba.

Commit message:
1, Implemented document-ordering elimination for general FLWOR.
2. No need to apply document ordering on the domain expression of a FOR clause, 
if the FOR clause is followed by an orderby or groupby clause.
3. Must apply document ordering on the domain expression of a FOR clause, if 
the FOR clause is followed by a sequential clause.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/gen-flwor-opt/+merge/165266

1, Implemented document-ordering elimination for general FLWOR.
2. No need to apply document ordering on the domain expression of a FOR clause, 
if the FOR clause is followed by an orderby or groupby clause.
3. Must apply document ordering on the domain expression of a FOR clause, if 
the FOR clause is followed by a sequential clause.
-- 
https://code.launchpad.net/~zorba-coders/zorba/gen-flwor-opt/+merge/165266
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/rewriter/rules/fold_rules.cpp'
--- src/compiler/rewriter/rules/fold_rules.cpp	2013-05-08 20:14:47 +0000
+++ src/compiler/rewriter/rules/fold_rules.cpp	2013-05-22 23:06:33 +0000
@@ -746,7 +746,8 @@
       }
     }
 
-    if (arg->get_expr_kind() == flwor_expr_kind)
+    if (arg->get_expr_kind() == flwor_expr_kind ||
+        arg->get_expr_kind() == gflwor_expr_kind)
     {
       bool modified = false;
       expr* newArg = partial_eval_return_clause(static_cast<flwor_expr*>(arg),
@@ -1021,7 +1022,8 @@
     }
   }
 
-  if (returnExpr->get_expr_kind() == flwor_expr_kind)
+  if (returnExpr->get_expr_kind() == flwor_expr_kind ||
+      returnExpr->get_expr_kind() == gflwor_expr_kind)
   {
     expr* newRet =
     partial_eval_return_clause(static_cast<flwor_expr*>(returnExpr),  modified, rCtx);

=== modified file 'src/compiler/rewriter/rules/type_rules.cpp'
--- src/compiler/rewriter/rules/type_rules.cpp	2013-02-07 17:24:36 +0000
+++ src/compiler/rewriter/rules/type_rules.cpp	2013-05-22 23:06:33 +0000
@@ -20,7 +20,6 @@
 #include "types/root_typemanager.h"
 #include "types/typeops.h"
 
-#include "compiler/expression/flwor_expr.h"
 #include "compiler/expression/expr_iter.h"
 #include "compiler/expression/expr.h"
 
@@ -445,46 +444,6 @@
       }
     }
   }
-#if 0
-  else if (node->get_expr_kind() == flwor_expr_kind ||
-           node->get_expr_kind() == gflwor_expr_kind)
-  {
-    flwor_expr* flworExpr = static_cast<flwor_expr*>(node);
-
-    bool modified = false;
-
-    csize numClauses = flworExpr->num_clauses();
-    for (csize i = 0; i < numClauses; ++i)
-    {
-      if (flworExpr->get_clause(i)->get_kind() == flwor_clause::order_clause)
-      {
-        orderby_clause* obc =
-        static_cast<orderby_clause*>(flworExpr->get_clause(i));
-
-        csize numColumns = obc->num_columns();
-        for (csize j = 0; j < numColumns; ++j)
-        {
-          expr* colExpr = obc->get_column_expr(j);
-          xqtref_t colType = colExpr->get_return_type();
-          const QueryLoc& colLoc = colExpr->get_loc();
-
-          if (!TypeOps::is_equal(tm, *colType, *rtm.EMPTY_TYPE, colLoc) &&
-              TypeOps::is_subtype(tm, *colType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, colLoc))
-          {
-            expr* castExpr = rCtx.theEM->
-            create_cast_expr(sctx, udf, colLoc, colExpr, rtm.STRING_TYPE_QUESTION);
-
-            obc->set_column_expr(j, castExpr);
-            modified = true;
-          }
-        }
-      }
-    }
-
-    if (modified)
-      return node;
-  }
-#endif
 
   return NULL;
 }

-- 
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