Repository: ignite Updated Branches: refs/heads/master 4385f12f8 -> 0f3546a9b
IGNITE-6588: SQL: optimized index segment resolution. This closes #2825. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0f3546a9 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0f3546a9 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0f3546a9 Branch: refs/heads/master Commit: 0f3546a9b45e55181f0c16b11f9378452357b2ec Parents: 4385f12 Author: devozerov <[email protected]> Authored: Tue Oct 10 17:54:50 2017 +0300 Committer: devozerov <[email protected]> Committed: Tue Oct 10 17:54:50 2017 +0300 ---------------------------------------------------------------------- .../query/h2/opt/GridH2IndexBase.java | 25 +++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0f3546a9/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 6568f13..048192a 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 @@ -804,26 +804,23 @@ public abstract class GridH2IndexBase extends BaseIndex { protected int segmentForRow(SearchRow row) { assert row != null; - CacheObject key; - - if (ctx != null) { - final Value keyColValue = row.getValue(KEY_COL); + if (segmentsCount() == 1 || ctx == null) + return 0; - assert keyColValue != null; + CacheObject key; - final Object o = keyColValue.getObject(); + final Value keyColValue = row.getValue(KEY_COL); - if (o instanceof CacheObject) - key = (CacheObject)o; - else - key = ctx.toCacheKeyObject(o); + assert keyColValue != null; - return segmentForPartition(ctx.affinity().partition(key)); - } + final Object o = keyColValue.getObject(); - assert segmentsCount() == 1; + if (o instanceof CacheObject) + key = (CacheObject)o; + else + key = ctx.toCacheKeyObject(o); - return 0; + return segmentForPartition(ctx.affinity().partition(key)); } /**
