protected override NodeInfo VisitNestOp(NestBaseOp op, Node n)
        {
            SingleStreamNestOp singleStreamNestOp = op as SingleStreamNestOp;
            ExtendedNodeInfo   extendedNodeInfo   = this.InitExtendedNodeInfo(n);

            foreach (CollectionInfo collectionInfo in op.CollectionInfo)
            {
                extendedNodeInfo.LocalDefinitions.Set(collectionInfo.CollectionVar);
            }
            extendedNodeInfo.Definitions.InitFrom(op.Outputs);
            foreach (Node child in n.Children)
            {
                extendedNodeInfo.ExternalReferences.Or(this.GetExtendedNodeInfo(child).ExternalReferences);
            }
            extendedNodeInfo.ExternalReferences.Minus(extendedNodeInfo.Definitions);
            if (singleStreamNestOp == null)
            {
                extendedNodeInfo.Keys.InitFrom(this.GetExtendedNodeInfo(n.Child0).Keys);
            }
            else
            {
                extendedNodeInfo.Keys.InitFrom((IEnumerable <Var>)singleStreamNestOp.Keys);
            }
            return((NodeInfo)extendedNodeInfo);
        }
        private Node VisitNestOp(Node n)
        {
            NestBaseOp         op = n.Op as NestBaseOp;
            SingleStreamNestOp singleStreamNestOp = op as SingleStreamNestOp;
            List <Node>        args = this.ProcessChildren(n);
            Var discriminatorVar    = (Var)null;

            if (singleStreamNestOp != null)
            {
                discriminatorVar = this.GetMappedVar(singleStreamNestOp.Discriminator);
            }
            List <CollectionInfo> collectionInfoList = new List <CollectionInfo>();

            foreach (CollectionInfo collectionInfo1 in op.CollectionInfo)
            {
                ColumnMap columnMap   = this.Copy(collectionInfo1.ColumnMap);
                Var       computedVar = (Var)this.m_destCmd.CreateComputedVar(collectionInfo1.CollectionVar.Type);
                this.SetMappedVar(collectionInfo1.CollectionVar, computedVar);
                VarList        flattenedElementVars = this.Copy(collectionInfo1.FlattenedElementVars);
                VarVec         keys            = this.Copy(collectionInfo1.Keys);
                List <SortKey> sortKeys        = this.Copy(collectionInfo1.SortKeys);
                CollectionInfo collectionInfo2 = Command.CreateCollectionInfo(computedVar, columnMap, flattenedElementVars, keys, sortKeys, collectionInfo1.DiscriminatorValue);
                collectionInfoList.Add(collectionInfo2);
            }
            VarVec         outputVars     = this.Copy(op.Outputs);
            List <SortKey> prefixSortKeys = this.Copy(op.PrefixSortKeys);
            NestBaseOp     nestBaseOp;

            if (singleStreamNestOp != null)
            {
                VarVec         keys            = this.Copy(singleStreamNestOp.Keys);
                List <SortKey> postfixSortKeys = this.Copy(singleStreamNestOp.PostfixSortKeys);
                nestBaseOp = (NestBaseOp)this.m_destCmd.CreateSingleStreamNestOp(keys, prefixSortKeys, postfixSortKeys, outputVars, collectionInfoList, discriminatorVar);
            }
            else
            {
                nestBaseOp = (NestBaseOp)this.m_destCmd.CreateMultiStreamNestOp(prefixSortKeys, outputVars, collectionInfoList);
            }
            return(this.m_destCmd.CreateNode((Op)nestBaseOp, args));
        }
Esempio n. 3
0
 // <summary>
 // Copies a singleStreamNestOp
 // </summary>
 public override Node Visit(SingleStreamNestOp op, Node n)
 {
     return(VisitNestOp(n));
 }
        protected override void VisitNestOp(NestBaseOp op, Node n)
        {
            Dictionary <string, object> attrs1             = new Dictionary <string, object>();
            SingleStreamNestOp          singleStreamNestOp = op as SingleStreamNestOp;

            if (singleStreamNestOp != null)
            {
                attrs1.Add("Discriminator", singleStreamNestOp.Discriminator == null ? (object)"<null>" : (object)singleStreamNestOp.Discriminator.ToString());
            }
            StringBuilder sb = new StringBuilder();

            if (singleStreamNestOp != null)
            {
                sb.Length = 0;
                string str = string.Empty;
                foreach (Var key in singleStreamNestOp.Keys)
                {
                    sb.Append(str);
                    sb.Append(key.Id);
                    str = ",";
                }
                if (sb.Length != 0)
                {
                    attrs1.Add("Keys", (object)sb.ToString());
                }
            }
            using (new Dump.AutoXml(this, (Op)op, attrs1))
            {
                using (new Dump.AutoXml(this, "outputs"))
                {
                    foreach (Var output in op.Outputs)
                    {
                        this.DumpVar(output);
                    }
                }
                foreach (CollectionInfo collectionInfo in op.CollectionInfo)
                {
                    Dictionary <string, object> attrs2 = new Dictionary <string, object>();
                    attrs2.Add("CollectionVar", (object)collectionInfo.CollectionVar);
                    if (collectionInfo.DiscriminatorValue != null)
                    {
                        attrs2.Add("DiscriminatorValue", collectionInfo.DiscriminatorValue);
                    }
                    if (collectionInfo.FlattenedElementVars.Count != 0)
                    {
                        attrs2.Add("FlattenedElementVars", (object)Dump.FormatVarList(sb, collectionInfo.FlattenedElementVars));
                    }
                    if (collectionInfo.Keys.Count != 0)
                    {
                        attrs2.Add("Keys", (object)collectionInfo.Keys);
                    }
                    if (collectionInfo.SortKeys.Count != 0)
                    {
                        attrs2.Add("SortKeys", (object)Dump.FormatVarList(sb, collectionInfo.SortKeys));
                    }
                    using (new Dump.AutoXml(this, "collection", attrs2))
                        collectionInfo.ColumnMap.Accept <Dump>((ColumnMapVisitor <Dump>)Dump.ColumnMapDumper.Instance, this);
                }
                this.VisitChildren(n);
            }
        }
 public virtual void Visit(SingleStreamNestOp op, Node n)
 {
     this.VisitNestOp((NestBaseOp)op, n);
 }
Esempio n. 6
0
 public override void Visit(SingleStreamNestOp op, Node n)
 {
     VisitPhysicalOpDefault(op, n);
     AssertRelOp(n.Child0.Op);
 }
Esempio n. 7
0
 /// <summary>
 ///     Visitor pattern method for SingleStreamNestOp
 /// </summary>
 /// <param name="op"> The op being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(SingleStreamNestOp op, Node n)
 {
     VisitNestOp(op, n);
 }
Esempio n. 8
0
 // <summary>
 // SingleStreamNestOp
 // </summary>
 public virtual TResultType Visit(SingleStreamNestOp op, Node n)
 {
     return(VisitNestOp(op, n));
 }
 public virtual TResultType Visit(SingleStreamNestOp op, Node n)
 {
     return(this.VisitNestOp((NestBaseOp)op, n));
 }