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 2015/12/21 12:41:31 UTC

[2/5] ignite git commit: IGNITE-2213: Fix.

http://git-wip-us.apache.org/repos/asf/ignite/blob/94103ec9/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 8353cdb..b221b30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -30,7 +30,7 @@ import org.apache.ignite.internal.binary.BinaryContext;
 import org.apache.ignite.internal.binary.BinarySchema;
 import org.apache.ignite.internal.binary.BinarySchemaRegistry;
 import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
-import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.binary.BinaryUtilsEx;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
@@ -131,7 +131,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
 
         byte ver = reader.readBytePositioned(start + GridBinaryMarshaller.PROTO_VER_POS);
 
-        BinaryUtils.checkProtocolVersion(ver);
+        BinaryUtilsEx.checkProtocolVersion(ver);
 
         int typeId = reader.readIntPositioned(start + GridBinaryMarshaller.TYPE_ID_POS);
         ctx = reader.binaryContext();
@@ -214,16 +214,16 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                     assignedFldsById = Collections.emptyMap();
 
                 // Get footer details.
-                int fieldIdLen = BinaryUtils.fieldIdLength(flags);
-                int fieldOffsetLen = BinaryUtils.fieldOffsetLength(flags);
+                int fieldIdLen = BinaryUtilsEx.fieldIdLength(flags);
+                int fieldOffsetLen = BinaryUtilsEx.fieldOffsetLength(flags);
 
-                IgniteBiTuple<Integer, Integer> footer = BinaryUtils.footerAbsolute(reader, start);
+                IgniteBiTuple<Integer, Integer> footer = BinaryUtilsEx.footerAbsolute(reader, start);
 
                 int footerPos = footer.get1();
                 int footerEnd = footer.get2();
 
                 // Get raw position.
-                int rawPos = BinaryUtils.rawOffsetAbsolute(reader, start);
+                int rawPos = BinaryUtilsEx.rawOffsetAbsolute(reader, start);
 
                 // Position reader on data.
                 reader.position(start + hdrLen);
