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 2019/02/04 08:16:56 UTC

[ignite] 05/08: Merge branch 'master' into col_model

This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 353fe5307b31f652aea43b05e118075d76091e47
Merge: 896bc23 1602cc7
Author: devozerov <vo...@gridgain.com>
AuthorDate: Mon Feb 4 11:05:53 2019 +0300

    Merge branch 'master' into col_model
    
    # Conflicts:
    #	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
    #	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java

 .../testframework/util/MavenUtils.java             |  22 +-
 .../transactions/PlatformTransactions.java         |   2 +
 .../processors/database/BPlusTreeSelfTest.java     |  28 +-
 .../processors/query/h2/IgniteH2Indexing.java      |  48 +-
 .../processors/query/h2/opt/GridH2IndexBase.java   |  52 +--
 .../query/h2/opt/GridH2QueryContext.java           | 290 +-----------
 .../processors/query/h2/opt/GridH2QueryType.java   |   7 +-
 .../query/h2/opt/join/CollocationModel.java        |  70 ++-
 .../query/h2/opt/join/DistributedJoinContext.java  | 263 +++++++++++
 .../query/h2/opt/join/DistributedJoinMode.java     |  51 ---
 .../query/h2/opt/join/DistributedLookupBatch.java  |  64 +--
 .../processors/query/h2/opt/join/RangeStream.java  |  13 +-
 .../query/h2/sql/GridSqlQuerySplitter.java         |  43 ++
 .../processors/query/h2/sql/SplitterContext.java   |  85 ++++
 .../query/h2/twostep/GridMapQueryExecutor.java     | 118 +++--
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  13 +-
 .../persistence/db/IgniteTcBotInitNewPageTest.java |  13 +-
 .../Cache/CacheTimeoutOnPmeTransactionalTest.cs    | 108 +++--
 .../Apache.Ignite.Core/IgniteConfiguration.cs      |   2 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs       |   2 +-
 .../Impl/Transactions/Transaction.cs               |   6 +
 .../Impl/Transactions/TransactionImpl.cs           |  15 +-
 .../Impl/Transactions/TransactionsImpl.cs          |  14 +-
 .../Transactions/ITransaction.cs                   |   8 +
 modules/web-console/frontend/app/app.d.ts          |   2 +-
 modules/web-console/frontend/app/app.js            | 498 ++++++++++-----------
 .../components/form-field-size/controller.ts       |  23 +-
 .../form-field/igniteFormField.directive.ts        |  76 ++++
 .../frontend/app/components/form-field/index.js    |   2 +
 .../frontend/app/components/page-admin/index.js    |   2 +-
 .../components/cache-edit-form/index.js            |  21 -
 .../components/cluster-edit-form/index.js          |  21 -
 .../components/model-edit-form/index.js            |  21 -
 .../page-configure/components/pcValidation.ts      | 197 --------
 .../app/components/page-configure/index.d.ts       | 154 -------
 .../components/page-configure/types/uirouter.d.ts  |  20 -
 .../ignite-information}/information.directive.js   |   0
 .../components/ignite-information}/information.pug |   0
 .../ignite-information}/information.scss           |   0
 .../components/queries-notebook/index.js           |   2 +
 .../frontend/app/components/page-queries/index.ts  |   2 +-
 .../button-download-project/component.ts}          |   9 +-
 .../components/button-download-project/index.ts}   |   0
 .../button-download-project/template.pug           |   0
 .../components/button-import-models/component.ts}  |  11 +-
 .../components/button-import-models/index.ts}      |   4 +-
 .../components/button-import-models/style.scss     |   0
 .../components/button-import-models/template.pug   |   0
 .../button-preview-project/component.ts}           |   9 +-
 .../components/button-preview-project/index.ts}    |   4 +-
 .../components/button-preview-project/template.pug |   0
 .../components/fakeUICanExit.spec.js               |   0
 .../components/fakeUICanExit.ts}                   |  15 +-
 .../components/formUICanExitGuard.ts}              |   9 +-
 .../components/modal-import-models/component.js    |   6 +-
 .../components/modal-import-models/index.ts}       |   0
 .../selected-items-amount-indicator/component.ts}  |   0
 .../selected-items-amount-indicator/style.scss     |   1 -
 .../selected-items-amount-indicator/template.pug   |   0
 .../components/modal-import-models/service.ts}     |  21 +-
 .../step-indicator/component.ts}                   |   8 +-
 .../modal-import-models/step-indicator/style.scss  |   1 -
 .../step-indicator/template.pug                    |   0
 .../components/modal-import-models/style.scss      |   0
 .../tables-action-cell/component.ts}               |  13 +-
 .../tables-action-cell/style.scss                  |   0
 .../tables-action-cell/template.pug                |   0
 .../modal-import-models/template.tpl.pug           |   1 +
 .../components/modal-preview-project/component.ts} |   0
 .../modal-preview-project/controller.ts}           |  33 +-
 .../components/modal-preview-project/index.ts}     |   0
 .../components/modal-preview-project/service.ts}   |  18 +-
 .../components/modal-preview-project/style.scss    |   3 +-
 .../components/modal-preview-project/template.pug  |   0
 .../page-configure-advanced/component.ts}          |   0
 .../components/cache-edit-form/component.ts}       |   0
 .../components/cache-edit-form/controller.ts}      |  37 +-
 .../components/cache-edit-form/index.ts}           |   4 +-
 .../components/cache-edit-form}/style.scss         |   0
 .../components/cache-edit-form/template.tpl.pug    |   0
 .../cache-edit-form/templates/affinity.pug         |   1 +
 .../cache-edit-form/templates/concurrency.pug      |   1 +
 .../cache-edit-form/templates/general.pug          |   1 +
 .../cache-edit-form/templates/memory.pug           |   1 +
 .../templates/near-cache-client.pug                |   1 +
 .../templates/near-cache-server.pug                |   1 +
 .../cache-edit-form/templates/node-filter.pug      |   1 +
 .../components/cache-edit-form/templates/query.pug |   1 +
 .../cache-edit-form/templates/rebalance.pug        |   1 +
 .../cache-edit-form/templates/statistics.pug       |   1 +
 .../components/cache-edit-form/templates/store.pug |   1 +
 .../components/cluster-edit-form/component.ts}     |   0
 .../cluster-edit-form/controller.spec.js           |   0
 .../components/cluster-edit-form/controller.ts}    |  43 +-
 .../components/cluster-edit-form/index.ts}         |   5 +-
 .../components/cluster-edit-form}/style.scss       |   0
 .../components/cluster-edit-form/template.tpl.pug  |   0
 .../cluster-edit-form/templates/atomic.pug         |   1 +
 .../cluster-edit-form/templates/attributes.pug     |   1 +
 .../cluster-edit-form/templates/binary.pug         |   1 +
 .../cluster-edit-form/templates/cache-key-cfg.pug  |   1 +
 .../cluster-edit-form/templates/checkpoint.pug     |   1 +
 .../cluster-edit-form/templates/checkpoint/fs.pug  |   0
 .../templates/checkpoint/jdbc.pug                  |   0
 .../cluster-edit-form/templates/checkpoint/s3.pug  |   0
 .../templates/client-connector.pug                 |   1 +
 .../cluster-edit-form/templates/collision.pug      |   1 +
 .../templates/collision/custom.pug                 |   0
 .../templates/collision/fifo-queue.pug             |   0
 .../templates/collision/job-stealing.pug           |   0
 .../templates/collision/priority-queue.pug         |   0
 .../cluster-edit-form/templates/communication.pug  |   1 +
 .../cluster-edit-form/templates/connector.pug      |   1 +
 .../cluster-edit-form/templates/data-storage.pug   |   1 +
 .../cluster-edit-form/templates/deployment.pug     |   1 +
 .../cluster-edit-form/templates/discovery.pug      |   1 +
 .../cluster-edit-form/templates/events.pug         |   1 +
 .../cluster-edit-form/templates/failover.pug       |   1 +
 .../cluster-edit-form/templates/general.pug        |   1 +
 .../templates/general/discovery/cloud.pug          |   0
 .../templates/general/discovery/google.pug         |   0
 .../templates/general/discovery/jdbc.pug           |   0
 .../templates/general/discovery/kubernetes.pug     |   0
 .../templates/general/discovery/multicast.pug      |   0
 .../templates/general/discovery/s3.pug             |   0
 .../templates/general/discovery/shared.pug         |   0
 .../templates/general/discovery/vm.pug             |   0
 .../templates/general/discovery/zookeeper.pug      |   0
 .../retrypolicy/bounded-exponential-backoff.pug    |   0
 .../discovery/zookeeper/retrypolicy/custom.pug     |   0
 .../zookeeper/retrypolicy/exponential-backoff.pug  |   0
 .../discovery/zookeeper/retrypolicy/forever.pug    |   0
 .../discovery/zookeeper/retrypolicy/n-times.pug    |   0
 .../discovery/zookeeper/retrypolicy/one-time.pug   |   0
 .../zookeeper/retrypolicy/until-elapsed.pug        |   0
 .../cluster-edit-form/templates/hadoop.pug         |   1 +
 .../cluster-edit-form/templates/load-balancing.pug |   1 +
 .../cluster-edit-form/templates/logger.pug         |   1 +
 .../cluster-edit-form/templates/logger/custom.pug  |   0
 .../cluster-edit-form/templates/logger/log4j.pug   |   0
 .../cluster-edit-form/templates/logger/log4j2.pug  |   0
 .../cluster-edit-form/templates/marshaller.pug     |   1 +
 .../cluster-edit-form/templates/memory.pug         |   1 +
 .../cluster-edit-form/templates/metrics.pug        |   1 +
 .../cluster-edit-form/templates/misc.pug           |   1 +
 .../cluster-edit-form/templates/mvcc.pug           |   1 +
 .../cluster-edit-form/templates/odbc.pug           |   1 +
 .../cluster-edit-form/templates/persistence.pug    |   1 +
 .../cluster-edit-form/templates/service.pug        |   1 +
 .../cluster-edit-form/templates/sql-connector.pug  |   1 +
 .../components/cluster-edit-form/templates/ssl.pug |   1 +
 .../cluster-edit-form/templates/swap.pug           |   1 +
 .../cluster-edit-form/templates/thread.pug         |   1 +
 .../cluster-edit-form/templates/time.pug           |   1 +
 .../cluster-edit-form/templates/transactions.pug   |   1 +
 .../components/igfs-edit-form/component.ts}        |   0
 .../components/igfs-edit-form/controller.ts}       |  20 +-
 .../components/igfs-edit-form/index.ts}            |   5 +-
 .../components/igfs-edit-form/style.scss           |   0
 .../components/igfs-edit-form/template.tpl.pug     |   0
 .../components/igfs-edit-form/templates/dual.pug   |   1 +
 .../igfs-edit-form/templates/fragmentizer.pug      |   1 +
 .../igfs-edit-form/templates/general.pug           |   1 +
 .../components/igfs-edit-form/templates/ipc.pug    |   1 +
 .../components/igfs-edit-form/templates/misc.pug   |   1 +
 .../igfs-edit-form/templates/secondary.pug         |   1 +
 .../components/model-edit-form/component.js        |   0
 .../components/model-edit-form/controller.ts}      |  71 ++-
 .../components/model-edit-form}/index.js           |   5 +-
 .../components/model-edit-form/style.scss          |   0
 .../components/model-edit-form/template.tpl.pug    |   0
 .../model-edit-form/templates/general.pug          |   1 +
 .../components/model-edit-form/templates/query.pug |   1 +
 .../components/model-edit-form/templates/store.pug |   1 +
 .../page-configure-advanced-caches/component.ts}   |   0
 .../page-configure-advanced-caches/controller.ts}  | 132 +++---
 .../page-configure-advanced-caches/index.ts}       |   0
 .../page-configure-advanced-caches/template.pug    |   0
 .../page-configure-advanced-cluster/component.ts}  |   0
 .../page-configure-advanced-cluster/controller.ts} |  22 +-
 .../page-configure-advanced-cluster/index.ts}      |   0
 .../page-configure-advanced-cluster/template.pug   |   0
 .../page-configure-advanced-igfs/component.ts}     |   0
 .../page-configure-advanced-igfs/controller.ts}    |  43 +-
 .../page-configure-advanced-igfs/index.ts}         |   0
 .../page-configure-advanced-igfs/template.pug      |   0
 .../page-configure-advanced-models/component.ts}   |   0
 .../page-configure-advanced-models/controller.ts}  |  55 ++-
 .../hasIndex.template.pug                          |   0
 .../page-configure-advanced-models/index.ts}       |   0
 .../keyCell.template.pug                           |   0
 .../page-configure-advanced-models/style.scss      |   0
 .../page-configure-advanced-models/template.pug    |   0
 .../valueCell.template.pug                         |   0
 .../page-configure-advanced/controller.ts}         |   2 +
 .../components/page-configure-advanced/index.ts}   |   0
 .../components/page-configure-advanced/style.scss  |   3 +-
 .../page-configure-advanced/template.pug           |   0
 .../components/page-configure-basic/component.ts}  |   0
 .../page-configure-basic/controller.spec.js        |   0
 .../components/page-configure-basic/controller.ts} |  56 +--
 .../components/page-configure-basic/index.ts}      |   0
 .../page-configure-basic/reducer.spec.js           |   0
 .../components/page-configure-basic/reducer.ts}    |   0
 .../components/page-configure-basic/style.scss     |   0
 .../components/page-configure-basic/template.pug   |   1 +
 .../page-configure-overview/component.ts}          |   0
 .../pco-grid-column-categories/directive.ts}       |   9 +-
 .../page-configure-overview/controller.ts}         |  55 ++-
 .../components/page-configure-overview/index.ts}   |   0
 .../components/page-configure-overview/style.scss  |   0
 .../page-configure-overview/template.pug           |   0
 .../components/page-configure/component.ts}        |   0
 .../components/page-configure/controller.ts}       |  27 +-
 .../components/page-configure/index.ts}            |   6 +-
 .../components/page-configure/style.scss           |   2 -
 .../components/page-configure/template.pug         |   0
 .../components/pc-items-table/component.js         |   0
 .../components/pc-items-table/controller.js        |   0
 .../components/pc-items-table/decorator.js         |   0
 .../components/pc-items-table/index.js             |   0
 .../components/pc-items-table/style.scss           |   2 +-
 .../components/pc-items-table/template.pug         |   0
 .../components/pc-split-button/component.ts}       |   0
 .../components/pc-split-button/controller.ts}      |  19 +-
 .../components/pc-split-button/index.ts}           |   0
 .../components/pc-split-button/template.pug        |   0
 .../components/pc-ui-grid-filters/directive.ts}    |   5 +-
 .../components/pc-ui-grid-filters/index.ts}        |   0
 .../components/pc-ui-grid-filters/style.scss       |   0
 .../components/pc-ui-grid-filters/template.pug     |   0
 .../components/pcIsInCollection.ts}                |   5 +-
 .../app/configuration/components/pcValidation.ts   | 117 +++++
 .../components/preview-panel/directive.ts}         |  10 +-
 .../components/preview-panel/index.ts}             |   0
 .../components/ui-ace-java/index.ts}               |   2 +-
 .../ui-ace-java/ui-ace-java.controller.ts}         |   0
 .../ui-ace-java/ui-ace-java.directive.ts}          |   0
 .../components}/ui-ace-java/ui-ace-java.pug        |   0
 .../components/ui-ace-spring/index.ts}             |   2 +-
 .../ui-ace-spring/ui-ace-spring.controller.ts}     |   0
 .../ui-ace-spring/ui-ace-spring.directive.ts}      |   0
 .../components}/ui-ace-spring/ui-ace-spring.pug    |   0
 .../components/ui-ace-tabs.directive.ts}           |   0
 .../components}/ui-ace.controller.js               |   0
 .../defaultNames.ts}                               |   0
 .../generator/JavaTypesNonEnum.service.spec.ts     |  38 ++
 .../generator/JavaTypesNonEnum.service.ts          |  62 +++
 .../generator}/configuration.module.js             |  42 +-
 .../generator}/generator/AbstractTransformer.js    |   4 +-
 .../generator}/generator/Beans.js                  |   0
 .../generator}/generator/ConfigurationGenerator.js |   0
 .../generator}/generator/Custom.service.js         |   0
 .../generator}/generator/Docker.service.js         |   0
 .../generator}/generator/Docker.service.spec.js    |   0
 .../generator/JavaTransformer.service.js           |   6 +-
 .../generator/generator/JavaTransformer.spec.js}   |   8 +-
 .../generator}/generator/Maven.service.js          |   0
 .../generator}/generator/PlatformGenerator.js      |   0
 .../generator}/generator/Properties.service.js     |   0
 .../generator}/generator/Readme.service.js         |   0
 .../generator/SharpTransformer.service.js          |   6 +-
 .../generator/generator/SharpTransformer.spec.js}  |   6 +-
 .../generator/SpringTransformer.service.js         |   2 +-
 .../generator/generator/SpringTransformer.spec.js} |   9 +-
 .../generator}/generator/StringBuilder.js          |   0
 .../generator/defaults/Cache.platform.service.js   |   0
 .../generator}/generator/defaults/Cache.service.js |   0
 .../generator/defaults/Cluster.platform.service.js |   0
 .../generator/defaults/Cluster.service.js          |   0
 .../generator/defaults/Event-groups.service.js     |   0
 .../generator}/generator/defaults/IGFS.service.js  |   0
 .../icons/configuration.icon.svg                   |   0
 .../frontend/app/configuration/index.lazy.ts       |  48 ++
 .../page-configure => configuration}/index.ts      |  88 ++--
 .../app/{helpers/jade => configuration}/mixins.pug |  46 +-
 .../Caches.js => configuration/services/Caches.ts} |  41 +-
 .../{ => configuration}/services/Clusters.spec.js  |   0
 .../services/Clusters.ts}                          |  35 +-
 .../services/ConfigChangesGuard.spec.js            |   0
 .../services/ConfigChangesGuard.ts}                |  29 +-
 .../services/ConfigSelectionManager.ts}            |   9 +-
 .../services/ConfigurationDownload.spec.js         |   0
 .../services/ConfigurationDownload.ts}             |  32 +-
 .../services/ConfigurationResource.spec.js         |   0
 .../services/ConfigurationResource.ts}             |   9 +-
 .../services/ConfigureState.ts}                    |   3 +-
 .../IGFSs.js => configuration/services/IGFSs.ts}   |  12 +-
 .../Models.js => configuration/services/Models.ts} |  60 +--
 .../services/PageConfigure.spec.js                 |   3 +-
 .../services/PageConfigure.ts}                     |  15 +-
 .../services/SummaryZipper.ts}                     |   5 +-
 .../services/summary.worker.js                     |  16 +-
 .../states.js => configuration/states.ts}          |  14 +-
 .../store/actionCreators.js                        |   0
 .../store/actionTypes.js                           |   0
 .../store/effects.js                               |  16 +-
 .../store/effects.spec.js                          |   0
 .../store}/reducer.js                              |   2 +-
 .../store}/reducer.spec.js                         |   0
 .../store/selectors.ts}                            |  63 ++-
 .../transitionHooks/errorState.ts}                 |  15 +-
 .../frontend/app/configuration/types/index.ts      | 140 ++++++
 .../app/core/activities/Activities.data.d.ts       |  37 --
 .../{Activities.data.js => Activities.data.ts}     |  26 +-
 .../app/directives/bs-affix-update.directive.js    |  40 --
 .../app/directives/centered/centered.directive.js  |  26 --
 .../frontend/app/directives/centered/centered.scss |  37 --
 .../directives/restore-input-focus.directive.js    |  30 --
 .../ui-ace-docker/ui-ace-docker.controller.js      |  41 --
 .../ui-ace-docker/ui-ace-docker.directive.js       |  46 --
 .../app/directives/ui-ace-docker/ui-ace-docker.pug |  27 --
 .../ui-ace-pojos/ui-ace-pojos.controller.js        | 102 -----
 .../ui-ace-pojos/ui-ace-pojos.directive.js         |  46 --
 .../app/directives/ui-ace-pojos/ui-ace-pojos.pug   |  40 --
 .../directives/ui-ace-pom/ui-ace-pom.controller.js |  41 --
 .../directives/ui-ace-pom/ui-ace-pom.directive.js  |  41 --
 .../app/directives/ui-ace-pom/ui-ace-pom.pug       |  17 -
 .../ui-ace-sharp/ui-ace-sharp.controller.js        |  41 --
 .../ui-ace-sharp/ui-ace-sharp.directive.js         | 147 ------
 .../app/directives/ui-ace-sharp/ui-ace-sharp.pug   |  22 -
 .../frontend/app/helpers/jade/mixins.pug           | 384 ----------------
 .../frontend/app/services/JavaTypes.service.js     |  42 +-
 .../services/JavaTypes.spec.js}                    |  18 +-
 modules/web-console/frontend/app/services/index.js |   2 -
 .../web-console/frontend/app/store/reduxDebug.ts   |   2 +-
 .../reduxDevtoolsIntegration.js                    |   2 +-
 modules/web-console/frontend/app/types/index.ts    |   7 +
 modules/web-console/frontend/app/vendor.js         |   1 +
 modules/web-console/frontend/index.js              |   3 +-
 .../web-console/frontend/public/images/docker.png  | Bin 521 -> 0 bytes
 .../web-console/frontend/public/images/java.png    | Bin 170 -> 0 bytes
 modules/web-console/frontend/public/images/xml.png | Bin 232 -> 0 bytes
 .../frontend/public/stylesheets/style.scss         |   1 -
 modules/web-console/frontend/tsconfig.json         |   1 +
 335 files changed, 2243 insertions(+), 3272 deletions(-)

diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 9c45ce3,c53d0ec..e2f06a3
--- 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
@@@ -30,8 -30,8 +30,9 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.query.QueryUtils;
  import org.apache.ignite.internal.processors.query.h2.H2Cursor;
  import org.apache.ignite.internal.processors.query.h2.H2Utils;
 +import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModelMultiplier;
  import org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper;
+ import org.apache.ignite.internal.processors.query.h2.opt.join.DistributedJoinContext;
  import org.apache.ignite.internal.processors.query.h2.opt.join.DistributedLookupBatch;
  import org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
  import org.apache.ignite.internal.processors.query.h2.opt.join.RangeSource;
@@@ -228,14 -213,10 +214,10 @@@ public abstract class GridH2IndexBase e
          // Notice that we check for isJoinBatchEnabled, because we can do multiple different
          // optimization passes on PREPARE stage.
          // Query expressions can not be distributed as well.
-         if (qctx == null || qctx.type() != PREPARE || qctx.distributedJoinMode() == OFF ||
-             !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-             return CollocationModelMultiplier.COLLOCATED.multiplier();
+         SplitterContext ctx = SplitterContext.get();
  
-         // We have to clear this cache because normally sub-query plan cost does not depend on anything
-         // other than index condition masks and sort order, but in our case it can depend on order
-         // of previous table filters.
-         clearViewIndexCache(ses);
+         if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
 -            return CollocationModel.MULTIPLIER_COLLOCATED;
++            return CollocationModelMultiplier.COLLOCATED.multiplier();
  
          assert filters != null;
  
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index c3c2412,e5eea1d..efe413c
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@@ -771,4 -790,88 +794,17 @@@ public final class CollocationModel 
              "with custom AffinityKeyMapper configured. " +
              "Please use AffinityKeyMapped annotation instead [cache=" + cacheName + ']');
      }
