ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1232 Quick optimization attempt
Date Thu, 28 Jul 2016 09:54:59 GMT
Repository: ignite
Updated Branches:
  refs/heads/igntie-1232-1 [created] 5612aac80


ignite-1232 Quick optimization attempt


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

Branch: refs/heads/igntie-1232-1
Commit: 5612aac80d1247804316c236f8ac238f87e577d3
Parents: 33d35b3
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Jul 28 12:39:41 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Jul 28 12:47:53 2016 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridH2IndexBase.java           | 138 +++++++++++++++++--
 .../query/h2/twostep/msg/GridH2Boolean.java     |  11 ++
 .../query/h2/twostep/msg/GridH2Byte.java        |  12 ++
 .../query/h2/twostep/msg/GridH2Date.java        |  11 ++
 .../query/h2/twostep/msg/GridH2Decimal.java     |  19 +++
 .../query/h2/twostep/msg/GridH2Double.java      |  13 ++
 .../query/h2/twostep/msg/GridH2Float.java       |  11 ++
 .../query/h2/twostep/msg/GridH2Long.java        |  11 ++
 .../query/h2/twostep/msg/GridH2RowMessage.java  |  18 +++
 .../h2/twostep/msg/GridH2RowRangeBounds.java    |  21 +++
 .../query/h2/twostep/msg/GridH2Short.java       |  11 ++
 .../query/h2/twostep/msg/GridH2String.java      |  12 ++
 .../query/h2/twostep/msg/GridH2Time.java        |  11 ++
 .../query/h2/twostep/msg/GridH2Timestamp.java   |  22 +++
 .../query/h2/twostep/msg/GridH2Uuid.java        |  22 +++
 .../h2/twostep/msg/GridH2ValueMessage.java      |  12 ++
 16 files changed, 340 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index c29239f..cc0f2dd 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -103,7 +104,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
     private static final AtomicLong idxIdGen = new AtomicLong();
 
     /** */
-    protected final long idxId = idxIdGen.incrementAndGet();
+    private final long idxId = idxIdGen.incrementAndGet();
 
     /** */
     private final ThreadLocal<Object> snapshot = new ThreadLocal<>();
@@ -1064,23 +1065,18 @@ public abstract class GridH2IndexBase extends BaseIndex {
 
                 RangeStream stream = rangeStreams.get(node);
 
-                List<GridH2RowRangeBounds> bounds;
-
                 if (stream == null) {
                     stream = new RangeStream(qctx, node);
 
                     stream.req = createRequest(qctx, batchLookupId);
-                    stream.req.bounds(bounds = new ArrayList<>());
 
                     rangeStreams.put(node, stream);
                 }
-                else
-                    bounds = stream.req.bounds();
 
-                bounds.add(rangeBounds);
+                stream.add(rangeBounds);
 
                 // If at least one node will have a full batch then we are ok.
-                if (bounds.size() >= qctx.pageSize())
+                if (stream.boundsMap.size() >= qctx.pageSize())
                     batchFull = true;
             }
 
