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/02/15 08:51:48 UTC

[04/50] [abbrv] ignite git commit: ignite-split2 - minor fixes

ignite-split2 - minor fixes


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

Branch: refs/heads/ignite-1232
Commit: 5a0bf09f8577bbe2ae20813053b18f030de170a6
Parents: 35e4b20
Author: S.Vladykin <sv...@gridgain.com>
Authored: Sat Dec 5 18:13:19 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Sat Dec 5 18:13:19 2015 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridH2Collocation.java         | 49 ++++++++++----------
 1 file changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5a0bf09f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Collocation.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Collocation.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Collocation.java
index fd72b2b..13af99b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Collocation.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Collocation.java
@@ -35,7 +35,7 @@ import org.h2.table.TableFilter;
 /**
  * Collocation model for a query.
  */
-public class GridH2Collocation {
+public final class GridH2Collocation {
     /** */
     public static final int MULTIPLIER_COLLOCATED = 1;
 
@@ -113,7 +113,7 @@ public class GridH2Collocation {
      * @param childFilters New child filters.
      * @return {@code true} If child filters were updated.
      */
-    public boolean childFilters(TableFilter[] childFilters) {
+    private boolean childFilters(TableFilter[] childFilters) {
         assert childFilters != null;
         assert select == childFilters[0].getSelect();
 
@@ -303,7 +303,7 @@ public class GridH2Collocation {
                     TableFilter prevJoin = expCol.getTableFilter();
 
                     if (prevJoin != null) {
-                        GridH2Collocation co = children[indexOf(prevJoin)];
+                        GridH2Collocation co = child(indexOf(prevJoin));
 
                         assert co != null || isNotTableOrViewChild(-1, prevJoin);
 
@@ -395,8 +395,13 @@ public class GridH2Collocation {
         for (TableFilter f = select.getTopTableFilter(); f != null; f = f.getJoin()) {
             childFilters[i] = f;
 
+            GridH2Collocation c = child(i);
+
+            if (c == null)
+                child(i, c = new GridH2Collocation(this, i));
+
             if (f.getTable().isView())
-                children[i].finalizeChildFiltersOrder();
+                c.finalizeChildFiltersOrder();
 
             i++;
         }
@@ -419,8 +424,18 @@ public class GridH2Collocation {
             boolean needReset = false;
 
             for (int i = 0; i < childFilters.length; i++) {
-                if (childFilters[i].getTable().isView() && children[i].finalizeChildFiltersOrder())
-                    needReset = true;
+                Table t = childFilters[i].getTable();
+
+                if (t.isView() || t instanceof GridH2Table) {
+                    if (child(i) == null) {
+                        child(i, new GridH2Collocation(this, i));
+
+                        needReset = true;
+                    }
+
+                    if (t.isView() && child(i).finalizeChildFiltersOrder())
+                        needReset = true;
+                }
             }
 
             if (needReset)
@@ -494,8 +509,8 @@ public class GridH2Collocation {
      * @param idx Index.
      * @param child Child collocation.
      */
-    public void child(int idx, GridH2Collocation child) {
-        assert child(idx) == null;
+    private void child(int idx, GridH2Collocation child) {
+        assert children[idx] == null;
 
         children[idx] = child;
     }
@@ -504,25 +519,11 @@ public class GridH2Collocation {
      * @param idx Index.
      * @return Child collocation.
      */
-    public GridH2Collocation child(int idx) {
+    private GridH2Collocation child(int idx) {
         return children[idx];
     }
 
     /**
-     * @return Upper collocation.
-     */
-    public GridH2Collocation upper() {
-        return upper;
-    }
-
-    /**
-     * @return Filter.
-     */
-    public int filter() {
-        return filter;
-    }
-
-    /**
      * @param qctx Query context.
      * @param info Sub-query info.
      * @param filters Filters.
@@ -578,7 +579,7 @@ public class GridH2Collocation {
             }
 
             if (i == unions.size()) {
-                c = new GridH2Collocation(c.upper(), c.filter());
+                c = new GridH2Collocation(c.upper, c.filter);
 
                 unions.add(c);