Exemple #1
0
        /// <summary>
        ///     Computes a NodeInfo for Distinct.
        ///     Definitions = OutputVars that are not external references
        ///     LocalDefinitions = None
        ///     Keys = Output Vars
        ///     External References = any external references from the inputs
        ///     RowCount = Input's RowCount
        ///     NonNullabeDefinitions : NonNullabeDefinitions of the input RelOp that are outputs
        ///     NonNullableInputDefinitions : default(empty) because cannot be used
        /// </summary>
        /// <param name="op"> The DistinctOp </param>
        /// <param name="n"> corresponding Node </param>
        public override NodeInfo Visit(DistinctOp op, Node n)
        {
            var nodeInfo = InitExtendedNodeInfo(n);

            //#497217 - The parameters should not be included as keys
            nodeInfo.Keys.InitFrom(op.Keys, true);

            // external references - inherit from child
            var childNodeInfo = GetExtendedNodeInfo(n.Child0);

            nodeInfo.ExternalReferences.InitFrom(childNodeInfo.ExternalReferences);

            // no local definitions - definitions are just the keys that are not external references
            foreach (var v in op.Keys)
            {
                if (childNodeInfo.Definitions.IsSet(v))
                {
                    nodeInfo.Definitions.Set(v);
                }
                else
                {
                    nodeInfo.ExternalReferences.Set(v);
                }
            }

            //Non-nullable definitions
            nodeInfo.NonNullableDefinitions.InitFrom(childNodeInfo.NonNullableDefinitions);
            nodeInfo.NonNullableDefinitions.And(op.Keys);

            nodeInfo.InitRowCountFrom(childNodeInfo);
            return(nodeInfo);
        }
Exemple #2
0
        // <summary>
        // Copies a DistinctOp
        // </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(DistinctOp op, Node n)
        {
            // Visit the Node's children and map their Vars
            var children = ProcessChildren(n);

            // Copy the DistinctOp's Keys
            var newDistinctKeys = Copy(op.Keys);

            // Create a new DistinctOp that uses the copied keys
            var newDistinctOp = m_destCmd.CreateDistinctOp(newDistinctKeys);

            // Return a new Node that references the copied DistinctOp and has the copied child Nodes as its children
            return(m_destCmd.CreateNode(newDistinctOp, children));
        }
        public override void Visit(DistinctOp op, Node n)
        {
            Dictionary <string, object> attrs = new Dictionary <string, object>();
            StringBuilder stringBuilder       = new StringBuilder();
            string        str = string.Empty;

            foreach (Var key in op.Keys)
            {
                stringBuilder.Append(str);
                stringBuilder.Append(key.Id);
                str = ",";
            }
            if (stringBuilder.Length != 0)
            {
                attrs.Add("Keys", (object)stringBuilder.ToString());
            }
            using (new Dump.AutoXml(this, (Op)op, attrs))
                this.VisitChildren(n);
        }
Exemple #4
0
        public override void Visit(DistinctOp op, Node n)
        {
            var attrs = new Dictionary <string, object>();

            var sb        = new StringBuilder();
            var separator = string.Empty;

            foreach (var v in op.Keys)
            {
                sb.Append(separator);
                sb.Append(v.Id);
                separator = ",";
            }
            if (0 != sb.Length)
            {
                attrs.Add("Keys", sb.ToString());
            }

            using (new AutoXml(this, op, attrs))
            {
                VisitChildren(n);
            }
        }
        public override NodeInfo Visit(DistinctOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n);

            extendedNodeInfo1.Keys.InitFrom((IEnumerable <Var>)op.Keys, true);
            ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0);

            extendedNodeInfo1.ExternalReferences.InitFrom(extendedNodeInfo2.ExternalReferences);
            foreach (Var key in op.Keys)
            {
                if (extendedNodeInfo2.Definitions.IsSet(key))
                {
                    extendedNodeInfo1.Definitions.Set(key);
                }
                else
                {
                    extendedNodeInfo1.ExternalReferences.Set(key);
                }
            }
            extendedNodeInfo1.NonNullableDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions);
            extendedNodeInfo1.NonNullableDefinitions.And(op.Keys);
            extendedNodeInfo1.InitRowCountFrom(extendedNodeInfo2);
            return((NodeInfo)extendedNodeInfo1);
        }
        public override Node Visit(DistinctOp op, Node n)
        {
            List <Node> args = this.ProcessChildren(n);

            return(this.m_destCmd.CreateNode((Op)this.m_destCmd.CreateDistinctOp(this.Copy(op.Keys)), args));
        }
 public virtual void Visit(DistinctOp op, Node n)
 {
     this.VisitRelOpDefault((RelOp)op, n);
 }
Exemple #8
0
 public override void Visit(DistinctOp op, Node n)
 {
     VisitRelOpDefault(op, n);
     AssertRelOp(n.Child0.Op);
 }
Exemple #9
0
 /// <summary>
 ///     Visitor pattern method for DistinctOp
 /// </summary>
 /// <param name="op"> The DistinctOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(DistinctOp op, Node n)
 {
     VisitRelOpDefault(op, n);
 }
Exemple #10
0
 // <summary>
 // Distinct
 // </summary>
 public virtual TResultType Visit(DistinctOp op, Node n)
 {
     return(VisitRelOpDefault(op, n));
 }