ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [18/50] [abbrv] ignite git commit: Merge remote-tracking branch 'apache/ignite-1.9' into ignite-4106-1.9
Date Wed, 01 Mar 2017 14:33:01 GMT
Merge remote-tracking branch 'apache/ignite-1.9' into ignite-4106-1.9

# Conflicts:
#	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
#	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/twostep/GridMapQueryExecutor.java
#	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
#	modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
#	modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java


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

Branch: refs/heads/master
Commit: 5b774f6d9dc7faa60a95b1206d30115b0ef67d16
Parents: f684c00 166e65c
Author: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Authored: Tue Feb 21 12:10:38 2017 +0300
Committer: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Committed: Tue Feb 21 12:10:38 2017 +0300

----------------------------------------------------------------------
 .../examples/java8/spark/SharedRDDExample.java  |    4 +-
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |   49 +-
 .../jdbc2/JdbcInsertStatementSelfTest.java      |   51 +
 .../jdbc2/JdbcMergeStatementSelfTest.java       |   51 +
 .../internal/jdbc2/JdbcStreamingSelfTest.java   |  189 ++
 .../jdbc2/JdbcUpdateStatementSelfTest.java      |   50 +
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java   |    1 +
 .../org/apache/ignite/IgniteJdbcDriver.java     |   30 +
 .../apache/ignite/IgniteSystemProperties.java   |    6 +
 .../ignite/internal/jdbc2/JdbcConnection.java   |   72 +-
 .../internal/jdbc2/JdbcPreparedStatement.java   |   34 +-
 .../ignite/internal/jdbc2/JdbcStatement.java    |   20 +-
 .../jdbc2/JdbcStreamedPreparedStatement.java    |   59 +
 .../cache/query/GridCacheSqlQuery.java          |   45 +-
 .../processors/query/GridQueryIndexing.java     |   35 +
 .../processors/query/GridQueryProcessor.java    |   63 +-
 .../visor/cache/VisorCacheClearTask.java        |   88 +-
 .../visor/compute/VisorGatewayTask.java         |   30 +-
 .../junits/multijvm/IgniteProcessProxy.java     |    5 +-
 .../query/h2/DmlStatementsProcessor.java        |  267 ++-
 .../processors/query/h2/IgniteH2Indexing.java   |  160 +-
 .../query/h2/dml/UpdatePlanBuilder.java         |    2 +-
 .../query/h2/opt/GridH2CollocationModel.java    |   78 +-
 .../query/h2/opt/GridH2IndexBase.java           |   47 +-
 .../processors/query/h2/sql/DmlAstUtils.java    |   46 +-
 .../processors/query/h2/sql/GridSqlAlias.java   |   13 +-
 .../processors/query/h2/sql/GridSqlArray.java   |    8 +-
 .../processors/query/h2/sql/GridSqlAst.java     |   61 +
 .../processors/query/h2/sql/GridSqlColumn.java  |   85 +-
 .../processors/query/h2/sql/GridSqlConst.java   |    6 +-
 .../processors/query/h2/sql/GridSqlElement.java |   43 +-
 .../query/h2/sql/GridSqlFunction.java           |   16 +-
 .../processors/query/h2/sql/GridSqlJoin.java    |   35 +-
 .../processors/query/h2/sql/GridSqlKeyword.java |    3 +-
 .../query/h2/sql/GridSqlOperation.java          |    6 +-
 .../query/h2/sql/GridSqlOperationType.java      |    4 +-
 .../query/h2/sql/GridSqlParameter.java          |    4 +-
 .../query/h2/sql/GridSqlPlaceholder.java        |    2 +-
 .../processors/query/h2/sql/GridSqlQuery.java   |   80 +-
 .../query/h2/sql/GridSqlQueryParser.java        |  228 ++-
 .../query/h2/sql/GridSqlQuerySplitter.java      | 1634 +++++++++++++++---
 .../processors/query/h2/sql/GridSqlSelect.java  |  121 +-
 .../query/h2/sql/GridSqlStatement.java          |    6 +-
 .../query/h2/sql/GridSqlSubquery.java           |   31 +-
 .../processors/query/h2/sql/GridSqlTable.java   |   19 +-
 .../processors/query/h2/sql/GridSqlType.java    |    6 +-
 .../processors/query/h2/sql/GridSqlUnion.java   |   66 +-
 .../processors/query/h2/sql/GridSqlValue.java   |   25 -
 .../query/h2/twostep/GridMapQueryExecutor.java  |    6 +-
 .../query/h2/twostep/GridMergeIndex.java        |  418 ++++-
 .../query/h2/twostep/GridMergeIndexSorted.java  |  284 +++
 .../h2/twostep/GridMergeIndexUnsorted.java      |   40 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |   56 +-
 .../h2/twostep/msg/GridH2QueryRequest.java      |    9 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |    2 +-
 ...niteCacheAbstractInsertSqlQuerySelfTest.java |    6 +-
 .../IgniteCacheInsertSqlQuerySelfTest.java      |   14 +
 .../query/IgniteSqlSplitterSelfTest.java        |  100 +-
 .../query/h2/sql/GridQueryParsingTest.java      |   41 +-
 modules/spark-2.10/pom.xml                      |   54 +
 modules/spark/pom.xml                           |  183 +-
 .../org/apache/ignite/spark/IgniteContext.scala |   22 +-
 .../spark/JavaEmbeddedIgniteRDDSelfTest.java    |   10 +-
 .../spark/JavaStandaloneIgniteRDDSelfTest.java  |   22 +-
 .../web-console/backend/services/activities.js  |    7 +-
 .../list-of-registered-users.controller.js      |   14 +-
 .../configuration/configuration.module.js       |    6 +-
 .../configuration/summary/summary.worker.js     |   28 +-
 .../console/agent/handlers/RestListener.java    |    9 +-
 modules/yardstick/DEVNOTES-standalone.txt       |    5 +-
 modules/yardstick/README.txt                    |   85 +-
 .../config/benchmark-atomic-win.properties      |    2 +-
 .../config/benchmark-atomic.properties          |   35 +-
 .../config/benchmark-bin-identity.properties    |   16 +-
 .../config/benchmark-cache-load-win.properties  |    2 +-
 .../config/benchmark-cache-load.properties      |    4 +-
 .../config/benchmark-client-mode.properties     |   68 +-
 .../config/benchmark-compute-win.properties     |    2 +-
 .../config/benchmark-compute.properties         |   30 +-
 .../config/benchmark-failover.properties        |    2 +-
 .../yardstick/config/benchmark-full.properties  |   62 +-
 .../config/benchmark-multicast.properties       |  107 +-
 .../config/benchmark-put-indexed-val.properties |   23 +-
 .../benchmark-query-put-separated.properties    |    3 +-
 .../config/benchmark-query-win.properties       |    2 +-
 .../yardstick/config/benchmark-query.properties |   33 +-
 .../config/benchmark-remote-sample.properties   |   80 +
 .../config/benchmark-remote.properties          |  119 ++
 .../config/benchmark-sample.properties          |   22 +-
 .../config/benchmark-sql-dml.properties         |   36 +-
 .../yardstick/config/benchmark-store.properties |    3 +-
 .../config/benchmark-tx-win.properties          |    2 +-
 .../yardstick/config/benchmark-tx.properties    |   33 +-
 .../yardstick/config/benchmark-win.properties   |    2 +-
 modules/yardstick/config/benchmark.properties   |   76 +-
 .../yardstick/config/ignite-remote-config.xml   |   47 +
 .../test-max-int-values-offheap.properties      |    3 +-
 .../test-max-int-values-onheap.properties       |    3 +-
 .../config/test-max-int-values-swap.properties  |    3 +-
 modules/yardstick/pom-standalone.xml            |    2 +-
 modules/yardstick/pom.xml                       |    2 +-
 parent/pom.xml                                  |    3 +-
 pom.xml                                         |    5 +-
 103 files changed, 4874 insertions(+), 1363 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 37f0ade,2abb3a9..5d2b728
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@@ -84,26 -85,48 +85,39 @@@ public interface GridQueryIndexing 
      /**
       * Queries individual fields (generally used by JDBC drivers).
       *
 -     * @param spaceName Space name.
 +     * @param cctx Cache context.
       * @param qry Query.
 -     * @param params Query parameters.
       * @param filter Space name and key filter.
 -     * @param enforceJoinOrder Enforce join order of tables in the query.
 -     * @param timeout Query timeout in milliseconds.
       * @param cancel Query cancel.
 -     * @return Query result.
 -     * @throws IgniteCheckedException If failed.
 +     * @return Cursor.
       */
 -    public GridQueryFieldsResult queryLocalSqlFields(@Nullable String spaceName, String
qry,
 -        Collection<Object> params, IndexingQueryFilter filter, boolean enforceJoinOrder,
int timeout,
 -        GridQueryCancel cancel) throws IgniteCheckedException;
 +    public <K, V> QueryCursor<List<?>> queryLocalSqlFields(GridCacheContext<?,
?> cctx, SqlFieldsQuery qry,
 +        IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException;
  
      /**
+      * Perform a MERGE statement using data streamer as receiver.
+      *
+      * @param spaceName Space name.
+      * @param qry Query.
+      * @param params Query parameters.
+      * @param streamer Data streamer to feed data to.
+      * @return Query result.
+      * @throws IgniteCheckedException If failed.
+      */
+     public long streamUpdateQuery(@Nullable final String spaceName, final String qry,
+          @Nullable final Object[] params, IgniteDataStreamer<?, ?> streamer) throws
IgniteCheckedException;
+ 
+     /**
       * Executes regular query.
       *
 -     * @param spaceName Space name.
 +     * @param cctx Cache context.
       * @param qry Query.
 -     * @param alias Table alias used in Query.
 -     * @param params Query parameters.
 -     * @param type Query return type.
       * @param filter Space name and key filter.
 -     * @return Queried rows.
 -     * @throws IgniteCheckedException If failed.
 +     * @param keepBinary Keep binary flag.
 +     * @return Cursor.
       */
 -    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalSql(@Nullable
String spaceName, String qry,
 -        String alias, Collection<Object> params, GridQueryTypeDescriptor type, IndexingQueryFilter
filter)
 -        throws IgniteCheckedException;
 +    public <K, V> QueryCursor<Cache.Entry<K,V>> queryLocalSql(GridCacheContext<?,
?> cctx, SqlQuery qry,
 +        IndexingQueryFilter filter, boolean keepBinary) throws IgniteCheckedException;
  
      /**
       * Executes text query.

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index de48eb9,15e7fc6..057fd10
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -93,8 -91,8 +94,9 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.query.GridQueryIndexing;
  import org.apache.ignite.internal.processors.query.GridQueryProperty;
  import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.IgniteSQLException;
 +import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2DefaultTableEngine;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOffheap;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap;
@@@ -1352,9 -1281,7 +1400,9 @@@ public class IgniteH2Indexing implement
          final boolean distributedJoins = qry.isDistributedJoins() && cctx.isPartitioned();
          final boolean grpByCollocated = qry.isCollocated();
  
 +        final DistributedJoinMode distributedJoinMode = distributedJoinMode(qry.isLocal(),
distributedJoins);
 +
-         GridCacheTwoStepQuery twoStepQry;
+         GridCacheTwoStepQuery twoStepQry = null;
          List<GridQueryFieldMetadata> meta;
  
          final TwoStepCachedQueryKey cachedQryKey = new TwoStepCachedQueryKey(space, sqlQry,
grpByCollocated,
@@@ -1368,12 -1295,13 +1416,13 @@@
          else {
              final UUID locNodeId = ctx.localNodeId();
  
-             setupConnection(c, distributedJoins, enforceJoinOrder);
+             // Here we will just parse the statement, no need to optimize it at all.
+             setupConnection(c, /*distributedJoins*/false, /*enforceJoinOrder*/true);
  
              GridH2QueryContext.set(new GridH2QueryContext(locNodeId, locNodeId, 0, PREPARE)
 -                .distributedJoins(distributedJoins));
 +                .distributedJoinMode(distributedJoinMode));
  
