System\Data\Query\PlanCompiler\NestPullup.cs (126)
103PlanCompiler.Assert(Command.Root.Op.OpType == OpType.PhysicalProject, "root node is not physicalProject?");
104Command.Root = VisitNode(Command.Root);
108SortRemover.Process(Command);
268VarVec newVarVec = Command.CreateVarVec(RemapVars(varVec, varMap));
465KeyVec keys = Command.PullupKeys(chi);
503newJoinApplyChildren.Add(AugmentNodeWithConstant(chi.Child0, () => Command.CreateNullSentinelOp(), out sentinelVar));
534Node newJoinApplyNode = Command.CreateNode(op, newJoinApplyChildren);
543ExtendedNodeInfo xni = newJoinApplyNode.GetExtendedNodeInfo(Command);
544VarVec newOutputVars = Command.CreateVarVec(xni.Definitions);
552NestBaseOp newNestOp = Command.CreateMultiStreamNestOp(new List<InternalTrees.SortKey>(), newOutputVars, newCollectionInfoList);
553Node newNode = Command.CreateNode(newNestOp, newNestChildren);
599Node varRefNode = Command.CreateNode(Command.CreateVarRefOp(var));
600Node predicateNode = Command.CreateNode(
601Command.CreateConditionalOp(OpType.Not),
602Command.CreateNode(
603Command.CreateConditionalOp(OpType.IsNull),
607Node filterNode = Command.CreateNode(Command.CreateFilterOp(), input, predicateNode);
683Command.RecomputeNodeInfo(n);
684Command.RecomputeNodeInfo(nestOpNode);
728VarVec projectOpOutputs = Command.CreateVarVec(op.Outputs);
739Node groupByNode = Command.CreateNode(
740Command.CreateGroupByOp(op.Keys, groupByOutputs), n.Child0, n.Child1, n.Child2);
742Node projectNode = Command.CreateNode(
743Command.CreateProjectOp(projectOpOutputs),
819if (!Command.GetExtendedNodeInfo(sortNode).ExternalReferences.IsSet(key.Var))
825this.Command.RecomputeNodeInfo(n);
827this.Command.RecomputeNodeInfo(sortNode);
906VarVec nestOpCollectionOutputs = Command.CreateVarVec();
915VarVec newOutputVars = Command.CreateVarVec(nestOp.Outputs);
954MultiStreamNestOp newNestOp = Command.CreateMultiStreamNestOp(sortKeys, newOutputVars, newCollectionInfo);
955Node newNode = Command.CreateNode(newNestOp, newNestInputs);
958Command.RecomputeNodeInfo(newNode);
989VarVec externalReferences = Command.CreateVarVec();
990VarVec collectionReferences = Command.CreateVarVec();
1046VarVec outputVars = Command.CreateVarVec(op.Outputs);
1050VarVec newProjectVars = Command.CreateVarVec(op.Outputs);
1095newNestedProjectNodeInputs.Add(Command.CreateNode(Command.CreateVarDefListOp(), referencedVars));
1097VarVec newNestedProjectOutputs = Command.CreateVarVec(nestedNestOp.Outputs);
1111Node newNestedProjectNode = Command.CreateNode(Command.CreateProjectOp(newNestedProjectOutputs), newNestedProjectNodeInputs);
1116VarVec newNestedNestOutputs = Command.CreateVarVec(newNestedProjectOutputs);
1119MultiStreamNestOp newNestedNestOp = Command.CreateMultiStreamNestOp(
1130projectNode = Command.CreateNode(newNestedNestOp, newNestedNestNodeInputs);
1138ProjectOp newProjectOp = Command.CreateProjectOp(newProjectVars);
1139projectNode.Child1 = Command.CreateNode(projectNode.Child1.Op, newChildren);
1154externalReferences.And(projectNode.GetExtendedNodeInfo(Command).Definitions);
1159MultiStreamNestOp nestOp = Command.CreateMultiStreamNestOp(new List<InternalTrees.SortKey>(), outputVars, collectionInfoList);
1163Node nestNode = Command.CreateNode(nestOp, collectionNodes);
1166Command.RecomputeNodeInfo(projectNode);
1167Command.RecomputeNodeInfo(nestNode);
1232externalReferences.Or(Command.GetNodeInfo(physicalProjectNode).ExternalReferences);
1243VarVec flattenedElementVarVec = Command.CreateVarVec(flattenedElementVarList); // Use a VarVec to make the lookups faster
1250sortKeys = OpCopier.Copy(Command, sortOp.Keys);
1267VarVec keyVars = Command.GetExtendedNodeInfo(nestOpInput).Keys.KeyVars;
1273VarVec keys = (keyVarsClone.IsEmpty) ? keyVars.Clone() : Command.CreateVarVec();
1353VarVec oldNestOpCollectionOutputs = Command.CreateVarVec();
1360VarVec oldNestOpNonCollectionOutputs = Command.CreateVarVec(nestOp.Outputs);
1364VarVec oldProjectOpNonCollectionOutputs = Command.CreateVarVec(projectOp.Outputs);
1368VarVec oldProjectOpCollectionOutputs = Command.CreateVarVec(projectOp.Outputs);
1373VarVec collectionsToRemove = Command.CreateVarVec(oldNestOpCollectionOutputs);
1403VarVec leftCorrelationVars = Command.CreateVarVec();
1406leftCorrelationVars.Or(nestNode.Children[i].GetExtendedNodeInfo(Command).ExternalReferences);
1408leftCorrelationVars.And(nestNode.Child0.GetExtendedNodeInfo(this.Command).Definitions);
1411VarVec newProjectOpOutputs = Command.CreateVarVec(oldProjectOpNonCollectionOutputs);
1438NullOp tempOp = Command.CreateNullOp(Command.StringType);
1439Node tempNode = Command.CreateNode(tempOp);
1441Node varDefNode = Command.CreateVarDefNode(tempNode, out tempVar);
1449projectNode.Op = Command.CreateProjectOp(Command.CreateVarVec(newProjectOpOutputs));
1450projectNode.Child1 = Command.CreateNode(projectNode.Child1.Op, newProjectOpChildren);
1465VarVec nestOpOutputs = Command.CreateVarVec(projectOp.Outputs);
1469nestOpOutputs.Or(newNestNodeChildren[i].GetNodeInfo(Command).ExternalReferences);
1478nestNode.Op = Command.CreateMultiStreamNestOp(nestOp.PrefixSortKeys, nestOpOutputs, newCollectionInfoList);
1481nestNode = Command.CreateNode(nestNode.Op, newNestNodeChildren);
1488Command.RecomputeNodeInfo(projectNode);
1492Command.RecomputeNodeInfo(nestNode);
1534Node newSingleRowOpNode = Command.CreateNode(op, n.Child0);
1536Command.RecomputeNodeInfo(n);
1634VarVec sortVars = Command.CreateVarVec();
1642result = Command.CreateMultiStreamNestOp(sortKeyList, inputNestOp.Outputs, inputNestOp.CollectionInfo);
1656VarVec sortVars = Command.CreateVarVec();
1836Node newNode = OpCopierTrackingCollectionVars.Copy(Command, refVarDefiningNode, out varMap, out collectionVarDefinitions);
1863VarList newOutputs = VarRemapper.RemapVarList(Command, varMap, originalPhysicalProjectOp.Outputs);
1866PhysicalProjectOp newPhysicalProjectOp = Command.CreatePhysicalProjectOp(newOutputs, newColumnMap);
1867Node newDefiningNode = Command.CreateNode(newPhysicalProjectOp, collectionVarDefinitionPair.Value);
1939if (n != Command.Root || !IsNestOpNode(n.Child0))
1976n.Op = Command.CreatePhysicalProjectOp(outputVars, newProjectColumnMap);
2004SortOp sortOp = Command.CreateSortOp(sortKeyList);
2005sortNode = Command.CreateNode(sortOp, nestNode.Child0);
2031VarVec sortVars = Command.CreateVarVec();
2146VarVec childKeys = Command.CreateVarVec(((SingleStreamNestOp)nestNode.Children[i].Op).Keys);
2161KeyVec drivingNodeKeys = Command.PullupKeys(drivingNode);
2180ExtendedNodeInfo drivingNodeInfo = Command.GetExtendedNodeInfo(drivingNode);
2216VarVec flattenedOutputVarVec = Command.CreateVarVec(flattenedOutputVarList);
2217VarVec nestOpOutputs = Command.CreateVarVec(flattenedOutputVarVec);
2321SingleStreamNestOp newSsnOp = Command.CreateSingleStreamNestOp(
2328Node newNestNode = Command.CreateNode(newSsnOp, unionAllNode);
2433return AugmentNodeWithConstant(input, () => Command.CreateInternalConstantOp(Command.IntegerType, value), out internalConstantVar);
2450Node constantNode = Command.CreateNode(constantOp);
2451Node varDefListNode = Command.CreateVarDefListNode(constantNode, out constantVar);
2455ExtendedNodeInfo inputNodeInfo = Command.GetExtendedNodeInfo(input);
2456VarVec projectOutputs = Command.CreateVarVec(inputNodeInfo.Definitions);
2459ProjectOp projectOp = Command.CreateProjectOp(projectOutputs);
2460Node projectNode = Command.CreateNode(projectOp, input, varDefListNode);
2495newDrivingNode = OpCopier.Copy(Command, drivingNode, drivingNodeVars, out newDrivingNodeVars);
2500VarRemapper varRemapper = new VarRemapper(this.Command);
2512op = Command.CreateCrossApplyOp();
2522op = Command.CreateOuterApplyOp();
2526Node applyNode = Command.CreateNode(op, newDrivingNode, nestNode.Children[i]);
2557NullOp nullOp = Command.CreateNullOp(v.Type);
2558Node nullOpNode = Command.CreateNode(nullOp);
2560Node nullOpVarDefNode = Command.CreateVarDefNode(nullOpNode, out nullOpVar);
2567Node varDefListNode = Command.CreateNode(Command.CreateVarDefListOp(), varDefListChildren);
2570VarVec projectOutputsVarSet = Command.CreateVarVec(projectOutputs);
2571ProjectOp projectOp = Command.CreateProjectOp(projectOutputsVarSet);
2572Node projectNode = Command.CreateNode(projectOp, applyNode, varDefListNode);
2586Var outputVar = Command.CreateSetOpVar(unionAllOutputs[idx].Type);
2590UnionAllOp unionAllOp = Command.CreateUnionAllOp(unionAllMap, projectMap);
2591unionAllNode = Command.CreateNode(unionAllOp, unionAllNode, projectNode);