protected override NodeInfo VisitApplyOp(ApplyBaseOp op, Node n) { ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n); ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0); ExtendedNodeInfo extendedNodeInfo3 = this.GetExtendedNodeInfo(n.Child1); extendedNodeInfo1.Definitions.Or(extendedNodeInfo2.Definitions); extendedNodeInfo1.Definitions.Or(extendedNodeInfo3.Definitions); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo3.ExternalReferences); extendedNodeInfo1.ExternalReferences.Minus(extendedNodeInfo1.Definitions); extendedNodeInfo1.Keys.InitFrom(extendedNodeInfo2.Keys, extendedNodeInfo3.Keys); extendedNodeInfo1.NonNullableDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); if (op.OpType == OpType.CrossApply) { extendedNodeInfo1.NonNullableDefinitions.Or(extendedNodeInfo3.NonNullableDefinitions); } extendedNodeInfo1.NonNullableVisibleDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); extendedNodeInfo1.NonNullableVisibleDefinitions.Or(extendedNodeInfo3.NonNullableDefinitions); RowCount maxRows = extendedNodeInfo2.MaxRows > RowCount.One || extendedNodeInfo3.MaxRows > RowCount.One ? RowCount.Unbounded : RowCount.One; RowCount minRows = op.OpType == OpType.CrossApply ? RowCount.Zero : extendedNodeInfo2.MinRows; extendedNodeInfo1.SetRowCount(minRows, maxRows); return((NodeInfo)extendedNodeInfo1); }
/// <summary> /// Computes a NodeInfo for a CrossApply/OuterApply op. /// Definitions = Definitions of my children /// LocalDefinitions = None /// Keys = Concatenation of the keys of my children (if every one of them has keys; otherwise, null) /// External References = any external references from the inputs /// RowCount: /// CrossApply: minRows=0; MaxRows=Unbounded /// (MaxRows = 1, if both inputs have MaxRow less than or equal to 1) /// OuterApply: minRows=leftInput.MinRows; MaxRows=Unbounded /// (MaxRows = 1, if both inputs have MaxRow less than or equal to 1) /// NonNullableDefinitions = /// CrossApply: NonNullableDefinitions of both children /// OuterApply: NonNullableDefinitions of the left child /// NonNullableInputDefinitions = NonNullabeDefinitions of both children /// </summary> /// <param name="op"> The ApplyOp </param> /// <param name="n"> corresponding Node </param> protected override NodeInfo VisitApplyOp(ApplyBaseOp op, Node n) { var nodeInfo = InitExtendedNodeInfo(n); var leftRelOpNodeInfo = GetExtendedNodeInfo(n.Child0); var rightRelOpNodeInfo = GetExtendedNodeInfo(n.Child1); nodeInfo.Definitions.Or(leftRelOpNodeInfo.Definitions); nodeInfo.Definitions.Or(rightRelOpNodeInfo.Definitions); nodeInfo.ExternalReferences.Or(leftRelOpNodeInfo.ExternalReferences); nodeInfo.ExternalReferences.Or(rightRelOpNodeInfo.ExternalReferences); nodeInfo.ExternalReferences.Minus(nodeInfo.Definitions); nodeInfo.Keys.InitFrom(leftRelOpNodeInfo.Keys, rightRelOpNodeInfo.Keys); //NonNullableDefinitions nodeInfo.NonNullableDefinitions.InitFrom(leftRelOpNodeInfo.NonNullableDefinitions); if (op.OpType == OpType.CrossApply) { nodeInfo.NonNullableDefinitions.Or(rightRelOpNodeInfo.NonNullableDefinitions); } nodeInfo.NonNullableVisibleDefinitions.InitFrom(leftRelOpNodeInfo.NonNullableDefinitions); nodeInfo.NonNullableVisibleDefinitions.Or(rightRelOpNodeInfo.NonNullableDefinitions); RowCount maxRows; if (leftRelOpNodeInfo.MaxRows <= RowCount.One && rightRelOpNodeInfo.MaxRows <= RowCount.One) { maxRows = RowCount.One; } else { maxRows = RowCount.Unbounded; } var minRows = (op.OpType == OpType.CrossApply) ? RowCount.Zero : leftRelOpNodeInfo.MinRows; nodeInfo.SetRowCount(minRows, maxRows); return(nodeInfo); }
// <summary> // ApplyOp common processing // </summary> protected override Node VisitApplyOp(ApplyBaseOp op, Node n) { return ApplyOpJoinOp(op, n); }
/// <summary> /// Perform default relop processing; Also "require" the join-elimination phase /// </summary> /// <param name="op"></param> /// <param name="n"></param> /// <returns></returns> protected override Node VisitApplyOp(ApplyBaseOp op, Node n) { m_compilerState.MarkPhaseAsNeeded(PlanCompilerPhase.JoinElimination); return VisitRelOpDefault(op, n); }
/// <summary> /// Default handler for all ApplyOps /// </summary> /// <param name="op"> apply op </param> /// <param name="n"> </param> protected virtual void VisitApplyOp(ApplyBaseOp op, Node n) { VisitRelOpDefault(op, n); }
protected override void VisitApplyOp(ApplyBaseOp op, Node n) { VisitRelOpDefault(op, n); AssertRelOpOrPhysicalOp(n.Child0.Op); AssertRelOpOrPhysicalOp(n.Child1.Op); }
/// <summary> /// ApplyOp handling /// CrossApplyOp handling /// OuterApplyOp handling /// /// Handling for all ApplyOps: Process the right child, and then /// the left child - since the right child may have references to the /// left /// </summary> /// <param name="op"> apply op </param> /// <param name="n"> </param> protected override void VisitApplyOp(ApplyBaseOp op, Node n) { VisitNode(n.Child1); // the right input VisitNode(n.Child0); // the left input }
protected virtual void VisitApplyOp(ApplyBaseOp op, Node n) { this.VisitRelOpDefault((RelOp)op, n); }
protected virtual void VisitApplyOp(ApplyBaseOp op, Node n) { VisitRelOpDefault(op, n); }
// <summary> // Common handling for all ApplyOps // </summary> // <param name="op"> the ApplyOp </param> // <param name="n"> the node to process </param> // <returns> a potentially modified subtree </returns> protected virtual TResultType VisitApplyOp(ApplyBaseOp op, Node n) { return(VisitRelOpDefault(op, n)); }