cubicweb/server/ssplanner.py
branch3.25
changeset 12228 8fa3131583ec
parent 11767 432f87a63057
child 12248 6350e0a482d5
equal deleted inserted replaced
12217:6ab1793f6f83 12228:8fa3131583ec
    22 from rql.stmts import Union, Select
    22 from rql.stmts import Union, Select
    23 from rql.nodes import Constant, Relation
    23 from rql.nodes import Constant, Relation
    24 
    24 
    25 from cubicweb import QueryError
    25 from cubicweb import QueryError
    26 from cubicweb.schema import VIRTUAL_RTYPES
    26 from cubicweb.schema import VIRTUAL_RTYPES
    27 from cubicweb.rqlrewrite import add_types_restriction
    27 from cubicweb.rqlrewrite import add_types_restriction, RQLRelationRewriter
    28 from cubicweb.server.edition import EditedEntity
    28 from cubicweb.server.edition import EditedEntity
    29 
    29 
    30 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
    30 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
    31 
    31 
    32 _CONSTANT = object()
    32 _CONSTANT = object()
   294     def _select_plan(self, plan, select, solutions):
   294     def _select_plan(self, plan, select, solutions):
   295         union = Union()
   295         union = Union()
   296         union.append(select)
   296         union.append(select)
   297         select.clean_solutions(solutions)
   297         select.clean_solutions(solutions)
   298         add_types_restriction(self.schema, select)
   298         add_types_restriction(self.schema, select)
       
   299         # Rewrite computed relations
       
   300         rewriter = RQLRelationRewriter(plan.cnx)
       
   301         rewriter.rewrite(union, plan.args)
   299         self.rqlhelper.annotate(union)
   302         self.rqlhelper.annotate(union)
   300         return self.build_select_plan(plan, union)
   303         return self.build_select_plan(plan, union)
   301 
   304 
   302 
   305 
   303 # execution steps and helper functions ########################################
   306 # execution steps and helper functions ########################################