protected override void VisitSetOp(SetOp op, Node n)
        {
            Dictionary <string, object> attrs = new Dictionary <string, object>();

            if (OpType.UnionAll == op.OpType)
            {
                UnionAllOp unionAllOp = (UnionAllOp)op;
                if (unionAllOp.BranchDiscriminator != null)
                {
                    attrs.Add("branchDiscriminator", (object)unionAllOp.BranchDiscriminator);
                }
            }
            using (new Dump.AutoXml(this, (Op)op, attrs))
            {
                using (new Dump.AutoXml(this, "outputs"))
                {
                    foreach (Var output in op.Outputs)
                    {
                        this.DumpVar(output);
                    }
                }
                int num = 0;
                foreach (Node child in n.Children)
                {
                    using (new Dump.AutoXml(this, "input", new Dictionary <string, object>()
                    {
                        {
                            "VarMap",
                            (object)op.VarMap[num++].ToString()
                        }
                    }))
                        this.VisitNode(child);
                }
            }
        }
Esempio n. 2
0
 // <summary>
 // Copies a UnionAllOp
 // </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(UnionAllOp op, Node n)
 {
     return(CopySetOp(op, n));
 }
 public override Node Visit(UnionAllOp op, Node n)
 {
     return(this.CopySetOp((SetOp)op, n));
 }
 public virtual void Visit(UnionAllOp op, Node n)
 {
     this.VisitSetOp((SetOp)op, n);
 }
        protected override NodeInfo VisitSetOp(SetOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n);

            extendedNodeInfo1.Definitions.InitFrom(op.Outputs);
            extendedNodeInfo1.LocalDefinitions.InitFrom(op.Outputs);
            ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0);
            ExtendedNodeInfo extendedNodeInfo3 = this.GetExtendedNodeInfo(n.Child1);
            RowCount         rowCount          = RowCount.Zero;

            extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences);
            extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo3.ExternalReferences);
            if (op.OpType == OpType.UnionAll)
            {
                rowCount = extendedNodeInfo2.MinRows > extendedNodeInfo3.MinRows ? extendedNodeInfo2.MinRows : extendedNodeInfo3.MinRows;
            }
            if (op.OpType == OpType.Intersect || op.OpType == OpType.Except)
            {
                extendedNodeInfo1.Keys.InitFrom((IEnumerable <Var>)op.Outputs);
            }
            else
            {
                UnionAllOp unionAllOp = (UnionAllOp)op;
                if (unionAllOp.BranchDiscriminator == null)
                {
                    extendedNodeInfo1.Keys.NoKeys = true;
                }
                else
                {
                    VarVec varVec = this.m_command.CreateVarVec();
                    for (int index = 0; index < n.Children.Count; ++index)
                    {
                        ExtendedNodeInfo extendedNodeInfo4 = n.Children[index].GetExtendedNodeInfo(this.m_command);
                        if (!extendedNodeInfo4.Keys.NoKeys && !extendedNodeInfo4.Keys.KeyVars.IsEmpty)
                        {
                            VarVec other = extendedNodeInfo4.Keys.KeyVars.Remap((Dictionary <Var, Var>)unionAllOp.VarMap[index].GetReverseMap());
                            varVec.Or(other);
                        }
                        else
                        {
                            varVec.Clear();
                            break;
                        }
                    }
                    if (varVec.IsEmpty)
                    {
                        extendedNodeInfo1.Keys.NoKeys = true;
                    }
                    else
                    {
                        extendedNodeInfo1.Keys.InitFrom((IEnumerable <Var>)varVec);
                    }
                }
            }
            VarVec other1 = extendedNodeInfo2.NonNullableDefinitions.Remap((Dictionary <Var, Var>)op.VarMap[0].GetReverseMap());

            extendedNodeInfo1.NonNullableDefinitions.InitFrom(other1);
            if (op.OpType != OpType.Except)
            {
                VarVec other2 = extendedNodeInfo3.NonNullableDefinitions.Remap((Dictionary <Var, Var>)op.VarMap[1].GetReverseMap());
                if (op.OpType == OpType.Intersect)
                {
                    extendedNodeInfo1.NonNullableDefinitions.Or(other2);
                }
                else
                {
                    extendedNodeInfo1.NonNullableDefinitions.And(other2);
                }
            }
            extendedNodeInfo1.NonNullableDefinitions.And(op.Outputs);
            extendedNodeInfo1.MinRows = rowCount;
            return((NodeInfo)extendedNodeInfo1);
        }
Esempio n. 6
0
 /// <summary>
 ///     Visitor pattern method for UnionAllOp
 /// </summary>
 /// <param name="op"> The UnionAllOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(UnionAllOp op, Node n)
 {
     VisitSetOp(op, n);
 }
Esempio n. 7
0
 // <summary>
 // UnionAll
 // </summary>
 public virtual TResultType Visit(UnionAllOp op, Node n)
 {
     return(VisitSetOp(op, n));
 }
 public virtual TResultType Visit(UnionAllOp op, Node n)
 {
     return(this.VisitSetOp((SetOp)op, n));
 }