You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/03/25 12:32:07 UTC

[12/22] ignite git commit: IGNITE-2870: .NET: Fixed incorrect handling of attribute-based SQL configuration with nested indexed field. This closes #568.

IGNITE-2870: .NET: Fixed incorrect handling of attribute-based SQL configuration with nested indexed field. This closes #568.


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

Branch: refs/heads/ignite-1786
Commit: 1332c80faefdbe0849afdbc4d92e59774556b578
Parents: cfc7d4e
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Thu Mar 24 16:54:14 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 16:54:14 2016 +0300

----------------------------------------------------------------------
 .../Query/CacheQueriesCodeConfigurationTest.cs      | 16 +++++++++++++++-
 .../Cache/Configuration/QueryEntity.cs              |  9 +++++----
 2 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1332c80f/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
index 684dd62..d5f98ac 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
@@ -140,7 +140,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
 
                 cache[1] = new AttributeQueryPerson("Arnold", 10)
                 {
-                    Address = new AttributeQueryAddress {Country = "USA", Street = "Pine Tree road"}
+                    Address = new AttributeQueryAddress {Country = "USA", Street = "Pine Tree road", Zip = 1}
                 };
 
                 cache[2] = new AttributeQueryPerson("John", 20);
@@ -155,6 +155,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
                     Assert.AreEqual(1, cursor.GetAll().Single().Key);
                 }
 
+                using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Zip = ?", 1)))
+                {
+                    Assert.AreEqual(1, cursor.GetAll().Single().Key);
+                }
+
                 using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Ar*")))
                 {
                     Assert.AreEqual(1, cursor.GetAll().Single().Key);
@@ -226,6 +231,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             public string Country { get; set; }
 
             /// <summary>
+            /// Gets or sets the zip.
+            /// </summary>
+            /// <value>
+            /// The zip.
+            /// </value>
+            [QuerySqlField(IsIndexed = true)]
+            public int Zip { get; set; }
+
+            /// <summary>
             /// Gets or sets the street.
             /// </summary>
             /// <value>

http://git-wip-us.apache.org/repos/asf/ignite/blob/1332c80f/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index 4ce0211..f4c12f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -314,16 +314,17 @@ namespace Apache.Ignite.Core.Cache.Configuration
                 {
                     var columnName = attr.Name ?? memberInfo.Key.Name;
 
+                    // No dot notation for indexes
+                    if (attr.IsIndexed)
+                        indexes.Add(new QueryIndexEx(columnName, attr.IsDescending, QueryIndexType.Sorted,
+                            attr.IndexGroups));
+
                     // Dot notation is required for nested SQL fields
                     if (parentPropName != null)
                         columnName = parentPropName + "." + columnName;
 
                     fields.Add(new QueryField(columnName, memberInfo.Value));
 
-                    if (attr.IsIndexed)
-                        indexes.Add(new QueryIndexEx(columnName, attr.IsDescending, QueryIndexType.Sorted,
-                            attr.IndexGroups));
-
                     ScanAttributes(memberInfo.Value, fields, indexes, columnName, visitedTypes);
                 }