public override System.Linq.Expressions.Expression Translate(Expression expression) { expression = OrderByRewriter.Rewrite(expression); expression = UnusedColumnRemover.Remove(expression); expression = RedundantColumnRemover.Remove(expression); expression = RedundantSubqueryRemover.Remove(expression); var rewritten = CrossApplyRewriter.Rewrite(expression); rewritten = CrossJoinRewriter.Rewrite(rewritten); if (rewritten != expression) { expression = rewritten; expression = UnusedColumnRemover.Remove(expression); expression = RedundantSubqueryRemover.Remove(expression); expression = RedundantJoinRemover.Remove(expression); expression = RedundantColumnRemover.Remove(expression); } expression = SkipToRowNumberRewriter.Rewrite(expression); expression = OrderByRewriter.Rewrite(expression); return(expression); }
public override Expression Translate(Expression expression) { expression = OrderByRewriter.Rewrite(expression); expression = base.Translate(expression); expression = SkipToRowNumberRewriter.Rewrite(expression); expression = OrderByRewriter.Rewrite(expression); return(expression); }
public override Expression Translate(Expression expression) { bool hasRowNumberExpression; // fix up any order-by's expression = OrderByRewriter.Rewrite(this.Language, expression); expression = XmlToCursorExpressionRewriter.Rewrite(expression); // remove redundant layers again before cross apply rewrite expression = UnusedColumnRemover.Remove(expression); expression = RedundantColumnRemover.Remove(expression); expression = RedundantSubqueryRemover.Remove(expression); expression = OneBasedIndexRewriter.Rewrite(expression); // convert cross-apply and outer-apply joins into inner & left-outer-joins if possible var rewritten = CrossApplyRewriter.Rewrite(this.language, expression); // convert cross joins into inner joins rewritten = CrossJoinRewriter.Rewrite(rewritten); if (rewritten != expression) { expression = rewritten; // do final reduction expression = UnusedColumnRemover.Remove(expression); expression = RedundantSubqueryRemover.Remove(expression); expression = RedundantJoinRemover.Remove(expression); expression = RedundantColumnRemover.Remove(expression); } // convert skip/take info into RowNumber pattern expression = SkipToRowNumberRewriter.Rewrite(expression, out hasRowNumberExpression); expression = SkipToNestedOrderByRewriter.Rewrite(this.Language, expression); expression = UnusedColumnRemover.Remove(expression); expression = WhereCountComparisonRewriter.Rewrite(expression); if (!hasRowNumberExpression) { expression = OrderByRewriter.Rewrite(this.Language, expression); expression = RedundantSubqueryRemover.Remove(expression); } expression = VfpCrossJoinIsolator.Isolate(expression); expression = ConditionalImmediateIfNullRemover.Remove(expression); expression = XmlToCursorJoinRewriter.Rewrite(expression); return(expression); }
public override Expression Translate(Expression expression) { // fix up any order-by's expression = OrderByRewriter.Rewrite(this.Language, expression); expression = base.Translate(expression); // convert skip/take info into RowNumber pattern expression = SkipToRowNumberRewriter.Rewrite(this.Language, expression); // fix up any order-by's we may have changed expression = OrderByRewriter.Rewrite(this.Language, expression); return(expression); }