# GG-10218 Added support for local query.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9ff80298 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9ff80298 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9ff80298 Branch: refs/heads/ignite-373 Commit: 9ff80298f395315027883ade7771730b6182477f Parents: 6d2a759 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed May 6 14:23:38 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed May 6 14:23:38 2015 +0700 ---------------------------------------------------------------------- .../ignite/internal/visor/query/VisorQueryArg.java | 14 +++++++++++++- .../ignite/internal/visor/query/VisorQueryJob.java | 2 ++ .../visor/commands/cache/VisorCacheScanCommand.scala | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java index becebda..5050414 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java @@ -32,17 +32,22 @@ public class VisorQueryArg implements Serializable { /** Query text. */ private final String qryTxt; + /** Flag whether to execute query locally. */ + private final boolean local; + /** Result batch size. */ private final int pageSize; /** * @param cacheName Cache name for query. * @param qryTxt Query text. + * @param local Flag whether to execute query locally. * @param pageSize Result batch size. */ - public VisorQueryArg(String cacheName, String qryTxt, int pageSize) { + public VisorQueryArg(String cacheName, String qryTxt, boolean local, int pageSize) { this.cacheName = cacheName; this.qryTxt = qryTxt; + this.local = local; this.pageSize = pageSize; } @@ -61,6 +66,13 @@ public class VisorQueryArg implements Serializable { } /** + * @return {@code true} if query should be executed locally. + */ + public boolean local() { + return local; + } + + /** * @return Page size. */ public int pageSize() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java index ebf62fa..4a9daad 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java @@ -75,6 +75,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten if (scan) { ScanQuery<Object, Object> qry = new ScanQuery<>(null); qry.setPageSize(arg.pageSize()); + qry.setLocal(arg.local()); long start = U.currentTimeMillis(); @@ -100,6 +101,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten else { SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryTxt()); qry.setPageSize(arg.pageSize()); + qry.setLocal(arg.local()); long start = U.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala index d40ec8d..4b66720 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala @@ -139,7 +139,7 @@ class VisorCacheScanCommand { val firstPage = try executeRandom(groupForDataNode(node, cacheName), - classOf[VisorQueryTask], new VisorQueryArg(cacheName, "SCAN", pageSize)) match { + classOf[VisorQueryTask], new VisorQueryArg(cacheName, "SCAN", false, pageSize)) match { case x if x.get1() != null => error(x.get1())