ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [12/17] incubator-ignite git commit: ignite-qry - merged
Date Wed, 10 Dec 2014 15:59:21 GMT
ignite-qry - merged


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

Branch: refs/heads/master
Commit: 922a2bab07206f930cab3eb4d930425757bb50b7
Parents: 984373d
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Tue Dec 9 19:32:11 2014 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Tue Dec 9 19:32:11 2014 +0300

----------------------------------------------------------------------
 .../MemcacheRestExampleNodeStartup.java         |   16 +-
 .../jdbc/GridJdbcLocalCachesSelfTest.java       |   10 +-
 .../configuration/GridQueryConfiguration.java   |  194 ++
 .../configuration/IgniteConfiguration.java      |   28 +-
 .../events/IgniteCacheQueryReadEvent.java       |    6 +-
 .../spi/indexing/GridIndexingQueryFilter.java   |   26 +
 .../ignite/spi/indexing/GridIndexingSpi.java    |  104 +
 .../spi/indexing/GridNoopIndexingSpi.java       |   58 +
 .../ignite/spi/indexing/IndexDescriptor.java    |   42 -
 .../apache/ignite/spi/indexing/IndexType.java   |   24 -
 .../ignite/spi/indexing/IndexingEntity.java     |   50 -
 .../spi/indexing/IndexingEntityAdapter.java     |   57 -
 .../spi/indexing/IndexingFieldMetadata.java     |   46 -
 .../spi/indexing/IndexingFieldsResult.java      |   35 -
 .../indexing/IndexingFieldsResultAdapter.java   |   49 -
 .../spi/indexing/IndexingKeyValueRow.java       |   42 -
 .../indexing/IndexingKeyValueRowAdapter.java    |   82 -
 .../ignite/spi/indexing/IndexingMarshaller.java |   38 -
 .../spi/indexing/IndexingQueryFilter.java       |   27 -
 .../apache/ignite/spi/indexing/IndexingSpi.java |  188 --
 .../spi/indexing/IndexingTypeDescriptor.java    |   84 -
 .../ignite/spi/indexing/NoopIndexingSpi.java    |  119 -
 .../query/GridCacheQueryConfiguration.java      |  117 +
 .../grid/cache/query/GridCacheQueryType.java    |    5 +-
 .../gridgain/grid/kernal/GridComponentType.java |    8 +-
 .../org/gridgain/grid/kernal/GridGainEx.java    |    5 +-
 .../org/gridgain/grid/kernal/GridKernal.java    |    2 +
 .../gridgain/grid/kernal/GridKernalContext.java |    8 +
 .../grid/kernal/GridKernalContextImpl.java      |   12 +
 .../managers/indexing/GridIndexingManager.java  | 1778 +------------
 .../GridCacheDistributedFieldsQueryFuture.java  |    8 +-
 .../query/GridCacheDistributedQueryManager.java |    6 +-
 .../query/GridCacheFieldsQueryErrorFuture.java  |    6 +-
 .../query/GridCacheLocalFieldsQueryFuture.java  |    8 +-
 .../cache/query/GridCacheLocalQueryManager.java |    6 +-
 .../cache/query/GridCacheQueriesEx.java         |    7 +
 .../cache/query/GridCacheQueriesImpl.java       |   21 +-
 .../cache/query/GridCacheQueriesProxy.java      |   12 +
 .../cache/query/GridCacheQueryAdapter.java      |    4 +-
 .../cache/query/GridCacheQueryManager.java      |  396 +--
 .../query/GridCacheQueryMetadataAware.java      |    4 +-
 .../cache/query/GridCacheQueryRequest.java      |    4 +-
 .../cache/query/GridCacheQueryResponse.java     |  135 +-
 .../cache/query/GridCacheQueryType.java         |    5 +
 .../cache/query/GridCacheSqlMetadata.java       |    3 +-
 .../query/jdbc/GridCacheQueryJdbcTask.java      |    6 +-
 .../query/GridQueryFieldMetadata.java           |   46 +
 .../processors/query/GridQueryFieldsResult.java |   34 +
 .../query/GridQueryFieldsResultAdapter.java     |   49 +
 .../query/GridQueryIndexDescriptor.java         |   42 +
 .../processors/query/GridQueryIndexType.java    |   24 +
 .../processors/query/GridQueryIndexing.java     |  162 ++
 .../processors/query/GridQueryProcessor.java    | 1672 ++++++++++++
 .../query/GridQueryTypeDescriptor.java          |   79 +
 .../visor/node/VisorSpisConfiguration.java      |    2 +-
 .../grid/kernal/visor/query/VisorQueryTask.java |    6 +-
 .../java/org/gridgain/grid/util/GridUtils.java  |   20 +
 .../GridCacheTxExceptionAbstractSelfTest.java   |   66 +-
 .../processors/query/h2/GridH2Indexing.java     | 1998 +++++++++++++++
 .../query/h2/GridH2ResultSetIterator.java       |  122 +
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |  447 ++++
 .../processors/query/h2/opt/GridH2Cursor.java   |   62 +
 .../query/h2/opt/GridH2IndexBase.java           |  198 ++
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  |  346 +++
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |   46 +
 .../processors/query/h2/opt/GridH2Row.java      |   40 +
 .../query/h2/opt/GridH2RowDescriptor.java       |  102 +
 .../query/h2/opt/GridH2SpatialIndex.java        |  318 +++
 .../processors/query/h2/opt/GridH2Table.java    |  889 +++++++
 .../query/h2/opt/GridH2TreeIndex.java           |  469 ++++
 .../processors/query/h2/opt/GridH2Utils.java    |  125 +
 .../query/h2/opt/GridLuceneDirectory.java       |  189 ++
 .../processors/query/h2/opt/GridLuceneFile.java |  186 ++
 .../query/h2/opt/GridLuceneIndex.java           |  384 +++
 .../query/h2/opt/GridLuceneInputStream.java     |  220 ++
 .../query/h2/opt/GridLuceneLockFactory.java     |   64 +
 .../query/h2/opt/GridLuceneOutputStream.java    |  230 ++
 .../query/h2/opt/GridSearchRowPointer.java      |   20 +
 .../kernal/processors/query/h2/package.html     |   15 +
 .../h2/GridH2IndexingSpaceConfiguration.java    |  156 --
 .../grid/spi/indexing/h2/GridH2IndexingSpi.java | 2398 ------------------
 .../spi/indexing/h2/GridH2IndexingSpiMBean.java |  222 --
 .../indexing/h2/GridH2ResultSetIterator.java    |  122 -
 .../h2/opt/GridH2AbstractKeyValueRow.java       |  446 ----
 .../grid/spi/indexing/h2/opt/GridH2Cursor.java  |   62 -
 .../spi/indexing/h2/opt/GridH2IndexBase.java    |  204 --
 .../h2/opt/GridH2KeyValueRowOffheap.java        |  346 ---
 .../h2/opt/GridH2KeyValueRowOnheap.java         |   46 -
 .../grid/spi/indexing/h2/opt/GridH2Row.java     |   40 -
 .../indexing/h2/opt/GridH2RowDescriptor.java    |  103 -
 .../spi/indexing/h2/opt/GridH2SpatialIndex.java |  318 ---
 .../grid/spi/indexing/h2/opt/GridH2Table.java   |  893 -------
 .../spi/indexing/h2/opt/GridH2TreeIndex.java    |  480 ----
 .../grid/spi/indexing/h2/opt/GridH2Utils.java   |  125 -
 .../indexing/h2/opt/GridLuceneDirectory.java    |  189 --
 .../spi/indexing/h2/opt/GridLuceneFile.java     |  186 --
 .../spi/indexing/h2/opt/GridLuceneIndex.java    |  391 ---
 .../indexing/h2/opt/GridLuceneInputStream.java  |  220 --
 .../indexing/h2/opt/GridLuceneLockFactory.java  |   64 -
 .../indexing/h2/opt/GridLuceneOutputStream.java |  230 --
 .../indexing/h2/opt/GridSearchRowPointer.java   |   20 -
 .../gridgain/grid/spi/indexing/h2/package.html  |   15 -
 .../GridCacheAbstractFieldsQuerySelfTest.java   |   78 +-
 .../cache/GridCacheAbstractQuerySelfTest.java   |   27 +-
 .../cache/GridCacheCrossCacheQuerySelfTest.java |    9 +-
 .../cache/GridCacheOffHeapAndSwapSelfTest.java  |   28 +-
 .../cache/GridCacheQueryLoadSelfTest.java       |    6 +-
 .../cache/GridCacheQueryMetricsSelfTest.java    |   17 +-
 .../GridCacheQueryMultiThreadedSelfTest.java    |   57 +-
 .../GridCacheQueryUserResourceSelfTest.java     |    4 +-
 ...idCacheReduceQueryMultithreadedSelfTest.java |   13 +-
 .../GridCacheSqlQueryMultiThreadedSelfTest.java |    9 +-
 .../processors/cache/GridCacheSwapSelfTest.java |    6 +-
 .../cache/GridIndexingWithNoopSwapSelfTest.java |   21 +-
 ...GridCachePartitionedFieldsQuerySelfTest.java |    2 +-
 ...idCachePartitionedHitsAndMissesSelfTest.java |   20 +-
 .../near/GridCacheQueryNodeRestartSelfTest.java |   17 +-
 .../GridCacheReplicatedFieldsQuerySelfTest.java |    8 +-
 .../GridCacheReplicatedQuerySelfTest.java       |   16 +-
 .../query/h2/GridH2IndexRebuildTest.java        |  241 ++
 .../query/h2/GridH2IndexingGeoSelfTest.java     |  240 ++
 .../query/h2/GridH2IndexingInMemSelfTest.java   |   17 +
 .../query/h2/GridH2IndexingOffheapSelfTest.java |   36 +
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  553 ++++
 .../query/h2/opt/GridH2TableSelfTest.java       |  613 +++++
 .../GridIndexingSpiAbstractSelfTest.java        |  594 -----
 .../spi/indexing/h2/GridH2IndexRebuildTest.java |  236 --
 .../h2/GridH2IndexingSpiGeoSelfTest.java        |  240 --
 .../h2/GridH2IndexingSpiInMemSelfTest.java      |   21 -
 ...GridH2IndexingSpiInMemStartStopSelfTest.java |   21 -
 .../h2/GridH2IndexingSpiOffheapSelfTest.java    |   40 -
 ...idH2IndexingSpiOffheapStartStopSelfTest.java |   40 -
 .../indexing/h2/opt/GridH2TableSelfTest.java    |  613 -----
 .../h2/opt/GridLuceneIndexLoadTest.java         |  162 --
 .../h2indexing/GridH2IndexingSpiLoadTest.java   |  288 ---
 .../bamboo/GridH2IndexingSpiTestSuite.java      |   12 +-
 136 files changed, 11394 insertions(+), 12750 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/examples/src/main/java/org/gridgain/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/gridgain/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java b/examples/src/main/java/org/gridgain/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java
