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