server/msplanner.py
branchstable
changeset 5420 09b50d7e5321
parent 5168 1ab032df5ca3
child 5421 8167de96c523
equal deleted inserted replaced
5419:0b7805928a27 5420:09b50d7e5321
   348                         # query
   348                         # query
   349                         if not varobj._q_invariant and any(ifilterfalse(
   349                         if not varobj._q_invariant and any(ifilterfalse(
   350                             source.support_relation, (r.r_type for r in rels))):
   350                             source.support_relation, (r.r_type for r in rels))):
   351                             self.needsplit = True
   351                             self.needsplit = True
   352         # add source for rewritten constants to sourcesterms
   352         # add source for rewritten constants to sourcesterms
       
   353         self._const_vars = {}
   353         for vconsts in self.rqlst.stinfo['rewritten'].itervalues():
   354         for vconsts in self.rqlst.stinfo['rewritten'].itervalues():
   354             const = vconsts[0]
   355             # remember those consts come from the same variable
       
   356             for const in vconsts:
       
   357                 self._const_vars[const] = vconsts
   355             source = self._session.source_from_eid(const.eval(self.plan.args))
   358             source = self._session.source_from_eid(const.eval(self.plan.args))
   356             if source is self.system_source:
   359             if source is self.system_source:
   357                 for const in vconsts:
   360                 for const in vconsts:
   358                     self._set_source_for_term(source, const)
   361                     self._set_source_for_term(source, const)
   359             elif not self._sourcesterms:
   362             elif not self._sourcesterms:
   535                 invalid_sources = frozenset((s, solidx) for s, solidx in invalid_sources
   538                 invalid_sources = frozenset((s, solidx) for s, solidx in invalid_sources
   536                                             if not (s in self._crossrelations and
   539                                             if not (s in self._crossrelations and
   537                                                     rel in self._crossrelations[s]))
   540                                                     rel in self._crossrelations[s]))
   538         if invalid_sources:
   541         if invalid_sources:
   539             self._remove_sources(term, invalid_sources)
   542             self._remove_sources(term, invalid_sources)
       
   543             # if term is a rewritten const, we can apply the same changes to
       
   544             # all other consts inserted from the same original variable
       
   545             for const in self._const_vars.get(term, ()):
       
   546                 if const is not term:
       
   547                     self._remove_sources(const, invalid_sources)
   540             termsources -= invalid_sources
   548             termsources -= invalid_sources
   541             self._remove_sources_until_stable(term, termssources)
   549             self._remove_sources_until_stable(term, termssources)
   542             if isinstance(oterm, Constant):
   550             if isinstance(oterm, Constant):
   543                 self._remove_sources(oterm, invalid_sources)
   551                 self._remove_sources(oterm, invalid_sources)
   544 
   552