public override NodeInfo Visit(CrossJoinOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n);
            List <KeyVec>    keyVecList        = new List <KeyVec>();
            RowCount         maxRows           = RowCount.Zero;
            RowCount         minRows           = RowCount.One;

            foreach (Node child in n.Children)
            {
                ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(child);
                extendedNodeInfo1.Definitions.Or(extendedNodeInfo2.Definitions);
                extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences);
                keyVecList.Add(extendedNodeInfo2.Keys);
                extendedNodeInfo1.NonNullableDefinitions.Or(extendedNodeInfo2.NonNullableDefinitions);
                if (extendedNodeInfo2.MaxRows > maxRows)
                {
                    maxRows = extendedNodeInfo2.MaxRows;
                }
                if (extendedNodeInfo2.MinRows < minRows)
                {
                    minRows = extendedNodeInfo2.MinRows;
                }
            }
            extendedNodeInfo1.Keys.InitFrom(keyVecList);
            extendedNodeInfo1.SetRowCount(minRows, maxRows);
            return((NodeInfo)extendedNodeInfo1);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Computes a NodeInfo for a CrossJoinOp.
        ///     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: MinRows: min(min-rows of each child)
        ///     MaxRows: max(max-rows of each child)
        ///     NonNullableDefinitions : The NonNullableDefinitions of the children
        ///     NonNullableInputDefinitions : default(empty) because cannot be used
        /// </summary>
        /// <param name="op"> The CrossJoinOp </param>
        /// <param name="n"> corresponding Node </param>
        public override NodeInfo Visit(CrossJoinOp op, Node n)
        {
            var nodeInfo = InitExtendedNodeInfo(n);

            // No definitions of my own. Simply inherit from my children
            // My external references are the union of my children's external
            // references
            // And my keys are the concatenation of the keys of each of my
            // inputs
            var keyVecList = new List <KeyVec>();
            var maxCard    = RowCount.Zero;
            var minCard    = RowCount.One;

            foreach (var chi in n.Children)
            {
                var chiNodeInfo = GetExtendedNodeInfo(chi);
                nodeInfo.Definitions.Or(chiNodeInfo.Definitions);
                nodeInfo.ExternalReferences.Or(chiNodeInfo.ExternalReferences);
                keyVecList.Add(chiNodeInfo.Keys);

                nodeInfo.NonNullableDefinitions.Or(chiNodeInfo.NonNullableDefinitions);

                // Not entirely precise, but good enough
                if (chiNodeInfo.MaxRows > maxCard)
                {
                    maxCard = chiNodeInfo.MaxRows;
                }
                if (chiNodeInfo.MinRows < minCard)
                {
                    minCard = chiNodeInfo.MinRows;
                }
            }
            nodeInfo.Keys.InitFrom(keyVecList);

            nodeInfo.SetRowCount(minCard, maxCard);

            return(nodeInfo);
        }
Exemplo n.º 3
0
 // <summary>
 // Copies a CrossJoinOp
 // </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(CrossJoinOp op, Node n)
 {
     return(CopyDefault(m_destCmd.CreateCrossJoinOp(), n));
 }
 public virtual void Visit(CrossJoinOp op, Node n)
 {
     this.VisitJoinOp((JoinBaseOp)op, n);
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Visitor pattern method for CrossJoinOp
 /// </summary>
 /// <param name="op"> The CrossJoinOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(CrossJoinOp op, Node n)
 {
     VisitJoinOp(op, n);
 }
Exemplo n.º 6
0
 // <summary>
 // CrossJoin
 // </summary>
 public virtual TResultType Visit(CrossJoinOp op, Node n)
 {
     return(VisitJoinOp(op, n));
 }
 public virtual TResultType Visit(CrossJoinOp op, Node n)
 {
     return(this.VisitJoinOp((JoinBaseOp)op, n));
 }