index dc5d4a2..616567a 100644
--- a/examples/src/main/java/org/gridgain/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java
+++ b/examples/src/main/java/org/gridgain/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java
@@ -16,7 +16,7 @@ import org.gridgain.grid.*;
 import org.gridgain.grid.cache.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.gridgain.grid.spi.indexing.h2.*;
+import org.gridgain.grid.cache.query.*;
 
 import java.util.*;
 
@@ -61,13 +61,6 @@ public class MemcacheRestExampleNodeStartup {
 
         cfg.setMarshaller(marsh);
 
-        GridH2IndexingSpi indexSpi = new GridH2IndexingSpi();
-
-        indexSpi.setDefaultIndexPrimitiveKey(true);
-        indexSpi.setDefaultIndexFixedTyping(false);
-
-        cfg.setIndexingSpi(indexSpi);
-
         GridCacheConfiguration cacheCfg = new GridCacheConfiguration();
 
         cacheCfg.setAtomicityMode(TRANSACTIONAL);
@@ -75,6 +68,13 @@ public class MemcacheRestExampleNodeStartup {
         cacheCfg.setPreloadMode(SYNC);
         cacheCfg.setAtomicityMode(TRANSACTIONAL);
 
+        GridCacheQueryConfiguration qryCfg = new GridCacheQueryConfiguration();
+
+        qryCfg.setIndexPrimitiveKey(true);
+        qryCfg.setIndexFixedTyping(false);
+
+        cacheCfg.setQueryConfiguration(qryCfg);
+
         cfg.setCacheConfiguration(cacheCfg);
 
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/clients/src/test/java/org/gridgain/jdbc/GridJdbcLocalCachesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/jdbc/GridJdbcLocalCachesSelfTest.java b/modules/clients/src/test/java/org/gridgain/jdbc/GridJdbcLocalCachesSelfTest.java
index 2b217ef..8287bff 100644
--- a/modules/clients/src/test/java/org/gridgain/jdbc/GridJdbcLocalCachesSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/jdbc/GridJdbcLocalCachesSelfTest.java
@@ -14,7 +14,7 @@ import org.gridgain.grid.cache.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.gridgain.grid.spi.indexing.h2.*;
+import org.gridgain.grid.cache.query.*;
 import org.gridgain.testframework.junits.common.*;
 
 import java.sql.*;
@@ -47,13 +47,13 @@ public class GridJdbcLocalCachesSelfTest extends GridCommonAbstractTest {
         cache.setCacheMode(LOCAL);
         cache.setWriteSynchronizationMode(FULL_SYNC);
 
-        cfg.setCacheConfiguration(cache);
+        GridCacheQueryConfiguration qryCfg = new GridCacheQueryConfiguration();
 
-        GridH2IndexingSpi idx = new GridH2IndexingSpi();
+        qryCfg.setIndexPrimitiveKey(true);
 
-        idx.setDefaultIndexPrimitiveKey(true);
+        cache.setQueryConfiguration(qryCfg);
 
-        cfg.setIndexingSpi(idx);
+        cfg.setCacheConfiguration(cache);
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
new file mode 100644
index 0000000..4e3b57a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/GridQueryConfiguration.java
@@ -0,0 +1,194 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.configuration;
+
+import org.gridgain.grid.cache.query.*;
+import org.gridgain.grid.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Configuration for embedded indexing facilities.
+ */
+public class GridQueryConfiguration {
+    /** Default query execution time interpreted as long query (3 seconds). */
+    public static final long DFLT_LONG_QRY_EXEC_TIMEOUT = 3000;
+
+    /** Default value for {@link #setUseOptimizedSerializer(boolean)} flag. */
+    public static final boolean DFLT_USE_OPTIMIZED_SERIALIZER = true;
+
+    /** */
+    private Class<?>[] idxCustomFuncClss;
+
+    /** */
+    private String[] searchPath;
+
+    /** */
+    private String initScriptPath;
+
+    /** */
+    private long maxOffHeapMemory = -1;
+
+    /** */
+    private long longQryExecTimeout = DFLT_LONG_QRY_EXEC_TIMEOUT;
+
+    /** */
+    private boolean longQryExplain;
+
+    /** */
+    private boolean useOptimizedSerializer = DFLT_USE_OPTIMIZED_SERIALIZER;
+
+    /**
+     * Sets maximum amount of memory available to off-heap storage. Possible values are
+     * <ul>
+     * <li>{@code -1} - Means that off-heap storage is disabled.</li>
+     * <li>
+     *     {@code 0} - GridGain will not limit off-heap storage (it's up to user to properly
+     *     add and remove entries from cache to ensure that off-heap storage does not grow
+     *     indefinitely.
+     * </li>
+     * <li>Any positive value specifies the limit of off-heap storage in bytes.</li>
+     * </ul>
+     * Default value is {@code -1}, which means that off-heap storage is disabled by default.
+     * <p>
+     * Use off-heap storage to load gigabytes of data in memory without slowing down
+     * Garbage Collection. Essentially in this case you should allocate very small amount
+     * of memory to JVM and GridGain will cache most of the data in off-heap space
+     * without affecting JVM performance at all.
+     *
+     * @param maxOffHeapMemory Maximum memory in bytes available to off-heap memory space.
+     */
+    public void setMaxOffHeapMemory(long maxOffHeapMemory) {
+        this.maxOffHeapMemory = maxOffHeapMemory;
+    }
+
+    /** {@inheritDoc} */
+    public long getMaxOffHeapMemory() {
+        return maxOffHeapMemory;
+    }
+
+    /**
+     * Specifies max allowed size of cache for deserialized offheap rows to avoid deserialization costs for most
+     * frequently used ones. In general performance is better with greater cache size. Must be more than 128 items.
+     *
+     * @param size Cache size in items.
+     */
+    public void setMaxOffheapRowsCacheSize(int size) {
+        A.ensure(size >= 128, "Offheap rows cache size must be not less than 128.");
+
+//        rowCache = new CacheLongKeyLIRS<>(size, 1, 128, 256); TODO
+    }
+
+    /**
+     * Sets the optional search path consisting of space names to search SQL schema objects. Useful for cross cache
+     * queries to avoid writing fully qualified table names.
+     *
+     * @param searchPath Search path.
+     */
+    public void setSearchPath(String... searchPath) {
+        this.searchPath = searchPath;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public String[] getSearchPath() {
+        return searchPath;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public String getInitialScriptPath() {
+        return initScriptPath;
+    }
+
+    /**
+     * Sets script path to be ran against H2 database after opening.
+     * The script must be UTF-8 encoded file.
+     *
+     * @param initScriptPath Script path.
+     */
+    public void setInitialScriptPath(String initScriptPath) {
+        this.initScriptPath = initScriptPath;
+    }
+
+    /**
+     * Sets classes with methods annotated by {@link GridCacheQuerySqlFunction}
+     * to be used as user-defined functions from SQL queries.
+     *
+     * @param idxCustomFuncClss List of classes.
+     */
+    public void setIndexCustomFunctionClasses(Class<?>... idxCustomFuncClss) {
+        this.idxCustomFuncClss = idxCustomFuncClss;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public Class<?>[] getIndexCustomFunctionClasses() {
+        return idxCustomFuncClss;
+    }
+
+    /** {@inheritDoc} */
+    public long getLongQueryExecutionTimeout() {
+        return longQryExecTimeout;
+    }
+
+    /**
+     * Set query execution time threshold. If queries exceed this threshold,
+     * then a warning will be printed out. If {@link #setLongQueryExplain(boolean)} is
+     * set to {@code true}, then execution plan will be printed out as well.
+     * <p>
+     * If not provided, default value is defined by {@link #DFLT_LONG_QRY_EXEC_TIMEOUT}.
+     *
+     * @param longQryExecTimeout Long query execution timeout.
+     * @see #setLongQueryExplain(boolean)
+     */
+    public void setLongQueryExecutionTimeout(long longQryExecTimeout) {
+        this.longQryExecTimeout = longQryExecTimeout;
+    }
+
+    /** {@inheritDoc} */
+    public boolean isLongQueryExplain() {
+        return longQryExplain;
+    }
+
+    /**
+     * If {@code true}, SPI will print SQL execution plan for long queries (explain SQL query).
+     * The time threshold of long queries is controlled via {@link #setLongQueryExecutionTimeout(long)}
+     * parameter.
+     * <p>
+     * If not provided, default value is {@code false}.
+     *
+     * @param longQryExplain Flag marking SPI should print SQL execution plan for long queries (explain SQL query).
+     * @see #setLongQueryExecutionTimeout(long)
+     */
+    public void setLongQueryExplain(boolean longQryExplain) {
+        this.longQryExplain = longQryExplain;
+    }
+
+    /**
+     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
+     * This setting usually makes sense for offheap indexing only.
+     * <p>
+     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
+     *
+     * @param useOptimizedSerializer Flag value.
+     */
+    public void setUseOptimizedSerializer(boolean useOptimizedSerializer) {
+        this.useOptimizedSerializer = useOptimizedSerializer;
+    }
+
+    /**
+     * The flag indicating that serializer for H2 database will be set to GridGain's marshaller.
+     * This setting usually makes sense for offheap indexing only.
+     * <p>
+     * Default is {@link #DFLT_USE_OPTIMIZED_SERIALIZER}.
+     *
+     * @return Flag value.
+     */
+    public boolean isUseOptimizedSerializer() {
+        return useOptimizedSerializer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 92bcdab..b955549 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -370,7 +370,7 @@ public class IgniteConfiguration {
     private SwapSpaceSpi swapSpaceSpi;
 
     /** Indexing SPI. */
-    private IndexingSpi[] indexingSpi;
+    private GridIndexingSpi indexingSpi;
 
     /** Address resolver. */
     private IgniteAddressResolver addrRslvr;
@@ -517,6 +517,9 @@ public class IgniteConfiguration {
     /** Warmup closure. Will be invoked before actual grid start. */
     private IgniteInClosure<IgniteConfiguration> warmupClos;
 
+    /** */
+    private GridQueryConfiguration qryCfg;
+
     /**
      * Creates valid grid configuration with all default values.
      */
@@ -599,6 +602,7 @@ public class IgniteConfiguration {
         p2pSvcShutdown = cfg.getPeerClassLoadingExecutorServiceShutdown();
         pluginCfgs = cfg.getPluginConfigurations();
         portableCfg = cfg.getPortableConfiguration();
+        qryCfg = cfg.getQueryConfiguration();
         restAccessibleFolders = cfg.getRestAccessibleFolders();
         restEnabled = cfg.isRestEnabled();
         restIdleTimeout = cfg.getRestIdleTimeout();
@@ -2147,12 +2151,12 @@ public class IgniteConfiguration {
     }
 
     /**
-     * Sets fully configured instances of {@link org.apache.ignite.spi.indexing.IndexingSpi}.
+     * Sets fully configured instances of {@link org.apache.ignite.spi.indexing.GridIndexingSpi}.
      *
-     * @param indexingSpi Fully configured instances of {@link org.apache.ignite.spi.indexing.IndexingSpi}.
+     * @param indexingSpi Fully configured instances of {@link org.apache.ignite.spi.indexing.GridIndexingSpi}.
      * @see IgniteConfiguration#getIndexingSpi()
      */
-    public void setIndexingSpi(IndexingSpi... indexingSpi) {
+    public void setIndexingSpi(GridIndexingSpi indexingSpi) {
         this.indexingSpi = indexingSpi;
     }
 
@@ -2165,7 +2169,7 @@ public class IgniteConfiguration {
      *
      * @return Indexing SPI implementation or <tt>null</tt> to use default implementation.
      */
-    public IndexingSpi[] getIndexingSpi() {
+    public GridIndexingSpi getIndexingSpi() {
         return indexingSpi;
     }
 
@@ -3157,6 +3161,20 @@ public class IgniteConfiguration {
         this.pluginCfgs = pluginCfgs;
     }
 
+    /**
+     * @return Query configuration.
+     */
+    public GridQueryConfiguration getQueryConfiguration() {
+        return qryCfg;
+    }
+
+    /**
+     * @param qryCfg Query configuration.
+     */
+    public void setQueryConfiguration(GridQueryConfiguration qryCfg) {
+        this.qryCfg = qryCfg;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgniteConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java
index e53bb00..cd10d99 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java
@@ -101,7 +101,7 @@ public class IgniteCacheQueryReadEvent<K, V> extends IgniteEventAdapter {
 
     /** Result row. */
     @GridToStringInclude
-    private final List<?> row;
+    private final Object row;
 
     /**
      * @param node Node where event was fired.
@@ -133,7 +133,7 @@ public class IgniteCacheQueryReadEvent<K, V> extends IgniteEventAdapter {
         @Nullable K key,
         @Nullable V val,
         @Nullable V oldVal,
-        @Nullable List<?> row) {
+        @Nullable Object row) {
         super(node, msg, type);
 
         assert qryType != null;
@@ -276,7 +276,7 @@ public class IgniteCacheQueryReadEvent<K, V> extends IgniteEventAdapter {
      *
      * @return Result row.
      */
-    @Nullable public List<?> row() {
+    @Nullable public Object row() {
         return row;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingQueryFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingQueryFilter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingQueryFilter.java
new file mode 100644
index 0000000..f91f414
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingQueryFilter.java
@@ -0,0 +1,26 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.indexing;
+
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Cache entry filter.
+ */
+public interface GridIndexingQueryFilter {
+    /**
+     * Creates optional predicate for space.
+     *
+     * @param spaceName Space name.
+     * @return Predicate or {@code null} if no filtering is needed.
+     */
+    @Nullable public <K, V> IgniteBiPredicate<K, V> forSpace(String spaceName);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingSpi.java
new file mode 100644
index 0000000..71cced8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridIndexingSpi.java
@@ -0,0 +1,104 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.indexing;
+
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run
+ * Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance.
+ * <p>
+ * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide
+ * internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when
+ * access to a specific implementation of this SPI is required - an instance of this SPI can be obtained
+ * via {@link org.apache.ignite.Ignite#configuration()} method to check its configuration properties or call other non-SPI
+ * methods. Note again that calling methods from this interface on the obtained instance can lead
+ * to undefined behavior and explicitly not supported.
+ *
+ *  * Here is a Java example on how to configure grid with {@code GridH2IndexingSpi}.
+ * <pre name="code" class="java">
+ * GridIndexingSpi spi = new MyIndexingSpi();
+ *
+ * GridConfiguration cfg = new GridConfiguration();
+ *
+ * // Overrides default indexing SPI.
+ * cfg.setIndexingSpi(spi);
+ *
+ * // Starts grid.
+ * G.start(cfg);
+ * </pre>
+ * Here is an example of how to configure {@code GridH2IndexingSpi} from Spring XML configuration file.
+ * <pre name="code" class="xml">
+ * &lt;property name=&quot;indexingSpi&quot;&gt;
+ *     &lt;bean class=&quot;com.example.MyIndexingSpi&quot;&gt;
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * </pre>
+ * <p>
+ * <img src="http://www.gridgain.com/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public interface GridIndexingSpi extends IgniteSpi {
+    /**
+     * Executes query.
+     *
+     * @param spaceName Space name.
+     * @param params Query parameters.
+     * @param filters System filters.
+     * @return Query result.
+     * @throws IgniteSpiException If failed.
+     */
+    public Iterator<?> query(@Nullable String spaceName, Collection<Object> params,
+        @Nullable GridIndexingQueryFilter filters) throws IgniteSpiException;
+
+    /**
+     * Updates index. Note that key is unique for space, so if space contains multiple indexes
+     * the key should be removed from indexes other than one being updated.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @param val Value.
+     * @param expirationTime Expiration time or 0 if never expires.
+     * @throws IgniteSpiException If failed.
+     */
+    public void store(@Nullable String spaceName, Object key, Object val, long expirationTime) throws IgniteSpiException;
+
+    /**
+     * Removes index entry by key.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @throws IgniteSpiException If failed.
+     */
+    public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException;
+
+    /**
+     * Will be called when entry with given key is swapped.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @throws IgniteSpiException If failed.
+     */
+    public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException;
+
+    /**
+     * Will be called when entry with given key is unswapped.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @param val Value.
+     * @throws IgniteSpiException If failed.
+     */
+    public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridNoopIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridNoopIndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridNoopIndexingSpi.java
new file mode 100644
index 0000000..7883625
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/GridNoopIndexingSpi.java
@@ -0,0 +1,58 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.indexing;
+
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Default implementation of {@link GridIndexingSpi} which does not index cache.
+ */
+@IgniteSpiNoop
+public class GridNoopIndexingSpi extends IgniteSpiAdapter implements GridIndexingSpi {
+    /** {@inheritDoc} */
+    @Override public Iterator<?> query(@Nullable String spaceName, Collection<Object> params,
+        @Nullable GridIndexingQueryFilter filters) throws IgniteSpiException {
+        throw new IgniteSpiException("You have to configure custom GridIndexingSpi implementation.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void store(@Nullable String spaceName, Object key, Object val, long expirationTime)
+        throws IgniteSpiException {
+        assert false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException {
+        assert false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException {
+        assert false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException {
+        assert false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void spiStop() throws IgniteSpiException {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexDescriptor.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexDescriptor.java
deleted file mode 100644
index ada2cc1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexDescriptor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import java.util.*;
-
-/**
- * Describes an index to be created for a certain type. It contains all necessary
- * information about fields, order, uniqueness, and specified
- * whether this is SQL or Text index.
- * See also {@link IndexingTypeDescriptor#indexes()}.
- */
-public interface IndexDescriptor {
-    /**
-     * Gets all fields to be indexed.
-     *
-     * @return Fields to be indexed.
-     */
-    public Collection<String> fields();
-
-    /**
-     * Specifies order of the index for each indexed field.
-     *
-     * @param field Field name.
-     * @return {@code True} if given field should be indexed in descending order.
-     */
-    public boolean descending(String field);
-
-    /**
-     * Gets index type.
-     *
-     * @return Type.
-     */
-    public IndexType type();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexType.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexType.java
deleted file mode 100644
index dcab0a7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-/**
- * Index types.
- */
-public enum IndexType {
-    /** Sorted SQL index. */
-    SORTED,
-
-    /** Spatial SQL index. */
-    GEO_SPATIAL,
-
-    /** Fulltext index. */
-    FULLTEXT
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntity.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntity.java
deleted file mode 100644
index 0208b75..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntity.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.spi.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * Wrapper around indexed key or value which also may contain the value in
- * unmarshalled form. It exists to avoid unnecessary unmarshalling whenever
- * it is not needed.
- * See also {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}.
- */
-public interface IndexingEntity<T> {
-    /**
-     * Gets indexed value. This method may return {@code null} only
-     * if actual value is {@code null}. Otherwise, it will unmarshal
-     * the {@link #bytes()} and return the actual value.
-     *
-     * @return Indexed value.
-     * @throws org.apache.ignite.spi.IgniteSpiException If value de-serialization failed.
-     */
-    @Nullable public T value() throws IgniteSpiException;
-
-    /**
-     * Optional bytes for marshaled indexed value. Certain SPI implementations
-     * may keep objects in unmarshalled form and therefore will not provide
-     * marshaled bytes for them.
-     *
-     * @return Optional marshaled value.
-     */
-    @Nullable public byte[] bytes();
-
-    /**
-     * Flag indicating whether this entity contains unmarshalled value.
-     *
-     * @return {@code True} if entity contains unmarshalled value, {@code false}
-     *      otherwise.
-     */
-    public boolean hasValue();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntityAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntityAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntityAdapter.java
deleted file mode 100644
index d0ca976..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingEntityAdapter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.tostring.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Convenience adapter for {@link IndexingEntity}.
- */
-public class IndexingEntityAdapter<T> implements IndexingEntity<T> {
-    /** */
-    @GridToStringInclude
-    private final T val;
-
-    /** */
-    @GridToStringExclude
-    private final byte[] bytes;
-
-    /**
-     * @param val Value.
-     * @param bytes Value marshalled by {@link org.apache.ignite.marshaller.IgniteMarshaller}.
-     */
-    public IndexingEntityAdapter(T val, @Nullable byte[] bytes) {
-        this.val = val;
-        this.bytes = bytes;
-    }
-
-    /** {@inheritDoc} */
-    @Override public T value() {
-        return val;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] bytes() {
-        return bytes;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasValue() {
-        return val != null || (val == null && bytes == null);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(IndexingEntityAdapter.class, this,
-            "bytesLength", (bytes == null ? 0 : bytes.length));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldMetadata.java
deleted file mode 100644
index 8b25c84..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldMetadata.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import java.io.*;
-
-/**
- * Query field descriptor. This descriptor is used to provide metadata
- * about fields returned in query result.
- */
-public interface IndexingFieldMetadata extends Externalizable {
-    /**
-     * Gets schema name.
-     *
-     * @return Schema name.
-     */
-    public String schemaName();
-
-    /**
-     * Gets name of type to which this field belongs.
-     *
-     * @return Gets type name.
-     */
-    public String typeName();
-
-    /**
-     * Gets field name.
-     *
-     * @return Field name.
-     */
-    public String fieldName();
-
-    /**
-     * Gets field type name.
-     *
-     * @return Field type name.
-     */
-    public String fieldTypeName();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResult.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResult.java
deleted file mode 100644
index 62e6ce1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResult.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.spi.*;
-
-import java.util.*;
-
-/**
- * Field query result. It is composed of
- * fields metadata and iterator over queried fields.
- * See also {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter)}.
- */
-public interface IndexingFieldsResult {
-    /**
-     * Gets metadata for queried fields.
-     *
-     * @return Meta data for queried fields.
-     */
-    List<IndexingFieldMetadata> metaData();
-
-    /**
-     * Gets iterator over queried fields.
-     *
-     * @return Iterator over queried fields.
-     */
-    IgniteSpiCloseableIterator<List<IndexingEntity<?>>> iterator();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResultAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResultAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResultAdapter.java
deleted file mode 100644
index c583b76..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingFieldsResultAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.spi.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * Convenience adapter for {@link IndexingFieldsResult}.
- */
-public class IndexingFieldsResultAdapter implements IndexingFieldsResult {
-    /** Meta data. */
-    private final List<IndexingFieldMetadata> metaData;
-
-    /** Result iterator. */
-    private final IgniteSpiCloseableIterator<List<IndexingEntity<?>>> it;
-
-    /**
-     * Creates query field result composed of field metadata and iterator
-     * over queried fields.
-     *
-     * @param metaData Meta data.
-     * @param it Result iterator.
-     */
-    public IndexingFieldsResultAdapter(@Nullable List<IndexingFieldMetadata> metaData,
-                                       IgniteSpiCloseableIterator<List<IndexingEntity<?>>> it) {
-        this.metaData = metaData != null ? Collections.unmodifiableList(metaData) : null;
-        this.it = it;
-    }
-
-    /** {@inheritDoc} */
-    @Override public List<IndexingFieldMetadata> metaData() {
-        return metaData;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteSpiCloseableIterator<List<IndexingEntity<?>>> iterator() {
-        return it;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRow.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRow.java
deleted file mode 100644
index 7b075ed..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRow.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import java.util.*;
-
-/**
- * This class represents a single row returned by key-value query. For example, it is returned
- * by query such as {@link IndexingSpi#query(String, String, Collection, IndexingTypeDescriptor, IndexingQueryFilter[])}
- * method. Key-value queries are different from fields query in a way that they
- * return the whole cached value, not its individual fields.
- * See also {@link IndexingSpi#query(String, String, Collection, IndexingTypeDescriptor, IndexingQueryFilter[])}.
- */
-public interface IndexingKeyValueRow<K, V> {
-    /**
-     * Gets cache key.
-     *
-     * @return Cache key.
-     */
-    public IndexingEntity<K> key();
-
-    /**
-     * Gets cache value.
-     *
-     * @return Cache value.
-     */
-    public IndexingEntity<V> value();
-
-    /**
-     * Gets version of cache value.
-     *
-     * @return Version of cache value.
-     */
-    public byte[] version();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRowAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRowAdapter.java
deleted file mode 100644
index f703c51..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingKeyValueRowAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
-*  __  ____/___________(_)______  /__  ____/______ ____(_)_______
-*  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-*  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-*  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
-*/
-
-package org.apache.ignite.spi.indexing;
-
-import org.gridgain.grid.kernal.processors.cache.query.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.tostring.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Convenience adapter for {@link IndexingKeyValueRow}.
- */
-public class IndexingKeyValueRowAdapter<K, V> implements IndexingKeyValueRow<K, V> {
-    /** Key. */
-    @GridToStringInclude
-    private IndexingEntity<K> key;
-
-    /** Value. */
-    @GridToStringInclude
-    private IndexingEntity<V> val;
-
-    /** Version. */
-    @GridToStringInclude
-    private byte[] ver;
-
-    /**
-     * Constructor.
-     *
-     * @param key Key.
-     * @param val Value.
-     */
-    public IndexingKeyValueRowAdapter(K key, V val) {
-        assert key != null;
-        assert val != null;
-
-        this.key = new IndexingEntityAdapter<>(key, null);
-        this.val = new IndexingEntityAdapter<>(val, null);
-    }
-
-    /**
-     * Constructs query index row.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param ver Version. It is {@code null} in case of {@link GridCacheQueryType#SCAN} query.
-     */
-    public IndexingKeyValueRowAdapter(IndexingEntity<K> key, @Nullable IndexingEntity<V> val,
-                                      @Nullable byte[] ver) {
-        assert key != null;
-
-        this.key = key;
-        this.val = val;
-        this.ver = ver;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IndexingEntity<K> key() {
-        return key;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IndexingEntity<V> value() {
-        return val;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] version() {
-        return ver;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(IndexingKeyValueRowAdapter.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingMarshaller.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingMarshaller.java
deleted file mode 100644
index e04c6a1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingMarshaller.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.spi.*;
-
-/**
- * Marshaller to be used in indexing SPI. This marshaller automatically
- * takes care of class loading of unmarshalled classes.
- * See also {@link IndexingSpi#registerMarshaller(IndexingMarshaller)}.
- */
-public interface IndexingMarshaller {
-    /**
-     * Unmarshalls bytes to object.
-     *
-     * @param bytes Bytes.
-     * @param <T> Value type.
-     * @return Value.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <T> IndexingEntity<T> unmarshal(byte[] bytes) throws IgniteSpiException;
-
-    /**
-     * Marshals object to bytes.
-     *
-     * @param entity Entity.
-     * @return Bytes.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public byte[] marshal(IndexingEntity<?> entity) throws IgniteSpiException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
deleted file mode 100644
index bbdcdf6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Space name and key filter.
- */
-public interface IndexingQueryFilter {
-    /**
-     * Creates optional predicate for space.
-     *
-     * @param spaceName Space name.
-     * @return Predicate or {@code null} if no filtering is needed.
-     */
-    @Nullable public <K, V> IgniteBiPredicate<K, V> forSpace(String spaceName) throws GridException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
deleted file mode 100644
index 74de3dd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.query.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run SQL,
- * TEXT or individual field queries against these indexes. Usually indexing SPI is used by caches by name
- * (see {@link GridCacheConfiguration#getIndexingSpiName()}). Logically storage is organized into separate spaces.
- * Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance.
- * <p>
- * Functionality of this SPI is exposed to {@link GridCacheQueries} interface:
- * <ul>
- *      <li>{@link GridCacheQueries#createSqlQuery(Class, String)}</li>
- *      <li>{@link GridCacheQueries#createSqlFieldsQuery(String)}</li>
- *      <li>{@link GridCacheQueries#createFullTextQuery(Class, String)}</li>
- * </ul>
- * <p>
- * The default indexing SPI implementation is
- * {@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi} which uses H2 database engine
- * for data indexing and querying. User can implement his own indexing SPI and use his own data structures
- * and query language instead of SQL. SPI can be configured for grid using {@link org.apache.ignite.configuration.IgniteConfiguration#getIndexingSpi()}.
- * <p>
- * GridGain comes with following built-in indexing SPI implementations:
- * <ul>
- *      <li>{@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi}</li>
- * </ul>
- * <p>
- * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide
- * internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when
- * access to a specific implementation of this SPI is required - an instance of this SPI can be obtained
- * via {@link org.apache.ignite.Ignite#configuration()} method to check its configuration properties or call other non-SPI
- * methods. Note again that calling methods from this interface on the obtained instance can lead
- * to undefined behavior and explicitly not supported.
- */
-public interface IndexingSpi extends IgniteSpi {
-    /**
-     * Queries individual fields (generally used by JDBC drivers).
-     *
-     * @param spaceName Space name.
-     * @param qry Query.
-     * @param params Query parameters.
-     * @param filters Space name and key filters.
-     * @return Query result.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> IndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
-        Collection<Object> params, IndexingQueryFilter filters) throws IgniteSpiException;
-
-    /**
-     * Executes regular query.
-     *
-     * @param spaceName Space name.
-     * @param qry Query.
-     * @param params Query parameters.
-     * @param type Query return type.
-     * @param filters Space name and key filters.
-     * @return Queried rows.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(@Nullable String spaceName, String qry,
-        Collection<Object> params, IndexingTypeDescriptor type, IndexingQueryFilter filters)
-        throws IgniteSpiException;
-
-    /**
-     * Executes text query.
-     *
-     * @param spaceName Space name.
-     * @param qry Text query.
-     * @param type Query return type.
-     * @param filters Space name and key filter.
-     * @return Queried rows.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(@Nullable String spaceName, String qry,
-        IndexingTypeDescriptor type, IndexingQueryFilter filters) throws IgniteSpiException;
-
-    /**
-     * Gets size of index for given type or -1 if it is a unknown type.
-     *
-     * @param spaceName Space name.
-     * @param desc Type descriptor.
-     * @return Objects number.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public long size(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException;
-
-    /**
-     * Registers type if it was not known before or updates it otherwise.
-     *
-     * @param spaceName Space name.
-     * @param desc Type descriptor.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     * @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
-     */
-    public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException;
-
-    /**
-     * Unregisters type and removes all corresponding data.
-     *
-     * @param spaceName Space name.
-     * @param type Type descriptor.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type) throws IgniteSpiException;
-
-    /**
-     * Updates index. Note that key is unique for space, so if space contains multiple indexes
-     * the key should be removed from indexes other than one being updated.
-     *
-     * @param spaceName Space name.
-     * @param type Value type.
-     * @param key Key.
-     * @param val Value.
-     * @param ver Version.
-     * @param expirationTime Expiration time or 0 if never expires.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type, IndexingEntity<K> key,
-        IndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException;
-
-    /**
-     * Removes index entry by key.
-     *
-     * @param spaceName Space name.
-     * @param key Key.
-     * @return {@code True} if removed by this operation, {@code false} otherwise.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> key) throws IgniteSpiException;
-
-    /**
-     * Will be called when entry with given key is swapped.
-     *
-     * @param spaceName Space name.
-     * @param swapSpaceName Swap space name.
-     * @param key Key.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException;
-
-    /**
-     * Will be called when entry with given key is unswapped.
-     *
-     * @param spaceName Space name.
-     * @param key Key.
-     * @param val Value.
-     * @param valBytes Value bytes.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes) throws IgniteSpiException;
-
-    /**
-     * Marshaller to be used by SPI.
-     *
-     * @param marshaller Marshaller.
-     */
-    public void registerMarshaller(IndexingMarshaller marshaller);
-
-    /**
-     * Registers space in this SPI.
-     *
-     * @param spaceName Space name.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public void registerSpace(String spaceName) throws IgniteSpiException;
-
-    /**
-     * Rebuilds all indexes of given type.
-     *
-     * @param spaceName Space name.
-     * @param type Type descriptor.
-     */
-    public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingTypeDescriptor.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingTypeDescriptor.java
deleted file mode 100644
index 3f96b1c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingTypeDescriptor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-
-import org.apache.ignite.spi.*;
-
-import java.util.*;
-
-/**
- * Value descriptor which allows to extract fields from value object of given type.
- * See also {@link IndexingSpi#registerType(String, IndexingTypeDescriptor)}.
- */
-public interface IndexingTypeDescriptor {
-    /**
-     * Gets type name which uniquely identifies this type.
-     *
-     * @return Type name which uniquely identifies this type.
-     */
-    public String name();
-
-    /**
-     * Gets mapping from values field name to its type.
-     *
-     * @return Fields that can be indexed, participate in queries and can be queried using
-     *      {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}
-     *      method.
-     */
-    public Map<String, Class<?>> valueFields();
-
-    /**
-     * Gets mapping from keys field name to its type.
-     *
-     * @return Fields that can be indexed, participate in queries and can be queried using
-     *      {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}
-     *      method.
-     */
-    public Map<String, Class<?>> keyFields();
-
-    /**
-     * Gets field value for given object.
-     *
-     * @param obj Object to get field value from.
-     * @param field Field name.
-     * @return Value for given field.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <T> T value(Object obj, String field) throws IgniteSpiException;
-
-    /**
-     * Gets indexes for this type.
-     *
-     * @return Indexes for this type.
-     */
-    public Map<String, IndexDescriptor> indexes();
-
-    /**
-     * Gets value class.
-     *
-     * @return Value class.
-     */
-    public Class<?> valueClass();
-
-    /**
-     * Gets key class.
-     *
-     * @return Key class.
-     */
-    public Class<?> keyClass();
-
-    /**
-     * Returns {@code true} if string representation of value should be indexed as text.
-     *
-     * @return If string representation of value should be full-text indexed.
-     */
-    public boolean valueTextIndex();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/apache/ignite/spi/indexing/NoopIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/NoopIndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/NoopIndexingSpi.java
deleted file mode 100644
index 9fba743..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/NoopIndexingSpi.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.spi.indexing;
-
-import org.apache.ignite.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * No-op implementation of {@link IndexingSpi}, throws exception on query attempt.
- */
-@IgniteSpiNoop
-public class NoopIndexingSpi extends IgniteSpiAdapter implements IndexingSpi {
-    /** */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
-        Collection<Object> params, IndexingQueryFilter filters) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(@Nullable String spaceName,
-        String qry, Collection<Object> params, IndexingTypeDescriptor type,
-        IndexingQueryFilter filters) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(@Nullable
-        String spaceName, String qry, IndexingTypeDescriptor type, IndexingQueryFilter filters)
-        throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long size(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor desc)
-        throws IgniteSpiException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type)
-        throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type,
-        IndexingEntity<K> key, IndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> key) throws IgniteSpiException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes)
-        throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void registerMarshaller(IndexingMarshaller marshaller) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void registerSpace(String spaceName) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        // No-op.
-    }
-
-    /**
-     * @return No-op SPI usage exception.
-     */
-    private IgniteSpiException spiException() {
-        return new IgniteSpiException("Current grid configuration does not support queries " +
-            "(please configure GridH2IndexingSpi).");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryConfiguration.java b/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryConfiguration.java
index 625a1ad..ce53d18 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryConfiguration.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryConfiguration.java
@@ -25,6 +25,18 @@ public class GridCacheQueryConfiguration implements Serializable {
     /** Query type resolver. */
     private GridCacheQueryTypeResolver typeRslvr;
 
+    /** */
+    private boolean idxPrimitiveKey;
+
+    /** */
+    private boolean idxPrimitiveVal;
+
+    /** */
+    private boolean idxFixedTyping;
+
+    /** */
+    private boolean escapeAll;
+
     /**
      * Default constructor.
      */
@@ -38,6 +50,10 @@ public class GridCacheQueryConfiguration implements Serializable {
     public GridCacheQueryConfiguration(GridCacheQueryConfiguration cfg) {
         typeMeta = cfg.getTypeMetadata();
         typeRslvr = cfg.getTypeResolver();
+        idxPrimitiveKey = cfg.isIndexPrimitiveKey();
+        idxPrimitiveVal = cfg.isIndexPrimitiveValue();
+        idxFixedTyping = cfg.isIndexFixedTyping();
+        escapeAll = cfg.isEscapeAll();
     }
 
     /**
@@ -75,4 +91,105 @@ public class GridCacheQueryConfiguration implements Serializable {
     public void setTypeResolver(GridCacheQueryTypeResolver typeRslvr) {
         this.typeRslvr = typeRslvr;
     }
+
+    /**
+     * Gets flag indicating whether SQL engine should index by key in cases
+     * where key is primitive type
+     *
+     * @return {@code True} if primitive keys should be indexed.
+     */
+    public boolean isIndexPrimitiveKey() {
+        return idxPrimitiveKey;
+    }
+
+    /**
+     * Sets flag indicating whether SQL engine should index by key in cases
+     * where key is primitive type.
+     *
+     * @param idxPrimitiveKey {@code True} if primitive keys should be indexed.
+     */
+    public void setIndexPrimitiveKey(boolean idxPrimitiveKey) {
+        this.idxPrimitiveKey = idxPrimitiveKey;
+    }
+
+    /**
+     * Gets flag indicating whether SQL engine should index by value in cases
+     * where value is primitive type
+     *
+     * @return {@code True} if primitive values should be indexed.
+     */
+    public boolean isIndexPrimitiveValue() {
+        return idxPrimitiveVal;
+    }
+
+    /**
+     * Sets flag indexing whether SQL engine should index by value in cases
+     * where value is primitive type.
+     *
+     * @param idxPrimitiveVal {@code True} if primitive values should be indexed.
+     */
+    public void setIndexPrimitiveValue(boolean idxPrimitiveVal) {
+        this.idxPrimitiveVal = idxPrimitiveVal;
+    }
+
+    /**
+     * This flag essentially controls whether all values of the same type have
+     * identical key type.
+     * <p>
+     * If {@code false}, SQL engine will store all keys in BINARY form to make it possible to store
+     * the same value type with different key types. If {@code true}, key type will be converted
+     * to respective SQL type if it is possible, hence, improving performance of queries.
+     * <p>
+     * Setting this value to {@code false} also means that {@code '_key'} column cannot be indexed and
+     * cannot participate in query where clauses. The behavior of using '_key' column in where
+     * clauses with this flag set to {@code false} is undefined.
+     *
+     * @return {@code True} if SQL engine should try to convert values to their respective SQL
+     *      types for better performance.
+     */
+    public boolean isIndexFixedTyping() {
+        return idxFixedTyping;
+    }
+
+    /**
+     * This flag essentially controls whether key type is going to be identical
+     * for all values of the same type.
+     * <p>
+     * If false, SQL engine will store all keys in BINARY form to make it possible to store
+     * the same value type with different key types. If true, key type will be converted
+     * to respective SQL type if it is possible, which may provide significant performance
+     * boost.
+     *
+     * @param idxFixedTyping {@code True} if SQL engine should try to convert values to their respective SQL
+     *      types for better performance.
+     */
+    public void setIndexFixedTyping(boolean idxFixedTyping) {
+        this.idxFixedTyping = idxFixedTyping;
+    }
+
+    /**
+     * If {@code true}, then table name and all column names in 'create table' SQL
+     * generated for SQL engine are escaped with double quotes. This flag should be set if table name of
+     * column name is H2 reserved word or is not valid H2 identifier (e.g. contains space or hyphen).
+     * <p>
+     * Note if this flag is set then table and column name in SQL queries also must be escaped with double quotes.
+
+     * @return Flag value.
+     */
+    public boolean isEscapeAll() {
+        return escapeAll;
+    }
+
+    /**
+     * If {@code true}, then table name and all column names in 'create table' SQL
+     * generated for SQL engine are escaped with double quotes. This flag should be set if table name of
+     * column name is H2 reserved word or is not valid H2 identifier (e.g. contains space or hyphen).
+     * <p>
+     * Note if this flag is set then table and column name in SQL queries also must be escaped with double quotes.
+
+     * @param escapeAll Flag value.
+     */
+    public void setEscapeAll(boolean escapeAll) {
+        this.escapeAll = escapeAll;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryType.java b/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryType.java
index 5d45d87..85d348a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryType.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/query/GridCacheQueryType.java
@@ -32,5 +32,8 @@ public enum GridCacheQueryType {
     SCAN,
 
     /** Continuous query. */
-    CONTINUOUS
+    CONTINUOUS,
+
+    /** SPI query. */
+    SPI
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/kernal/GridComponentType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridComponentType.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridComponentType.java
index 59ce18f..032c489 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridComponentType.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridComponentType.java
@@ -46,10 +46,10 @@ public enum GridComponentType {
         "gridgain-spring"
     ),
 
-    /** H2 indexing SPI. */
-    H2_INDEXING(
-        "org.apache.ignite.spi.indexing.NoopIndexingSpi",
-        "org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi",
+    /** Indexing. */
+    INDEXING(
+        null,
+        "org.gridgain.grid.kernal.processors.query.h2.GridH2Indexing",
         "gridgain-indexing"
     ),
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
index 9d72e65..1b622c5 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
@@ -1382,6 +1382,7 @@ public class GridGainEx {
             myCfg.setDotNetConfiguration(cfg.getDotNetConfiguration());
             myCfg.setPluginConfigurations(cfg.getPluginConfigurations());
             myCfg.setTransactionsConfiguration(new GridTransactionsConfiguration(cfg.getTransactionsConfiguration()));
+            myCfg.setQueryConfiguration(cfg.getQueryConfiguration());
 
             ClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration();
 
@@ -1474,7 +1475,7 @@ public class GridGainEx {
             FailoverSpi[] failSpi = cfg.getFailoverSpi();
             LoadBalancingSpi[] loadBalancingSpi = cfg.getLoadBalancingSpi();
             SwapSpaceSpi swapspaceSpi = cfg.getSwapSpaceSpi();
-            IndexingSpi[] indexingSpi = cfg.getIndexingSpi();
+            GridIndexingSpi indexingSpi = cfg.getIndexingSpi();
 
             execSvc = cfg.getExecutorService();
             sysExecSvc = cfg.getSystemExecutorService();
@@ -1722,7 +1723,7 @@ public class GridGainEx {
             }
 
             if (indexingSpi == null)
-                indexingSpi = new IndexingSpi[] {(IndexingSpi)H2_INDEXING.createOptional()};
+                indexingSpi = new GridNoopIndexingSpi();
 
             myCfg.setCommunicationSpi(commSpi);
             myCfg.setDiscoverySpi(discoSpi);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java
index d913605..2ec852b 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java
@@ -54,6 +54,7 @@ import org.gridgain.grid.kernal.processors.offheap.*;
 import org.gridgain.grid.kernal.processors.plugin.*;
 import org.gridgain.grid.kernal.processors.port.*;
 import org.gridgain.grid.kernal.processors.portable.*;
+import org.gridgain.grid.kernal.processors.query.*;
 import org.gridgain.grid.kernal.processors.resource.*;
 import org.gridgain.grid.kernal.processors.rest.*;
 import org.gridgain.grid.kernal.processors.segmentation.*;
@@ -724,6 +725,7 @@ public class GridKernal extends ClusterGroupAdapter implements GridEx, IgniteMBe
             startProcessor(ctx, createComponent(GridLicenseProcessor.class, ctx), attrs);
             startProcessor(ctx, new GridAffinityProcessor(ctx), attrs);
             startProcessor(ctx, createComponent(GridSegmentationProcessor.class, ctx), attrs);
+            startProcessor(ctx, new GridQueryProcessor(ctx), attrs);
             startProcessor(ctx, new GridCacheProcessor(ctx), attrs);
             startProcessor(ctx, new GridTaskSessionProcessor(ctx), attrs);
             startProcessor(ctx, new GridJobProcessor(ctx), attrs);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
index 0cf12e3..7b161a4 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
@@ -43,6 +43,7 @@ import org.gridgain.grid.kernal.processors.offheap.*;
 import org.gridgain.grid.kernal.processors.plugin.*;
 import org.gridgain.grid.kernal.processors.port.*;
 import org.gridgain.grid.kernal.processors.portable.*;
+import org.gridgain.grid.kernal.processors.query.*;
 import org.gridgain.grid.kernal.processors.resource.*;
 import org.gridgain.grid.kernal.processors.rest.*;
 import org.gridgain.grid.kernal.processors.schedule.*;
@@ -329,6 +330,13 @@ public interface GridKernalContext extends GridMetadataAware, Iterable<GridCompo
     public GridInteropProcessor interop();
 
     /**
+     * Gets query processor.
+     *
+     * @return Query processor.
+     */
+    public GridQueryProcessor query();
+
+    /**
      * @return Plugin processor.
      */
     public IgnitePluginProcessor plugins();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/922a2bab/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
index 4af386f..41e435e 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
@@ -45,6 +45,7 @@ import org.gridgain.grid.kernal.processors.offheap.*;
 import org.gridgain.grid.kernal.processors.plugin.*;
 import org.gridgain.grid.kernal.processors.port.*;
 import org.gridgain.grid.kernal.processors.portable.*;
+import org.gridgain.grid.kernal.processors.query.*;
 import org.gridgain.grid.kernal.processors.resource.*;
 import org.gridgain.grid.kernal.processors.rest.*;
 import org.gridgain.grid.kernal.processors.schedule.*;
@@ -141,6 +142,10 @@ public class GridKernalContextImpl extends GridMetadataAwareAdapter implements G
 
     /** */
     @GridToStringInclude
+    private GridQueryProcessor qryProc;
+
+    /** */
+    @GridToStringInclude
     private GridTaskProcessor taskProc;
 
     /** */
@@ -438,6 +443,8 @@ public class GridKernalContextImpl extends GridMetadataAwareAdapter implements G
             interopProc = (GridInteropProcessor)comp;
         else if (comp instanceof IgnitePluginProcessor)
             pluginProc = (IgnitePluginProcessor)comp;
+        else if (comp instanceof GridQueryProcessor)
+            qryProc = (GridQueryProcessor)comp;
         else
             assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
 
@@ -690,6 +697,11 @@ public class GridKernalContextImpl extends GridMetadataAwareAdapter implements G
     }
 
     /** {@inheritDoc} */
+    @Override public GridQueryProcessor query() {
+        return qryProc;
+    }
+
+    /** {@inheritDoc} */
     @Override public IgniteLogger log() {
         return config().getGridLogger();
     }


Mime
View raw message