public override void Visit(FilterOp op, Node n) { VisitRelOpDefault(op, n); AssertRelOpOrPhysicalOp(n.Child0.Op); AssertScalarOp(n.Child1.Op); AssertBooleanOp(n.Child1.Op); }
public override NodeInfo Visit(FilterOp op, Node n) { ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n); ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0); NodeInfo nodeInfo = this.GetNodeInfo(n.Child1); extendedNodeInfo1.Definitions.Or(extendedNodeInfo2.Definitions); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences); extendedNodeInfo1.ExternalReferences.Or(nodeInfo.ExternalReferences); extendedNodeInfo1.ExternalReferences.Minus(extendedNodeInfo2.Definitions); extendedNodeInfo1.Keys.InitFrom(extendedNodeInfo2.Keys); extendedNodeInfo1.NonNullableDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); extendedNodeInfo1.NonNullableVisibleDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); extendedNodeInfo1.MinRows = RowCount.Zero; ConstantPredicateOp op1 = n.Child1.Op as ConstantPredicateOp; extendedNodeInfo1.MaxRows = op1 == null || !op1.IsFalse ? extendedNodeInfo2.MaxRows : RowCount.Zero; return((NodeInfo)extendedNodeInfo1); }
/// <summary> /// Computes a NodeInfo for a FilterOp. /// Definitions = Definitions of the input Relop /// LocalDefinitions = None /// Keys = Keys of the input Relop /// External References = any external references from the input + any external /// references from the predicate /// MaxOneRow = Input's RowCount /// If the predicate is a "false" predicate, then max RowCount is zero /// If we can infer additional info from the key-selector, we may be /// able to get better estimates /// NonNullabeDefinitions = NonNullabeDefinitions of the input RelOp /// NonNullableInputDefinitions = NonNullabeDefinitions of the input RelOp /// </summary> /// <param name="op"> The FilterOp </param> /// <param name="n"> corresponding Node </param> public override NodeInfo Visit(FilterOp op, Node n) { var nodeInfo = InitExtendedNodeInfo(n); var relOpChildNodeInfo = GetExtendedNodeInfo(n.Child0); var predNodeInfo = GetNodeInfo(n.Child1); // definitions are my child's definitions nodeInfo.Definitions.Or(relOpChildNodeInfo.Definitions); // No local definitions // My external references are my child's external references + those made // by my predicate nodeInfo.ExternalReferences.Or(relOpChildNodeInfo.ExternalReferences); nodeInfo.ExternalReferences.Or(predNodeInfo.ExternalReferences); nodeInfo.ExternalReferences.Minus(relOpChildNodeInfo.Definitions); // my keys are my child's keys nodeInfo.Keys.InitFrom(relOpChildNodeInfo.Keys); //The non-nullable definitions are same as these of the child nodeInfo.NonNullableDefinitions.InitFrom(relOpChildNodeInfo.NonNullableDefinitions); nodeInfo.NonNullableVisibleDefinitions.InitFrom(relOpChildNodeInfo.NonNullableDefinitions); // inherit max RowCount from child; set min RowCount to 0, because // we require way more analysis to do anything smarter nodeInfo.MinRows = RowCount.Zero; // If the predicate is a "false" predicate, then we know that MaxRows // is zero as well var predicate = n.Child1.Op as ConstantPredicateOp; if (predicate != null && predicate.IsFalse) { nodeInfo.MaxRows = RowCount.Zero; } else { nodeInfo.MaxRows = relOpChildNodeInfo.MaxRows; } return(nodeInfo); }
// <summary> // Copies a filterOp // </summary> // <param name="op"> The Op to Copy </param> // <param name="n"> The Node that references the Op </param> // <returns> A copy of the original Node that references a copy of the original Op </returns> public override Node Visit(FilterOp op, Node n) { return(CopyDefault(m_destCmd.CreateFilterOp(), n)); }
public virtual void Visit(FilterOp op, Node n) { this.VisitRelOpDefault((RelOp)op, n); }
/// <summary> /// Visitor pattern method for FilterOp /// </summary> /// <param name="op"> The FilterOp being visited </param> /// <param name="n"> The Node that references the Op </param> public virtual void Visit(FilterOp op, Node n) { VisitRelOpDefault(op, n); }
// <summary> // FilterOp // </summary> public virtual TResultType Visit(FilterOp op, Node n) { return(VisitRelOpDefault(op, n)); }