private TranslateResult Translate(Expression expression)
        {
            ProjectionExpression projection = expression as ProjectionExpression;

            if (projection == null)
            {
                expression = Evaluator.PartialEval(expression, CanBeEvaluatedLocally, log);
                expression = QueryBinder.Bind(this, expression, log);
                expression = AggregateRewriter.Rewrite(expression, log);
                expression = OrderByRewriter.Rewrite(expression, log);
                expression = UnusedColumnRemover.Remove(expression, log);
                expression = RedundantSubqueryRemover.Remove(expression, log);
                projection = (ProjectionExpression)expression;
            }
            string commandText = QueryFormatter.Format(projection.Source, log);

            string[]         columns   = projection.Source.Columns.Select(c => c.Name).ToArray();
            LambdaExpression projector = ProjectionBuilder.Build(projection.Projector, projection.Source.Alias, columns, log);

            return(new TranslateResult(commandText, projector, projection.Aggregator));
        }