-             PreparedStatement stmt;
+             PreparedStatement stmt = null;
  
              boolean cachesCreated = false;
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 89d661d,bdfddd5..31057c7
--- 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
@@@ -262,14 -245,15 +262,15 @@@ public abstract class GridH2IndexBase e
       * @param filter Current filter.
       * @return Multiplier.
       */
-     public int getDistributedMultiplier(Session ses, TableFilter[] filters, int filter)
{
+     public final int getDistributedMultiplier(Session ses, TableFilter[] filters, int filter)
{
          GridH2QueryContext qctx = GridH2QueryContext.get();
  
-         // We do complex optimizations with respect to distributed joins only on prepare
stage
-         // because on run stage reordering of joined tables by Optimizer is explicitly disabled
-         // and thus multiplier will be always the same, so it will not affect choice of
index.
+         // We do optimizations with respect to distributed joins only on PREPARE stage only.
+         // 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.isPreparingQueryExpression())
 -        if (qctx == null || qctx.type() != PREPARE || !qctx.distributedJoins() ||
++        if (qctx == null || qctx.type() != PREPARE || qctx.distributedJoinMode() == OFF
||
+             !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
              return GridH2CollocationModel.MULTIPLIER_COLLOCATED;
  
          // We have to clear this cache because normally sub-query plan cost does not depend
on anything
@@@ -391,18 -375,16 +392,18 @@@
          if (affCol != null) {
              affColId = affCol.column.getColumnId();
              int[] masks = filter.getMasks();
-             ucast = masks != null && masks[affColId] == IndexCondition.EQUALITY;
-         }
-         else {
-             affColId = -1;
-             ucast = false;
+ 
+             if (masks != null) {
+                 ucast = (masks[affColId] & IndexCondition.EQUALITY) != 0 ||
+                     (masks[KEY_COL] & IndexCondition.EQUALITY) != 0;
+             }
          }
  
 -        GridCacheContext<?,?> cctx = getTable().rowDescriptor().context();
 +        GridCacheContext<?, ?> cctx = getTable().rowDescriptor().context();
  
 -        return new DistributedLookupBatch(cctx, ucast, affColId);
 +        boolean isLocal = qctx.distributedJoinMode() == LOCAL_ONLY;
 +
 +        return new DistributedLookupBatch(cctx, ucast, affColId, isLocal);
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 5027c9a,b0fa639..72a34a6
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@@ -86,8 -84,7 +86,9 @@@ import static org.apache.ignite.events.
  import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ;
  import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
  import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
+ import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.setupConnection;
 +import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.OFF;
 +import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.distributedJoinMode;
  import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.MAP;
  import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.REPLICATED;
  import static org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.QUERY_POOL;
@@@ -433,7 -435,8 +434,8 @@@ public class GridMapQueryExecutor 
              req.partitions(),
              null,
              req.pageSize(),
 -            false,
 +            OFF,
+             true,
              req.timeout());
      }
  
@@@ -491,7 -457,8 +493,8 @@@
              parts,
              req.tables(),
              req.pageSize(),
 -            req.isFlagSet(GridH2QueryRequest.FLAG_DISTRIBUTED_JOINS),
 +            joinMode,
+             req.isFlagSet(GridH2QueryRequest.FLAG_ENFORCE_JOIN_ORDER),
              req.timeout());
      }
  
