Esempio n. 1
0
        public override void Visit(ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n)
        {
            this.VisitChildren(n);
            ExtendedNodeInfo extendedNodeInfo = n.Child0.GetExtendedNodeInfo(this.m_command);

            if (!extendedNodeInfo.Keys.NoKeys)
            {
                VarVec varVec = this.m_command.CreateVarVec(op.Outputs);
                Dictionary <Var, Var> varRemappings = NodeInfoVisitor.ComputeVarRemappings(n.Child1);
                VarVec other = extendedNodeInfo.Keys.KeyVars.Remap(varRemappings);
                varVec.Or(other);
                op.Outputs.InitFrom(varVec);
            }
            this.m_command.RecomputeNodeInfo(n);
        }
Esempio n. 2
0
        /// <summary>
        /// Pulls up keys for a ProjectOp. First visits its children to pull
        /// up its keys; then identifies any keys from the input that it may have
        /// projected out - and adds them to the output list of vars
        /// </summary>
        /// <param name="op">Current ProjectOp</param>
        /// <param name="n">Current subtree</param>
        public override void Visit(ProjectOp op, Node n)
        {
            VisitChildren(n);

            ExtendedNodeInfo childNodeInfo = n.Child0.GetExtendedNodeInfo(m_command);

            if (!childNodeInfo.Keys.NoKeys)
            {
                VarVec outputVars = m_command.CreateVarVec(op.Outputs);
                // NOTE: This code appears in NodeInfoVisitor as well. Try to see if we
                //       can share this somehow.
                Dictionary <Var, Var> varRenameMap = NodeInfoVisitor.ComputeVarRemappings(n.Child1);
                VarVec mappedKeyVec = childNodeInfo.Keys.KeyVars.Remap(varRenameMap);
                outputVars.Or(mappedKeyVec);
                op.Outputs.InitFrom(outputVars);
            }
            m_command.RecomputeNodeInfo(n);
        }