ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-2970 .NET: Fixed CompiledQuery generation for embedded const parameters. This closes #629.
Date Mon, 11 Apr 2016 11:42:41 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 75455f9b7 -> 919200698


IGNITE-2970 .NET: Fixed CompiledQuery generation for embedded const parameters. This closes
#629.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/91920069
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/91920069
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/91920069

Branch: refs/heads/master
Commit: 919200698a0930e806a5d13d3dedea897e0d2aa0
Parents: 75455f9
Author: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Authored: Mon Apr 11 14:42:36 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Apr 11 14:42:36 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs      | 3 +++
 modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs   | 6 ++++--
 .../dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs | 6 ++----
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/91920069/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index a9656e8..218ebef 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -845,6 +845,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         {
             var cache = GetPersonCache().AsCacheQueryable();
 
+            // const args are not allowed
+            Assert.Throws<InvalidOperationException>(() => CompiledQuery.Compile(()
=> cache.Where(x => x.Key < 5)));
+
             // 0 arg
             var qry0 = CompiledQuery.Compile(() => cache.Select(x => x.Value.Name));
             Assert.AreEqual(PersonCount, qry0().ToArray().Length);

http://git-wip-us.apache.org/repos/asf/ignite/blob/91920069/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
index 2fa66ce..9e6c6c7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/CompiledQuery.cs
@@ -41,7 +41,7 @@ namespace Apache.Ignite.Linq
         {
             IgniteArgumentCheck.NotNull(query, "query");
 
-            var compiledQuery = GetCompiledQuery(query(), null);
+            var compiledQuery = GetCompiledQuery(query(), query);
 
             return () => compiledQuery(new object[0]);
         }
@@ -57,7 +57,7 @@ namespace Apache.Ignite.Linq
         {
             IgniteArgumentCheck.NotNull(query, "query");
 
-            var compiledQuery = GetCompiledQuery(query(default(T1)), null);
+            var compiledQuery = GetCompiledQuery(query(default(T1)), query);
 
             return x => compiledQuery(new object[] {x});
         }
@@ -191,6 +191,8 @@ namespace Apache.Ignite.Linq
         private static Func<object[], IQueryCursor<T>> GetCompiledQuery<T>(IQueryable<T>
queryable, 
             Delegate queryCaller)
         {
+            Debug.Assert(queryCaller != null);
+
             var cacheQueryable = queryable as ICacheQueryableInternal;
 
             if (cacheQueryable == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/91920069/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 09f57ff..c715e4c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
@@ -105,6 +105,7 @@ namespace Apache.Ignite.Linq.Impl
         public Func<object[], IQueryCursor<T>> CompileQuery<T>(QueryModel
queryModel, Delegate queryCaller)
         {
             Debug.Assert(queryModel != null);
+            Debug.Assert(queryCaller != null);
 
             var qryData = GetQueryData(queryModel);
 
@@ -112,9 +113,6 @@ namespace Apache.Ignite.Linq.Impl
 
             var selector = GetResultSelector<T>(queryModel.SelectClause.Selector);
 
-            if (queryCaller == null)
-                return args => _cache.QueryFields(new SqlFieldsQuery(qryText, _local,
args), selector);
-
             // Compiled query is a delegate with query parameters
             // Delegate parameters order and query parameters order may differ
 
@@ -128,7 +126,7 @@ namespace Apache.Ignite.Linq.Impl
             if ((qryOrderParams.Count != qryData.Parameters.Count) ||
                 (qryOrderParams.Count != userOrderParams.Count))
                 throw new InvalidOperationException("Error compiling query: all compiled
query arguments " +
-                                                    "should come from enclosing lambda expression");
+                    "should come from enclosing delegate parameters.");
 
             var indices = qryOrderParams.Select(x => userOrderParams.IndexOf(x)).ToArray();
 


Mime
View raw message