@@@ -519,7 -484,8 +522,8 @@@
          int[] parts,
          Collection<String> tbls,
          int pageSize,
 -        boolean distributedJoins,
 +        DistributedJoinMode distributedJoinMode,
+         boolean enforceJoinOrder,
          int timeout
      ) {
          // Prepare to run queries.
@@@ -580,8 -545,7 +584,8 @@@
  
              Connection conn = h2.connectionForSpace(mainCctx.name());
  
 -            setupConnection(conn, distributedJoins, enforceJoinOrder);
 +            // Here we enforce join order to have the same behavior on all the nodes.
-             h2.setupConnection(conn, distributedJoinMode != OFF, true);
++            h2.setupConnection(conn, distributedJoinMode != OFF, enforceJoinOrder);
  
              GridH2QueryContext.set(qctx);
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 8837046,f813cae..3cfaae9
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@@ -62,12 -62,11 +62,11 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
  import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
  import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
 -import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
  import org.apache.ignite.internal.processors.query.GridQueryCancel;
 +import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
- import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
  import org.apache.ignite.internal.processors.query.h2.sql.GridSqlType;
  import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
  import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
@@@ -100,8 -99,9 +99,10 @@@ import org.jsr166.ConcurrentHashMap8
  
  import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
  import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
+ import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.setupConnection;
 +import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.OFF;
  import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.REDUCE;
+ import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.mergeTableIdentifier;
  
  /**
   * Reduce query executor.
@@@ -616,6 -610,12 +618,15 @@@ public class GridReduceQueryExecutor 
                  if (oldStyle && distributedJoins)
                      throw new CacheException("Failed to enable distributed joins. Topology
contains older data nodes.");
  
+                 // Always enforce join order on map side to have consistent behavior.
+                 int flags = GridH2QueryRequest.FLAG_ENFORCE_JOIN_ORDER;
+ 
+                 if (distributedJoins)
+                     flags |= GridH2QueryRequest.FLAG_DISTRIBUTED_JOINS;
+ 
++                if(qry.isLocal())
++                    flags |= GridH2QueryRequest.FLAG_IS_LOCAL;
++
                  if (send(nodes,
                      oldStyle ?
                          new GridQueryRequest(qryReqId,
@@@ -634,13 -634,14 +645,12 @@@
                              .tables(distributedJoins ? qry.tables() : null)
                              .partitions(convert(partsMap))
                              .queries(mapQrys)
-                             .flags((qry.isLocal() ? GridH2QueryRequest.FLAG_IS_LOCAL : 0)
|
-                                 (distributedJoins ? GridH2QueryRequest.FLAG_DISTRIBUTED_JOINS
: 0))
+                             .flags(flags)
                              .timeout(timeoutMillis),
                      oldStyle && partsMap != null ? new ExplicitPartitionsSpecializer(partsMap)
: null,
 -                    distributedJoins)
 -                    ) {
 -                    awaitAllReplies(r, nodes);
 +                    false)) {
  
 -                    cancel.checkCancelled();
 +                    awaitAllReplies(r, nodes, cancel);
  
                      Object state = r.state.get();
  
@@@ -700,10 -700,10 +709,10 @@@
  
                          UUID locNodeId = ctx.localNodeId();
  
-                         h2.setupConnection(r.conn, false, enforceJoinOrder);
+                         setupConnection(r.conn, false, enforceJoinOrder);
  
                          GridH2QueryContext.set(new GridH2QueryContext(locNodeId, locNodeId,
qryReqId, REDUCE)
 -                            .pageSize(r.pageSize).distributedJoins(false));
 +                            .pageSize(r.pageSize).distributedJoinMode(OFF));
  
                          try {
                              if (qry.explain())

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index ec49aff,e5dbf33..0ad534c
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@@ -51,10 -51,10 +51,15 @@@ public class GridH2QueryRequest impleme
      public static int FLAG_DISTRIBUTED_JOINS = 1;
  
      /**
+      * Remote map query executor will enforce join order for the received map queries.
+      */
+     public static int FLAG_ENFORCE_JOIN_ORDER = 1 << 1;
+ 
++    /**
 +     * Restrict distributed joins range-requests to local index segments. Range requests
to other nodes will not be sent.
 +     */
-     public static int FLAG_IS_LOCAL = 2;
++    public static int FLAG_IS_LOCAL = 1 << 2;
 +
      /** */
      private long reqId;
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b774f6d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 4ae2f91,432ed34..37dea47
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@@ -34,9 -34,8 +34,10 @@@ import org.apache.ignite.cache.CacheKey
  import org.apache.ignite.cache.CacheMode;
  import org.apache.ignite.cache.CachePeekMode;
  import org.apache.ignite.cache.affinity.Affinity;
+ import org.apache.ignite.cache.affinity.AffinityKeyMapped;
  import org.apache.ignite.cache.query.QueryCursor;
 +import org.apache.ignite.cache.affinity.AffinityKeyMapped;
 +import org.apache.ignite.cache.query.QueryCursor;
  import org.apache.ignite.cache.query.SqlFieldsQuery;
  import org.apache.ignite.cache.query.annotations.QuerySqlField;
  import org.apache.ignite.cluster.ClusterNode;


Mime
View raw message