239 instantiations of Node
System.Data.Entity (239)
System\Data\Query\InternalTrees\Command.cs (2)
583return new Node(m_nextNodeId++, op, new List<Node>(args)); 594return new Node(m_nextNodeId++, op, args);
System\Data\Query\PlanCompiler\TransformationRules.cs (237)
1061new PatternMatchRule(new Node(ComparisonOp.PatternEq, 1062new Node(InternalConstantOp.Pattern), 1063new Node(InternalConstantOp.Pattern)), 1124new PatternMatchRule(new Node(LikeOp.Pattern, 1125new Node(InternalConstantOp.Pattern), 1126new Node(InternalConstantOp.Pattern), 1127new Node(NullOp.Pattern)), 1153new PatternMatchRule(new Node(ConditionalOp.PatternAnd, 1154new Node(LeafOp.Pattern), 1155new Node(ConstantPredicateOp.Pattern)), 1158new PatternMatchRule(new Node(ConditionalOp.PatternAnd, 1159new Node(ConstantPredicateOp.Pattern), 1160new Node(LeafOp.Pattern)), 1163new PatternMatchRule(new Node(ConditionalOp.PatternOr, 1164new Node(LeafOp.Pattern), 1165new Node(ConstantPredicateOp.Pattern)), 1168new PatternMatchRule(new Node(ConditionalOp.PatternOr, 1169new Node(ConstantPredicateOp.Pattern), 1170new Node(LeafOp.Pattern)), 1173new PatternMatchRule(new Node(ConditionalOp.PatternNot, 1174new Node(ConstantPredicateOp.Pattern)), 1241new PatternMatchRule(new Node(ConditionalOp.PatternIsNull, 1242new Node(InternalConstantOp.Pattern)), 1245new PatternMatchRule(new Node(ConditionalOp.PatternIsNull, 1246new Node(NullSentinelOp.Pattern)), 1265new PatternMatchRule(new Node(ConditionalOp.PatternIsNull, 1266new Node(NullOp.Pattern)), 1284new Node(CastOp.Pattern, 1285new Node(NullOp.Pattern)), 1305new PatternMatchRule(new Node(ConditionalOp.PatternIsNull, 1306new Node(VarRefOp.Pattern)), 1418new PatternMatchRule(new Node(FilterOp.Pattern, 1419new Node(FilterOp.Pattern, 1420new Node(LeafOp.Pattern), 1421new Node(LeafOp.Pattern)), 1422new Node(LeafOp.Pattern)), 1444new PatternMatchRule(new Node(FilterOp.Pattern, 1445new Node(ProjectOp.Pattern, 1446new Node(LeafOp.Pattern), 1447new Node(LeafOp.Pattern)), 1448new Node(LeafOp.Pattern)), 1509new PatternMatchRule(new Node(FilterOp.Pattern, 1510new Node(UnionAllOp.Pattern, 1511new Node(LeafOp.Pattern), 1512new Node(LeafOp.Pattern)), 1513new Node(LeafOp.Pattern)), 1516new PatternMatchRule(new Node(FilterOp.Pattern, 1517new Node(IntersectOp.Pattern, 1518new Node(LeafOp.Pattern), 1519new Node(LeafOp.Pattern)), 1520new Node(LeafOp.Pattern)), 1523new PatternMatchRule(new Node(FilterOp.Pattern, 1524new Node(ExceptOp.Pattern, 1525new Node(LeafOp.Pattern), 1526new Node(LeafOp.Pattern)), 1527new Node(LeafOp.Pattern)), 1627new PatternMatchRule(new Node(FilterOp.Pattern, 1628new Node(DistinctOp.Pattern, 1629new Node(LeafOp.Pattern)), 1630new Node(LeafOp.Pattern)), 1681new PatternMatchRule(new Node(FilterOp.Pattern, 1682new Node(GroupByOp.Pattern, 1683new Node(LeafOp.Pattern), 1684new Node(LeafOp.Pattern), 1685new Node(LeafOp.Pattern)), 1686new Node(LeafOp.Pattern)), 1764new PatternMatchRule(new Node(FilterOp.Pattern, 1765new Node(CrossJoinOp.Pattern, 1766new Node(LeafOp.Pattern), 1767new Node(LeafOp.Pattern)), 1768new Node(LeafOp.Pattern)), 1771new PatternMatchRule(new Node(FilterOp.Pattern, 1772new Node(InnerJoinOp.Pattern, 1773new Node(LeafOp.Pattern), 1774new Node(LeafOp.Pattern), 1775new Node(LeafOp.Pattern)), 1776new Node(LeafOp.Pattern)), 1779new PatternMatchRule(new Node(FilterOp.Pattern, 1780new Node(LeftOuterJoinOp.Pattern, 1781new Node(LeafOp.Pattern), 1782new Node(LeafOp.Pattern), 1783new Node(LeafOp.Pattern)), 1784new Node(LeafOp.Pattern)), 1941new PatternMatchRule(new Node(FilterOp.Pattern, 1942new Node(OuterApplyOp.Pattern, 1943new Node(LeafOp.Pattern), 1944new Node(LeafOp.Pattern)), 1945new Node(LeafOp.Pattern)), 1986new PatternMatchRule(new Node(FilterOp.Pattern, 1987new Node(LeafOp.Pattern), 1988new Node(ConstantPredicateOp.Pattern)), 2095new PatternMatchRule(new Node(ProjectOp.Pattern, 2096new Node(ProjectOp.Pattern, 2097new Node(LeafOp.Pattern), 2098new Node(LeafOp.Pattern)), 2099new Node(LeafOp.Pattern)), 2171new PatternMatchRule(new Node(ProjectOp.Pattern, 2172new Node(LeafOp.Pattern), 2173new Node(VarDefListOp.Pattern)), 2411new PatternMatchRule(new Node(CrossApplyOp.Pattern, 2412new Node(LeafOp.Pattern), 2413new Node(FilterOp.Pattern, 2414new Node(LeafOp.Pattern), 2415new Node(LeafOp.Pattern))), 2418new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2419new Node(LeafOp.Pattern), 2420new Node(FilterOp.Pattern, 2421new Node(LeafOp.Pattern), 2422new Node(LeafOp.Pattern))), 2473new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2474new Node(LeafOp.Pattern), 2475new Node(ProjectOp.Pattern, 2476new Node(FilterOp.Pattern, 2477new Node(LeafOp.Pattern), 2478new Node(LeafOp.Pattern)), 2479new Node(VarDefListOp.Pattern, 2480new Node(VarDefOp.Pattern, 2481new Node(InternalConstantOp.Pattern))))), 2485new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2486new Node(LeafOp.Pattern), 2487new Node(ProjectOp.Pattern, 2488new Node(FilterOp.Pattern, 2489new Node(LeafOp.Pattern), 2490new Node(LeafOp.Pattern)), 2491new Node(VarDefListOp.Pattern, 2492new Node(VarDefOp.Pattern, 2493new Node(NullSentinelOp.Pattern))))), 2623new PatternMatchRule(new Node(CrossApplyOp.Pattern, 2624new Node(LeafOp.Pattern), 2625new Node(ProjectOp.Pattern, 2626new Node(LeafOp.Pattern), 2627new Node(LeafOp.Pattern))), 2662new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2663new Node(LeafOp.Pattern), 2664new Node(ProjectOp.Pattern, 2665new Node(LeafOp.Pattern), 2666new Node(LeafOp.Pattern))), 2807new PatternMatchRule(new Node(CrossApplyOp.Pattern, 2808new Node(LeafOp.Pattern), 2809new Node(LeafOp.Pattern)), 2812new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2813new Node(LeafOp.Pattern), 2814new Node(LeafOp.Pattern)), 2895new PatternMatchRule(new Node(CrossApplyOp.Pattern, 2896new Node(LeafOp.Pattern), 2897new Node(LeafOp.Pattern)), 2900new PatternMatchRule(new Node(OuterApplyOp.Pattern, 2901new Node(LeafOp.Pattern), 2902new Node(LeafOp.Pattern)), 3285new PatternMatchRule(new Node(CrossApplyOp.Pattern, 3286new Node(LeafOp.Pattern), 3287new Node(LeftOuterJoinOp.Pattern, 3288new Node(SingleRowTableOp.Pattern), 3289new Node(LeafOp.Pattern), 3290new Node(ConstantPredicateOp.Pattern))), 3344new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3345new Node(LeafOp.Pattern), 3346new Node(ProjectOp.Pattern, 3347new Node(LeafOp.Pattern), 3348new Node(LeafOp.Pattern))), 3351new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3352new Node(ProjectOp.Pattern, 3353new Node(LeafOp.Pattern), 3354new Node(LeafOp.Pattern)), 3355new Node(LeafOp.Pattern)), 3358new PatternMatchRule(new Node(InnerJoinOp.Pattern, 3359new Node(LeafOp.Pattern), 3360new Node(ProjectOp.Pattern, 3361new Node(LeafOp.Pattern), 3362new Node(LeafOp.Pattern)), 3363new Node(LeafOp.Pattern)), 3366new PatternMatchRule(new Node(InnerJoinOp.Pattern, 3367new Node(ProjectOp.Pattern, 3368new Node(LeafOp.Pattern), 3369new Node(LeafOp.Pattern)), 3370new Node(LeafOp.Pattern), 3371new Node(LeafOp.Pattern)), 3374new PatternMatchRule(new Node(LeftOuterJoinOp.Pattern, 3375new Node(ProjectOp.Pattern, 3376new Node(LeafOp.Pattern), 3377new Node(LeafOp.Pattern)), 3378new Node(LeafOp.Pattern), 3379new Node(LeafOp.Pattern)), 3497new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3498new Node(LeafOp.Pattern), 3499new Node(FilterOp.Pattern, 3500new Node(LeafOp.Pattern), 3501new Node(LeafOp.Pattern))), 3504new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3505new Node(FilterOp.Pattern, 3506new Node(LeafOp.Pattern), 3507new Node(LeafOp.Pattern)), 3508new Node(LeafOp.Pattern)), 3511new PatternMatchRule(new Node(InnerJoinOp.Pattern, 3512new Node(LeafOp.Pattern), 3513new Node(FilterOp.Pattern, 3514new Node(LeafOp.Pattern), 3515new Node(LeafOp.Pattern)), 3516new Node(LeafOp.Pattern)), 3519new PatternMatchRule(new Node(InnerJoinOp.Pattern, 3520new Node(FilterOp.Pattern, 3521new Node(LeafOp.Pattern), 3522new Node(LeafOp.Pattern)), 3523new Node(LeafOp.Pattern), 3524new Node(LeafOp.Pattern)), 3527new PatternMatchRule(new Node(LeftOuterJoinOp.Pattern, 3528new Node(FilterOp.Pattern, 3529new Node(LeafOp.Pattern), 3530new Node(LeafOp.Pattern)), 3531new Node(LeafOp.Pattern), 3532new Node(LeafOp.Pattern)), 3619new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3620new Node(SingleRowTableOp.Pattern), 3621new Node(LeafOp.Pattern)), 3624new PatternMatchRule(new Node(CrossJoinOp.Pattern, 3625new Node(LeafOp.Pattern), 3626new Node(SingleRowTableOp.Pattern)), 3630new PatternMatchRule(new Node(LeftOuterJoinOp.Pattern, 3631new Node(LeafOp.Pattern), 3632new Node(SingleRowTableOp.Pattern), 3633new Node(LeafOp.Pattern)), 3692new PatternMatchRule(new Node(SingleRowOp.Pattern, 3693new Node(LeafOp.Pattern)), 3738new PatternMatchRule(new Node(SingleRowOp.Pattern, 3739new Node(ProjectOp.Pattern, 3740new Node(LeafOp.Pattern), new Node(LeafOp.Pattern))), 3953new PatternMatchRule(new Node(GroupByOp.Pattern, 3954new Node(ProjectOp.Pattern, 3955new Node(LeafOp.Pattern), 3956new Node(LeafOp.Pattern)), 3957new Node(LeafOp.Pattern), 3958new Node(LeafOp.Pattern)), 4156new PatternMatchRule(new Node(GroupByOp.Pattern, 4157new Node(LeafOp.Pattern), 4158new Node(LeafOp.Pattern), 4159new Node(VarDefListOp.Pattern)),
2303 references to Node
System.Data.Entity (2303)
System\Data\Mapping\FunctionImportMappingComposable.cs (20)
82private Node m_internalTreeNode; 94internal Node GetInternalTree(Command targetIqtCommand, IList<Node> targetIqtArguments) 109var rootProject = itree.Root; // PhysicalProject(RelInput) 113var rootInput = rootProject.Child0; // the RelInput in PhysicalProject(RelInput) 119Node relNode = rootInput; 131Node varRefNode = itree.CreateNode(itree.CreateVarRefOp(relVar)); 132Node castNode = itree.CreateNode(itree.CreateSoftCastOp(expectedElementType), varRefNode); 133Node varDefListNode = itree.CreateVarDefListNode(castNode, out relVar); 146Dictionary<string, Node> viewArguments = new Dictionary<string, Node>(m_commandParameters.Length); 150var argumentNode = targetIqtArguments[i]; 172private Dictionary<string, Node> m_viewArguments; 174private FunctionViewOpCopier(Command cmd, Dictionary<string, Node> viewArguments) 180internal static Node Copy(Command cmd, Node viewNode, Dictionary<string, Node> viewArguments) 186public override Node Visit(VarRefOp op, Node n) 195Node argNode;
System\Data\Mapping\ViewGeneration\GeneratedView.cs (2)
172private Node m_internalTreeNode; //we cache IQTs for Query Views since that is the one query stack works of. 206internal Node GetInternalTree(Command targetIqtCommand)
System\Data\Query\InternalTrees\AncillaryOps.cs (4)
53internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 62internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 88internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 97internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }
System\Data\Query\InternalTrees\Command.cs (68)
33private Node m_root; 98internal Node Root { get { return m_root; } set { m_root = value; } } 528internal Node CreateNode(Op op) 530return this.CreateNode(op, new List<Node>()); 539internal Node CreateNode(Op op, Node arg1) 541List<Node> l = new List<Node>(); 553internal Node CreateNode(Op op, Node arg1, Node arg2) 555List<Node> l = new List<Node>(); 568internal Node CreateNode(Op op, Node arg1, Node arg2, Node arg3) 570List<Node> l = new List<Node>(); 581internal Node CreateNode(Op op, IList<Node> args) 583return new Node(m_nextNodeId++, op, new List<Node>(args)); 592internal Node CreateNode(Op op, List<Node> args) 1058internal Node CreateVarDefNode(Node definingExpr, out Var computedVar) 1065Node varDefNode = this.CreateNode(varDefOp, definingExpr); 1076internal Node CreateVarDefListNode(Node definingExpr, out Var computedVar) 1078Node varDefNode = this.CreateVarDefNode(definingExpr, out computedVar); 1080Node varDefListNode = this.CreateNode(op, varDefNode); 1515internal NodeInfo GetNodeInfo(Node n) 1525internal ExtendedNodeInfo GetExtendedNodeInfo(Node n) 1533internal void RecomputeNodeInfo(Node n) 1545internal KeyVec PullupKeys(Node n) 1599IList<Node> inputNodes, IList<Var> inputVars, 1600out Node resultNode, out IList<Var> resultVars) 1621Node unionAllNode = inputNodes[0]; 1655internal void BuildUnionAllLadder(IList<Node> inputNodes, IList<Var> inputVars, 1656out Node resultNode, out Var resultVar) 1681internal Node BuildProject(Node inputNode, IEnumerable<Var> inputVars, 1682IEnumerable<Node> computedExpressions) 1687Node varDefListNode = this.CreateNode(varDefListOp); 1689foreach (Node expr in computedExpressions) 1694Node varDefNode = this.CreateNode(varDefOp, expr); 1697Node projectNode = this.CreateNode( 1714internal Node BuildProject(Node input, Node computedExpression, out Var projectVar) 1716Node projectNode = BuildProject(input, new Var[] { }, new Node[] { computedExpression }); 1738internal void BuildOfTypeTree(Node inputNode, Var inputVar, TypeUsage desiredType, bool includeSubtypes, 1739out Node resultNode, out Var resultVar) 1742Node predicate = this.CreateNode(isOfOp, this.CreateNode(this.CreateVarRefOp(inputVar))); 1743Node filterNode = this.CreateNode(this.CreateFilterOp(), inputNode, predicate); 1756internal Node BuildFakeTreatProject(Node inputNode, Var inputVar, TypeUsage desiredType, out Var resultVar) 1758Node treatNode = this.CreateNode(this.CreateFakeTreatOp(desiredType), 1760Node resultNode = this.BuildProject(inputNode, treatNode, out resultVar); 1772internal Node BuildComparison(OpType opType, Node arg0, Node arg1) 1787Node newNode = this.CreateNode(this.CreateComparisonOp(opType), arg0, arg1); 1797internal Node BuildCollect(Node relOpNode, Var relOpVar) 1799Node physicalProjectNode = this.CreateNode(this.CreatePhysicalProjectOp(relOpVar), relOpNode); 1801Node collectNode = this.CreateNode(this.CreateCollectOp(collectOpType), physicalProjectNode);
System\Data\Query\InternalTrees\Dump.cs (34)
75static internal string ToXml(Command itree, Node subtree) { 157protected override void VisitDefault(Node n) { 163protected override void VisitScalarOpDefault(ScalarOp op, Node n) { 166foreach (Node chi in n.Children) { 174protected override void VisitJoinOp(JoinBaseOp op, Node n) { 190public override void Visit(CaseOp op, Node n) { 211public override void Visit(CollectOp op, Node n) { 217protected override void VisitConstantOp(ConstantBaseOp op, Node n) { 232public override void Visit(DistinctOp op, Node n) { 252protected override void VisitGroupByOp(GroupByBaseOp op, Node n) { 277public override void Visit(IsOfOp op, Node n) 282foreach (Node chi in n.Children) 291protected override void VisitNestOp(NestBaseOp op, Node n) { 369private void VisitNewOp(Op op, Node n) { 371foreach (Node chi in n.Children) { 378public override void Visit(NewEntityOp op, Node n) { 381public override void Visit(NewInstanceOp op, Node n) { 385public override void Visit(DiscriminatedNewEntityOp op, Node n) { 389public override void Visit(NewMultisetOp op, Node n) { 393public override void Visit(NewRecordOp op, Node n) { 397public override void Visit(PhysicalProjectOp op, Node n) { 413public override void Visit(ProjectOp op, Node n) { 425public override void Visit(PropertyOp op, Node n) { 432public override void Visit(RelPropertyOp op, Node n) { 445public override void Visit(ScanTableOp op, Node n) { 453public override void Visit(ScanViewOp op, Node n) { 460protected override void VisitSetOp(SetOp op, Node n) { 475foreach (Node chi in n.Children) { 486public override void Visit(SortOp op, Node n) { 492public override void Visit(ConstrainedSortOp op, Node n) { 500protected override void VisitSortOp(SortBaseOp op, Node n) 516public override void Visit(UnnestOp op, Node n) { 527public override void Visit(VarDefOp op, Node n) { 536public override void Visit(VarRefOp op, Node n) {
System\Data\Query\InternalTrees\NodeCounter.cs (3)
29internal static int Count(Node subTree) 41protected override int VisitDefault(Node n) 44foreach (Node child in n.Children)
System\Data\Query\InternalTrees\NodeInfo.cs (36)
167internal virtual void ComputeHashValue(Command cmd, Node n) 170foreach (Node chi in n.Children) 262internal override void ComputeHashValue(Command cmd, Node n) 352internal void RecomputeNodeInfo(Node n) 378private NodeInfo GetNodeInfo(Node n) 382private ExtendedNodeInfo GetExtendedNodeInfo(Node n) 386private NodeInfo InitNodeInfo(Node n) 392private ExtendedNodeInfo InitExtendedNodeInfo(Node n) 407protected override NodeInfo VisitDefault(Node n) 414foreach (Node chi in n.Children) 429private bool IsDefinitionNonNullable(Node definition, VarVec nonNullableInputs) 455public override NodeInfo Visit(VarRefOp op, Node n) 465protected override NodeInfo VisitRelOpDefault(RelOp op, Node n) 481protected override NodeInfo VisitTableOp(ScanTableBaseOp op, Node n) 516public override NodeInfo Visit(UnnestOp op, Node n) 562internal static Dictionary<Var, Var> ComputeVarRemappings(Node varDefListNode) 567foreach (Node varDefNode in varDefListNode.Children) 594public override NodeInfo Visit(ProjectOp op, Node n) 620foreach (Node chi in n.Child1.Children) 677public override NodeInfo Visit(FilterOp op, Node n) 734protected override NodeInfo VisitGroupByOp(GroupByBaseOp op, Node n) 747foreach (Node chi in n.Child1.Children) 764foreach (Node chi in n.Children[i].Children) 798public override NodeInfo Visit(CrossJoinOp op, Node n) 810foreach (Node chi in n.Children) 858protected override NodeInfo VisitJoinOp(JoinBaseOp op, Node n) 953protected override NodeInfo VisitApplyOp(ApplyBaseOp op, Node n) 1011protected override NodeInfo VisitSetOp(SetOp op, Node n) 1131protected override NodeInfo VisitSortOp(SortBaseOp op, Node n) 1183public override NodeInfo Visit(DistinctOp op, Node n) 1228public override NodeInfo Visit(SingleRowOp op, Node n) 1249public override NodeInfo Visit(SingleRowTableOp op, Node n) 1273public override NodeInfo Visit(PhysicalProjectOp op, Node n) 1276foreach (Node chi in n.Children) 1318protected override NodeInfo VisitNestOp(NestBaseOp op, Node n) 1330foreach (Node chi in n.Children)
System\Data\Query\InternalTrees\Nodes.cs (10)
26private List<Node> m_children; 41internal Node(int nodeId, Op op, List<Node> children) 54internal Node(Op op, params Node[] children) 55: this(-1, op, new List<Node>(children)) 69internal List<Node> Children { get { return m_children; } } 79internal Node Child0 { get { return m_children[0]; } set { m_children[0] = value; } } 88internal Node Child1 { get { return m_children[1]; } set { m_children[1] = value; } } 97internal Node Child2 { get { return m_children[2]; } set { m_children[2] = value; } } 101internal Node Child3 { get { return m_children[3]; } /* commented out because of fxcop - there are no upstream callers -- set { m_children[3] = value; }*/ } 117internal bool IsEquivalent(Node other)
System\Data\Query\InternalTrees\OpCopier.cs (152)
26internal static Node Copy(Command cmd, Node n) 41internal static Node Copy(Command cmd, Node node, VarList varList, out VarList newVarList) 44Node newNode = Copy(cmd, node, out varMap); 54internal static Node Copy(Command cmd, Node n, out VarMap varMap) 57Node newNode = oc.CopyNode(n); 239protected Node CopyNode(Node n) 241return n.Op.Accept<Node>(this, n); 249private List<Node> ProcessChildren(Node n) 251List<Node> children = new List<Node>(); 252foreach (Node chi in n.Children) 265private Node CopyDefault(Op op, Node original) 280public override Node Visit(Op op, Node n) 293public override Node Visit(ConstantOp op, Node n) 305public override Node Visit(NullOp op, Node n) 316public override Node Visit(ConstantPredicateOp op, Node n) 327public override Node Visit(InternalConstantOp op, Node n) 339public override Node Visit(NullSentinelOp op, Node n) 351public override Node Visit(FunctionOp op, Node n) 362public override Node Visit(PropertyOp op, Node n) 373public override Node Visit(RelPropertyOp op, Node n) 384public override Node Visit(CaseOp op, Node n) 395public override Node Visit(ComparisonOp op, Node n) 406public override Node Visit(LikeOp op, Node n) 417public override Node Visit(AggregateOp op, Node n) 428public override Node Visit(NewInstanceOp op, Node n) 439public override Node Visit(NewEntityOp op, Node n) 460public override Node Visit(DiscriminatedNewEntityOp op, Node n) 471public override Node Visit(NewMultisetOp op, Node n) 482public override Node Visit(NewRecordOp op, Node n) 493public override Node Visit(RefOp op, Node n) 504public override Node Visit(VarRefOp op, Node n) 522public override Node Visit(ConditionalOp op, Node n) 533public override Node Visit(ArithmeticOp op, Node n) 544public override Node Visit(TreatOp op, Node n) 556public override Node Visit(CastOp op, Node n) 567public override Node Visit(SoftCastOp op, Node n) 578public override Node Visit(DerefOp op, Node n) 589public override Node Visit(NavigateOp op, Node n) 600public override Node Visit(IsOfOp op, Node n) 614public override Node Visit(ExistsOp op, Node n) 625public override Node Visit(ElementOp op, Node n) 636public override Node Visit(GetRefKeyOp op, Node n) 647public override Node Visit(GetEntityRefOp op, Node n) 658public override Node Visit(CollectOp op, Node n) 673public override Node Visit(ScanTableOp op, Node n) 691public override Node Visit(ScanViewOp op, Node n) 700List<Node> children = ProcessChildren(n); 710public override Node Visit(UnnestOp op, Node n) 713List<Node> children = ProcessChildren(n); 735public override Node Visit(ProjectOp op, Node n) 738List<Node> children = ProcessChildren(n); 756public override Node Visit(FilterOp op, Node n) 767public override Node Visit(SortOp op, Node n) 770List<Node> children = ProcessChildren(n); 788public override Node Visit(ConstrainedSortOp op, Node n) 791List<Node> children = ProcessChildren(n); 809public override Node Visit(GroupByOp op, Node n) 812List<Node> children = ProcessChildren(n); 827public override Node Visit(GroupByIntoOp op, Node n) 830List<Node> children = ProcessChildren(n); 845public override Node Visit(CrossJoinOp op, Node n) 856public override Node Visit(InnerJoinOp op, Node n) 867public override Node Visit(LeftOuterJoinOp op, Node n) 878public override Node Visit(FullOuterJoinOp op, Node n) 889public override Node Visit(CrossApplyOp op, Node n) 900public override Node Visit(OuterApplyOp op, Node n) 911private Node CopySetOp(SetOp op, Node n) 914List<Node> children = ProcessChildren(n); 975public override Node Visit(UnionAllOp op, Node n) 986public override Node Visit(IntersectOp op, Node n) 997public override Node Visit(ExceptOp op, Node n) 1008public override Node Visit(DistinctOp op, Node n) 1011List<Node> children = ProcessChildren(n); 1023public override Node Visit(SingleRowOp op, Node n) 1028public override Node Visit(SingleRowTableOp op, Node n) 1042public override Node Visit(VarDefOp op, Node n) 1045List<Node> children = ProcessChildren(n); 1058public override Node Visit(VarDefListOp op, Node n) 1079public override Node Visit(PhysicalProjectOp op, Node n) 1082List<Node> children = ProcessChildren(n); 1096private Node VisitNestOp(Node n) 1103List<Node> newChildren = ProcessChildren(n); 1150public override Node Visit(SingleStreamNestOp op, Node n) 1161public override Node Visit(MultiStreamNestOp op, Node n)
System\Data\Query\InternalTrees\Ops.cs (2)
480internal virtual void Accept(BasicOpVisitor v, Node n) 492internal virtual TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n)
System\Data\Query\InternalTrees\PhysicalOps.cs (6)
54internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 63internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 266internal override void Accept(BasicOpVisitor v, Node n) 278internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) 318internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 327internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }
System\Data\Query\InternalTrees\RelOps.cs (44)
79internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 88internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 126internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 135internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 185internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 194internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 242internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 251internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 274internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 283internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 306internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 315internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 338internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 347internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 387internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 396internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 419internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 428internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 456internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 465internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 509internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 518internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 620internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 629internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 669internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 678internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 722internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 731internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 762internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 771internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 812internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 821internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 901internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 910internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 933internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 942internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 965internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 974internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1018internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1027internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1064internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1073internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1108internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1117internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }
System\Data\Query\InternalTrees\Rule.cs (11)
35internal delegate bool ProcessNodeDelegate(RuleProcessingContext context, Node subTree, out Node newSubTree); 69internal abstract bool Match(Node node); 79internal bool Apply(RuleProcessingContext ruleProcessingContext, Node node, out Node newNode) 128internal override bool Match(Node node) 142private Node m_pattern; 151internal PatternMatchRule(Node pattern, ProcessNodeDelegate processDelegate) 161private bool Match(Node pattern, Node original) 177internal override bool Match(Node node)
System\Data\Query\InternalTrees\RuleProcessor.cs (18)
45private static bool ApplyRulesToNode(RuleProcessingContext context, ReadOnlyCollection<ReadOnlyCollection<InternalTrees.Rule>> rules, Node currentNode, out Node newNode) 85private Node ApplyRulesToSubtree(RuleProcessingContext context, 87Node subTreeRoot, Node parent, int childIndexInParent) 131Node newSubTreeRoot; 155internal Node ApplyRulesToSubtree(RuleProcessingContext context, ReadOnlyCollection<ReadOnlyCollection<InternalTrees.Rule>> rules, Node subTreeRoot) 168public Node m_subTreeRoot; 170private Node m_parent; 176internal SubTreeId(RuleProcessingContext context, Node node, Node parent, int childIndex) 209internal delegate void OpDelegate(RuleProcessingContext context, Node node); 227internal virtual void PreProcess(Node node) 237internal virtual void PreProcessSubTree(Node node) 247internal virtual void PostProcess(Node node, Rule rule) 256internal virtual void PostProcessSubTree(Node node) 265internal virtual int GetHashCode(Node node)
System\Data\Query\InternalTrees\ScalarOps.cs (64)
102internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 111internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 142internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 151internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 183internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 192internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 223internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 232internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 279internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 288internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 345internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 354internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 404internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 413internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 458internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 467internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 511internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 520internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 568internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 577internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 608internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 617internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 654internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 663internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 697internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 706internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 738internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 747internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 780internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 789internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 815internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 824internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 875internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 884internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 915internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 924internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 970internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 979internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1054internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1063internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1093internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1102internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1138internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1141internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1228internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1237internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1260internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1269internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1291internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1300internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1344internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1353internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1387internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1396internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1427internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1436internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1467internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1476internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1507internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1516internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1547internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1556internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); } 1613internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); } 1622internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }
System\Data\Query\InternalTrees\Visitors.cs (165)
30protected virtual void VisitChildren(Node n) 32foreach (Node chi in n.Children) 42protected virtual void VisitChildrenReverse(Node n) 54internal virtual void VisitNode(Node n) 62protected virtual void VisitDefault(Node n) 72protected virtual void VisitConstantOp(ConstantBaseOp op, Node n) 82protected virtual void VisitTableOp(ScanTableBaseOp op, Node n) 92protected virtual void VisitJoinOp(JoinBaseOp op, Node n) 102protected virtual void VisitApplyOp(ApplyBaseOp op, Node n) 111protected virtual void VisitSetOp(SetOp op, Node n) 121protected virtual void VisitSortOp(SortBaseOp op, Node n) 131protected virtual void VisitGroupByOp(GroupByBaseOp op, Node n) 144public virtual void Visit(Op op, Node n) 150protected virtual void VisitScalarOpDefault(ScalarOp op, Node n) 160public virtual void Visit(ConstantOp op, Node n) 170public virtual void Visit(NullOp op, Node n) 180public virtual void Visit(NullSentinelOp op, Node n) 190public virtual void Visit(InternalConstantOp op, Node n) 200public virtual void Visit(ConstantPredicateOp op, Node n) 210public virtual void Visit(FunctionOp op, Node n) 220public virtual void Visit(PropertyOp op, Node n) 230public virtual void Visit(RelPropertyOp op, Node n) 240public virtual void Visit(CaseOp op, Node n) 250public virtual void Visit(ComparisonOp op, Node n) 260public virtual void Visit(LikeOp op, Node n) 270public virtual void Visit(AggregateOp op, Node n) 280public virtual void Visit(NewInstanceOp op, Node n) 290public virtual void Visit(NewEntityOp op, Node n) 300public virtual void Visit(DiscriminatedNewEntityOp op, Node n) 310public virtual void Visit(NewMultisetOp op, Node n) 320public virtual void Visit(NewRecordOp op, Node n) 330public virtual void Visit(RefOp op, Node n) 340public virtual void Visit(VarRefOp op, Node n) 350public virtual void Visit(ConditionalOp op, Node n) 360public virtual void Visit(ArithmeticOp op, Node n) 370public virtual void Visit(TreatOp op, Node n) 380public virtual void Visit(CastOp op, Node n) 389public virtual void Visit(SoftCastOp op, Node n) 399public virtual void Visit(IsOfOp op, Node n) 409public virtual void Visit(ExistsOp op, Node n) 419public virtual void Visit(ElementOp op, Node n) 429public virtual void Visit(GetEntityRefOp op, Node n) 439public virtual void Visit(GetRefKeyOp op, Node n) 449public virtual void Visit(CollectOp op, Node n) 454public virtual void Visit(DerefOp op, Node n) 459public virtual void Visit(NavigateOp op, Node n) 467protected virtual void VisitAncillaryOpDefault(AncillaryOp op, Node n) 477public virtual void Visit(VarDefOp op, Node n) 487public virtual void Visit(VarDefListOp op, Node n) 496protected virtual void VisitRelOpDefault(RelOp op, Node n) 506public virtual void Visit(ScanTableOp op, Node n) 516public virtual void Visit(ScanViewOp op, Node n) 526public virtual void Visit(UnnestOp op, Node n) 536public virtual void Visit(ProjectOp op, Node n) 546public virtual void Visit(FilterOp op, Node n) 556public virtual void Visit(SortOp op, Node n) 566public virtual void Visit(ConstrainedSortOp op, Node n) 576public virtual void Visit(GroupByOp op, Node n) 586public virtual void Visit(GroupByIntoOp op, Node n) 596public virtual void Visit(CrossJoinOp op, Node n) 606public virtual void Visit(InnerJoinOp op, Node n) 616public virtual void Visit(LeftOuterJoinOp op, Node n) 626public virtual void Visit(FullOuterJoinOp op, Node n) 636public virtual void Visit(CrossApplyOp op, Node n) 646public virtual void Visit(OuterApplyOp op, Node n) 656public virtual void Visit(UnionAllOp op, Node n) 666public virtual void Visit(IntersectOp op, Node n) 676public virtual void Visit(ExceptOp op, Node n) 686public virtual void Visit(DistinctOp op, Node n) 696public virtual void Visit(SingleRowOp op, Node n) 706public virtual void Visit(SingleRowTableOp op, Node n) 714protected virtual void VisitPhysicalOpDefault(PhysicalOp op, Node n) 724public virtual void Visit(PhysicalProjectOp op, Node n) 735protected virtual void VisitNestOp(NestBaseOp op, Node n) 744public virtual void Visit(SingleStreamNestOp op, Node n) 753public virtual void Visit(MultiStreamNestOp op, Node n) 775protected virtual void VisitChildren(Node n) 787protected virtual void VisitChildrenReverse(Node n) 800internal TResultType VisitNode(Node n) 811protected virtual TResultType VisitDefault(Node n) 823internal virtual TResultType Unimplemented(Node n) 835public virtual TResultType Visit(Op op, Node n) 850protected virtual TResultType VisitAncillaryOpDefault(AncillaryOp op, Node n) 861public virtual TResultType Visit(VarDefOp op, Node n) 872public virtual TResultType Visit(VarDefListOp op, Node n) 889protected virtual TResultType VisitPhysicalOpDefault(PhysicalOp op, Node n) 900public virtual TResultType Visit(PhysicalProjectOp op, Node n) 915protected virtual TResultType VisitNestOp(NestBaseOp op, Node n) 926public virtual TResultType Visit(SingleStreamNestOp op, Node n) 936public virtual TResultType Visit(MultiStreamNestOp op, Node n) 955protected virtual TResultType VisitRelOpDefault(RelOp op, Node n) 968protected virtual TResultType VisitApplyOp(ApplyBaseOp op, Node n) 979public virtual TResultType Visit(CrossApplyOp op, Node n) 990public virtual TResultType Visit(OuterApplyOp op, Node n) 1007protected virtual TResultType VisitJoinOp(JoinBaseOp op, Node n) 1018public virtual TResultType Visit(CrossJoinOp op, Node n) 1029public virtual TResultType Visit(FullOuterJoinOp op, Node n) 1040public virtual TResultType Visit(LeftOuterJoinOp op, Node n) 1051public virtual TResultType Visit(InnerJoinOp op, Node n) 1068protected virtual TResultType VisitSetOp(SetOp op, Node n) 1079public virtual TResultType Visit(ExceptOp op, Node n) 1090public virtual TResultType Visit(IntersectOp op, Node n) 1101public virtual TResultType Visit(UnionAllOp op, Node n) 1114public virtual TResultType Visit(DistinctOp op, Node n) 1125public virtual TResultType Visit(FilterOp op, Node n) 1136protected virtual TResultType VisitGroupByOp(GroupByBaseOp op, Node n) 1148public virtual TResultType Visit(GroupByOp op, Node n) 1159public virtual TResultType Visit(GroupByIntoOp op, Node n) 1170public virtual TResultType Visit(ProjectOp op, Node n) 1182protected virtual TResultType VisitTableOp(ScanTableBaseOp op, Node n) 1192public virtual TResultType Visit(ScanTableOp op, Node n) 1203public virtual TResultType Visit(ScanViewOp op, Node n) 1215public virtual TResultType Visit(SingleRowOp op, Node n) 1226public virtual TResultType Visit(SingleRowTableOp op, Node n) 1239protected virtual TResultType VisitSortOp(SortBaseOp op, Node n) 1250public virtual TResultType Visit(SortOp op, Node n) 1261public virtual TResultType Visit(ConstrainedSortOp op, Node n) 1272public virtual TResultType Visit(UnnestOp op, Node n) 1289protected virtual TResultType VisitScalarOpDefault(ScalarOp op, Node n) 1300protected virtual TResultType VisitConstantOp(ConstantBaseOp op, Node n) 1311public virtual TResultType Visit(AggregateOp op, Node n) 1322public virtual TResultType Visit(ArithmeticOp op, Node n) 1333public virtual TResultType Visit(CaseOp op, Node n) 1344public virtual TResultType Visit(CastOp op, Node n) 1355public virtual TResultType Visit(SoftCastOp op, Node n) 1366public virtual TResultType Visit(CollectOp op, Node n) 1377public virtual TResultType Visit(ComparisonOp op, Node n) 1388public virtual TResultType Visit(ConditionalOp op, Node n) 1399public virtual TResultType Visit(ConstantOp op, Node n) 1410public virtual TResultType Visit(ConstantPredicateOp op, Node n) 1421public virtual TResultType Visit(ElementOp op, Node n) 1432public virtual TResultType Visit(ExistsOp op, Node n) 1443public virtual TResultType Visit(FunctionOp op, Node n) 1454public virtual TResultType Visit(GetEntityRefOp op, Node n) 1465public virtual TResultType Visit(GetRefKeyOp op, Node n) 1476public virtual TResultType Visit(InternalConstantOp op, Node n) 1487public virtual TResultType Visit(IsOfOp op, Node n) 1498public virtual TResultType Visit(LikeOp op, Node n) 1509public virtual TResultType Visit(NewEntityOp op, Node n) 1520public virtual TResultType Visit(NewInstanceOp op, Node n) 1531public virtual TResultType Visit(DiscriminatedNewEntityOp op, Node n) 1542public virtual TResultType Visit(NewMultisetOp op, Node n) 1553public virtual TResultType Visit(NewRecordOp op, Node n) 1564public virtual TResultType Visit(NullOp op, Node n) 1575public virtual TResultType Visit(NullSentinelOp op, Node n) 1586public virtual TResultType Visit(PropertyOp op, Node n) 1596public virtual TResultType Visit(RelPropertyOp op, Node n) 1607public virtual TResultType Visit(RefOp op, Node n) 1618public virtual TResultType Visit(TreatOp op, Node n) 1629public virtual TResultType Visit(VarRefOp op, Node n) 1634public virtual TResultType Visit(DerefOp op, Node n) 1638public virtual TResultType Visit(NavigateOp op, Node n) 1649internal abstract class BasicOpVisitorOfNode : BasicOpVisitorOfT<Node> 1657protected override void VisitChildren(Node n) 1669protected override void VisitChildrenReverse(Node n) 1682protected override Node VisitDefault(Node n) 1700protected override Node VisitAncillaryOpDefault(AncillaryOp op, Node n) 1717protected override Node VisitPhysicalOpDefault(PhysicalOp op, Node n) 1734protected override Node VisitRelOpDefault(RelOp op, Node n) 1750protected override Node VisitScalarOpDefault(ScalarOp op, Node n)
System\Data\Query\PlanCompiler\AggregatePushdown.cs (90)
37internal delegate bool TryGetValue(Node key, out Node value); 47private readonly Node _definingGroupByNode; 48private HashSet<KeyValuePair<Node, Node>> _candidateAggregateNodes; 58internal GroupAggregateVarInfo(Node defingingGroupNode, Var groupAggregateVar) 73internal HashSet<KeyValuePair<Node, Node>> CandidateAggregateNodes 79_candidateAggregateNodes = new HashSet<KeyValuePair<Node, Node>>(); 99internal Node DefiningGroupNode 120private readonly Node _computation; 131internal GroupAggregateVarRefInfo(GroupAggregateVarInfo groupAggregateVarInfo, Node computation, bool isUnnested) 145internal Node Computation 199internal void Add(Var var, GroupAggregateVarInfo groupAggregateVarInfo, Node computationTemplate, bool isUnnested) 214internal void Add(Var var, GroupAggregateVarInfo groupAggregateVarInfo, Node computationTemplate, bool isUnnested, EdmMember property) 322Node subtree, 327out Node templateNode, 332Node inputNode = subtree; 390public override Node Visit(VarRefOp op, Node n) 403public override Node Visit(PropertyOp op, Node n) 428private Node VisitCollect(Node n) 431Node currentNode = n.Child0; 432Dictionary<Var, Node> constantDefinitions = new Dictionary<Var, Node>(); 441foreach (Node definitionNode in currentNode.Child1.Children) 482Node computationTemplate = TranslateOverGroupAggregateVar(outputVar, null); 489Node constantDefinitionNode; 505private static bool IsConstant(Node node) 507Node currentNode = node; 526private Node TranslateOverGroupAggregateVar(Var var, EdmMember property) 553Node computationTemplate = groupAggregateVarRefInfo.Computation; 570protected override Node VisitDefault(Node n) 572List<Node> newChildren = new List<Node>(n.Children.Count); 576Node processedChild = VisitNode(n.Children[i]); 600protected override Node VisitRelOpDefault(RelOp op, Node n) 605public override Node Visit(AggregateOp op, Node n) 610public override Node Visit(CollectOp op, Node n) 615public override Node Visit(ElementOp op, Node n) 635private readonly Dictionary<Node, Node> _childToParent = new Dictionary<Node, Node>(); 677public override void Visit(VarDefOp op, Node n) 681Node definingNode = n.Child0; 685Node templateNode; 696Node argumentNode = definingNode.Children[i]; 713public override void Visit(GroupByIntoOp op, Node n) 716foreach (Node child in n.Child3.Children) 737public override void Visit(UnnestOp op, Node n) 758public override void Visit(FunctionOp op, Node n) 767Node argumentNode = n.Child0; 770Node templateNode; 775referencedGroupAggregateVarInfo.CandidateAggregateNodes.Add(new KeyValuePair<Node, Node>(n, templateNode)); 786protected override void VisitDefault(Node n) 789foreach (Node child in n.Children) 813internal static bool IsVarRefOverGivenVar(Node node, Var var) 866foreach (KeyValuePair<Node, Node> candidate in groupAggregateVarInfo.CandidateAggregateNodes) 887KeyValuePair<Node, Node> candidate, 890IList<Node> functionAncestors; 891IList<Node> groupByAncestors; 892Node definingGroupNode = groupAggregateVarInfo.DefiningGroupNode; 911Node argumentNode = OpCopier.Copy(m_command, candidate.Value); 917Node newFunctionDefiningNode = m_command.CreateNode( 922Node varDefNode = m_command.CreateVarDefNode(newFunctionDefiningNode, out newFunctionVar); 932Node groupByAncestor = groupByAncestors[i]; 951private static bool AreAllNodesSupportedForPropagation(IList<Node> nodes) 953foreach (Node node in nodes) 973private void FindPathsToLeastCommonAncestor(Node node1, Node node2, out IList<Node> ancestors1, out IList<Node> ancestors2) 1002private IList<Node> FindAncestors(Node node) 1004List<Node> ancestors = new List<Node>(); 1005Node currentNode = node; 1006Node ancestor;
System\Data\Query\PlanCompiler\CodeGen.cs (4)
92this.m_subCommands = new List<Node>(new Node[] { this.Command.Root }); 126foreach (Node subCommand in m_subCommands) 147private List<Node> m_subCommands;
System\Data\Query\PlanCompiler\CTreeGenerator.cs (85)
347internal static DbCommandTree Generate(Command itree, Node toConvert) 355private CTreeGenerator(Command itree, Node toConvert) 402private RelOpInfo VisitAsRelOp(Node inputNode) 438private RelOpInfo EnterExpressionBindingScope(Node inputNode, bool pushScope) 460private RelOpInfo EnterExpressionBindingScope(Node inputNode) 482private GroupByScope EnterGroupByScope(Node inputNode) 512private void EnterVarDefScope(List<Node> varDefNodes) 525foreach (Node childNode in varDefNodes) 547private void EnterVarDefListScope(Node varDefListNode) 645private static void AssertBinary(Node n) 650private DbExpression VisitChild(Node n, int index) 656private new List<DbExpression> VisitChildren(Node n) 659foreach (Node argNode in n.Children) 672protected override DbExpression VisitConstantOp(ConstantBaseOp op, Node n) 680public override DbExpression Visit(ConstantOp op, Node n) 685public override DbExpression Visit(InternalConstantOp op, Node n) 690public override DbExpression Visit(NullOp op, Node n) 695public override DbExpression Visit(NullSentinelOp op, Node n) 700public override DbExpression Visit(ConstantPredicateOp op, Node n) 709public override DbExpression Visit(FunctionOp op, Node n) 718public override DbExpression Visit(PropertyOp op, Node n) 724public override DbExpression Visit(RelPropertyOp op, Node n) 730public override DbExpression Visit(ArithmeticOp op, Node n) 793public override DbExpression Visit(CaseOp op, Node n) 838public override DbExpression Visit(ComparisonOp op, Node n) 901public override DbExpression Visit(ConditionalOp op, Node n) 960public override DbExpression Visit(LikeOp op, Node n) 974public override DbExpression Visit(AggregateOp op, Node n) 983public override DbExpression Visit(NavigateOp op, Node n) 989public override DbExpression Visit(NewEntityOp op, Node n) 994public override DbExpression Visit(NewInstanceOp op, Node n) 1000public override DbExpression Visit(DiscriminatedNewEntityOp op, Node n) 1006public override DbExpression Visit(NewMultisetOp op, Node n) 1012public override DbExpression Visit(NewRecordOp op, Node n) 1018public override DbExpression Visit(RefOp op, Node n) 1024public override DbExpression Visit(VarRefOp op, Node n) 1029public override DbExpression Visit(TreatOp op, Node n) 1035public override DbExpression Visit(CastOp op, Node n) 1048public override DbExpression Visit(SoftCastOp op, Node n) 1059public override DbExpression Visit(IsOfOp op, Node n) 1068public override DbExpression Visit(ExistsOp op, Node n) 1087public override DbExpression Visit(ElementOp op, Node n) 1098public override DbExpression Visit(GetRefKeyOp op, Node n) 1104public override DbExpression Visit(GetEntityRefOp op, Node n) 1110public override DbExpression Visit(CollectOp op, Node n) 1273public override DbExpression Visit(ScanTableOp op, Node n) 1308public override DbExpression Visit(ScanViewOp op, Node n) 1318public override DbExpression Visit(UnnestOp op, Node n) 1326Node input = n.Child0.Child0; 1350private RelOpInfo BuildEmptyProjection(Node relOpNode) 1401private RelOpInfo BuildProjection(Node relOpNode, IEnumerable<Var> projectionVars) 1441DbExpression VisitProject(ProjectOp op, Node n, IEnumerable<Var> varList) 1475public override DbExpression Visit(ProjectOp op, Node n) 1480public override DbExpression Visit(FilterOp op, Node n) 1552public override DbExpression Visit(SortOp op, Node n) 1585public override DbExpression Visit(ConstrainedSortOp op, Node n) 1666public override DbExpression Visit(GroupByOp op, Node n) 1736Node aggRootNode = n.Child2; 1738foreach (Node aggVarDefNode in aggRootNode.Children) 1746Node aggOpNode = aggVarDefNode.Child0; 1812public override DbExpression Visit(GroupByIntoOp op, Node n) 1832private RelOpInfo VisitJoinInput(Node joinInputNode) 1865private DbExpression VisitBinaryJoin(Node joinNode, DbExpressionKind joinKind) 1945public override DbExpression Visit(CrossJoinOp op, Node n) 1963foreach (Node inputNode in n.Children) 1983public override DbExpression Visit(InnerJoinOp op, Node n) 1989public override DbExpression Visit(LeftOuterJoinOp op, Node n) 1995public override DbExpression Visit(FullOuterJoinOp op, Node n) 2011private DbExpression VisitApply(Node applyNode, DbExpressionKind applyKind) 2058public override DbExpression Visit(CrossApplyOp op, Node n) 2064public override DbExpression Visit(OuterApplyOp op, Node n) 2095private DbExpression VisitSetOpArgument(Node argNode, VarVec outputVars, VarMap argVars) 2138private DbExpression VisitSetOp(SetOp op, Node n, AliasGenerator alias, Func<DbExpression, DbExpression, DbExpression> setOpExpressionBuilder) 2194public override DbExpression Visit(UnionAllOp op, Node n) 2199public override DbExpression Visit(IntersectOp op, Node n) 2204public override DbExpression Visit(ExceptOp op, Node n) 2210public override DbExpression Visit(DerefOp op, Node n) 2215public override DbExpression Visit(DistinctOp op, Node n) 2246public override DbExpression Visit(SingleRowOp op, Node n) 2293public override DbExpression Visit(SingleRowTableOp op, Node n) 2303public override DbExpression Visit(VarDefOp op, Node n) 2313public override DbExpression Visit(VarDefListOp op, Node n) 2338public override DbExpression Visit(PhysicalProjectOp op, Node n) 2364public override DbExpression Visit(SingleStreamNestOp op, Node n) 2368public override DbExpression Visit(MultiStreamNestOp op, Node n)
System\Data\Query\PlanCompiler\ITreeGenerator.cs (256)
41internal class ITreeGenerator : DbExpressionVisitor<Node> 50internal abstract Node this[string varName] { get; } 74internal override Node this[string name] 100private readonly Dictionary<string, Tuple<Node, bool>> _arguments; 101private readonly Dictionary<Node, bool> _referencedArgs; 103internal LambdaScope(ITreeGenerator treeGen, Command command, Dictionary<string, Tuple<Node, bool>> args) 108_referencedArgs = new Dictionary<Node, bool>(_arguments.Count); 112internal override Node this[string name] 118Node argNode = _arguments[name].Item1; 126Node argCopy = OpCopier.Copy(_command, argNode, out mappedVars); 132List<Node> sources = new List<Node>(1); 135List<Node> copies = new List<Node>(1); 161private void MapCopiedNodeVars(IList<Node> sources, IList<Node> copies, Dictionary<Var, Var> varMappings) 175Node sourceNode = sources[idx]; 176Node copyNode = copies[idx]; 198private readonly Dictionary<Node, Var> _varMap = new Dictionary<Node, Var>(); 244internal Dictionary<Node, Var> VarMap { get { return _varMap; } } 303Node scalarExpr = ConvertToScalarOpTree(_iqtCommand.Root, ctree.Query); 304Node singletonTableNode = _iqtCommand.CreateNode(_iqtCommand.CreateSingleRowTableOp()); 306Node varDefListNode = _iqtCommand.CreateVarDefListNode(scalarExpr, out newVar); 310Node newRoot = _iqtCommand.CreateNode(projectOp, singletonTableNode, varDefListNode); 440private delegate Node VisitExprDelegate(DbExpression e); 442private Node VisitExpr(DbExpression e) 450return e.Accept<Node>(this); 459private Node VisitExprAsScalar(DbExpression expr) 466Node node = VisitExpr(expr); // the real work 477private Node ConvertToScalarOpTree(Node node, DbExpression expr) 508private Node ConvertRelOpToScalarOpTree(Node node, TypeUsage resultType) 516Node projectNode = CapWithPhysicalProject(node); 525private Node ConvertPredicateToScalarOpTree(Node node, DbExpression expr) 530List<Node> arguments = new List<Node>((expr.ExpressionKind == DbExpressionKind.IsNull) ? 3 : 5); 541Node predCopy = VisitExpr(expr); 563private Node VisitExprAsPredicate(DbExpression expr) 570Node node = VisitExpr(expr); 579Node trueNode = _iqtCommand.CreateNode(_iqtCommand.CreateInternalConstantOp(_iqtCommand.BooleanType, true)); 596private static IList<Node> VisitExpr(IList<DbExpression> exprs, VisitExprDelegate exprDelegate) 598List<Node> nodeList = new List<Node>(); 611private IList<Node> VisitExprAsScalar(IList<DbExpression> exprs) 616private Node VisitUnary(DbUnaryExpression e, Op op, VisitExprDelegate exprDelegate) 621private Node VisitBinary(DbBinaryExpression e, Op op, VisitExprDelegate exprDelegate) 631private Node EnsureRelOp(Node inputNode) 685Node varDefNode = _iqtCommand.CreateVarDefNode(inputNode, out inputCollectionVar); 698Node unnestNode = _iqtCommand.CreateNode(unnest, varDefNode); 708Node varRefNode = _iqtCommand.CreateNode(_iqtCommand.CreateVarRefOp(unnest.Table.Columns[0])); 709Node varDefListNode = _iqtCommand.CreateVarDefListNode(varRefNode, out projectVar); 712Node projectNode = _iqtCommand.CreateNode(projectOp, unnestNode, varDefListNode); 725private Node CapWithProject(Node input) 736Node projectNode = _iqtCommand.CreateNode(projectOp, input, 749private Node CapWithPhysicalProject(Node input) 756Node projectNode = _iqtCommand.CreateNode(projectOp, input); 766private Node EnterExpressionBinding(DbExpressionBinding binding) 777private Node EnterGroupExpressionBinding(DbGroupExpressionBinding binding) 788private Node VisitBoundExpressionPushBindingScope(DbExpression boundExpression, string bindingName) 791Node inputNode = VisitBoundExpression(boundExpression, out boundVar); 802private Node VisitBoundExpression(DbExpression boundExpression, out Var boundVar) 807Node inputNode = VisitExpr(boundExpression); 876private void EnterLambdaFunction(DbLambda lambda, List<Tuple<Node, bool>> argumentValues, EdmFunction expandingEdmFunction) 880var args = new Dictionary<string, Tuple<Node, bool>>(); 940private Node ProjectNewRecord(Node inputNode, RowType recType, IEnumerable<Var> colVars) 945List<Node> recordColumns = new List<Node>(); 954Node newRecordNode = _iqtCommand.CreateNode(_iqtCommand.CreateNewRecordOp(recType), recordColumns); 960Node varDefNode = _iqtCommand.CreateVarDefListNode(newRecordNode, out newRecordVar); 966Node projectionNode = _iqtCommand.CreateNode(projection, inputNode, varDefNode); 975public override Node Visit(DbExpression e) 980public override Node Visit(DbConstantExpression e) 992public override Node Visit(DbNullExpression e) 998public override Node Visit(DbVariableReferenceExpression e) 1000Node varNode = ResolveScope(e)[e.VariableName]; 1027public override Node Visit(DbParameterReferenceExpression e) 1033public override Node Visit(DbFunctionExpression e) 1035Node retNode = null; 1065List<Node> argNodes = new List<Node>(e.Arguments.Count); 1079public override Node Visit(DbLambdaExpression e) 1084private Node VisitLambdaExpression(DbLambda lambda, IList<DbExpression> arguments, DbExpression applicationExpr, EdmFunction expandingEdmFunction) 1086Node retNode = null; 1088var argNodes = new List<Tuple<Node, bool>>(arguments.Count); 1128private Node BuildSoftCast(Node node, TypeUsage targetType) 1150Node varRefNode = _iqtCommand.CreateNode(_iqtCommand.CreateVarRefOp(nodeVar)); 1151Node castNode = _iqtCommand.CreateNode(_iqtCommand.CreateSoftCastOp(targetType), varRefNode); 1152Node varDefListNode = _iqtCommand.CreateVarDefListNode(castNode, out projectVar); 1155Node projectNode = _iqtCommand.CreateNode(projectOp, node, varDefListNode); 1182private Node BuildSoftCast(Node node, EdmType targetType) 1187private Node BuildEntityRef(Node arg, TypeUsage entityType) 1237public override Node Visit(DbPropertyExpression e) 1249Node retNode = null; 1257Node instance = VisitExpr(e.Instance); 1308public override Node Visit(DbComparisonExpression e) 1312Node leftArg = VisitExprAsScalar(e.Left); 1313Node rightArg = VisitExprAsScalar(e.Right); 1335public override Node Visit(DbLikeExpression e) 1345private Node CreateLimitNode(Node inputNode, Node limitNode, bool withTies) 1350Node retNode = null; 1415public override Node Visit(DbLimitExpression expression) 1420Node inputNode = EnsureRelOp(VisitExpr(expression.Argument)); 1426Node limitNode = VisitExprAsScalar(expression.Limit); 1428Node retNode; 1467public override Node Visit(DbIsNullExpression e) 1496Node argNode = VisitExprAsScalar(e.Argument); 1505public override Node Visit(DbArithmeticExpression e) 1510List<Node> children = new List<Node>(); 1513Node child = VisitExprAsScalar(arg); 1519public override Node Visit(DbAndExpression e) 1525public override Node Visit(DbOrExpression e) 1531public override Node Visit(DbNotExpression e) 1537public override Node Visit(DbDistinctExpression e) 1539Node inputSetNode = EnsureRelOp(VisitExpr(e.Argument)); 1542Node distinctNode = _iqtCommand.CreateNode(distinctOp, inputSetNode); 1547public override Node Visit(DbElementExpression e) 1550Node inputSetNode = EnsureRelOp(VisitExpr(e.Argument)); 1569public override Node Visit(DbIsEmptyExpression e) 1575Node inputSetNode = EnsureRelOp(VisitExpr(e.Argument)); 1589private Node VisitSetOpExpression(DbBinaryExpression expression) 1599Node leftNode = EnsureRelOp(VisitExpr(expression.Left)); 1600Node rightNode = EnsureRelOp(VisitExpr(expression.Right)); 1637Node setOpNode = _iqtCommand.CreateNode(setOp, leftNode, rightNode); 1646public override Node Visit(DbUnionAllExpression e) 1651public override Node Visit(DbIntersectExpression e) 1656public override Node Visit(DbExceptExpression e) 1661public override Node Visit(DbTreatExpression e) 1675public override Node Visit(DbIsOfExpression e) 1689public override Node Visit(DbCastExpression e) 1695public override Node Visit(DbCaseExpression e) 1697List<Node> childNodes = new List<Node>(); 1999public override Node Visit(DbOfTypeExpression e) 2011Node inputNode = EnsureRelOp(VisitExpr(rewrittenIsOfFilter)); 2024Node resultNode = _iqtCommand.BuildFakeTreatProject(inputNode, inputVar, e.OfType, out resultVar); 2033public override Node Visit(DbNewInstanceExpression e) 2036List<Node> relPropertyExprs = null; 2048relPropertyExprs = new List<Node>(); 2055Node relPropertyNode = VisitExprAsScalar(targetRef.TargetEntityReference); 2070List<Node> newArgs = new List<Node>(); 2077Node newArg = BuildSoftCast(VisitExprAsScalar(e.Arguments[i]), Helper.GetModelTypeUsage(m)); 2088Node newArg = BuildSoftCast(VisitExprAsScalar(arg), elementTypeUsage); 2097Node node = _iqtCommand.CreateNode(newInstOp, newArgs); 2102public override Node Visit(DbRefExpression e) 2111Node newArg = BuildSoftCast(VisitExprAsScalar(e.Argument), TypeHelpers.CreateKeyRowType(e.EntitySet.ElementType)); 2115public override Node Visit(DbRelationshipNavigationExpression e) 2119Node arg = VisitExprAsScalar(e.NavigationSource); 2123public override Node Visit(DbDerefExpression e) 2129public override Node Visit(DbRefKeyExpression e) 2135public override Node Visit(DbEntityRefExpression e) 2141public override Node Visit(DbScanExpression e) 2150Node node = _iqtCommand.CreateNode(op); 2157public override Node Visit(DbFilterExpression e) 2164Node inputSetNode = EnterExpressionBinding(e.Input); 2165Node predicateNode = VisitExprAsPredicate(e.Predicate); 2171Node filtNode = _iqtCommand.CreateNode(filtOp, inputSetNode, predicateNode); 2184public override Node Visit(DbProjectExpression e) 2197private Node GenerateDiscriminatedProject(DbProjectExpression e) 2202Node source = EnterExpressionBinding(e.Input); 2205List<Node> relPropertyExprs = new List<Node>(); 2217List<Node> newArgs = new List<Node>(_discriminatorMap.PropertyMap.Count + 1); 2223Node newArg = CreateNewInstanceArgument(property, value); 2228Node newInstNode = _iqtCommand.CreateNode(newInstOp, newArgs); 2232Node varDefListNode = _iqtCommand.CreateVarDefListNode(newInstNode, out sourceVar); 2235Node projNode = _iqtCommand.CreateNode(projOp, source, varDefListNode); 2241private Node CreateNewInstanceArgument(EdmMember property, DbExpression value) 2243Node newArg = BuildSoftCast(VisitExprAsScalar(value), Helper.GetModelTypeUsage(property)); 2247private Node GenerateStandardProject(DbProjectExpression e) 2249Node projectedSetNode = EnterExpressionBinding(e.Input); 2250Node projectionNode = VisitExprAsScalar(e.Projection); 2254Node varDefListNode = _iqtCommand.CreateVarDefListNode(projectionNode, out projectionVar); 2257Node projNode = _iqtCommand.CreateNode(projOp, projectedSetNode, varDefListNode); 2263public override Node Visit(DbCrossJoinExpression e) 2268public override Node Visit(DbJoinExpression e) 2277private Node VisitJoin(DbExpression e, IList<DbExpressionBinding> inputs, DbExpression joinCond) 2299List<Node> inputNodes = new List<Node>(); 2304Node inputNode = VisitBoundExpression(inputs[idx].Expression, out boundVar); 2320Node joinCondNode = VisitExprAsPredicate(joinCond); 2385public override Node Visit(DbApplyExpression e) 2397Node inputNode = EnterExpressionBinding(e.Input); 2405Node applyNode = EnterExpressionBinding(e.Apply); 2431Node retNode = _iqtCommand.CreateNode(applyOp, inputNode, applyNode); 2443public override Node Visit(DbGroupByExpression e) 2455Node inputNode; 2456List<Node> keyVarDefNodes; 2474Node copyOfInput = null; 2475List<Node> copyOfKeyVarDefNodes = null; 2495List<Node> aggVarDefNodes = new List<Node>(); 2496Node groupAggDefNode = null; 2505IList<Node> argNodes = VisitExprAsScalar(agg.Arguments); 2540List<Node> groupByChildren = new List<Node>(); 2568Node groupByNode = _iqtCommand.CreateNode( 2581private void ExtractKeys(DbGroupByExpression e, VarVec keyVarSet, VarVec outputVarSet, out Node inputNode, out List<Node> keyVarDefNodes, out ExpressionBindingScope scope) 2591keyVarDefNodes = new List<Node>(); 2596Node keyNode = VisitExprAsScalar(keyExpr); 2627private Node ProcessFunctionAggregate(DbFunctionAggregate funcAgg, IList<Node> argNodes, out Var aggVar) 2629Node aggNode = _iqtCommand.CreateNode( 2669private Node ProcessGroupAggregate(List<Node> keyVarDefNodes, Node copyOfInput, List<Node> copyOfkeyVarDefNodes, VarVec copyKeyVarSet, TypeUsage inputResultType, out Var groupAggVar) 2672Node groupDefNode = copyOfInput; 2680Node projectNodeWithKeys = _iqtCommand.CreateNode( 2688List<Node> flattentedKeys = new List<Node>(); 2689List<Node> copyFlattenedKeys = new List<Node>(); 2693Node keyVarDef = keyVarDefNodes[i]; 2694Node copyOfKeyVarDef = copyOfkeyVarDefNodes[i]; 2711Node filterPredicateNode = null; 2715Node keyNode = flattentedKeys[j]; 2716Node copyKeyNode = copyFlattenedKeys[j]; 2722Node predicate = _iqtCommand.CreateNode( 2747Node filterNode = _iqtCommand.CreateNode( 2757Node result = _iqtCommand.CreateVarDefNode(groupDefNode, out groupAggVar); 2767private void FlattenProperties(Node input, IList<Node> flattenedProperties) 2776Node newInput = (i == 0) ? input : OpCopier.Copy(_iqtCommand, input); 2798private Node VisitSortArguments(DbExpressionBinding input, IList<DbSortClause> sortOrder, List<SortKey> sortKeys, out Var inputVar) 2813Node inputNode = EnterExpressionBinding(input); 2822List<Node> sortVarDefs = new List<Node>(); 2831Node exprNode = VisitExprAsScalar(clause.Expression); 2890public override Node Visit(DbSkipExpression expression) 2897Node inputNode = VisitSortArguments(expression.Input, expression.SortOrder, sortKeys, out inputVar); 2902Node countNode = VisitExprAsScalar(expression.Count); 2911Node skipNode = 2926public override Node Visit(DbSortExpression e) 2933Node inputNode = VisitSortArguments(e.Input, e.SortOrder, sortKeys, out inputVar); 2943Node newSortNode = _iqtCommand.CreateNode(newSortOp, inputNode); 2952public override Node Visit(DbQuantifierExpression e) 2954Node retNode = null; 2965Node inputNode = EnterExpressionBinding(e.Input); 2970Node predicateNode = VisitExprAsPredicate(e.Predicate); 2989Node predicateCopy = VisitExprAsScalar(e.Predicate);
System\Data\Query\PlanCompiler\JoinElimination.cs (18)
55private Dictionary<Node, Node> m_joinGraphUnnecessaryMap = new Dictionary<Node,Node>(); 99private bool NeedsJoinGraph(Node joinNode) 109private Node ProcessJoinGraph(Node joinNode) 116Dictionary<Node, Node> processedNodes; 117Node newNode = joinGraph.DoJoinElimination(out remappedVars, out processedNodes); 125foreach (Node n in processedNodes.Keys) 161private Node VisitDefaultForAllNodes(Node n) 180protected override Node VisitDefault(Node n) 195protected override Node VisitJoinOp(JoinBaseOp op, Node joinNode) 197Node newNode;
System\Data\Query\PlanCompiler\JoinGraph.cs (75)
86private Node m_node; 98internal AugmentedNode(int id, Node node) 109internal AugmentedNode(int id, Node node, List<AugmentedNode> children) 130internal Node Node { get { return m_node; } } 186internal AugmentedTableNode(int id, Node node) : base(id, node) 264private Node m_otherPredicate; 278internal AugmentedJoinNode(int id, Node node, 281Node otherPredicate) 295internal AugmentedJoinNode(int id, Node node, List<AugmentedNode> children) 308internal Node OtherPredicate { get { return m_otherPredicate; } } 491private Dictionary<Node, Node> m_processedNodes; 507internal JoinGraph(Command command, ConstraintManager constraintManager, VarRefManager varRefManager, Node joinNode, bool isSqlCe) 520m_processedNodes = new Dictionary<Node, Node>(); 543internal Node DoJoinElimination(out VarMap varMap, 544out Dictionary<Node, Node> processedNodes) 557Node result = BuildNodeTree(); 633private void SplitPredicate(Node joinNode, 635out Node otherPredicateNode) 683private AugmentedNode BuildAugmentedNodeTree(Node node) 704Node otherPredicate; 713foreach (Node chi in node.Children) 2284private Node BuildNodeTree() 2308Dictionary<Node, int> predicates; 2309Node newNode = RebuildNodeTree(m_root, out predicates); 2322private Node BuildFilterForNullableColumns(Node inputNode, VarVec nonNullableColumns) 2335Node predNode = null; 2338Node varRefNode = m_command.CreateNode(m_command.CreateVarRefOp(v)); 2339Node isNotNullNode = m_command.CreateNode(m_command.CreateConditionalOp(OpType.IsNull), varRefNode); 2353Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), inputNode, predNode); 2365private Node BuildFilterNode(Node inputNode, Node predicateNode) 2392private Node RebuildPredicate(AugmentedJoinNode joinNode, out int minLocationId) 2416Node predicateNode = joinNode.OtherPredicate; 2437Node leftVarNode = m_command.CreateNode(m_command.CreateVarRefOp(newLeftVar)); 2438Node rightVarNode = m_command.CreateNode(m_command.CreateVarRefOp(newRightVar)); 2440Node equalsNode = m_command.CreateNode(m_command.CreateComparisonOp(OpType.EQ), 2464private Node RebuildNodeTreeForCrossJoins(AugmentedJoinNode joinNode) 2466List<Node> newChildren = new List<Node>(); 2469Dictionary<Node, int> predicates; 2484Node newJoinNode = m_command.CreateNode(m_command.CreateCrossJoinOp(), newChildren); 2499private Node RebuildNodeTree(AugmentedJoinNode joinNode, out Dictionary<Node, int> predicates) 2510Dictionary<Node, int> leftPredicates; 2511Dictionary<Node, int> rightPredicates; 2513Node leftNode = RebuildNodeTree(joinNode.Children[0], out leftPredicates); 2514Node rightNode = RebuildNodeTree(joinNode.Children[1], out rightPredicates); 2517Node localPredicateNode; 2542Node singleRowTableNode = m_command.CreateNode(m_command.CreateSingleRowTableOp()); 2561Node newJoinNode = m_command.CreateNode(joinNode.Node.Op, 2582private Node RebuildNodeTree(AugmentedTableNode tableNode) 2621Node filterNode = BuildFilterForNullableColumns(replacementNode.Node, replacementNode.NullableColumns); 2635private Node RebuildNodeTree(AugmentedNode augmentedNode, out Dictionary<Node, int> predicates) 2673private Node CombinePredicateNodes(int targetNodeId, Node localPredicateNode, int localPredicateMinLocationId, Dictionary<Node, int> leftPredicates, Dictionary<Node, int> rightPredicates, out Dictionary<Node, int> outPredicates) 2675Node result = null; 2676outPredicates = new Dictionary<Node, int>(); 2685foreach (KeyValuePair<Node, int> predicatePair in leftPredicates) 2693foreach (KeyValuePair<Node, int> predicatePair in rightPredicates) 2713private Node ClassifyPredicate(int targetNodeId, Node predicateNode, int predicateMinLocationId, Node result, Dictionary<Node, int> outPredicates) 2732private Node CombinePredicates(Node node1, Node node2)
System\Data\Query\PlanCompiler\KeyPullup.cs (11)
61internal KeyVec GetKeys(Node node) 84protected override void VisitChildren(Node n) 86foreach (Node chi in n.Children) 105protected override void VisitRelOpDefault(RelOp op, Node n) 117public override void Visit(ScanTableOp op, Node n) 133public override void Visit(ProjectOp op, Node n) 217public override void Visit(UnionAllOp op, Node n) 238Node branchNode = n.Children[i]; 279Node branchNode = n.Children[i]; 283List<Node> varDefNodes = new List<Node>();
System\Data\Query\PlanCompiler\NestPullup.cs (189)
60private Dictionary<Var, Node> m_definingNodeMap = new Dictionary<Var, Node>(); 128private static bool IsNestOpNode(Node n) 144private Node NestingNotSupported(Op op, Node n) 151foreach (Node chi in n.Children) 287public override Node Visit(VarDefOp op, Node n) 313public override Node Visit(VarRefOp op, Node n) 331public override Node Visit(CaseOp op, Node n) 334foreach (Node chi in n.Children) 361public override Node Visit(ExistsOp op, Node n) 388protected override Node VisitRelOpDefault(RelOp op, Node n) 422private Node ApplyOpJoinOp(Op op, Node n) 430foreach (Node chi in n.Children) 461foreach (Node chi in n.Children) 480List<Node> newNestChildren = new List<Node>(); 481List<Node> newJoinApplyChildren = new List<Node>(); 484foreach (Node chi in n.Children) 513Node newNestChild = ApplyIsNotNullFilter(chi.Children[i], sentinelVar); 534Node newJoinApplyNode = Command.CreateNode(op, newJoinApplyChildren); 553Node newNode = Command.CreateNode(newNestOp, newNestChildren); 566private Node ApplyIsNotNullFilter(Node node, Var sentinelVar) 568Node newFilterChild = node; 569Node newFilterParent = null; 576Node newFilterNode = CapWithIsNotNullFilter(newFilterChild, sentinelVar); 577Node result; 597private Node CapWithIsNotNullFilter(Node input, Var var) 599Node varRefNode = Command.CreateNode(Command.CreateVarRefOp(var)); 600Node predicateNode = Command.CreateNode( 607Node filterNode = Command.CreateNode(Command.CreateFilterOp(), input, predicateNode); 617protected override Node VisitApplyOp(ApplyBaseOp op, Node n) 632public override Node Visit(DistinctOp op, Node n) 655public override Node Visit(FilterOp op, Node n) 677Node nestOpNode = n.Child0; 678Node nestOpInputNode = nestOpNode.Child0; 703public override Node Visit(GroupByOp op, Node n) 723public override Node Visit(GroupByIntoOp op, Node n) 726Node varDefListNode = n.Child3; 732foreach (Node chi in varDefListNode.Children) 739Node groupByNode = Command.CreateNode( 742Node projectNode = Command.CreateNode( 755protected override Node VisitJoinOp(JoinBaseOp op, Node n) 799public override Node Visit(ProjectOp op, Node n) 809Node newNode; 816Node sortNode = n.Child0; 844/// Helper method for <see cref="Visit(ProjectOp, Node)"/>. 848private Node HandleProjectNode(Node n) 851Node newNode = ProjectOpCase1(n); 887private Node MergeNestedNestOps(Node nestNode) 902Node nestedNestNode = nestNode.Child0; 913List<Node> newNestInputs = new List<Node>(); 955Node newNode = Command.CreateNode(newNestOp, newNestInputs); 976private Node ProjectOpCase1(Node projectNode) 987List<Node> newChildren = new List<Node>(); 988List<Node> collectionNodes = new List<Node>(); 991List<Node> definedVars = new List<Node>(); 992List<Node> referencedVars = new List<Node>(); 994foreach (Node chi in projectNode.Child1.Children) 997Node definingExprNode = chi.Child0; 1003Node physicalProjectNode = definingExprNode.Child0; 1013Node physicalProjectNode; 1092List<Node> newNestedProjectNodeInputs = new List<Node>(); 1106foreach (Node varDefNode in referencedVars) 1111Node newNestedProjectNode = Command.CreateNode(Command.CreateProjectOp(newNestedProjectOutputs), newNestedProjectNodeInputs); 1124List<Node> newNestedNestNodeInputs = new List<Node>(); 1163Node nestNode = Command.CreateNode(nestOp, collectionNodes); 1183private void EnsureReferencedVarsAreRemoved(List<Node> referencedVars, VarVec outputVars) 1185foreach (Node chi in referencedVars) 1201private void EnsureReferencedVarsAreRemapped(List<Node> referencedVars) 1203foreach (Node chi in referencedVars) 1229private void ConvertToNestOpInput(Node physicalProjectNode, Var collectionVar, List<CollectionInfo> collectionInfoList, List<Node> collectionNodes, VarVec externalReferences, VarVec collectionReferences) 1235Node nestOpInput = physicalProjectNode.Child0; 1317private Node ProjectOpCase2(Node projectNode) 1323Node nestNode = projectNode.Child0; 1376List<Node> newNestNodeChildren; 1381newNestNodeChildren = new List<Node>(nestNode.Children); 1386newNestNodeChildren = new List<Node>(); 1416List<Node> newProjectOpChildren = new List<Node>(projectNode.Child1.Children.Count); 1417foreach (Node chi in projectNode.Child1.Children) 1439Node tempNode = Command.CreateNode(tempOp); 1441Node varDefNode = Command.CreateVarDefNode(tempNode, out tempVar); 1514protected override Node VisitSetOp(SetOp op, Node n) 1527public override Node Visit(SingleRowOp op, Node n) 1534Node newSingleRowOpNode = Command.CreateNode(op, n.Child0); 1552public override Node Visit(SortOp op, Node n) 1585public override Node Visit(ConstrainedSortOp op, Node n) 1595Node nestNode = n.Child0; 1728public override Node Visit(UnnestOp op, Node n) 1748Node newNode = n.Child0.Child0; 1777Node refVarDefiningNode; 1831private Node CopyCollectionVarDefinition(Node refVarDefiningNode) 1835Dictionary<Var, Node> collectionVarDefinitions; 1836Node newNode = OpCopierTrackingCollectionVars.Copy(Command, refVarDefiningNode, out varMap, out collectionVarDefinitions); 1842foreach (KeyValuePair<Var, Node> collectionVarDefinitionPair in collectionVarDefinitions) 1856Node keyDefiningNode; 1867Node newDefiningNode = Command.CreateNode(newPhysicalProjectOp, collectionVarDefinitionPair.Value); 1889protected override Node VisitNestOp(NestBaseOp op, Node n) 1896foreach (Node chi in n.Children) 1924public override Node Visit(PhysicalProjectOp op, Node n) 1948Node nestNode = n.Child0; 1967Node sortNode = BuildSortForNestElimination(ssnOp, nestNode); 1994private Node BuildSortForNestElimination(SingleStreamNestOp ssnOp, Node nestNode) 1996Node sortNode; 2117private Node ConvertToSingleStreamNest(Node nestNode, Dictionary<Var, ColumnMap> varRefReplacementMap, VarList flattenedOutputVarList, out SimpleColumnMap[] parentKeyColumnMaps) 2128Node chi = nestNode.Children[i]; 2160Node drivingNode = nestNode.Child0; 2194Node unionAllNode = BuildUnionAllSubqueryForNestOp(nestOp, nestNode, drivingNodeVars, discriminatorVarList, out outputDiscriminatorVar, out varMapList); 2328Node newNestNode = Command.CreateNode(newSsnOp, unionAllNode); 2353private void NormalizeNestOpInputs(NestBaseOp nestOp, Node nestNode, out VarList discriminatorVarList, out List<List<InternalTrees.SortKey>> sortKeys) 2366Node inputNode = nestNode.Children[i]; 2418Node augmentedInput = AugmentNodeWithInternalIntegerConstant(inputNode, i, out discriminatorVar); 2431private Node AugmentNodeWithInternalIntegerConstant(Node input, int value, out Var internalConstantVar) 2445private Node AugmentNodeWithConstant(Node input, Func<ConstantBaseOp> createOp, out Var constantVar) 2450Node constantNode = Command.CreateNode(constantOp); 2451Node varDefListNode = Command.CreateVarDefListNode(constantNode, out constantVar); 2460Node projectNode = Command.CreateNode(projectOp, input, varDefListNode); 2475private Node BuildUnionAllSubqueryForNestOp(NestBaseOp nestOp, Node nestNode, VarList drivingNodeVars, VarList discriminatorVarList, out Var discriminatorVar, out List<Dictionary<Var, Var>> varMapList) 2477Node drivingNode = nestNode.Child0; 2480Node unionAllNode = null; 2489Node newDrivingNode; 2526Node applyNode = Command.CreateNode(op, newDrivingNode, nestNode.Children[i]); 2533List<Node> varDefListChildren = new List<Node>(); 2558Node nullOpNode = Command.CreateNode(nullOp); 2560Node nullOpVarDefNode = Command.CreateVarDefNode(nullOpNode, out nullOpVar); 2567Node varDefListNode = Command.CreateNode(Command.CreateVarDefListOp(), varDefListChildren); 2572Node projectNode = Command.CreateNode(projectOp, applyNode, varDefListNode); 2669private Dictionary<Var, Node> m_newCollectionVarDefinitions = new Dictionary<Var, Node>(); 2689internal static Node Copy(Command cmd, Node n, out VarMap varMap, out Dictionary<Var, Node> newCollectionVarDefinitions) 2692Node newNode = oc.CopyNode(n); 2706public override Node Visit(MultiStreamNestOp op, Node n) 2708Node result = base.Visit(op, n); 2734private Node m_topMostSort = null; 2739private HashSet<Node> changedNodes = new HashSet<Node>(); 2743private SortRemover(Command command, Node topMostSort) 2753Node topMostSort; 2776protected override void VisitChildren(Node n) 2781Node originalChild = n.Children[i]; 2803public override Node Visit(SortOp op, Node n) 2806Node result;
System\Data\Query\PlanCompiler\NominalTypeEliminator.cs (217)
108private readonly Dictionary<Node, PropertyRefList> m_nodePropertyMap; 124Dictionary<Node, PropertyRefList> nodePropertyMap, 158Dictionary<Node, PropertyRefList> nodePropertyMap; 201Node rootNode = m_command.Root; 289private Node BuildAccessor(Node input, md.EdmProperty property) 327private Node BuildAccessorWithNulls(Node input, md.EdmProperty property) 329Node newNode = this.BuildAccessor(input, property); 345private Node BuildTypeIdAccessor(Node input, TypeInfo typeInfo) 347Node result; 367private Node BuildSoftCast(Node node, md.TypeUsage targetType) 379Node newNode = m_command.CreateNode(m_command.CreateSoftCastOp(targetType), node); 390private Node Copy(Node n) 400private Node CreateNullConstantNode(md.TypeUsage type) 409private Node CreateNullSentinelConstant() 420private Node CreateTypeIdConstant(TypeInfo typeInfo) 443private Node CreateTypeIdConstantForPrefixMatch(TypeInfo typeInfo) 614private void GetPropertyValues(TypeInfo typeInfo, OperationKind opKind, Node input, bool ignoreMissingProperties, 615out List<md.EdmProperty> properties, out List<Node> values) 618values = new List<Node>(); 622KeyValuePair<md.EdmProperty, Node> kv = GetPropertyValue(input, prop, ignoreMissingProperties); 639private KeyValuePair<md.EdmProperty, Node> GetPropertyValue(Node input, md.EdmProperty property, bool ignoreMissingProperties) 641Node n = null; 651return new KeyValuePair<md.EdmProperty, Node>(property, n); 699private Node CreateTVFProjection(Node unnestNode, List<Var> unnestOpTableColumns, TypeInfo unnestOpTableTypeInfo, out List<Var> newVars) 705List<Node> convertToFlattenedTypeVarDefs = new List<Node>(); 772public override Node Visit(VarDefListOp op, Node n) 776List<Node> newChildren = new List<Node>(); 778foreach (Node chi in n.Children) 786List<Node> newChiList; 791foreach (Node newChi in newChiList) 805Node newVarDefListNode = m_command.CreateNode(n.Op, newChildren); 817private void FlattenComputedVar(ComputedVar v, Node node, out List<Node> newNodes, out md.TypeUsage newType) 819newNodes = new List<Node>(); 820Node definingExprNode = node.Child0; // defining expression for the VarDefOp 828Node newVarDefNode = m_command.CreateVarDefNode(definingExprNode, out newVar); 840newNodes = new List<Node>(); 857Node propAccessor = null; 876Node newVarDefNode = m_command.CreateVarDefNode(propAccessor, out newVar); 918private Node FlattenEnumOrStrongSpatialVar(VarDefOp varDefOp, Node node) 924Node newVarDefNode = m_command.CreateVarDefNode(node, out newVar); 940public override Node Visit(PhysicalProjectOp op, Node n) 1048public override Node Visit(DistinctOp op, Node n) 1070public override Node Visit(GroupByOp op, Node n) 1098public override Node Visit(GroupByIntoOp op, Node n) 1125public override Node Visit(ProjectOp op, Node n) 1153public override Node Visit(ScanTableOp op, Node n) 1198internal static Var GetSingletonVar(Node n) 1253public override Node Visit(ScanViewOp op, Node n) 1264Node definingNode = VisitNode(n.Child0); 1290public override Node Visit(SortOp op, Node n) 1314public override Node Visit(UnnestOp op, Node n) 1324Node chi = n.Child0; 1345List<Node> newChildren = new List<Node>(); 1481protected override Node VisitSetOp(SetOp op, Node n) 1518private Node FixupSetOpChild(Node setOpChild, VarMap varMap, List<ComputedVar> newComputedVars) 1532List<Node> varDefOpNodes = new List<Node>(); 1536Node varDefOpNode = m_command.CreateNode(varDefOp, CreateNullConstantNode(v.Type)); 1539Node varDefListNode = m_command.CreateNode(m_command.CreateVarDefListOp(), varDefOpNodes); 1541Node projectNode = m_command.CreateNode(projectOp, setOpChild, varDefListNode); 1721public override Node Visit(SoftCastOp op, Node n) 1740List<Node> newArgs = new List<Node>(); 1749IEnumerator<Node> inputs = n.Child0.Children.GetEnumerator(); 1780Node arg = BuildSoftCast(inputs.Current, md.Helper.GetModelTypeUsage(p)); 1786Node newNode = m_command.CreateNode(newOp, newArgs); 1825public override Node Visit(CastOp op, Node n) 1853private Node RewriteAsCastToUnderlyingType(md.PrimitiveType underlyingType, CastOp op, Node n) 1873public override Node Visit(ConstantOp op, Node n) 1918public override Node Visit(CaseOp op, Node n) 1928Node rewrittenNode; 1960Node newNode = FlattenCaseOp(op, n, m_typeInfo.GetTypeInfo(op.Type), desiredProperties); 1986private bool TryRewriteCaseOp(Node n, bool thenClauseIsNull, out Node rewrittenNode) 1996Node resultNode = thenClauseIsNull ? n.Child2 : n.Child1; 2003Node currentNullSentinel = resultNode.Child0; 2008List<Node> children = new List<Node>(3); 2013Node nullSentinelNullNode = m_command.CreateNode(m_command.CreateNullOp(integerType)); 2014Node nullSentinelThenNode = thenClauseIsNull ? nullSentinelNullNode : currentNullSentinel; 2015Node nullSentinelElseNode = thenClauseIsNull ? currentNullSentinel : nullSentinelNullNode; 2048private Node FlattenCaseOp(CaseOp op, Node n, TypeInfo typeInfo, PropertyRefList desiredProperties) 2053List<Node> fieldValues = new List<Node>(); 2065List<Node> caseChildren = new List<Node>(); 2068Node whenNode = Copy(n.Children[i]); 2072Node propNode = BuildAccessorWithNulls(n.Children[i], property); 2076Node elseNode = BuildAccessorWithNulls(n.Children[n.Children.Count - 1], property); 2079Node caseNode = m_command.CreateNode(m_command.CreateCaseOp(md.Helper.GetModelTypeUsage(property)), caseChildren); 2097public override Node Visit(CollectOp op, Node n) 2115public override Node Visit(ComparisonOp op, Node n) 2142List<Node> values1; 2143List<Node> values2; 2153Node andNode = null; 2157Node newCompNode = m_command.CreateNode(newCompOp, values1[i], values2[i]); 2174public override Node Visit(ConditionalOp op, Node n) 2213List<Node> values = null; 2218Node andNode = null; 2219foreach (Node propertyValue in values) 2221Node isNullNode = m_command.CreateNode(m_command.CreateConditionalOp(OpType.IsNull), propertyValue); 2237public override Node Visit(ConstrainedSortOp op, Node n) 2256public override Node Visit(GetEntityRefOp op, Node n) 2267public override Node Visit(GetRefKeyOp op, Node n) 2281private Node FlattenGetKeyOp(ScalarOp op, Node n) 2293List<Node> inputFieldValues; 2319Node newNode = m_command.CreateNode(rec, inputFieldValues); 2331private Node VisitPropertyOp(Op op, Node n, PropertyRef propertyRef, bool throwIfMissing) 2349Node newNode = null; 2356List<Node> fieldValues = new List<Node>(); 2370Node field = BuildAccessor(n.Child0, newNestedProp); 2406public override Node Visit(PropertyOp op, Node n) 2417public override Node Visit(RelPropertyOp op, Node n) 2434public override Node Visit(RefOp op, Node n) 2444List<Node> inputFieldValues; 2480Node newNode = m_command.CreateNode(recOp, inputFieldValues); 2489private static void RemoveNullSentinel(TypeInfo inputTypeInfo, List<md.EdmProperty> inputFields, List<Node> inputFieldValues, List<md.EdmProperty> outputFields) 2506public override Node Visit(VarRefOp op, Node n) 2537List<Node> newNodeChildren = new List<Node>(); 2543Node newNode = m_command.CreateNode(newOp, newNodeChildren); 2556public override Node Visit(NewEntityOp op, Node n) 2567public override Node Visit(NewInstanceOp op, Node n) 2578public override Node Visit(DiscriminatedNewEntityOp op, Node n) 2596private Node NormalizeTypeDiscriminatorValues(DiscriminatedNewEntityOp op, Node discriminator) 2601List<Node> children = new List<Node>(op.DiscriminatorMap.TypeMap.Count * 2 - 1); 2608Node normalizedDiscriminatorConstant = CreateTypeIdConstant(currentTypeInfo); 2620Node discriminatorConstant = m_command.CreateNode(discriminatorValueOp); 2622Node discriminatorPredicate = m_command.CreateNode(discriminatorPredicateOp, discriminator, discriminatorConstant); 2639public override Node Visit(NewRecordOp op, Node n) 2650private Node GetEntitySetIdExpr(md.EdmProperty entitySetIdProperty, NewEntityBaseOp op) 2652Node entitySetIdNode; 2679private Node FlattenConstructor(ScalarOp op, Node n) 2715List<Node> newFieldValues = new List<Node>(); 2733Node discriminator = n.Children[0]; 2755Node entitySetIdNode = GetEntitySetIdExpr(typeInfo.EntitySetIdProperty, newEntityOp); 2775Node fieldValue = n.Children[childrenIndex]; 2787Node nestedPropertyValue = BuildAccessor(fieldValue, nestedProperty); 2819Node fieldValue = n.Children[childrenIndex]; 2828Node nestedPropertyValue = BuildAccessor(fieldValue, nestedProperty); 2847Node newNode = m_command.CreateNode(newOp, newFieldValues); 2862public override Node Visit(NullOp op, Node n) 2882List<Node> newFieldValues = new List<Node>(); 2912public override Node Visit(IsOfOp op, Node n) 2922Node newNode = CreateTypeComparisonOp(n.Child0, typeInfo, op.IsOfOnly); 2934public override Node Visit(TreatOp op, Node n) 2962Node likeNode = CreateTypeComparisonOp(n.Child0, typeInfo, false); 2964Node caseNode = m_command.CreateNode(caseOp, likeNode, n.Child0, CreateNullConstantNode(caseOp.Type)); 2971Node flattenedCaseNode = FlattenCaseOp(caseOp, caseNode, typeInfo, desiredProperties); 2988private Node CreateTypeComparisonOp(Node input, TypeInfo typeInfo, bool isExact) 2990Node typeIdProperty = BuildTypeIdAccessor(input, typeInfo); 2991Node newNode = null; 3006Node typeIdConstantNode = CreateTypeIdConstantForPrefixMatch(typeInfo); 3024private Node CreateDisjunctiveTypeComparisonOp(TypeInfo typeInfo, Node typeIdProperty) 3031Node current = null; 3034Node typeComparisonNode = CreateTypeEqualsOp(type, typeIdProperty); 3058private Node CreateTypeEqualsOp(TypeInfo typeInfo, Node typeIdProperty) 3060Node typeIdConstantNode = CreateTypeIdConstant(typeInfo); 3062Node result = m_command.CreateNode(eqCompOp, typeIdProperty, typeIdConstantNode);
System\Data\Query\PlanCompiler\Normalizer.cs (29)
83public override Node Visit(ExistsOp op, Node n) 98private Node BuildDummyProjectForExists(Node child) 101Node projectNode = m_command.BuildProject( 114private Node BuildUnnest(Node collectionNode) 120Node varDefNode = m_command.CreateVarDefNode(collectionNode, out newVar); 122Node unnestNode = m_command.CreateNode(unnestOp, varDefNode); 133private Node VisitCollectionFunction(FunctionOp op, Node n) 137Node unnestNode = BuildUnnest(n); 140Node projectNode = m_command.CreateNode(projectOp, unnestNode); 142Node collectNode = m_command.CreateNode(collectOp, projectNode); 167private Node VisitCollectionAggregateFunction(FunctionOp op, Node n) 170Node argNode = n.Child0; 182Node unnestNode = BuildUnnest(argNode); 188Node unnestVarRefNode = m_command.CreateNode(unnestVarRefOp); 193Node aggExprNode = m_command.CreateNode(aggregateOp, unnestVarRefNode); 196Node keyVarDefListNode = m_command.CreateNode(m_command.CreateVarDefListOp()); 200Node aggVarDefListNode = m_command.CreateVarDefListNode(aggExprNode, out aggVar); 203Node gbySubqueryNode = m_command.CreateNode(gbyOp, unnestNode, keyVarDefListNode, aggVarDefListNode); 206Node ret = AddSubqueryToParentRelOp(aggVar, gbySubqueryNode); 220public override Node Visit(FunctionOp op, Node n) 223Node newNode = null; 253protected override Node VisitJoinOp(JoinBaseOp op, Node n)
System\Data\Query\PlanCompiler\PlanCompilerUtil.cs (13)
36internal static bool IsRowTypeCaseOpWithNullability(CaseOp op, Node n, out bool thenClauseIsNull) 79internal static bool IsCollectionAggregateFunction(FunctionOp op, Node n) 113internal static Node CombinePredicates(Node predicate1, Node predicate2, Command command) 115IEnumerable<Node> andParts1 = BreakIntoAndParts(predicate1); 116IEnumerable<Node> andParts2 = BreakIntoAndParts(predicate2); 118Node result = predicate1; 120foreach (Node predicatePart2 in andParts2) 123foreach (Node predicatePart1 in andParts1) 149private static IEnumerable<Node> BreakIntoAndParts(Node predicate) 151return Helpers.GetLeafNodes<Node>(predicate,
System\Data\Query\PlanCompiler\Predicate.cs (18)
58private List<Node> m_parts; 69m_parts = new List<Node>(); 77internal Predicate(Command command, Node andTree) 92internal void AddPart(Node n) 108internal Node BuildAndTree() 110Node andNode = null; 111foreach (Node n in m_parts) 163foreach (Node part in m_parts) 186foreach (Node part in m_parts) 216foreach (Node part in m_parts) 259foreach (Node part in m_parts) 274private void InitFromAndTree(Node andTree) 301foreach (Node part in m_parts) 340private static bool IsEquiJoinPredicate(Node simplePredicateNode, out Var leftVar, out Var rightVar) 377private static bool IsEquiJoinPredicate(Node simplePredicateNode, 421private static bool PreservesNulls(Node simplePredNode, VarVec tableColumns) 475private bool IsKeyPredicate(Node left, Node right, VarVec keyVars, VarVec definitions, out Var keyVar)
System\Data\Query\PlanCompiler\PreProcessor.cs (199)
306private Node ExpandView(Node node, ScanTableOp scanTableOp, ref IsOfOp typeFilter) 380Node ret = definingQuery.GetInternalTree(m_command); 402private void DetermineDiscriminatorMapUsage(Node viewNode, EntitySetBase entitySet, EntityTypeBase rootEntityType, bool includeSubtypes) 463private Node RewriteNavigateOp(Node navigateOpNode, NavigateOp navigateOp, out Var outputVar) 487Node relPropertyNode = m_command.CreateNode(relPropertyOp, 516List<Node> scanTableNodes = new List<Node>(); 522Node branchNode = m_command.CreateNode(tableOp); 528Node unionAllNode = null; 535Node targetEnd = m_command.CreateNode(m_command.CreatePropertyOp(navigateOp.ToEnd), 537Node sourceEnd = m_command.CreateNode(m_command.CreatePropertyOp(navigateOp.FromEnd), 539Node predicateNode = m_command.BuildComparison(OpType.EQ, navigateOpNode.Child0, sourceEnd); 540Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), 543Node projectNode = m_command.BuildProject(filterNode, targetEnd, out projectVar); 548Node ret; 574private Node BuildOfTypeTable(EntitySetBase entitySet, TypeUsage ofType, out Var resultVar) 578Node tableNode = m_command.CreateNode(tableOp); 581Node resultNode; 623private Node RewriteDerefOp(Node derefOpNode, DerefOp derefOp, out Var outputVar) 634List<Node> scanTableNodes = new List<Node>(); 639Node tableNode = BuildOfTypeTable(entitySet, entityType, out tableVar); 644Node unionAllNode; 651Node entityRefNode = m_command.CreateNode( 654Node keyComparisonPred = m_command.BuildComparison(OpType.EQ, derefOpNode.Child0, entityRefNode); 655Node filterNode = m_command.CreateNode( 709private Node BuildJoinForNavProperty(RelationshipSet relSet, RelationshipEndMember end, 717Node asTableNode = BuildOfTypeTable(relSet, null, out rsVar); 718Node esTableNode = BuildOfTypeTable(entitySet, TypeHelpers.GetElementTypeUsage(end.TypeUsage), out esVar); 723Node joinPredicate = m_command.BuildComparison(OpType.EQ, 728Node joinNode = m_command.CreateNode(m_command.CreateInnerJoinOp(), 752private Node RewriteManyToOneNavigationProperty(RelProperty relProperty, 753Node sourceEntityNode, TypeUsage resultType) 756Node relPropertyNode = m_command.CreateNode(relPropertyOp, sourceEntityNode); 758Node derefNode = m_command.CreateNode(derefOp, relPropertyNode); 774private Node RewriteOneToManyNavigationProperty(RelProperty relProperty, 776Node sourceRefNode) 779Node ret = RewriteFromOneNavigationProperty(relProperty, relationshipSets, sourceRefNode, out outputVar); 799private Node RewriteOneToOneNavigationProperty(RelProperty relProperty, 801Node sourceRefNode) 804Node ret = RewriteFromOneNavigationProperty(relProperty, relationshipSets, sourceRefNode, out outputVar); 836private Node RewriteFromOneNavigationProperty(RelProperty relProperty, List<RelationshipSet> relationshipSets, Node sourceRefNode, out Var outputVar) 843List<Node> scanTableNodes = new List<Node>(relationshipSets.Count); 849Node tableNode = BuildOfTypeTable(entitySet, entityType, out tableVar); 858Node unionAllNode; 868Node inverseRelPropertyNode = m_command.CreateNode( 871Node predicateNode = m_command.BuildComparison(OpType.EQ, 873Node ret = m_command.CreateNode(m_command.CreateFilterOp(), unionAllNode, predicateNode); 904private Node RewriteManyToManyNavigationProperty(RelProperty relProperty, 906Node sourceRefNode) 913Node ret = null; 915List<Node> joinNodes = new List<Node>(relationshipSets.Count); 921Node joinNode = BuildJoinForNavProperty(r, relProperty.ToEnd, out rsVar, out esVar); 930Node unionAllNode; 937Node rsSourceRefNode = m_command.CreateNode(m_command.CreatePropertyOp(relProperty.FromEnd), 939Node predicate = m_command.BuildComparison(OpType.EQ, 941Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), 947Node projectNode = m_command.BuildProject(filterNode, new Var[] { unionAllVars[1] }, new Node[] { }); 972private Node RewriteNavigationProperty(NavigationProperty navProperty, 973Node sourceEntityNode, TypeUsage resultType) 1002Node sourceRefNode = m_command.CreateNode( 1035protected override Node VisitScalarOpDefault(ScalarOp op, Node n) 1062public override Node Visit(DerefOp op, Node n) 1068Node ret = RewriteDerefOp(n, op, out outputVar); 1086public override Node Visit(ElementOp op, Node n) 1091Node subQueryRelOp = n.Child0; 1096Node ret = AddSubqueryToParentRelOp(projectVar, subQueryRelOp); 1106public override Node Visit(ExistsOp op, Node n) 1119public override Node Visit(FunctionOp op, Node n) 1143Node ret = functionImportMappingComposable.GetInternalTree(m_command, n.Children); 1195public override Node Visit(CaseOp op, Node n) 1214public override Node Visit(ConditionalOp op, Node n) 1226private void ProcessConditionalOp(ConditionalOp op, Node n) 1241private void ValidateNavPropertyOp(PropertyOp op, Node n) 1276private Node VisitNavPropertyOp(PropertyOp op, Node n) 1295Node ret = RewriteNavigationProperty(navProperty, n.Child0, op.Type); 1306private static bool IsNavigationPropertyOverVarRef(Node n) 1313Node currentNode = n.Child0; 1332public override Node Visit(PropertyOp op, Node n) 1334Node ret; 1355public override Node Visit(RefOp op, Node n) 1370public override Node Visit(TreatOp op, Node n) 1393public override Node Visit(IsOfOp op, Node n) 1465private Node RewriteIsOfAsIsNull(IsOfOp op, Node n) 1469Node isNullNode = m_command.CreateNode(isNullOp, n.Child0); 1476Node notNode = m_command.CreateNode(notOp, isNullNode); 1480Node trueNode = m_command.CreateNode(trueOp); 1484Node nullNode = m_command.CreateNode(nullOp); 1488Node caseNode = m_command.CreateNode(caseOp, notNode, trueNode, nullNode); 1492Node equalsNode = m_command.CreateNode(equalsOp, caseNode, trueNode); 1514public override Node Visit(NavigateOp op, Node n) 1518Node ret = RewriteNavigateOp(n, op, out outputVar); 1600private Node BuildKeyExpressionForNewEntityOp(Op op, Node n) 1606List<Node> keyFields = new List<Node>(); 1617Node keyNode = m_command.CreateNode(keyOp, keyFields); 1644private Node BuildRelPropertyExpression(EntitySetBase entitySet, RelProperty relProperty, 1645Node keyExpr) 1666Node scanNode = m_command.CreateNode(scanTableOp); 1668Node sourceEndNode = m_command.CreateNode( 1671Node predicateNode = m_command.BuildComparison(OpType.EQ, 1674Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), 1680Node ret = VisitNode(filterNode); 1706private IEnumerable<Node> BuildAllRelPropertyExpressions(EntitySetBase entitySet, 1708Dictionary<RelProperty, Node> prebuiltExpressions, 1709Node keyExpr) 1713Node relPropNode; 1729public override Node Visit(NewEntityOp op, Node n) 1742List<Node> newChildren; 1794Node keyExpr = BuildKeyExpressionForNewEntityOp(op, n); 1799Dictionary<RelProperty, Node> prebuiltRelPropertyExprs = new Dictionary<RelProperty, Node>(); 1809newChildren = new List<Node>(); 1815foreach (Node relPropNode in BuildAllRelPropertyExpressions(scope, relProperties, prebuiltRelPropertyExprs, keyExpr)) 1825Node newNode = m_command.CreateNode(newEntityOp, newChildren); 1833public override Node Visit(DiscriminatedNewEntityOp op, Node n) 1858Node keyExpr = BuildKeyExpressionForNewEntityOp(op, n); 1860List<Node> newChildren = new List<Node>(); 1869Dictionary<RelProperty, Node> prebuiltRelPropertyExprs = new Dictionary<RelProperty, Node>(); 1878foreach (Node relPropNode in BuildAllRelPropertyExpressions(op.EntitySet, relProperties, prebuiltRelPropertyExprs, keyExpr)) 1884Node newNode = m_command.CreateNode(newEntityOp, newChildren); 1921public override Node Visit(NewMultisetOp op, Node n) 1923Node resultNode = null; 1934Node singleRowTableNode = m_command.CreateNode(m_command.CreateSingleRowTableOp()); 1935Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), 1938Node fakeChild = m_command.CreateNode(m_command.CreateNullOp(collectionType.TypeUsage)); 1940Node projectNode = m_command.BuildProject(filterNode, fakeChild, out newVar); 1957List<Node> inputNodes = new List<Node>(); 1959foreach (Node chi in n.Children) 1961Node singleRowTableNode = m_command.CreateNode(m_command.CreateSingleRowTableOp()); 1963Node projectNode = m_command.BuildProject(singleRowTableNode, chi, out newVar); 1983List<Node> inputNodes = new List<Node>(); 1988Node singleRowTableNode = m_command.CreateNode(m_command.CreateSingleRowTableOp()); 1990Node discriminatorNode = m_command.CreateNode(m_command.CreateInternalConstantOp(m_command.IntegerType, i)); 1992Node projectNode = m_command.BuildProject(singleRowTableNode, discriminatorNode, out newVar); 2001List<Node> caseArgNodes = new List<Node>(n.Children.Count * 2 + 1); 2008Node whenNode = m_command.CreateNode(equalsOp, 2020Node caseNode = m_command.CreateNode(m_command.CreateCaseOp(collectionType.TypeUsage), caseArgNodes); 2027Node physicalProjectNode = m_command.CreateNode(physicalProjectOp, resultNode); 2030Node collectNode = m_command.CreateNode(collectOp, physicalProjectNode); 2040private bool AreAllConstantsOrNulls(List<Node> nodes) 2042foreach (Node node in nodes) 2059public override Node Visit(CollectOp op, Node n) 2107private Node ProcessScanTable(Node scanTableNode, ScanTableOp scanTableOp, ref IsOfOp typeFilter) 2113Node ret = null; 2141public override Node Visit(ScanTableOp op, Node n) 2153public override Node Visit(ScanViewOp op, Node n) 2183protected override Node VisitJoinOp(JoinBaseOp op, Node n) 2205protected override Node VisitApplyOp(ApplyBaseOp op, Node n) 2222Node ancestor = m_ancestors.Peek(); 2244public override Node Visit(SortOp op, Node n) 2263private bool IsOfTypeOverScanTable(Node n, out IsOfOp typeFilter) 2309public override Node Visit(FilterOp op, Node n) 2314Node ret = ProcessScanTable(n.Child0, (ScanTableOp)n.Child0.Op, ref typeFilter); 2338public override Node Visit(ProjectOp op, Node n) 2350IList<Node> sortChildren = new List<Node>(); 2377Node newNode = VisitRelOpDefault(op, n); 2387public override Node Visit(GroupByIntoOp op, Node n)
System\Data\Query\PlanCompiler\ProjectionPruner.cs (51)
148internal static Node Process(PlanCompiler compilerState, Node node) 159private Node Process(Node node) 252protected override void VisitChildren(Node n) 262protected override void VisitChildrenReverse(Node n) 286public override Node Visit(VarDefListOp op, Node n) 298List<Node> newChildren = new List<Node>(); 299foreach (Node chi in n.Children) 322public override Node Visit(PhysicalProjectOp op, Node n) 350protected override Node VisitNestOp(NestBaseOp op, Node n) 369public override Node Visit(SingleStreamNestOp op, Node n) 383public override Node Visit(MultiStreamNestOp op, Node n) 401protected override Node VisitApplyOp(ApplyBaseOp op, Node n) 418public override Node Visit(DistinctOp op, Node n) 440public override Node Visit(ElementOp op, Node n) 460public override Node Visit(FilterOp op, Node n) 481protected override Node VisitGroupByOp(GroupByBaseOp op, Node n) 529private void RemoveRedundantConstantKeys(VarVec keyVec, VarVec outputVec, Node varDefListNode) 532List<Node> constantKeys = varDefListNode.Children.Where(d => d.Op.OpType == OpType.VarDef 549Node keyNode = constantKeys.First(); 564public override Node Visit(GroupByIntoOp op, Node n) 566Node result = VisitGroupByOp(op, n); 592protected override Node VisitJoinOp(JoinBaseOp op, Node n) 628public override Node Visit(ProjectOp op, Node n) 652public override Node Visit(ScanTableOp op, Node n) 673protected override Node VisitSetOp(SetOp op, Node n) 708protected override Node VisitSortOp(SortBaseOp op, Node n) 736public override Node Visit(UnnestOp op, Node n) 763public override Node Visit(VarRefOp op, Node n) 777public override Node Visit(ExistsOp op, Node n)
System\Data\Query\PlanCompiler\PropertyPushdownHelper.cs (37)
69private readonly Dictionary<Node, PropertyRefList> m_nodePropertyRefMap; 81m_nodePropertyRefMap = new Dictionary<Node, PropertyRefList>(); 97internal static void Process(Command itree, StructuredTypeInfo structuredTypeInfo, out Dictionary<Var, PropertyRefList> varPropertyRefs, out Dictionary<Node, PropertyRefList> nodePropertyRefs) 111private void Process(Node rootNode) 129private PropertyRefList GetPropertyRefList(Node node) 145private void AddPropertyRefs(Node node, PropertyRefList propertyRefs) 248protected override void VisitDefault(Node n) 251foreach (Node chi in n.Children) 274public override void Visit(SoftCastOp op, Node n) 310public override void Visit(CaseOp op, Node n) 333public override void Visit(CollectOp op, Node n) 344public override void Visit(ComparisonOp op, Node n) 364foreach (Node chi in n.Children) 377public override void Visit(ElementOp op, Node n) 391public override void Visit(GetEntityRefOp op, Node n) 413public override void Visit(IsOfOp op, Node n) 431private void VisitPropertyOp(Op op, Node n, PropertyRef propertyRef) 478public override void Visit(RelPropertyOp op, Node n) 491public override void Visit(PropertyOp op, Node n) 504public override void Visit(TreatOp op, Node n) 525public override void Visit(VarRefOp op, Node n) 548public override void Visit(VarDefOp op, Node n) 564public override void Visit(VarDefListOp op, Node n) 585protected override void VisitApplyOp(ApplyBaseOp op, Node n) 599public override void Visit(DistinctOp op, Node n) 617public override void Visit(FilterOp op, Node n) 628protected override void VisitGroupByOp(GroupByBaseOp op, Node n) 660protected override void VisitJoinOp(JoinBaseOp op, Node n) 677public override void Visit(ProjectOp op, Node n) 689public override void Visit(ScanTableOp op, Node n) 702public override void Visit(ScanViewOp op, Node n) 727protected override void VisitSetOp(SetOp op, Node n) 767protected override void VisitSortOp(SortBaseOp op, Node n) 786public override void Visit(UnnestOp op, Node n) 800public override void Visit(PhysicalProjectOp op, Node n) 820public override void Visit(MultiStreamNestOp op, Node n) 831public override void Visit(SingleStreamNestOp op, Node n)
System\Data\Query\PlanCompiler\ProviderCommandInfoUtils.cs (2)
54Node node, 86Node node)
System\Data\Query\PlanCompiler\SubqueryTrackingVisitor.cs (34)
42protected readonly Stack<Node> m_ancestors = new Stack<Node>(); 43private readonly Dictionary<Node, List<Node>> m_nodeSubqueries = new Dictionary<Node, List<Node>>(); 59protected void AddSubqueryToRelOpNode(Node relOpNode, Node subquery) 61List<Node> nestedSubqueries; 66nestedSubqueries = new List<Node>(); 79protected Node AddSubqueryToParentRelOp(Var outputVar, Node subquery) 81Node ancestor = FindRelOpAncestor(); 94protected Node FindRelOpAncestor() 96foreach (Node n in m_ancestors) 119protected override void VisitChildren(Node n) 148private Node AugmentWithSubqueries(Node input, List<Node> subqueries, bool inputFirst) 150Node newNode; 196protected override Node VisitRelOpDefault(RelOp op, Node n) 202List<Node> nestedSubqueries; 211Node newInputNode = AugmentWithSubqueries(n.Child0, nestedSubqueries, true); 225protected bool ProcessJoinOp(JoinBaseOp op, Node n) 234List<Node> nestedSubqueries; 244Node joinCondition = n.Child2; 246Node inputNode = m_command.CreateNode(m_command.CreateSingleRowTableOp()); 248Node filterNode = m_command.CreateNode(m_command.CreateFilterOp(), inputNode, joinCondition); 249Node existsNode = m_command.CreateNode(m_command.CreateExistsOp(), filterNode); 264public override Node Visit(UnnestOp op, Node n) 268List<Node> nestedSubqueries; 273Node newNode = AugmentWithSubqueries(n, nestedSubqueries, false /* inputFirst */);
System\Data\Query\PlanCompiler\TransformationRules.cs (310)
56internal void RemapSubtree(Node subTree) 87internal Node ReMap(Node node, Dictionary<Var, Node> varMap) 95Node newNode = null; 124internal Node Copy(Node node) 142internal bool IsScalarOpTree(Node node) 158foreach (Node relOpAncestor in m_relOpAncestors) 212foreach (Node applyAncestor in applyAncestors) 242internal static bool HasOpNotSafeForNullSentinelValueChange(Node n) 248foreach (Node child in n.Children) 266internal bool IsScalarOpTree(Node node, Dictionary<Var, int> varRefMap) 289internal Dictionary<Var, Node> GetVarMap(Node varDefListNode, Dictionary<Var, int> varRefMap) 293Dictionary<Var, Node> varMap = new Dictionary<Var, Node>(); 294foreach (Node chi in varDefListNode.Children) 318Node n; 341internal Node BuildNullIfExpression(Var conditionVar, Node expr) 344Node varRefNode = this.Command.CreateNode(varRefOp); 345Node whenNode = this.Command.CreateNode(this.Command.CreateConditionalOp(OpType.IsNull), varRefNode); 346Node elseNode = expr; 347Node thenNode = this.Command.CreateNode(this.Command.CreateNullOp(elseNode.Op.Type)); 348Node caseNode = this.Command.CreateNode(this.Command.CreateCaseOp(elseNode.Op.Type), whenNode, thenNode, elseNode); 358internal void SuppressFilterPushdown(Node n) 368internal bool IsFilterPushdownSuppressed(Node n) 405m_suppressions = new Dictionary<Node, Node>(); 414private readonly Dictionary<Node, Node> m_suppressions; 418private Stack<Node> m_relOpAncestors = new Stack<Node>(); 436internal override void PreProcess(Node n) 448internal override void PreProcessSubTree(Node subTree) 477internal override void PostProcessSubTree(Node subtree) 482Node poppedNode = m_relOpAncestors.Pop(); 497internal override void PostProcess(Node n, InternalTrees.Rule rule) 522internal override int GetHashCode(Node node) 547private bool IsScalarOpTree(Node node, Dictionary<Var, int> varRefMap, ref int nonLeafNodeCount) 574foreach (Node chi in node.Children) 839static bool ProcessSimplifyCase(RuleProcessingContext context, Node caseOpNode, out Node newNode) 877private static bool ProcessSimplifyCase_Collapse(CaseOp caseOp, Node caseOpNode, out Node newNode) 880Node firstThenNode = caseOpNode.Child1; 881Node elseNode = caseOpNode.Children[caseOpNode.Children.Count - 1]; 914private static bool ProcessSimplifyCase_EliminateWhenClauses(RuleProcessingContext context, CaseOp caseOp, Node caseOpNode, out Node newNode) 916List<Node> newNodeArgs = null; 967newNodeArgs = new List<Node>(); 1035static bool ProcessFlattenCase(RuleProcessingContext context, Node caseOpNode, out Node newNode) 1038Node elseChild = caseOpNode.Children[caseOpNode.Children.Count - 1]; 1073static bool ProcessComparisonsOverConstant(RuleProcessingContext context, Node node, out Node newNode) 1129static bool ProcessLikeOverConstant(RuleProcessingContext context, Node n, out Node newNode) 1190static bool ProcessLogOpOverConstant(RuleProcessingContext context, Node node, 1191Node constantPredicateNode, Node otherNode, 1192out Node newNode) 1217static bool ProcessAndOverConstantPredicate1(RuleProcessingContext context, Node node, out Node newNode) 1221static bool ProcessAndOverConstantPredicate2(RuleProcessingContext context, Node node, out Node newNode) 1225static bool ProcessOrOverConstantPredicate1(RuleProcessingContext context, Node node, out Node newNode) 1229static bool ProcessOrOverConstantPredicate2(RuleProcessingContext context, Node node, out Node newNode) 1233static bool ProcessNotOverConstantPredicate(RuleProcessingContext context, Node node, out Node newNode) 1258static bool ProcessIsNullOverConstant(RuleProcessingContext context, Node isNullNode, out Node newNode) 1275static bool ProcessIsNullOverNull(RuleProcessingContext context, Node isNullNode, out Node newNode) 1296static bool ProcessNullCast(RuleProcessingContext context, Node castNullOp, out Node newNode) 1320static bool ProcessIsNullOverVarRef(RuleProcessingContext context, Node isNullNode, out Node newNode) 1390private static Node GetPushdownPredicate(Command command, Node filterNode, VarVec columns, out Node nonPushdownPredicateNode) 1392Node pushdownPredicateNode = filterNode.Child1; 1431static bool ProcessFilterOverFilter(RuleProcessingContext context, Node filterNode, out Node newNode) 1433Node newAndNode = context.Command.CreateNode( 1457static bool ProcessFilterOverProject(RuleProcessingContext context, Node filterNode, out Node newNode) 1460Node predicateNode = filterNode.Child1; 1484Node projectNode = filterNode.Child0; 1485Dictionary<Var, Node> varMap = trc.GetVarMap(projectNode.Child1, varRefMap); 1494Node remappedPredicateNode = trc.ReMap(predicateNode, varMap); 1499Node newFilterNode = trc.Command.CreateNode(trc.Command.CreateFilterOp(), projectNode.Child0, remappedPredicateNode); 1500Node newProjectNode = trc.Command.CreateNode(projectNode.Op, newFilterNode, projectNode.Child1); 1539static bool ProcessFilterOverSetOp(RuleProcessingContext context, Node filterNode, out Node newNode) 1548Node nonPushdownPredicate; 1549Node pushdownPredicate = GetPushdownPredicate(trc.Command, filterNode, null, out nonPushdownPredicate); 1564Node setOpNode = filterNode.Child0; 1566List<Node> newSetOpChildren = new List<Node>(); 1577Dictionary<Var, Node> remapMap = new Dictionary<Var, Node>(); 1580Node varRefNode = trc.Command.CreateNode(trc.Command.CreateVarRefOp(kv.Value)); 1589Node predicateNode = pushdownPredicate; 1594Node newPredicateNode = trc.ReMap(predicateNode, remapMap); 1598Node newFilterNode = trc.Command.CreateNode( 1606Node newSetOpNode = trc.Command.CreateNode(setOpNode.Op, newSetOpChildren); 1641static bool ProcessFilterOverDistinct(RuleProcessingContext context, Node filterNode, out Node newNode) 1648Node nonPushdownPredicate; 1649Node pushdownPredicate = GetPushdownPredicate(context.Command, filterNode, null, out nonPushdownPredicate); 1659Node distinctNode = filterNode.Child0; 1660Node pushdownFilterNode = context.Command.CreateNode(context.Command.CreateFilterOp(), distinctNode.Child0, pushdownPredicate); 1661Node newDistinctNode = context.Command.CreateNode(distinctNode.Op, pushdownFilterNode); 1700static bool ProcessFilterOverGroupBy(RuleProcessingContext context, Node filterNode, out Node newNode) 1703Node groupByNode = filterNode.Child0; 1720Node nonPushdownPredicate; 1721Node pushdownPredicate = GetPushdownPredicate(context.Command, filterNode, groupByOp.Keys, out nonPushdownPredicate); 1732Dictionary<Var, Node> varMap = trc.GetVarMap(groupByNode.Child1, varRefMap); 1737Node remappedPushdownPredicate = trc.ReMap(pushdownPredicate, varMap); 1742Node subFilterNode = trc.Command.CreateNode(trc.Command.CreateFilterOp(), groupByNode.Child0, remappedPushdownPredicate); 1743Node newGroupByNode = trc.Command.CreateNode(groupByNode.Op, subFilterNode, groupByNode.Child1, groupByNode.Child2); 1793static bool ProcessFilterOverJoin(RuleProcessingContext context, Node filterNode, out Node newNode) 1806Node joinNode = filterNode.Child0; 1808Node leftInputNode = joinNode.Child0; 1809Node rightInputNode = joinNode.Child1; 1839Node leftSingleTablePredicateNode = null; 1846Node rightSingleTablePredicateNode = null; 1859Node newJoinPredicateNode = null; 1910Node newJoinNode; 1926Node newFilterPredicateNode = predicate.BuildAndTree(); 1956static bool ProcessFilterOverOuterApply(RuleProcessingContext context, Node filterNode, out Node newNode) 1959Node applyNode = filterNode.Child0; 1961Node applyRightInputNode = applyNode.Child1; 1973Node newApplyNode = command.CreateNode(command.CreateCrossApplyOp(), applyNode.Child0, applyRightInputNode); 1974Node newFilterNode = command.CreateNode(command.CreateFilterOp(), newApplyNode, filterNode.Child1); 2000static bool ProcessFilterWithConstantPredicate(RuleProcessingContext context, Node n, out Node newNode) 2030List<Node> varDefNodeList = new List<Node>(); 2035Node constNode = trc.Command.CreateNode(nullConst); 2037Node varDefNode = trc.Command.CreateVarDefNode(constNode, out computedVar); 2046Node constNode = trc.Command.CreateNode(nullConst); 2048Node varDefNode = trc.Command.CreateVarDefNode(constNode, out computedVar); 2053Node singleRowTableNode = trc.Command.CreateNode(trc.Command.CreateSingleRowTableOp()); 2056Node varDefListNode = trc.Command.CreateNode(trc.Command.CreateVarDefListOp(), varDefNodeList); 2058Node projectNode = trc.Command.CreateNode(projectOp, n, varDefListNode); 2110static bool ProcessProjectOverProject(RuleProcessingContext context, Node projectNode, out Node newNode) 2114Node varDefListNode = projectNode.Child1; 2115Node subProjectNode = projectNode.Child0; 2122foreach (Node varDefNode in varDefListNode.Children) 2130Dictionary<Var, Node> varMap = trc.GetVarMap(subProjectNode.Child1, varRefMap); 2137Node newVarDefListNode = trc.Command.CreateNode(trc.Command.CreateVarDefListOp()); 2140foreach (Node varDefNode in varDefListNode.Children) 2150foreach (Node chi in subProjectNode.Child1.Children) 2186static bool ProcessProjectWithNoLocalDefinitions(RuleProcessingContext context, Node n, out Node newNode) 2220static bool ProcessProjectWithSimpleVarRedefinitions(RuleProcessingContext context, Node n, out Node newNode) 2240foreach (Node varDefNode in n.Child1.Children) 2242Node definingExprNode = varDefNode.Child0; 2267List<Node> newVarDefNodes = new List<Node>(); 2268foreach (Node varDefNode in n.Child1.Children) 2290Node newVarDefListNode = command.CreateNode(command.CreateVarDefListOp(), newVarDefNodes); 2326static bool ProcessProjectOpWithNullSentinel(RuleProcessingContext context, Node n, out Node newNode) 2330Node varDefListNode = n.Child1; 2362Node varDefNode = n.Child1.Children[i]; 2363Node definingExprNode = varDefNode.Child0; 2433static bool ProcessApplyOverFilter(RuleProcessingContext context, Node applyNode, out Node newNode) 2436Node filterNode = applyNode.Child1; 2511static bool ProcessOuterApplyOverDummyProjectOverFilter(RuleProcessingContext context, Node applyNode, out Node newNode) 2514Node projectNode = applyNode.Child1; 2516Node filterNode = projectNode.Child0; 2517Node filterInputNode = filterNode.Child0; 2540Node joinNodeRightInput = null; 2567Node varDefNode = projectNode.Child1.Child0; 2605Node joinNode = command.CreateNode(command.CreateLeftOuterJoinOp(), applyNode.Child0, joinNodeRightInput, filterNode.Child1); 2638static bool ProcessCrossApplyOverProject(RuleProcessingContext context, Node applyNode, out Node newNode) 2641Node projectNode = applyNode.Child1; 2703static bool ProcessOuterApplyOverProject(RuleProcessingContext context, Node applyNode, out Node newNode) 2706Node projectNode = applyNode.Child1; 2707Node varDefListNode = projectNode.Child1; 2726Node dummyProjectNode = null; 2741foreach (Node varDefNode in varDefListNode.Children) 2751Node dummyConstantExpr = command.CreateNode(nullSentinelDefinitionOp); 2752Node dummyProjectVarDefListNode = command.CreateVarDefListNode(dummyConstantExpr, out sentinelVar); 2758Node currentDefinition; 2826static bool ProcessApplyOverAnything(RuleProcessingContext context, Node applyNode, out Node newNode) 2829Node applyLeftChild = applyNode.Child0; 2830Node applyRightChild = applyNode.Child1; 2886Node trueNode = command.CreateNode(trueOp); 2916static bool ProcessApplyIntoScalarSubquery(RuleProcessingContext context, Node applyNode, out Node newNode) 2945Node elementNode = command.CreateNode(command.CreateElementOp(oldVar.Type), applyNode.Child1); 2948Node varDefListNode = command.CreateVarDefListNode(elementNode, out newVar); 2972private static bool CanRewriteApply(Node rightChild, ExtendedNodeInfo applyRightChildNodeInfo, OpType applyKind) 3023internal static int CountOutputs(Node node) 3040internal new int VisitChildren(Node n) 3043foreach (Node child in n.Children) 3056protected override int VisitDefault(Node n) 3073protected override int VisitSetOp(SetOp op, Node n) 3086public override int Visit(DistinctOp op, Node n) 3097public override int Visit(FilterOp op, Node n) 3108public override int Visit(GroupByOp op, Node n) 3119public override int Visit(ProjectOp op, Node n) 3131public override int Visit(ScanTableOp op, Node n) 3142public override int Visit(SingleRowTableOp op, Node n) 3153protected override int VisitSortOp(SortBaseOp op, Node n) 3186internal static void RemapSubtree(Node root, Command command, Var oldVar) 3198internal override void RemapSubtree(Node subTree) 3200foreach (Node chi in subTree.Children) 3216public override void Visit(VarDefOp op, Node n) 3233public override void Visit(ScanTableOp op, Node n) 3253protected override void VisitSetOp(SetOp op, Node n) 3300static bool ProcessCrossApplyOverLeftOuterJoinOverSingleRowTable(RuleProcessingContext context, Node applyNode, out Node newNode) 3303Node joinNode = applyNode.Child1; 3390static bool ProcessJoinOverProject(RuleProcessingContext context, Node joinNode, out Node newNode) 3397Node joinConditionNode = joinNode.HasChild2 ? joinNode.Child2 : (Node)null; 3404Node newJoinNode; 3405Node newProjectNode; 3409List<Node> varDefNodes = new List<Node>(); 3422Dictionary<Var, Node> varMap1 = trc.GetVarMap(joinNode.Child0.Child1, varRefMap); 3423Dictionary<Var, Node> varMap2 = trc.GetVarMap(joinNode.Child1.Child1, varRefMap); 3448Node varDefListNode = command.CreateNode( 3470Node projectNode = joinNode.Children[projectNodeIdx]; 3473Dictionary<Var, Node> varMap = trc.GetVarMap(projectNode.Child1, varRefMap); 3551static bool ProcessJoinOverFilter(RuleProcessingContext context, Node joinNode, out Node newNode) 3557Node predicateNode = null; 3558Node newLeftInput = joinNode.Child0; 3567Node newRightInput = joinNode.Child1; 3592Node newJoinNode; 3643static bool ProcessJoinOverSingleRowTable(RuleProcessingContext context, Node joinNode, out Node newNode) 3704static bool ProcessSingleRowOpOverAnything(RuleProcessingContext context, Node singleRowNode, out Node newNode) 3750static bool ProcessSingleRowOpOverProject(RuleProcessingContext context, Node singleRowNode, out Node newNode) 3753Node projectNode = singleRowNode.Child0; 3754Node projectNodeInput = projectNode.Child0; 3812private static bool ProcessSetOpOverEmptySet(RuleProcessingContext context, Node setOpNode, out Node newNode) 3878static bool ProcessGroupByWithSimpleVarRedefinitions(RuleProcessingContext context, Node n, out Node newNode) 3899foreach (Node varDefNode in n.Child1.Children) 3901Node definingExprNode = varDefNode.Child0; 3925List<Node> newVarDefNodes = new List<Node>(); 3926foreach (Node varDefNode in n.Child1.Children) 3945Node newVarDefListNode = command.CreateNode(command.CreateVarDefListOp(), newVarDefNodes); 3973static bool ProcessGroupByOverProject(RuleProcessingContext context, Node n, out Node newNode) 3978Node projectNode = n.Child0; 3979Node projectNodeVarDefList = projectNode.Child1; 3981Node keys = n.Child1; 3982Node aggregates = n.Child2; 4005Node varDefNode = projectNodeVarDefList.Children[i]; 4026Dictionary<Var, Node> varToDefiningNode = new Dictionary<Var, Node>(projectNodeVarDefList.Children.Count); 4029Node varDefNode = projectNodeVarDefList.Children[j]; 4045private Dictionary<Var, Node> m_varReplacementTable; 4048private VarRefReplacer(Dictionary<Var, Node> varReplacementTable, Command command) 4063internal static Node Replace(Dictionary<Var, Node> varReplacementTable, Node root, Command command) 4069public override Node Visit(VarRefOp op, Node n) 4071Node replacementNode; 4087protected override Node VisitDefault(Node n) 4089Node result = base.VisitDefault(n); 4119internal static bool AnyVarUsedMoreThanOnce(VarVec varVec, Node root, Command command) 4126public override void Visit(VarRefOp op, Node n) 4142protected override void VisitChildren(Node n) 4175static bool ProcessGroupByOpWithNoAggregates(RuleProcessingContext context, Node n, out Node newNode) 4184Node varDefListNode = command.CreateNode(varDefListOp); 4227private static bool ProcessGroupByOpOnAllInputColumnsWithAggregateOperation(RuleProcessingContext context, Node n, out Node newNode) 4276var scanTable = command.CreateNode(scanTableOp); 4277var outerApplyNode = command.CreateNode(command.CreateOuterApplyOp(), scanTable, n); 4280var varDefListNode = command.CreateVarDefListNode(command.CreateNode(command.CreateVarRefOp(groupByOp.Outputs.First)), out newVar); 4287Node equality = null; 4294var comparison = command.CreateNode( 4310var filter = command.CreateNode(command.CreateFilterOp(), 4347static bool ProcessSortOpOverAtMostOneRow(RuleProcessingContext context, Node n, out Node newNode) 4386static bool ProcessConstrainedSortOpOverEmptySet(RuleProcessingContext context, Node n, out Node newNode) 4426static bool ProcessDistinctOpOfKeys(RuleProcessingContext context, Node n, out Node newNode) 4441Node varDefListNode = command.CreateNode(varDefListOp);
System\Data\Query\PlanCompiler\VarRefManager.cs (12)
28private Dictionary<Node, Node> m_nodeToParentMap; //child-parent mapping 29private Dictionary<Node, int> m_nodeToSiblingNumber; //the index of the given node among its siblings, i.e. 0 for a first child 40m_nodeToParentMap = new Dictionary<Node, Node>(); 41m_nodeToSiblingNumber = new Dictionary<Node, int>(); 52internal void AddChildren(Node parent) 71internal bool HasKeyReferences(VarVec keys, Node definingNode, Node targetJoinNode) 73Node currentChild = definingNode; 74Node parent; 117private static bool HasVarReferencesShallow(Node node, VarVec vars, int childIndex, out bool continueUp)
System\Data\Query\PlanCompiler\VarRemapper.cs (14)
83internal virtual void RemapNode(Node node) 96internal virtual void RemapSubtree(Node subTree) 103foreach (Node chi in subTree.Children) 234protected override void VisitDefault(Node n) 240public override void Visit(VarRefOp op, Node n) 255protected override void VisitNestOp(NestBaseOp op, Node n) 260public override void Visit(PhysicalProjectOp op, Node n) 271protected override void VisitGroupByOp(GroupByBaseOp op, Node n) 277public override void Visit(GroupByIntoOp op, Node n) 282public override void Visit(DistinctOp op, Node n) 287public override void Visit(ProjectOp op, Node n) 292public override void Visit(UnnestOp op, Node n) 301protected override void VisitSetOp(SetOp op, Node n) 307protected override void VisitSortOp(SortBaseOp op, Node n)