コード例 #1
0
        public override NodeInfo Visit(PhysicalProjectOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n);

            foreach (Node child in n.Children)
            {
                NodeInfo nodeInfo = this.GetNodeInfo(child);
                extendedNodeInfo1.ExternalReferences.Or(nodeInfo.ExternalReferences);
            }
            extendedNodeInfo1.Definitions.InitFrom((IEnumerable <Var>)op.Outputs);
            extendedNodeInfo1.LocalDefinitions.InitFrom(extendedNodeInfo1.Definitions);
            ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0);

            if (!extendedNodeInfo2.Keys.NoKeys)
            {
                VarVec varVec = this.m_command.CreateVarVec(extendedNodeInfo2.Keys.KeyVars);
                varVec.Minus(extendedNodeInfo1.Definitions);
                if (varVec.IsEmpty)
                {
                    extendedNodeInfo1.Keys.InitFrom(extendedNodeInfo2.Keys);
                }
            }
            extendedNodeInfo1.NonNullableDefinitions.Or(extendedNodeInfo2.NonNullableDefinitions);
            extendedNodeInfo1.NonNullableDefinitions.And(extendedNodeInfo1.Definitions);
            extendedNodeInfo1.NonNullableVisibleDefinitions.Or(extendedNodeInfo2.NonNullableVisibleDefinitions);
            return((NodeInfo)extendedNodeInfo1);
        }
コード例 #2
0
        /// <summary>
        ///     Computes a NodeInfo for a PhysicalProjectOp.
        ///     Definitions = OutputVars
        ///     LocalDefinitions = None
        ///     Keys = None
        ///     External References = any external references from the inputs
        ///     RowCount=default
        ///     NonNullabeDefinitions = NonNullabeDefinitions of the input RelOp that are among the definitions
        ///     NonNullableInputDefinitions = NonNullabeDefinitions of the input RelOp
        /// </summary>
        /// <param name="op"> The PhysicalProjectOp </param>
        /// <param name="n"> corresponding Node </param>
        public override NodeInfo Visit(PhysicalProjectOp op, Node n)
        {
            var nodeInfo = InitExtendedNodeInfo(n);

            foreach (var chi in n.Children)
            {
                var childNodeInfo = GetNodeInfo(chi);
                nodeInfo.ExternalReferences.Or(childNodeInfo.ExternalReferences);
            }
            nodeInfo.Definitions.InitFrom(op.Outputs);
            nodeInfo.LocalDefinitions.InitFrom(nodeInfo.Definitions);

            //
            // Inherit the keys from the child - but only if all the columns were projected
            // out
            //
            var driverChildNodeInfo = GetExtendedNodeInfo(n.Child0);

            if (!driverChildNodeInfo.Keys.NoKeys)
            {
                var missingKeys = m_command.CreateVarVec(driverChildNodeInfo.Keys.KeyVars);
                missingKeys.Minus(nodeInfo.Definitions);
                if (missingKeys.IsEmpty)
                {
                    nodeInfo.Keys.InitFrom(driverChildNodeInfo.Keys);
                }
            }

            //Non-nullable definitions
            nodeInfo.NonNullableDefinitions.Or(driverChildNodeInfo.NonNullableDefinitions);
            nodeInfo.NonNullableDefinitions.And(nodeInfo.Definitions);
            nodeInfo.NonNullableVisibleDefinitions.Or(driverChildNodeInfo.NonNullableVisibleDefinitions);

            return(nodeInfo);
        }
コード例 #3
0
ファイル: BasicValidator.cs プロジェクト: dotnet/ef6tools
 public override void Visit(PhysicalProjectOp op, Node n)
 {
     VisitPhysicalOpDefault(op, n);
     Assert(n.Children.Count >= 1, "PhysicalProjectOp needs at least 1 arg: found {0}", n.Children.Count);
     foreach (var chi in n.Children)
     {
         AssertRelOpOrPhysicalOp(chi.Op);
     }
 }
コード例 #4
0
        // <summary>
        // Copies a PhysicalProjectOp
        // </summary>
        public override Node Visit(PhysicalProjectOp op, Node n)
        {
            // Visit the Node's children and map their Vars
            var children = ProcessChildren(n);

            // Copy the ProjectOp's VarSet
            var newVarList = Copy(op.Outputs);

            var newColumnMap = Copy(op.ColumnMap) as SimpleCollectionColumnMap;

            Debug.Assert(newColumnMap != null, "Coping of a physical project's columnMap did not return a SimpleCollectionColumnMap");
            // Create a new ProjectOp based on the copied VarSet
            var newProject = m_destCmd.CreatePhysicalProjectOp(newVarList, newColumnMap);

            // Return a new Node that references the copied ProjectOp and has the copied child Nodes as its children
            return(m_destCmd.CreateNode(newProject, children));
        }
コード例 #5
0
 public override void Visit(PhysicalProjectOp op, Node n)
 {
     using (new Dump.AutoXml(this, (Op)op))
     {
         using (new Dump.AutoXml(this, "outputs"))
         {
             foreach (Var output in (List <Var>)op.Outputs)
             {
                 this.DumpVar(output);
             }
         }
         using (new Dump.AutoXml(this, "columnMap"))
             op.ColumnMap.Accept <Dump>((ColumnMapVisitor <Dump>)Dump.ColumnMapDumper.Instance, this);
         using (new Dump.AutoXml(this, "input"))
             this.VisitChildren(n);
     }
 }
コード例 #6
0
 public override void Visit(PhysicalProjectOp op, Node n)
 {
     using (new AutoXml(this, op))
     {
         using (new AutoXml(this, "outputs"))
         {
             foreach (var v in op.Outputs)
             {
                 DumpVar(v);
             }
         }
         using (new AutoXml(this, "columnMap"))
         {
             op.ColumnMap.Accept(ColumnMapDumper.Instance, this);
         }
         using (new AutoXml(this, "input"))
         {
             VisitChildren(n);
         }
     }
 }
コード例 #7
0
        public override Node Visit(PhysicalProjectOp op, Node n)
        {
            List <Node> args = this.ProcessChildren(n);

            return(this.m_destCmd.CreateNode((Op)this.m_destCmd.CreatePhysicalProjectOp(this.Copy(op.Outputs), this.Copy((ColumnMap)op.ColumnMap) as SimpleCollectionColumnMap), args));
        }
コード例 #8
0
 public virtual void Visit(PhysicalProjectOp op, Node n)
 {
     this.VisitPhysicalOpDefault((PhysicalOp)op, n);
 }
コード例 #9
0
 // <summary>
 // PhysicalProjectOp
 // </summary>
 public virtual TResultType Visit(PhysicalProjectOp op, Node n)
 {
     return(VisitPhysicalOpDefault(op, n));
 }