http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java index 5854ac0..37ed59b 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java @@ -42,6 +42,9 @@ public class GridSqlFunction extends GridSqlElement { } /** */ + private final String schema; + + /** */ private final String name; /** */ @@ -54,29 +57,32 @@ public class GridSqlFunction extends GridSqlElement { * @param type Function type. */ public GridSqlFunction(GridSqlFunctionType type) { - this(type, type.functionName()); + this(null, type, type.functionName()); } /** + * @param schema Schema. * @param type Type. * @param name Name. */ - private GridSqlFunction(GridSqlFunctionType type, String name) { + private GridSqlFunction(String schema, GridSqlFunctionType type, String name) { if (name == null) throw new NullPointerException(); if (type == null) type = UNKNOWN_FUNCTION; + this.schema = schema; this.name = name; this.type = type; } /** + * @param schema Schema. * @param name Name. */ - public GridSqlFunction(String name) { - this(TYPE_MAP.get(name), name); + public GridSqlFunction(String schema, String name) { + this(schema, TYPE_MAP.get(name), name); } /** @@ -91,7 +97,12 @@ public class GridSqlFunction extends GridSqlElement { /** {@inheritDoc} */ @Override public String getSQL() { - StatementBuilder buff = new StatementBuilder(Parser.quoteIdentifier(name)); + StatementBuilder buff = new StatementBuilder(); + + if (schema != null) + buff.append(Parser.quoteIdentifier(schema)).append('.'); + + buff.append(Parser.quoteIdentifier(name)); if (type == CASE) { if (!children.isEmpty())
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunctionType.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunctionType.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunctionType.java index f3cee7e..ac14abd 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunctionType.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunctionType.java @@ -58,6 +58,9 @@ public enum GridSqlFunctionType { /** */ EXTRACT, + /** */ + SYSTEM_RANGE, + /** Constant for all other functions. */ UNKNOWN_FUNCTION; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java index f02822b..fbb75d4 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java @@ -147,6 +147,9 @@ public class GridSqlQueryParser { private static final Getter<FunctionTable, Expression> FUNC_EXPR = getter(FunctionTable.class, "functionExpr"); /** */ + private static final Getter<JavaFunction, FunctionAlias> FUNC_ALIAS = getter(JavaFunction.class, "functionAlias"); + + /** */ private final IdentityHashMap<Object, Object> h2ObjToGridObj = new IdentityHashMap<>(); /** @@ -182,7 +185,7 @@ public class GridSqlQueryParser { res = parseExpression(FUNC_EXPR.get((FunctionTable)tbl)); } else if (tbl instanceof RangeTable) { - res = new GridSqlFunction("SYSTEM_RANGE"); + res = new GridSqlFunction(GridSqlFunctionType.SYSTEM_RANGE); res.addChild(parseExpression(RANGE_MIN.get((RangeTable)tbl))); res.addChild(parseExpression(RANGE_MAX.get((RangeTable)tbl))); @@ -441,7 +444,7 @@ public class GridSqlQueryParser { if (expression instanceof Function) { Function f = (Function)expression; - GridSqlFunction res = new GridSqlFunction(f.getName()); + GridSqlFunction res = new GridSqlFunction(null, f.getName()); for (Expression arg : f.getArgs()) res.addChild(parseExpression(arg)); @@ -456,7 +459,9 @@ public class GridSqlQueryParser { if (expression instanceof JavaFunction) { JavaFunction f = (JavaFunction)expression; - GridSqlFunction res = new GridSqlFunction(f.getName()); + FunctionAlias alias = FUNC_ALIAS.get(f); + + GridSqlFunction res = new GridSqlFunction(alias.getSchema().getName(), f.getName()); for (Expression arg : f.getArgs()) res.addChild(parseExpression(arg)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java ---------------------------------------------------------------------- diff --git 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 index 3bb5320..24918da 100644 --- 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 @@ -146,8 +146,10 @@ public class GridMapQueryExecutor { // Run queries. int i = 0; + String space = req.space(); + for (GridCacheSqlQuery qry : req.queries()) { - ResultSet rs = h2.executeSqlQueryWithTimer(h2.connectionForSpace(null), qry.query(), + ResultSet rs = h2.executeSqlQueryWithTimer(space, h2.connectionForSpace(space), qry.query(), F.asList(qry.parameters())); assert rs instanceof JdbcResultSet : rs.getClass(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java ---------------------------------------------------------------------- diff --git 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 index 149faba..4e93f17 100644 --- 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 @@ -186,7 +186,7 @@ public class GridReduceQueryExecutor { runs.put(qryReqId, r); try { - ctx.io().sendUserMessage(nodes, new GridQueryRequest(qryReqId, 1000, qry.mapQueries()), // TODO conf page size + ctx.io().sendUserMessage(nodes, new GridQueryRequest(qryReqId, 1000, space, qry.mapQueries()), // TODO conf page size GridTopic.TOPIC_QUERY, false, 0); r.latch.await(); @@ -196,7 +196,7 @@ public class GridReduceQueryExecutor { GridCacheSqlQuery rdc = qry.reduceQuery(); - final ResultSet res = h2.executeSqlQueryWithTimer(r.conn, rdc.query(), F.asList(rdc.parameters())); + final ResultSet res = h2.executeSqlQueryWithTimer(space, r.conn, rdc.query(), F.asList(rdc.parameters())); for (GridMergeTable tbl : r.tbls) dropTable(r.conn, tbl.getName()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java index 6c70ddc..2834b84 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java @@ -38,17 +38,22 @@ public class GridQueryRequest implements Serializable { private int pageSize; /** */ + private String space; + + /** */ @GridToStringInclude private Collection<GridCacheSqlQuery> qrys; /** * @param reqId Request ID. * @param pageSize Page size. + * @param space Space. * @param qrys Queries. */ - public GridQueryRequest(long reqId, int pageSize, Collection<GridCacheSqlQuery> qrys) { + public GridQueryRequest(long reqId, int pageSize, String space, Collection<GridCacheSqlQuery> qrys) { this.reqId = reqId; this.pageSize = pageSize; + this.space = space; assert qrys instanceof Serializable; @@ -70,6 +75,13 @@ public class GridQueryRequest implements Serializable { } /** + * @return Space. + */ + public String space() { + return space; + } + + /** * @return Queries. */ public Collection<GridCacheSqlQuery> queries() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java index 37b5c08..6c61531 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java @@ -95,14 +95,6 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs cache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cache.setPreloadMode(SYNC); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - qcfg.setIndexPrimitiveValue(true); - qcfg.setIndexFixedTyping(true); - - cache.setQueryConfiguration(qcfg); - if (cacheMode() == PARTITIONED) cache.setBackups(1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java index 160bdd6..1bdcabd 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java @@ -135,13 +135,6 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest { cacheCfg.setEvictionPolicy(null); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - qcfg.setIndexPrimitiveValue(true); - - cacheCfg.setQueryConfiguration(qcfg); - cfg.setCacheConfiguration(cacheCfg); cfg.setDeploymentMode(SHARED); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryMetricsSelfTest.java index 82f200c..0ce77f9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryMetricsSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryMetricsSelfTest.java @@ -69,12 +69,6 @@ public class GridCacheQueryMetricsSelfTest extends GridCommonAbstractTest { cacheCfg.setCacheMode(CACHE_MODE); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - - cacheCfg.setQueryConfiguration(qcfg); - cfg.setCacheConfiguration(cacheCfg); return cfg; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java index f31b52b..8c71f2e 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java @@ -68,12 +68,6 @@ public class GridCacheReduceQueryMultithreadedSelfTest extends GridCacheAbstract cfg.setBackups(1); cfg.setWriteSynchronizationMode(FULL_SYNC); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - - cfg.setQueryConfiguration(qcfg); - return cfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java index ba1e519..3778af3 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java @@ -70,12 +70,6 @@ public class GridIndexingWithNoopSwapSelfTest extends GridCommonAbstractTest { cc.setBackups(1); cc.setAtomicityMode(TRANSACTIONAL); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - - cc.setQueryConfiguration(qcfg); - c.setCacheConfiguration(cc); return c; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java index 69cc62e..d2cf52f 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java @@ -96,14 +96,6 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA cache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cache.setPreloadMode(SYNC); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(primitives); - qcfg.setIndexPrimitiveValue(primitives); - qcfg.setIndexFixedTyping(true); - - cache.setQueryConfiguration(qcfg); - if (cacheMode() == PARTITIONED) cache.setBackups(1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java index aafca83..a9a9883 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java @@ -106,12 +106,6 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac c.setDiscoverySpi(disco); - QueryConfiguration idxCfg = new QueryConfiguration(); - - idxCfg.setIndexCustomFunctionClasses(SqlFunctions.class); - - c.setQueryConfiguration(idxCfg); - // Otherwise noop swap space will be chosen on Windows. c.setSwapSpaceSpi(new FileSwapSpaceSpi()); @@ -136,13 +130,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cc.setPreloadMode(SYNC); cc.setSwapEnabled(true); cc.setEvictNearSynchronized(false); - - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - qcfg.setIndexFixedTyping(true); - - cc.setQueryConfiguration(qcfg); + cc.setSqlFunctionClasses(SqlFunctions.class); // Explicitly set number of backups equal to number of grids. if (cacheMode() == CacheMode.PARTITIONED) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java index 30ff110..f3cbf96 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java @@ -22,7 +22,6 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.eviction.lru.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; -import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.query.*; @@ -95,27 +94,13 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes cacheCfg.setSwapEnabled(true); cacheCfg.setBackups(1); cacheCfg.setEvictionPolicy(evictsEnabled() ? new CacheLruEvictionPolicy(100) : null); - - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - - cacheCfg.setQueryConfiguration(qcfg); + cacheCfg.setSqlOnheapRowCacheSize(128); if (offheapEnabled() && evictsEnabled()) cacheCfg.setOffHeapMaxMemory(1000); // Small offheap for evictions. cfg.setCacheConfiguration(cacheCfg); - QueryConfiguration indexing = new QueryConfiguration(); - - indexing.setMaxOffheapRowsCacheSize(128); - - if (offheapEnabled()) - indexing.setMaxOffHeapMemory(0); - - cfg.setQueryConfiguration(indexing); - GridQueryProcessor.idxCls = FakeIndexing.class; return cfg; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java index a2afa48..3956a82 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java @@ -17,14 +17,13 @@ package org.apache.ignite.internal.processors.cache.distributed.near; -import org.apache.ignite.cache.query.*; import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -82,12 +81,6 @@ public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTe cc.setAtomicityMode(TRANSACTIONAL); cc.setDistributionMode(NEAR_PARTITIONED); - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - - cc.setQueryConfiguration(qcfg); - c.setCacheConfiguration(cc); return c; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingOffheapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingOffheapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingOffheapSelfTest.java index 05d6b03..da1664b 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingOffheapSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingOffheapSelfTest.java @@ -21,24 +21,8 @@ package org.apache.ignite.internal.processors.query.h2; * Tests for H2 indexing SPI. */ public class GridH2IndexingOffheapSelfTest extends GridIndexingSpiAbstractSelfTest { - /** */ - private static final long offheap = 10000000; - - private static IgniteH2Indexing currentSpi; - - /** {@inheritDoc} */ - @Override protected void startIndexing(IgniteH2Indexing spi) throws Exception { - spi.configuration().setMaxOffHeapMemory(offheap); - - currentSpi = spi; - - super.startIndexing(spi); - } - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - assertEquals(0, currentSpi.getAllocatedOffHeapMemory()); + @Override protected boolean offheap() { + return true; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java index 97efc94..438cd10 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.query.h2; import org.apache.ignite.*; +import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -81,12 +82,20 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract /** {@inheritDoc} */ protected void startIndexing(IgniteH2Indexing spi) throws Exception { - spi.registerSpace("A"); - spi.registerSpace("B"); + spi.registerCache(cacheCfg("A")); + spi.registerCache(cacheCfg("B")); spi.start(null); } + private CacheConfiguration cacheCfg(String name) { + CacheConfiguration cfg = new CacheConfiguration<Object,Object>(); + + cfg.setName(name); + + return cfg; + } + @Override protected void afterTest() throws Exception { idx.stop(); @@ -155,6 +164,10 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract return idx; } + protected boolean offheap() { + return false; + } + /** * @throws Exception If failed. */ @@ -310,7 +323,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract assertEquals(2, spi.size(typeAB.space(), typeAB, null)); assertEquals(0, spi.size(typeBA.space(), typeBA, null)); - boolean h2IdxOffheap = spi.configuration().getMaxOffHeapMemory() > 0; + boolean h2IdxOffheap = offheap(); // At the time of this writing index rebuilding is not supported for GridH2Indexing with off-heap storage. if (!h2IdxOffheap) { @@ -356,15 +369,12 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract public void testLongQueries() throws Exception { IgniteH2Indexing spi = getIndexing(); - long longQryExecTime = 100; + long longQryExecTime = CacheConfiguration.DFLT_LONG_QRY_WARN_TIMEOUT; GridStringLogger log = new GridStringLogger(false, this.log); IgniteLogger oldLog = GridTestUtils.getFieldValue(spi, "log"); - spi.configuration().setLongQueryExecutionTimeout(longQryExecTime); - spi.configuration().setLongQueryExplain(true); - try { GridTestUtils.setFieldValue(spi, "log", log); @@ -394,7 +404,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract } finally { GridTestUtils.setFieldValue(spi, "log", oldLog); - spi.configuration().setLongQueryExecutionTimeout(3000); } } @@ -410,43 +419,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract } /** - * Test long queries write explain warnings into log. - * - * @throws Exception If failed. - */ - public void testZeroLongQuery() throws Exception { - IgniteH2Indexing spi = getIndexing(); - - long longQryExecTime = -1; - - GridStringLogger log = new GridStringLogger(false, this.log); - - IgniteLogger oldLog = GridTestUtils.getFieldValue(spi, "log"); - spi.configuration().setLongQueryExecutionTimeout(longQryExecTime); - spi.configuration().setLongQueryExplain(true); - - try { - GridTestUtils.setFieldValue(spi, "log", log); - - String sql = "SELECT * FROM MyNonExistingTable"; - - GridQueryFieldsResult res = spi.queryFields(null, sql, Collections.emptyList(), null); - - assertFalse(res.iterator().hasNext()); - - String logStr = log.toString(); - - F.println(logStr); - - assertTrue(logStr.contains("Failed to explain plan because required table does not exist")); - } - finally { - GridTestUtils.setFieldValue(spi, "log", oldLog); - spi.configuration().setLongQueryExecutionTimeout(3000); - } - } - - /** * Index descriptor. */ private static class TextIndex implements GridQueryIndexDescriptor { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java index 5f97c86..7748d6c 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java @@ -20,8 +20,6 @@ package org.apache.ignite.internal.processors.query.h2.sql; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.query.annotations.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.query.*; @@ -65,12 +63,6 @@ public class GridQueryParsingTest extends GridCommonAbstractTest { c.setDiscoverySpi(disco); - QueryConfiguration idxCfg = new QueryConfiguration(); - - idxCfg.setIndexCustomFunctionClasses(GridQueryParsingTest.class); - - c.setQueryConfiguration(idxCfg); - c.setMarshaller(new OptimizedMarshaller(true)); // Cache. @@ -82,13 +74,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest { cc.setWriteSynchronizationMode(FULL_SYNC); cc.setPreloadMode(SYNC); cc.setSwapEnabled(false); - - CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); - - qcfg.setIndexPrimitiveKey(true); - qcfg.setIndexFixedTyping(true); - - cc.setQueryConfiguration(qcfg); + cc.setSqlFunctionClasses(GridQueryParsingTest.class); c.setCacheConfiguration(cc); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8bc23403/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala index 94e9374..d32407a 100644 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala +++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala @@ -52,13 +52,6 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) { cfg.setName(name) cfg.setQueryIndexEnabled(true) - val qc = new CacheQueryConfiguration() - - qc.setIndexPrimitiveKey(true) - qc.setIndexFixedTyping(true) - - cfg.setQueryConfiguration(qc) - cfg }