@@ -251,7 +251,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                     else {
                         int type = fieldLen != 0 ? reader.readByte(0) : 0;
 
-                        if (fieldLen != 0 && !BinaryUtils.isPlainArrayType(type) && BinaryUtils.isPlainType(type)) {
+                        if (fieldLen != 0 && !BinaryUtilsEx.isPlainArrayType(type) && BinaryUtilsEx.isPlainType(type)) {
                             writer.writeFieldId(fieldId);
 
                             writer.write(reader.array(), reader.position(), fieldLen);
@@ -314,19 +314,19 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                             nullObjField = true;
                     }
                     else
-                        newFldTypeId = BinaryUtils.typeByClass(val.getClass());
+                        newFldTypeId = BinaryUtilsEx.typeByClass(val.getClass());
 
-                    String newFldTypeName = BinaryUtils.fieldTypeName(newFldTypeId);
+                    String newFldTypeName = BinaryUtilsEx.fieldTypeName(newFldTypeId);
 
                     if (oldFldTypeName == null) {
                         // It's a new field, we have to add it to metadata.
                         if (fieldsMeta == null)
                             fieldsMeta = new HashMap<>();
 
-                        fieldsMeta.put(name, BinaryUtils.fieldTypeId(newFldTypeName));
+                        fieldsMeta.put(name, BinaryUtilsEx.fieldTypeId(newFldTypeName));
                     }
                     else if (!nullObjField) {
-                        String objTypeName = BinaryUtils.fieldTypeName(GridBinaryMarshaller.OBJ);
+                        String objTypeName = BinaryUtilsEx.fieldTypeName(GridBinaryMarshaller.OBJ);
 
                         if (!objTypeName.equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName)) {
                             throw new BinaryObjectException(
@@ -343,8 +343,8 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
 
             if (reader != null) {
                 // Write raw data if any.
-                int rawOff = BinaryUtils.rawOffsetAbsolute(reader, start);
-                int footerStart = BinaryUtils.footerStartAbsolute(reader, start);
+                int rawOff = BinaryUtilsEx.rawOffsetAbsolute(reader, start);
+                int footerStart = BinaryUtilsEx.footerStartAbsolute(reader, start);
 
                 if (rawOff < footerStart) {
                     writer.rawWriter();
@@ -353,7 +353,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                 }
 
                 // Shift reader to the end of the object.
-                reader.position(start + BinaryUtils.length(reader, start));
+                reader.position(start + BinaryUtilsEx.length(reader, start));
             }
 
             writer.postWrite(true, registeredType, hashCode);
@@ -405,7 +405,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
     private IgniteBiTuple<Integer, Integer> fieldPositionAndLength(int footerPos, int footerEnd, int rawPos,
         int fieldIdLen, int fieldOffsetLen) {
         // Get field offset first.
-        int fieldOffset = BinaryUtils.fieldOffsetRelative(reader, footerPos + fieldIdLen, fieldOffsetLen);
+        int fieldOffset = BinaryUtilsEx.fieldOffsetRelative(reader, footerPos + fieldIdLen, fieldOffsetLen);
         int fieldPos = start + fieldOffset;
 
         // Get field length.
@@ -416,7 +416,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
             fieldLen = rawPos - fieldPos;
         else {
             // Field is somewhere in the middle, get difference with the next offset.
-            int nextFieldOffset = BinaryUtils.fieldOffsetRelative(reader,
+            int nextFieldOffset = BinaryUtilsEx.fieldOffsetRelative(reader,
                 footerPos + fieldIdLen + fieldOffsetLen + fieldIdLen, fieldOffsetLen);
 
             fieldLen = nextFieldOffset - fieldOffset;
@@ -432,19 +432,19 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
         assert reader != null;
 
         if (readCache == null) {
-            int fieldIdLen = BinaryUtils.fieldIdLength(flags);
-            int fieldOffsetLen = BinaryUtils.fieldOffsetLength(flags);
+            int fieldIdLen = BinaryUtilsEx.fieldIdLength(flags);
+            int fieldOffsetLen = BinaryUtilsEx.fieldOffsetLength(flags);
 
             BinarySchema schema = reader.schema();
 
             Map<Integer, Object> readCache = new HashMap<>();
 
-            IgniteBiTuple<Integer, Integer> footer = BinaryUtils.footerAbsolute(reader, start);
+            IgniteBiTuple<Integer, Integer> footer = BinaryUtilsEx.footerAbsolute(reader, start);
 
             int footerPos = footer.get1();
             int footerEnd = footer.get2();
 
-            int rawPos = BinaryUtils.rawOffsetAbsolute(reader, start);
+            int rawPos = BinaryUtilsEx.rawOffsetAbsolute(reader, start);
 
             int idx = 0;
 
@@ -485,12 +485,12 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
             val = readCache.get(fldId);
         }
 
-        return (T)BinaryUtils.unwrapLazy(val);
+        return (T) BinaryUtilsEx.unwrapLazy(val);
     }
 
     /** {@inheritDoc} */
     @Override public BinaryObjectBuilder setField(String name, Object val0) {
-        Object val = val0 == null ? new BinaryValueWithType(BinaryUtils.typeByClass(Object.class), null) : val0;
+        Object val = val0 == null ? new BinaryValueWithType(BinaryUtilsEx.typeByClass(Object.class), null) : val0;
 
         if (assignedVals == null)
             assignedVals = new LinkedHashMap<>();
@@ -511,7 +511,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
         if (assignedVals == null)
             assignedVals = new LinkedHashMap<>();
 
-        assignedVals.put(name, new BinaryValueWithType(BinaryUtils.typeByClass(type), val));
+        assignedVals.put(name, new BinaryValueWithType(BinaryUtilsEx.typeByClass(type), val));
 
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/94103ec9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index 7401434..b071362 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -23,7 +23,7 @@ import java.util.Map;
 import java.util.Set;
 import org.apache.ignite.cache.affinity.AffinityKeyMapper;
 import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.binary.BinaryUtilsEx;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.apache.ignite.internal.util.typedef.F;
 
@@ -203,7 +203,7 @@ import org.apache.ignite.internal.util.typedef.F;
         if (keepBinary)
             return map;
 
-        Map<Object, Object> map0 = BinaryUtils.newMap(map);
+        Map<Object, Object> map0 = BinaryUtilsEx.newMap(map);
 
         for (Map.Entry<Object, Object> e : map.entrySet())
             map0.put(unwrapBinary(e.getKey(), keepBinary, cpy), unwrapBinary(e.getValue(), keepBinary, cpy));
@@ -241,7 +241,7 @@ import org.apache.ignite.internal.util.typedef.F;
      * @return Unwrapped set.
      */
     private Set<Object> unwrapBinaries(Set<Object> set, boolean keepBinary, boolean cpy) {
-        Set<Object> set0 = BinaryUtils.newSet(set);
+        Set<Object> set0 = BinaryUtilsEx.newSet(set);
 
         for (Object obj : set)
             set0.add(unwrapBinary(obj, keepBinary, cpy));

http://git-wip-us.apache.org/repos/asf/ignite/blob/94103ec9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 6aee7a9..167860e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -59,7 +59,7 @@ import org.apache.ignite.internal.binary.BinaryObjectOffheapImpl;
 import org.apache.ignite.internal.binary.BinaryTypeImpl;
 import org.apache.ignite.internal.binary.GridBinaryMarshaller;
 import org.apache.ignite.internal.binary.BinaryContext;
-import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.binary.BinaryUtilsEx;
 import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
 import org.apache.ignite.internal.binary.streams.BinaryOffheapInputStream;
@@ -170,11 +170,11 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
 
                     if (metaDataCache == null) {
                         BinaryMetadata oldMeta = metaBuf.get(typeId);
-                        BinaryMetadata mergedMeta = BinaryUtils.mergeMetadata(oldMeta, newMeta0);
+                        BinaryMetadata mergedMeta = BinaryUtilsEx.mergeMetadata(oldMeta, newMeta0);
 
                         if (oldMeta != mergedMeta) {
                             synchronized (this) {
-                                mergedMeta = BinaryUtils.mergeMetadata(oldMeta, newMeta0);
+                                mergedMeta = BinaryUtilsEx.mergeMetadata(oldMeta, newMeta0);
 
                                 if (oldMeta != mergedMeta)
                                     metaBuf.put(typeId, mergedMeta);
@@ -315,7 +315,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
                 BinaryMetadata oldMeta0 = oldMeta != null ? oldMeta.metadata() : null;
 
                 try {
-                    res = BinaryUtils.mergeMetadata(oldMeta0, newMeta);
+                    res = BinaryUtilsEx.mergeMetadata(oldMeta0, newMeta);
                 }
                 catch (BinaryObjectException e) {
                     res = oldMeta0;
@@ -379,7 +379,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
         if (obj == null)
             return null;
 
-        if (BinaryUtils.isBinaryType(obj.getClass()))
+        if (BinaryUtilsEx.isBinaryType(obj.getClass()))
             return obj;
 
         if (obj instanceof Object[]) {
@@ -408,7 +408,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             Collection<Object> pCol;
 
             if (col instanceof Set)
-                pCol = (Collection<Object>)BinaryUtils.newSet((Set<?>)col);
+                pCol = (Collection<Object>) BinaryUtilsEx.newSet((Set<?>) col);
             else
                 pCol = new ArrayList<>(col.size());
 
@@ -421,7 +421,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
         if (obj instanceof Map) {
             Map<?, ?> map = (Map<?, ?>)obj;
 
-            Map<Object, Object> pMap = BinaryUtils.newMap((Map<Object, Object>)obj);
+            Map<Object, Object> pMap = BinaryUtilsEx.newMap((Map<Object, Object>) obj);
 
             for (Map.Entry<?, ?> e : map.entrySet())
                 pMap.put(marshalToBinary(e.getKey()), marshalToBinary(e.getValue()));
@@ -484,7 +484,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
 
         try {
             BinaryMetadata oldMeta = metaDataCache.localPeek(key);
-            BinaryMetadata mergedMeta = BinaryUtils.mergeMetadata(oldMeta, newMeta0);
+            BinaryMetadata mergedMeta = BinaryUtilsEx.mergeMetadata(oldMeta, newMeta0);
 
             BinaryObjectException err = metaDataCache.invoke(key, new MetadataProcessor(mergedMeta));
 
@@ -810,7 +810,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             try {
                 BinaryMetadata oldMeta = entry.getValue();
 
-                BinaryMetadata mergedMeta = BinaryUtils.mergeMetadata(oldMeta, newMeta);
+                BinaryMetadata mergedMeta = BinaryUtilsEx.mergeMetadata(oldMeta, newMeta);
 
                 if (mergedMeta != oldMeta)
                     entry.setValue(mergedMeta);

http://git-wip-us.apache.org/repos/asf/ignite/blob/94103ec9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryDuplicateFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryDuplicateFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryDuplicateFieldsQuerySelfTest.java
new file mode 100644
index 0000000..ab45467
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryDuplicateFieldsQuerySelfTest.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryUtils;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import javax.cache.Cache;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Tests for class with duplicate field names.
+ */
+public class BinaryDuplicateFieldsQuerySelfTest extends GridCommonAbstractTest {
+    /** Field 1. */
+    private static final String FIELD_1 = BinaryUtils.qualifiedFieldName(Entity1.class, "x");
+
+    /** Field 2. */
+    private static final String FIELD_2 = BinaryUtils.qualifiedFieldName(Entity2.class, "x");
+
+    /** Ignite instance. */
+    private Ignite ignite;
+
+    /** Cache. */
+    private IgniteCache<Integer, Entity2> cache;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
+    @Override protected void beforeTest() throws Exception {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setLocalHost("127.0.0.1");
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setMarshaller(new BinaryMarshaller());
+
+        CacheConfiguration cacheCfg = new CacheConfiguration();
+
+        cacheCfg.setName(null);
+        cacheCfg.setCacheMode(CacheMode.PARTITIONED);
+        cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+        cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+
+        CacheTypeMetadata meta = new CacheTypeMetadata();
+
+        meta.setKeyType(Integer.class);
+        meta.setValueType(Entity2.class);
+
+        Map<String, Class<?>> qryFields = new HashMap<>();
+
+        qryFields.put(FIELD_1, Integer.class);
+        qryFields.put(FIELD_2, Integer.class);
+
+        meta.setQueryFields(qryFields);
+
+        cacheCfg.setTypeMetadata(Collections.singleton(meta));
+
+        cfg.setCacheConfiguration(cacheCfg);
+
+        ignite = Ignition.start(cfg);
+
+        cache = ignite.cache(null);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        G.stopAll(true);
+
+        ignite = null;
+        cache = null;
+    }
+
+    /**
+     * Test duplicate fields querying.
+     *
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("unchecked")
+    public void testDuplicateFields() throws Exception {
+        cache.put(1, new Entity2(10, 11));
+        cache.put(2, new Entity2(20, 21));
+        cache.put(3, new Entity2(30, 31));
+
+        // Test first field.
+        Iterator iter = cache.query(new SqlQuery(Entity2.class, FIELD_1 + "=20")).iterator();
+
+        assert iter.hasNext();
+
+        Cache.Entry<Integer, Entity2> res = (Cache.Entry)iter.next();
+
+        assertEquals(2, (int)res.getKey());
+        assertEquals(20, res.getValue().get1());
+        assertEquals(21, res.getValue().get2());
+
+        assert !iter.hasNext();
+
+        // Test second field.
+        iter = cache.query(new SqlQuery(Entity2.class, FIELD_2 + "=21")).iterator();
+
+        assert iter.hasNext();
+
+        res = (Cache.Entry)iter.next();
+
+        assertEquals(2, (int)res.getKey());
+        assertEquals(20, res.getValue().get1());
+        assertEquals(21, res.getValue().get2());
+
+        assert !iter.hasNext();
+
+        iter = cache.query(
+            new SqlFieldsQuery("SELECT p." + FIELD_1 + ", p." + FIELD_2 + " " +
+                "FROM " + Entity2.class.getSimpleName() + " p " +
+                "WHERE p." + FIELD_1 + "=20 AND p." + FIELD_2 + "=21")).iterator();
+
+        assert iter.hasNext();
+
+        List<Object> fieldsRes = (List<Object>)iter.next();
+
+        assertEquals(20, fieldsRes.get(0));
+        assertEquals(21, fieldsRes.get(1));
+
+        assert !iter.hasNext();
+    }
+
+    /**
+     * First entity.
+     */
+    private static class Entity1 {
+        /** Value. */
+        private int x;
+
+        /**
+         * Default constructor.
+         */
+        protected Entity1() {
+            // No-op.
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param x Value.
+         */
+        protected Entity1(int x) {
+            this.x = x;
+        }
+
+        /**
+         * @return Value.
+         */
+        public int get1() {
+            return x;
+        }
+    }
+
+    private static class Entity2 extends Entity1 {
+        /** Value. */
+        private int x;
+
+        /**
+         * Default ctor.
+         */
+        public Entity2() {
+            // No-op.
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param x1 X1.
+         * @param x2 X2.
+         */
+        public Entity2(int x1, int x2) {
+            super(x1);
+
+            x = x2;
+        }
+
+        /**
+         * @return Value.
+         */
+        public int get2() {
+            return x;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/94103ec9/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index 6abc2d4..7ed7c4d 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.BinaryDuplicateFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.BinarySerializationQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.BinarySerializationQueryWithReflectiveSerializerSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
@@ -32,7 +34,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisable
 import org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
@@ -100,7 +101,6 @@ import org.apache.ignite.internal.processors.query.IgniteSqlSplitterSelfTest;
 import org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest;
 import org.apache.ignite.internal.processors.query.h2.sql.GridQueryParsingTest;
 import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryTest;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.spi.communication.tcp.GridOrderedMessageCancelSelfTest;
 import org.apache.ignite.testframework.config.GridTestProperties;
 
@@ -120,6 +120,7 @@ public class IgniteBinaryCacheQueryTestSuite extends TestSuite {
         // Serialization.
         suite.addTestSuite(BinarySerializationQuerySelfTest.class);
         suite.addTestSuite(BinarySerializationQueryWithReflectiveSerializerSelfTest.class);
+        suite.addTestSuite(BinaryDuplicateFieldsQuerySelfTest.class);
 
         // Parsing.
         suite.addTestSuite(GridQueryParsingTest.class);