+ 
+     /**
+      * @param ses Session.
+      */
+     private static void clearViewIndexCache(Session ses) {
+         // We have to clear this cache because normally sub-query plan cost does not depend on anything
+         // other than index condition masks and sort order, but in our case it can depend on order
+         // of previous table filters.
+         Map<Object,ViewIndex> viewIdxCache = ses.getViewIndexCache(true);
+ 
+         if (!viewIdxCache.isEmpty())
+             viewIdxCache.clear();
+     }
 -
 -    /**
 -     * Collocation type.
 -     */
 -    private enum Type {
 -        /** */
 -        PARTITIONED_COLLOCATED(true, true),
 -
 -        /** */
 -        PARTITIONED_NOT_COLLOCATED(true, false),
 -
 -        /** */
 -        REPLICATED(false, true);
 -
 -        /** */
 -        private final boolean partitioned;
 -
 -        /** */
 -        private final boolean collocated;
 -
 -        /**
 -         * @param partitioned Partitioned.
 -         * @param collocated Collocated.
 -         */
 -        Type(boolean partitioned, boolean collocated) {
 -            this.partitioned = partitioned;
 -            this.collocated = collocated;
 -        }
 -
 -        /**
 -         * @return {@code true} If partitioned.
 -         */
 -        public boolean isPartitioned() {
 -            return partitioned;
 -        }
 -
 -        /**
 -         * @return {@code true} If collocated.
 -         */
 -        public boolean isCollocated() {
 -            return collocated;
 -        }
 -
 -        /**
 -         * @param partitioned Partitioned.
 -         * @param collocated Collocated.
 -         * @return Type.
 -         */
 -        static Type of(boolean partitioned, boolean collocated) {
 -            if (collocated)
 -                return partitioned ? Type.PARTITIONED_COLLOCATED : Type.REPLICATED;
 -
 -            assert partitioned;
 -
 -            return Type.PARTITIONED_NOT_COLLOCATED;
 -        }
 -    }
 -
 -    /**
 -     * Affinity of a table relative to previous joined tables.
 -     */
 -    private enum Affinity {
 -        /** */
 -        NONE,
 -
 -        /** */
 -        HAS_AFFINITY_CONDITION,
 -
 -        /** */
 -        COLLOCATED_JOIN
 -    }
  }