Esempio n. 1
0
        private static bool HasVarReferencesShallow(
            System.Data.Entity.Core.Query.InternalTrees.Node node,
            VarVec vars,
            int childIndex,
            out bool continueUp)
        {
            switch (node.Op.OpType)
            {
            case OpType.Project:
                continueUp = false;
                return(VarRefManager.HasVarReferences(((ProjectOp)node.Op).Outputs, vars));

            case OpType.Sort:
            case OpType.ConstrainedSort:
                continueUp = true;
                return(VarRefManager.HasVarReferences(((SortBaseOp)node.Op).Keys, vars));

            case OpType.GroupBy:
                continueUp = false;
                return(VarRefManager.HasVarReferences(((GroupByBaseOp)node.Op).Keys, vars));

            case OpType.UnionAll:
            case OpType.Intersect:
            case OpType.Except:
                continueUp = false;
                return(VarRefManager.HasVarReferences((SetOp)node.Op, vars, childIndex));

            case OpType.Distinct:
                continueUp = false;
                return(VarRefManager.HasVarReferences(((DistinctOp)node.Op).Keys, vars));

            case OpType.PhysicalProject:
                continueUp = false;
                return(VarRefManager.HasVarReferences(((PhysicalProjectOp)node.Op).Outputs, vars));

            default:
                continueUp = true;
                return(false);
            }
        }
Esempio n. 2
0
 internal bool HasKeyReferences(VarVec keys, System.Data.Entity.Core.Query.InternalTrees.Node definingNode, System.Data.Entity.Core.Query.InternalTrees.Node targetJoinNode)
 {
     System.Data.Entity.Core.Query.InternalTrees.Node key = definingNode;
     System.Data.Entity.Core.Query.InternalTrees.Node node;
     for (bool continueUp = true; continueUp& this.m_nodeToParentMap.TryGetValue(key, out node); key = node)
     {
         if (node != targetJoinNode)
         {
             if (VarRefManager.HasVarReferencesShallow(node, keys, this.m_nodeToSiblingNumber[key], out continueUp))
             {
                 return(true);
             }
             for (int index = this.m_nodeToSiblingNumber[key] + 1; index < node.Children.Count; ++index)
             {
                 if (node.Children[index].GetNodeInfo(this.m_command).ExternalReferences.Overlaps(keys))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 3
0
 private JoinElimination(PlanCompiler compilerState)
 {
     m_compilerState = compilerState;
     m_varRemapper = new VarRemapper(m_compilerState.Command);
     m_varRefManager = new VarRefManager(m_compilerState.Command);
 }
Esempio n. 4
0
 private JoinElimination(PlanCompiler compilerState)
 {
     m_compilerState = compilerState;
     m_varRemapper   = new VarRemapper(m_compilerState.Command);
     m_varRefManager = new VarRefManager(m_compilerState.Command);
 }
Esempio n. 5
0
 private JoinElimination(System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler compilerState)
 {
     this.m_compilerState = compilerState;
     this.m_varRemapper   = new VarRemapper(this.m_compilerState.Command);
     this.m_varRefManager = new VarRefManager(this.m_compilerState.Command);
 }