@@ -1151,6 +1147,26 @@ public abstract class GridH2IndexBase extends BaseIndex {
     }
 
     /**
+     *
+     */
+    static class RangeCursor extends GridH2Cursor {
+        /** */
+        private int rangeId;
+
+        /**
+         * @param iter Iterator.
+         * @param rangeId Range ID.
+         */
+        public RangeCursor(Iterator<? extends Row> iter, int rangeId) {
+            super(iter);
+            this.rangeId = rangeId;
+        }
+    }
+
+    /** */
+    static final RangeCursor EMPTY_CURSOR = new RangeCursor(Collections.<Row>emptyIterator(),
-1);
+
+    /**
      * Per node range stream.
      */
     private class RangeStream {
@@ -1173,11 +1189,23 @@ public abstract class GridH2IndexBase extends BaseIndex {
         Iterator<GridH2RowRange> ranges = emptyIterator();
 
         /** */
-        Cursor cursor = GridH2Cursor.EMPTY;
+        RangeCursor cursor = EMPTY_CURSOR;
+
+        /** */
+        RangeCursor dupCursor;
 
         /** */
         int cursorRangeId = -1;
 
+        /** */
+        Map<GridH2RowRangeBounds, Integer> boundsMap = new LinkedHashMap<>();
+
+        /** */
+        Map<Integer, Integer> dupRanges;
+
+        /** */
+        Map<Integer, List<GridH2RowRange>> rcvdDupRanges;
+
         /**
          * @param qctx Query context.
          * @param node Node.
@@ -1187,24 +1215,48 @@ public abstract class GridH2IndexBase extends BaseIndex {
             this.qctx = qctx;
         }
 
+        void add(GridH2RowRangeBounds bounds) {
+            Integer old = boundsMap.get(bounds);
+
+            if (old != null) {
+                if (dupRanges == null) {
+                    dupRanges = new HashMap<>();
+                    rcvdDupRanges = new HashMap<>();
+                }
+
+                assert old < bounds.rangeId();
+
+                dupRanges.put(bounds.rangeId(), old);
+
+                rcvdDupRanges.put(old, new ArrayList<GridH2RowRange>());
+            }
+            else
+                boundsMap.put(bounds, bounds.rangeId());
+        }
+
         /**
          * Start streaming.
          */
         private void start() {
-            remainingRanges = req.bounds().size();
+            remainingRanges = boundsMap.size();
 
             assert remainingRanges > 0;
 
             if (log.isDebugEnabled())
                 log.debug("Starting stream: [node=" + node + ", req=" + req + "]");
 
+            req.bounds(new ArrayList<GridH2RowRangeBounds>(remainingRanges));
+
+            for (GridH2RowRangeBounds b : boundsMap.keySet())
+                req.bounds().add(b);
+
             send(singletonList(node), req);
         }
 
         /**
          * @param msg Response.
          */
-        public void onResponse(GridH2IndexRangeResponse msg) {
+        void onResponse(GridH2IndexRangeResponse msg) {
             respQueue.add(msg);
         }
 
@@ -1286,11 +1338,58 @@ public abstract class GridH2IndexBase extends BaseIndex {
             }
         }
 
+        private Iterator<GridH2RowRange> duplicatedRange(int rangeId) {
+            Integer dupRange = dupRanges != null ? dupRanges.remove(rangeId) : null;
+
+            if (dupRange != null) {
+                List<GridH2RowRange> ranges = rcvdDupRanges != null ? rcvdDupRanges.get(dupRange)
: null;
+
+                if (!F.isEmpty(ranges))
+                    return ranges.iterator();
+            }
+
+            return null;
+        }
+
         /**
          * @param rangeId Requested range ID.
          * @return {@code true} If next row for the requested range was found.
          */
         private boolean next(final int rangeId) {
+            if (dupCursor != null && dupCursor.rangeId == rangeId && dupCursor.next())
+                return true;
+            else
+                dupCursor = null;
+
+            Iterator<GridH2RowRange> rcvdRanges = duplicatedRange(rangeId);
+
+            if (rcvdRanges != null) {
+                GridH2RowRange range = rcvdRanges.next();
+
+                if (!F.isEmpty(range.rows())) {
+                    final Iterator<GridH2RowMessage> it = range.rows().iterator();
+
+                    if (it.hasNext()) {
+                        dupCursor = new RangeCursor(new Iterator<Row>() {
+                            @Override public boolean hasNext() {
+                                return it.hasNext();
+                            }
+
+                            @Override public Row next() {
+                                return toRow(it.next());
+                            }
+
+                            @Override public void remove() {
+                                throw new UnsupportedOperationException();
+                            }
+                        }, rangeId);
+
+                        if (dupCursor.next())
+                            return true;
+                    }
+                }
+            }
+
             for (;;) {
                 if (rangeId == cursorRangeId) {
                     if (cursor.next())
@@ -1299,7 +1398,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
                 else if (rangeId < cursorRangeId)
                     return false;
 
-                cursor = GridH2Cursor.EMPTY;
+                cursor = EMPTY_CURSOR;
 
                 while (!ranges.hasNext()) {
                     if (remainingRanges == 0) {
@@ -1315,11 +1414,17 @@ public abstract class GridH2IndexBase extends BaseIndex {
 
                 cursorRangeId = range.rangeId();
 
+                if (rcvdDupRanges != null && rcvdDupRanges.containsKey(cursorRangeId))
{
+                    List<GridH2RowRange> ranges = rcvdDupRanges.get(range.rangeId());
+
+                    ranges.add(range);
+                }
+
                 if (!F.isEmpty(range.rows())) {
                     final Iterator<GridH2RowMessage> it = range.rows().iterator();
 
                     if (it.hasNext()) {
-                        cursor = new GridH2Cursor(new Iterator<Row>() {
+                        cursor = new RangeCursor(new Iterator<Row>() {
                             @Override public boolean hasNext() {
                                 return it.hasNext();
                             }
@@ -1332,7 +1437,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
                             @Override public void remove() {
                                 throw new UnsupportedOperationException();
                             }
-                        });
+                        }, range.rangeId());
                     }
                 }
             }
@@ -1343,7 +1448,9 @@ public abstract class GridH2IndexBase extends BaseIndex {
          * @return Current row.
          */
         private Row get(int rangeId) {
-            assert rangeId == cursorRangeId;
+            RangeCursor cursor = dupCursor != null ? dupCursor : this.cursor;
+
+            assert rangeId == cursor.rangeId;
 
             return cursor.get();
         }
@@ -1443,6 +1550,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
                     // We have to return empty range here.
                     GridH2RowRange emptyRange = new GridH2RowRange();
 
+                    emptyRange.rows(Collections.<GridH2RowMessage>emptyList());
                     emptyRange.rangeId(curRangeId);
 
                     return emptyRange;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
index edd404e..072e8be 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Boolean.java
@@ -53,6 +53,17 @@ public class GridH2Boolean extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Boolean.class && x ==
((GridH2Boolean)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return x ? 1231 : 1237;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
index 894794e..cfe5c5c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Byte.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -53,6 +54,17 @@ public class GridH2Byte extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Byte.class && x == ((GridH2Byte)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return x;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
index 8025257..fd94bd3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Date.java
@@ -55,6 +55,17 @@ public class GridH2Date extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Date.class && date ==
((GridH2Date)obj).date);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return (int)(date ^ (date >>> 32));
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
index a3ad444..24061ae 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
+import java.util.Objects;
+import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -38,6 +40,10 @@ public class GridH2Decimal extends GridH2ValueMessage {
     /** */
     private byte[] b;
 
+    /** */
+    @GridDirectTransient
+    private BigDecimal x;
+
     /**
      *
      */
@@ -53,11 +59,24 @@ public class GridH2Decimal extends GridH2ValueMessage {
 
         BigDecimal x = val.getBigDecimal();
 
+        this.x = x;
+
         scale = x.scale();
         b = x.unscaledValue().toByteArray();
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Decimal.class && Objects.equals(x,
((GridH2Decimal)obj).x));
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return x != null ? x.hashCode() : 0;
+    }
+
+    /** {@inheritDoc} */
     @Override public Value value(GridKernalContext ctx) {
         return ValueDecimal.get(new BigDecimal(new BigInteger(b), scale));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
index 2ceea8d..aa15116 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Double.java
@@ -48,6 +48,19 @@ public class GridH2Double extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Double.class && x ==
((GridH2Double)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        long bits = Double.doubleToLongBits(x);
+
+        return (int)(bits ^ (bits >>> 32));
+    }
+
+    /** {@inheritDoc} */
     @Override public Value value(GridKernalContext ctx) {
         return ValueDouble.get(x);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
index 6923470..4119750 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Float.java
@@ -53,6 +53,17 @@ public class GridH2Float extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Float.class && x == ((GridH2Float)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return Float.floatToIntBits(x);
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
index 3d360f0..7851786 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Long.java
@@ -53,6 +53,17 @@ public class GridH2Long extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Long.class && x == ((GridH2Long)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return (int)(x ^ (x >>> 32));
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
index 59c548d..64714d4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowMessage.java
@@ -51,6 +51,24 @@ public class GridH2RowMessage implements Message {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridH2RowMessage that = (GridH2RowMessage)o;
+
+        return vals != null ? vals.equals(that.vals) : that.vals == null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return vals != null ? vals.hashCode() : 0;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
index e32e449..c325bb3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2RowRangeBounds.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
@@ -95,6 +96,26 @@ public class GridH2RowRangeBounds implements Message {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridH2RowRangeBounds that = (GridH2RowRangeBounds)o;
+
+        return Objects.equals(first, that.first) && Objects.equals(last, that.last);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = first != null ? first.hashCode() : 0;
+        res = 31 * res + (last != null ? last.hashCode() : 0);
+        return res;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
index ebeca9d..b537eb2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Short.java
@@ -53,6 +53,17 @@ public class GridH2Short extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Short.class && x == ((GridH2Short)obj).x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return x;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
index f2f9fdc..2f6f29c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2String.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -55,6 +56,17 @@ public class GridH2String extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2String.class && Objects.equals(x,
((GridH2String)obj).x));
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return x != null ? x.hashCode() : 0;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
index 172d695..51fc525 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Time.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.query.h2.twostep.msg;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -49,6 +50,16 @@ public class GridH2Time extends GridH2ValueMessage {
         nanos = t.getNanos();
     }
 
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this ||
+            (obj != null && obj.getClass() == GridH2Time.class && nanos ==
((GridH2Time)obj).nanos);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return (int)nanos;
+    }
 
     /** {@inheritDoc} */
     @Override public Value value(GridKernalContext ctx) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
index b020799..488e59a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Timestamp.java
@@ -54,6 +54,28 @@ public class GridH2Timestamp extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (obj == this)
+            return true;
+
+        if (obj.getClass() == GridH2Timestamp.class) {
+            GridH2Timestamp other = (GridH2Timestamp)obj;
+
+            return date == other.date && nanos == other.nanos;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = super.hashCode();
+        res = 31 * res + (int) (date ^ (date >>> 32));
+        res = 31 * res + (int) (nanos ^ (nanos >>> 32));
+        return res;
+    }
+
+    /** {@inheritDoc} */
     @Override public Value value(GridKernalContext ctx) {
         return ValueTimestamp.fromDateValueAndNanos(date, nanos);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
index fa9360b..2fc73df 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Uuid.java
@@ -59,6 +59,28 @@ public class GridH2Uuid extends GridH2ValueMessage {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (obj == this)
+            return true;
+
+        if (obj.getClass() == GridH2Uuid.class) {
+            GridH2Uuid other = (GridH2Uuid)obj;
+
+            return high == other.high && low == other.low;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = super.hashCode();
+        res = 31 * res + (int) (high ^ (high >>> 32));
+        res = 31 * res + (int) (low ^ (low >>> 32));
+        return res;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5612aac8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
index 18f8880..74d6483 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessage.java
@@ -43,6 +43,18 @@ public abstract class GridH2ValueMessage implements Message {
         // No-op.
     }
 
+    @Override public int hashCode() {
+        assert false : this.getClass();
+
+        return 0;
+    }
+
+    @Override public boolean equals(Object obj) {
+        assert false : this.getClass();
+
+        return false;
+    }
+
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         return true;


Mime
View raw message