.NET: Remove dead code from old LINQ CompiledQuery
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/49fcd2cc Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/49fcd2cc Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/49fcd2cc Branch: refs/heads/ignite-5075-cc-debug Commit: 49fcd2cced1f7b5117b8f1a4fca252b31e2c9b90 Parents: db7d776 Author: Pavel Tupitsyn <ptupit...@apache.org> Authored: Thu May 25 18:45:51 2017 +0300 Committer: Pavel Tupitsyn <ptupit...@apache.org> Committed: Thu May 25 18:45:51 2017 +0300 ---------------------------------------------------------------------- .../Impl/CacheFieldsQueryExecutor.cs | 39 -------------------- .../Impl/CacheQueryableBase.cs | 14 ++----- .../Impl/ICacheQueryableInternal.cs | 6 --- 3 files changed, 3 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/49fcd2cc/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs index 27082bd..bc7251b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs @@ -93,45 +93,6 @@ namespace Apache.Ignite.Linq.Impl } /// <summary> - /// Compiles the query (old method, does not support some scenarios). - /// </summary> - public Func<object[], IQueryCursor<T>> CompileQuery<T>(QueryModel queryModel, Delegate queryCaller) - { - Debug.Assert(queryModel != null); - Debug.Assert(queryCaller != null); - - var qryData = GetQueryData(queryModel); - - var qryText = qryData.QueryText; - - var selector = GetResultSelector<T>(queryModel.SelectClause.Selector); - - // Compiled query is a delegate with query parameters - // Delegate parameters order and query parameters order may differ - - // These are in order of usage in query - var qryOrderParams = qryData.ParameterExpressions.OfType<MemberExpression>() - .Select(x => x.Member.Name).ToList(); - - // These are in order they come from user - var userOrderParams = queryCaller.Method.GetParameters().Select(x => x.Name).ToList(); - - if ((qryOrderParams.Count != qryData.Parameters.Count) || - (qryOrderParams.Count != userOrderParams.Count)) - throw new InvalidOperationException("Error compiling query: all compiled query arguments " + - "should come from enclosing delegate parameters."); - - var indices = qryOrderParams.Select(x => userOrderParams.IndexOf(x)).ToArray(); - - // Check if user param order is already correct - if (indices.SequenceEqual(Enumerable.Range(0, indices.Length))) - return args => _cache.QueryFields(GetFieldsQuery(qryText, args), selector); - - // Return delegate with reorder - return args => _cache.QueryFields(GetFieldsQuery(qryText, - args.Select((x, i) => args[indices[i]]).ToArray()), selector); - } - /// <summary> /// Compiles the query without regard to number or order of arguments. /// </summary> public Func<object[], IQueryCursor<T>> CompileQuery<T>(QueryModel queryModel) http://git-wip-us.apache.org/repos/asf/ignite/blob/49fcd2cc/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryableBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryableBase.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryableBase.cs index 21a7850..5702f4f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryableBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryableBase.cs @@ -28,16 +28,16 @@ namespace Apache.Ignite.Linq.Impl /// <summary> /// Base class for cache queryables. /// </summary> - internal class CacheQueryableBase<T> : QueryableBase<T>, ICacheQueryableInternal + internal abstract class CacheQueryableBase<T> : QueryableBase<T>, ICacheQueryableInternal { /** <inheritdoc /> */ - public CacheQueryableBase(IQueryProvider provider) : base(provider) + protected CacheQueryableBase(IQueryProvider provider) : base(provider) { // No-op. } /** <inheritdoc /> */ - public CacheQueryableBase(IQueryProvider provider, Expression expression) : base(provider, expression) + protected CacheQueryableBase(IQueryProvider provider, Expression expression) : base(provider, expression) { // No-op. } @@ -82,14 +82,6 @@ namespace Apache.Ignite.Linq.Impl } /** <inheritdoc /> */ - public Func<object[], IQueryCursor<TQ>> CompileQuery<TQ>(Delegate queryCaller) - { - var executor = CacheQueryProvider.Executor; - - return executor.CompileQuery<TQ>(GetQueryModel(), queryCaller); - } - - /** <inheritdoc /> */ public Func<object[], IQueryCursor<TQ>> CompileQuery<TQ>(LambdaExpression queryExpression) { var executor = CacheQueryProvider.Executor; http://git-wip-us.apache.org/repos/asf/ignite/blob/49fcd2cc/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/ICacheQueryableInternal.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/ICacheQueryableInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/ICacheQueryableInternal.cs index ffc81b4..b24bc5c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/ICacheQueryableInternal.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/ICacheQueryableInternal.cs @@ -47,12 +47,6 @@ namespace Apache.Ignite.Linq.Impl QueryModel GetQueryModel(); /// <summary> - /// Compiles the query (the old way). - /// </summary> - /// <param name="queryCaller">Caller expression to examine argument order.</param> - Func<object[], IQueryCursor<T>> CompileQuery<T>(Delegate queryCaller); - - /// <summary> /// Compiles the query. /// </summary> /// <param name="queryExpression">The query expression.</param>