ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [22/50] ignite git commit: IGNITE-4308: Ignore QueryEntity.keyFields when key is an SQL type. This closes #1286.
Date Tue, 06 Dec 2016 08:40:19 GMT
IGNITE-4308: Ignore QueryEntity.keyFields when key is an SQL type. This closes #1286.


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 2ca709f8efb83c33ebe85d4b45844644a6fee7d4
Parents: ac6d910
Author: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Authored: Fri Nov 25 19:17:49 2016 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Fri Nov 25 19:17:49 2016 +0300

----------------------------------------------------------------------
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java       |  2 --
 .../internal/processors/query/GridQueryProcessor.java | 14 +++++++++++++-
 .../IgniteCacheAbstractInsertSqlQuerySelfTest.java    |  8 --------
 .../cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java |  2 --
 4 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ca709f8/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index 1590067..4a97aef 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@ -118,8 +118,6 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
         e.addQueryField("firstName", String.class.getName(), null);
         e.addQueryField("lastName", String.class.getName(), null);
 
-        e.setKeyFields(Collections.<String>emptySet());
-
         ccfg.setQueryEntities(Collections.singletonList(e));
 
         return cfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ca709f8/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 0fc6044..1594cee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1502,10 +1502,22 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             aliases = Collections.emptyMap();
 
         Set<String> keyFields = qryEntity.getKeyFields();
+
+        // We have to distinguish between empty and null keyFields when the key is not of
SQL type -
+        // when a key is not of SQL type, absence of a field in nonnull keyFields tell us
that this field
+        // is a value field, and null keyFields tells us that current configuration
+        // does not tell us anything about this field's ownership.
         boolean hasKeyFields = (keyFields != null);
 
+        boolean isKeyClsSqlType = isSqlType(d.keyClass());
+
         for (Map.Entry<String, String> entry : qryEntity.getFields().entrySet()) {
-            Boolean isKeyField = (hasKeyFields ? keyFields.contains(entry.getKey()) : null);
+            Boolean isKeyField;
+
+            if (isKeyClsSqlType) // We don't care about keyFields in this case - it might
be null, or empty, or anything
+                isKeyField = false;
+            else
+                isKeyField = (hasKeyFields ? keyFields.contains(entry.getKey()) : null);
 
             BinaryProperty prop = buildBinaryProperty(entry.getKey(), U.classForName(entry.getValue(),
Object.class, true),
                 aliases, isKeyField);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ca709f8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index 2c3ab23..47369ee 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -148,8 +148,6 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             QueryEntity s2p = new QueryEntity(String.class.getName(), "Person");
 
-            s2p.setKeyFields(Collections.<String>emptySet());
-
             LinkedHashMap<String, String> flds = new LinkedHashMap<>();
 
             flds.put("id", Integer.class.getName());
@@ -161,8 +159,6 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             QueryEntity s2s = new QueryEntity(String.class.getName(), String.class.getName());
 
-            s2s.setKeyFields(Collections.<String>emptySet());
-
             s2pCcfg.setQueryEntities(Arrays.asList(s2p, s2s));
 
             ignite(0).createCache(s2pCcfg);
@@ -173,8 +169,6 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             QueryEntity i2p = new QueryEntity(Integer.class.getName(), "Person");
 
-            i2p.setKeyFields(Collections.<String>emptySet());
-
             LinkedHashMap<String, String> flds = new LinkedHashMap<>();
 
             flds.put("id", Integer.class.getName());
@@ -285,8 +279,6 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             QueryEntity i2i = new QueryEntity(Integer.class.getName(), Integer.class.getName());
 
-            i2i.setKeyFields(Collections.<String>emptySet());
-
             i2i.setFields(new LinkedHashMap<String, String>());
 
             i2i.setIndexes(Collections.<QueryIndex>emptyList());

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ca709f8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
index 22116a9..123c32a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
@@ -153,8 +153,6 @@ public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest extends GridCommonA
 
         QueryEntity e = new QueryEntity(String.class.getName(), "Person");
 
-        e.setKeyFields(Collections.<String>emptySet());
-
         LinkedHashMap<String, String> flds = new LinkedHashMap<>();
 
         flds.put("id", Integer.class.getName());


Mime
View raw message