예제 #1
0
        // <summary>
        // If the given node is not the top most SortOp node remove it.
        // </summary>
        public override Node Visit(SortOp op, Node n)
        {
            VisitChildren(n);
            Node result;

            if (ReferenceEquals(n, m_topMostSort))
            {
                result = n;
            }
            else
            {
                result = n.Child0;
            }
            return(result);
        }
예제 #2
0
        // <summary>
        // If the given node is not the top most SortOp node remove it.
        // </summary>
        public override Node Visit(SortOp op, Node n)
        {
            VisitChildren(n);
            Node result;

            if (ReferenceEquals(n, m_topMostSort))
            {
                result = n;
            }
            else
            {
                result = n.Child0;
            }
            return result;
        }
예제 #3
0
        // <summary>
        // SortOp
        // </summary>
        // <remarks>
        // If the input to a SortOp is a NestOp, then none of the sort
        // keys can be collection Vars of the NestOp – we don't support
        // sorts over collections.
        // </remarks>
        public override Node Visit(SortOp op, Node n)
        {
            // Visit the children
            VisitChildren(n);
            m_varRemapper.RemapNode(n);

            // If the child is a NestOp, then simply push the sortkeys into the
            // "prefixKeys" of the nestOp, and return the NestOp itself.
            // The SortOp has now been merged into the NestOp
            var nestOp = n.Child0.Op as NestBaseOp;
            if (nestOp != null)
            {
                n.Child0.Op = GetNestOpWithConsolidatedSortKeys(nestOp, op.Keys);
                return n.Child0;
            }

            return n;
        }
        /// <summary>
        ///     Convert a SortOp. Specifically, walk the SortKeys, and expand out
        ///     any Structured type Var references
        /// </summary>
        /// <param name="op"> the sortOp </param>
        /// <param name="n"> the current node </param>
        /// <returns> new subtree </returns>
        public override Node Visit(SortOp op, Node n)
        {
            VisitChildren(n);

            var newSortKeys = HandleSortKeys(op.Keys);

            if (newSortKeys != op.Keys)
            {
                n.Op = m_command.CreateSortOp(newSortKeys);
            }
            return n;
        }
예제 #5
0
        /// <summary>
        /// Visit a SortOp. Eliminate it if the path to this node is not one of 
        /// PhysicalProject(Sort) or
        /// TopN(Sort)
        /// 
        /// Otherwise, simply visit the child RelOp
        /// 
        /// </summary>
        /// <param name="op">Current sortOp</param>
        /// <param name="n">current subtree</param>
        /// <returns>possibly transformed subtree</returns>
        public override Node Visit(SortOp op, Node n)
        {
            // can I eliminate this sort
            if (IsSortUnnecessary())
            {
                return VisitNode(n.Child0);
            }

            // perform default processing
            return VisitRelOpDefault(op, n);
        }
 /// <summary>
 ///     Visitor pattern method for SortOp
 /// </summary>
 /// <param name="op"> The SortOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(SortOp op, Node n)
 {
     VisitSortOp(op, n);
 }
예제 #7
0
        // <summary>
        // Copies a sort node
        // </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(SortOp op, Node n)
        {
            // Visit the Node's children and map their Vars
            var children = ProcessChildren(n);

            // Copy the SortOp's SortKeys
            var newSortKeys = Copy(op.Keys);

            // Create a new SortOp that uses the copied SortKeys
            var newSortOp = m_destCmd.CreateSortOp(newSortKeys);

            // Return a new Node that references the copied SortOp and has the copied child Nodes as its children
            return m_destCmd.CreateNode(newSortOp, children);
        }
예제 #8
0
 public override System.Data.Entity.Core.Query.InternalTrees.Node Visit(SortOp op, System.Data.Entity.Core.Query.InternalTrees.Node n)
 {
     this.VisitChildren(n);
     return(!object.ReferenceEquals((object)n, (object)this.m_topMostSort) ? n.Child0 : n);
 }