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

Commit message:
an optimization on the fix for bug #1172331

Requested reviews:
  Markos Zaharioudakis (markos-za)

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

an optimization on the fix for bug #1172331
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/160868
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/codegen/plan_visitor.cpp'
--- src/compiler/codegen/plan_visitor.cpp	2013-04-24 18:01:51 +0000
+++ src/compiler/codegen/plan_visitor.cpp	2013-04-25 11:58:30 +0000
@@ -1603,9 +1603,20 @@
 
         PlanIter_t winVarIter = pop_itstack();
 
-        treatIter = new TreatIterator(sctx, qloc, winVarIter,
+        bool checkPrime = true;
+
+        xqtref_t varPType = TypeOps::prime_type(tm, *varType);
+        xqtref_t domainPType = TypeOps::prime_type(tm, *domainType);
+
+        if (TypeOps::is_subtype(tm, *domainPType, *varPType, qloc))
+        {
+          checkPrime = false;
+        }
+
+        treatIter = new TreatIterator(sctx, qloc,
+                                      winVarIter,
                                       varType,
-                                      true,
+                                      checkPrime,
                                       TREAT_TYPE_MATCH,
                                       NULL);
       }

=== modified file 'src/compiler/expression/flwor_expr.cpp'
--- src/compiler/expression/flwor_expr.cpp	2013-04-24 18:01:51 +0000
+++ src/compiler/expression/flwor_expr.cpp	2013-04-25 11:58:30 +0000
@@ -92,31 +92,6 @@
   if (theVarExpr != NULL)
   {
     theVarExpr->set_flwor_clause(this);
-
-#if 0
-    if (theKind == window_clause && theVarExpr->get_type() != NULL)
-    {
-      RootTypeManager& rtm = GENV_TYPESYSTEM;
-      TypeManager* tm = theVarExpr->get_type_manager();
-
-      const QueryLoc& loc = theVarExpr->get_loc();
-
-      xqtref_t varType = theVarExpr->get_type();
-      xqtref_t domainType = theDomainExpr->get_return_type();
-
-      if (!TypeOps::is_subtype(tm, *rtm.ITEM_TYPE_STAR, *varType, loc) &&
-          !TypeOps::is_subtype(tm, *domainType, *varType, loc))
-      {
-        theDomainExpr = theCCB->theEM->
-        create_treat_expr(theDomainExpr->get_sctx(),
-                          theDomainExpr->get_udf(),
-                          theDomainExpr->get_loc(),
-                          theDomainExpr,
-                          varType,
-                          TREAT_TYPE_MATCH);
-      }
-    }
-#endif
   }
 }
 
@@ -305,35 +280,6 @@
 
   if (winKind == tumbling_window)
     theLazyEval = true;
-
-#if 0
-  if (varExpr != NULL && sctx != NULL)
-  {
-    RootTypeManager& rtm = GENV_TYPESYSTEM;
-    TypeManager* tm = sctx->get_typemanager();
-
-    xqtref_t varType = varExpr->get_type();
-
-    if (varType != NULL)
-    {
-      xqtref_t domainType = domainExpr->get_return_type();
-
-      if (!TypeOps::is_subtype(tm, *rtm.ITEM_TYPE_STAR, *varType, loc) &&
-          !TypeOps::is_subtype(tm, *domainType, *varType, loc))
-      {
-        domainExpr = theCCB->theEM->
-        create_treat_expr(sctx,
-                          domainExpr->get_udf(),
-                          loc,
-                          domainExpr,
-                          varType,
-                          TREAT_TYPE_MATCH);
-
-        set_expr(domainExpr);
-      }
-    }
-  }
-#endif
 }
 
 

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