You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2017/03/01 14:33:05 UTC

[22/50] [abbrv] ignite git commit: Minors

Minors


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

Branch: refs/heads/master
Commit: 2e90a07218272c5cb2c09111e193a3613d3d51ac
Parents: 56ce223
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Tue Feb 21 15:05:51 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Tue Feb 21 15:05:51 2017 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridH2TreeIndex.java           | 34 ++++----------------
 1 file changed, 6 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2e90a072/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 64ca9ea..07c3e6d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -45,25 +45,13 @@ import org.h2.table.TableFilter;
 import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.KEY_COL;
+
 /**
  * Base class for snapshotable segmented tree indexes.
  */
 @SuppressWarnings("ComparatorNotSerializable")
 public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridSearchRowPointer> {
-    /** */
-    private static Field KEY_FIELD;
-
-    /** */
-    static {
-        try {
-            KEY_FIELD = GridH2AbstractKeyValueRow.class.getDeclaredField("key");
-            KEY_FIELD.setAccessible(true);
-        }
-        catch (NoSuchFieldException e) {
-            KEY_FIELD = null;
-        }
-    }
-
     /** Index segments. */
     private final ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row>[] segments;
 
@@ -451,22 +439,12 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
 
             assert ctx != null;
 
-            if (row instanceof GridH2AbstractKeyValueRow && KEY_FIELD != null) {
-                try {
-                    Object o = KEY_FIELD.get(row);
-
-                    if (o instanceof CacheObject)
-                        key = (CacheObject)o;
-                    else
-                        key = ctx.toCacheKeyObject(o);
+            Object o = ctx.toCacheKeyObject(row.getValue(KEY_COL));
 
-                }
-                catch (IllegalAccessException e) {
-                    throw new IllegalStateException(e);
-                }
-            }
+            if (o instanceof CacheObject)
+                key = (CacheObject)o;
             else
-                key = ctx.toCacheKeyObject(row.getValue(0));
+                key = ctx.toCacheKeyObject(o);
 
             return segmentForPartition(ctx.affinity().partition(key));
         }