You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/12/06 08:40:02 UTC

[05/50] ignite git commit: IGNITE-4280 Test fix for IgniteBinaryCacheQueryTestSuite. This closes #1275.

IGNITE-4280 Test fix for IgniteBinaryCacheQueryTestSuite. This closes #1275.


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

Branch: refs/heads/ignite-comm-balance-master
Commit: fabb77d17859a0a6318c2fe11182ab753e2198e0
Parents: c4badee
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Nov 24 18:51:07 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Nov 24 18:51:07 2016 +0300

----------------------------------------------------------------------
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |  2 ++
 .../org/apache/ignite/cache/QueryEntity.java    |  2 +-
 .../processors/query/GridQueryProcessor.java    | 23 ++++++++++----------
 .../odbc-example/config/example-odbc.xml        |  8 +++++++
 .../odbc-test/config/queries-test-noodbc.xml    |  4 ++++
 .../cpp/odbc-test/config/queries-test.xml       |  4 ++++
 6 files changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fabb77d1/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 4a97aef..1590067 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,6 +118,8 @@ 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/fabb77d1/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
index fc3b921..c8abdfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
@@ -45,7 +45,7 @@ public class QueryEntity implements Serializable {
     private LinkedHashMap<String, String> fields = new LinkedHashMap<>();
 
     /** Set of field names that belong to the key. */
-    private Set<String> keyFields = new HashSet<>();
+    private Set<String> keyFields;
 
     /** Aliases. */
     private Map<String, String> aliases = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/fabb77d1/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 fe773c1..0fc6044 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
@@ -44,7 +44,6 @@ import javax.cache.Cache;
 import javax.cache.CacheException;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.binary.BinaryField;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectBuilder;
@@ -1425,7 +1424,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             aliases = Collections.emptyMap();
 
         for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet()) {
-            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null, d);
+            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null);
 
             d.addProperty(prop, false);
 
@@ -1437,7 +1436,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (Map.Entry<String, Class<?>> entry : meta.getDescendingFields().entrySet()) {
-            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null, d);
+            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null);
 
             d.addProperty(prop, false);
 
@@ -1449,7 +1448,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (String txtIdx : meta.getTextFields()) {
-            BinaryProperty prop = buildBinaryProperty(txtIdx, String.class, aliases, null, d);
+            BinaryProperty prop = buildBinaryProperty(txtIdx, String.class, aliases, null);
 
             d.addProperty(prop, false);
 
@@ -1468,7 +1467,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                 for (Map.Entry<String, IgniteBiTuple<Class<?>, Boolean>> idxField : idxFields.entrySet()) {
                     BinaryProperty prop = buildBinaryProperty(idxField.getKey(), idxField.getValue().get1(), aliases,
-                        null, d);
+                        null);
 
                     d.addProperty(prop, false);
 
@@ -1482,7 +1481,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         }
 
         for (Map.Entry<String, Class<?>> entry : meta.getQueryFields().entrySet()) {
-            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null, d);
+            BinaryProperty prop = buildBinaryProperty(entry.getKey(), entry.getValue(), aliases, null);
 
             if (!d.props.containsKey(prop.name()))
                 d.addProperty(prop, false);
@@ -1509,7 +1508,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             Boolean isKeyField = (hasKeyFields ? keyFields.contains(entry.getKey()) : null);
 
             BinaryProperty prop = buildBinaryProperty(entry.getKey(), U.classForName(entry.getValue(), Object.class, true),
-                aliases, isKeyField, d);
+                aliases, isKeyField);
 
             d.addProperty(prop, false);
         }
@@ -1609,12 +1608,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      *      nested fields.
      * @param resType Result type.
      * @param aliases Aliases.
-     * @param isKeyField
-     *@param d Type descriptor.  @return Binary property.
+     * @param isKeyField Key ownership flag, as defined in {@link QueryEntity#keyFields}: {@code true} if field belongs
+     *      to key, {@code false} if it belongs to value, {@code null} if QueryEntity#keyFields is null.
+     * @return Binary property.
      */
     private BinaryProperty buildBinaryProperty(String pathStr, Class<?> resType, Map<String, String> aliases,
-        @Nullable Boolean isKeyField, TypeDescriptor d) throws IgniteCheckedException {
-
+        @Nullable Boolean isKeyField) throws IgniteCheckedException {
         String[] path = pathStr.split("\\.");
 
         BinaryProperty res = null;
@@ -2190,7 +2189,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             if (isKeyProp0 == 0)
                 throw new IllegalStateException("Ownership flag not set for binary property. Have you set 'keyFields'" +
-                    " property of QueryEntity in configuration XML?");
+                    " property of QueryEntity in programmatic or XML configuration?");
 
             return isKeyProp0 == 1;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fabb77d1/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
index 864f950..e19075e 100644
--- a/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
+++ b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
@@ -56,6 +56,10 @@
                                     </map>
                                 </property>
 
+                                <property name="keyFields">
+                                    <list></list>
+                                </property>
+
                                 <property name="indexes">
                                     <list>
                                         <bean class="org.apache.ignite.cache.QueryIndex">
@@ -85,6 +89,10 @@
                                         <entry key="name" value="java.lang.String"/>
                                     </map>
                                 </property>
+
+                                <property name="keyFields">
+                                    <list></list>
+                                </property>
                             </bean>
                         </list>
                     </property>

http://git-wip-us.apache.org/repos/asf/ignite/blob/fabb77d1/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml
index db19669..82173de 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml
@@ -61,6 +61,10 @@
                                     </map>
                                 </property>
 
+                                <property name="keyFields">
+                                    <list></list>
+                                </property>
+
                                 <property name="indexes">
                                     <list>
                                         <bean class="org.apache.ignite.cache.QueryIndex">

http://git-wip-us.apache.org/repos/asf/ignite/blob/fabb77d1/modules/platforms/cpp/odbc-test/config/queries-test.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-test.xml b/modules/platforms/cpp/odbc-test/config/queries-test.xml
index 26e6341..f511c7d 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-test.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-test.xml
@@ -67,6 +67,10 @@
                                     </map>
                                 </property>
 
+                                <property name="keyFields">
+                                    <list></list>
+                                </property>
+
                                 <property name="indexes">
                                     <list>
                                         <bean class="org.apache.ignite.cache.QueryIndex">