You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mm...@apache.org on 2022/05/24 12:57:04 UTC
[ignite] branch master updated: IGNITE-17021 Move ignite-geospatial to the Ignite Extensions project (#10032)
This is an automated email from the ASF dual-hosted git repository.
mmuzaf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 725c8551e1f IGNITE-17021 Move ignite-geospatial to the Ignite Extensions project (#10032)
725c8551e1f is described below
commit 725c8551e1f7696509171a00f932655ce41f6271
Author: Maxim Muzafarov <ma...@gmail.com>
AuthorDate: Tue May 24 15:56:54 2022 +0300
IGNITE-17021 Move ignite-geospatial to the Ignite Extensions project (#10032)
---
assembly/dependencies-apache-ignite-slim.xml | 1 -
assembly/dependencies-apache-ignite.xml | 1 -
docs/_docs/setup.adoc | 14 +-
examples/pom-standalone-lgpl.xml | 6 -
examples/pom-standalone.xml | 6 -
examples/pom.xml | 5 -
.../examples/datagrid/SpatialQueryExample.java | 108 ----
.../SpatialQueryExampleMultiNodeSelfTest.java | 31 -
.../examples/SpatialQueryExampleSelfTest.java | 35 --
.../IgniteLgplExamplesSelfTestSuite.java | 6 +-
modules/bom/pom.xml | 5 -
modules/geospatial/README.txt | 47 --
modules/geospatial/licenses/apache-2.0.txt | 202 ------
modules/geospatial/pom.xml | 140 -----
.../query/h2/opt/GeoSpatialClientIndex.java | 85 ---
.../h2/opt/GeoSpatialClientIndexDefinition.java | 75 ---
.../query/h2/opt/GeoSpatialClientIndexFactory.java | 39 --
.../processors/query/h2/opt/GeoSpatialIndex.java | 65 --
.../query/h2/opt/GeoSpatialIndexDefinition.java | 70 ---
.../query/h2/opt/GeoSpatialIndexFactory.java | 69 ---
.../query/h2/opt/GeoSpatialIndexImpl.java | 381 ------------
.../processors/query/h2/opt/GeoSpatialUtils.java | 98 ---
.../processors/query/h2/opt/GeometryIndexKey.java | 49 --
.../query/h2/opt/GridH2SpatialBaseIndex.java | 65 --
.../query/h2/opt/GridH2SpatialClientIndex.java | 91 ---
.../query/h2/opt/GridH2SpatialIndex.java | 141 -----
.../query/h2/H2IndexesSystemViewTest.java | 119 ----
.../query/h2/H2IndexingAbstractGeoSelfTest.java | 676 ---------------------
.../processors/query/h2/H2IndexingGeoSelfTest.java | 30 -
.../query/h2/H2IndexingSegmentedGeoSelfTest.java | 30 -
.../testsuites/GeoSpatialIndexingTestSuite.java | 36 --
modules/indexing/pom.xml | 4 +-
modules/osgi-karaf/src/main/resources/features.xml | 2 +-
modules/osgi/pom.xml | 4 +-
pom.xml | 2 -
35 files changed, 9 insertions(+), 2729 deletions(-)
diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml
index 9da7de0aeb0..6063518097b 100644
--- a/assembly/dependencies-apache-ignite-slim.xml
+++ b/assembly/dependencies-apache-ignite-slim.xml
@@ -129,7 +129,6 @@
<exclude>${project.groupId}:ignite-hadoop</exclude>
<exclude>${project.groupId}:ignite-codegen</exclude>
<exclude>${project.groupId}:ignite-schedule</exclude>
- <exclude>${project.groupId}:ignite-geospatial</exclude>
<exclude>${project.groupId}:ignite-appserver-test</exclude>
<exclude>${project.groupId}:ignite-websphere-test</exclude>
<exclude>${project.groupId}:ignite-cassandra</exclude>
diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml
index 2a02dc57135..d78936f1b87 100644
--- a/assembly/dependencies-apache-ignite.xml
+++ b/assembly/dependencies-apache-ignite.xml
@@ -129,7 +129,6 @@
<exclude>${project.groupId}:ignite-visor-plugins</exclude>
<exclude>${project.groupId}:ignite-codegen</exclude>
<exclude>${project.groupId}:ignite-schedule</exclude>
- <exclude>${project.groupId}:ignite-geospatial</exclude>
<exclude>${project.groupId}:ignite-appserver-test</exclude>
<exclude>${project.groupId}:ignite-websphere-test</exclude>
<exclude>${project.groupId}:ignite-cassandra</exclude>
diff --git a/docs/_docs/setup.adoc b/docs/_docs/setup.adoc
index ca5cdacfcbd..515f20ead78 100644
--- a/docs/_docs/setup.adoc
+++ b/docs/_docs/setup.adoc
@@ -181,19 +181,11 @@ your application.
The following modules have LGPL dependencies and, therefore, can't be deployed on the Maven Central repository:
* ignite-hibernate (Apache Ignite Extensions)
-* ignite-geospatial
-* ignite-schedule
+* ignite-geospatial (Apache Ignite Extensions)
+* ignite-schedule (deprecated)
To use these modules, you will need to build them from sources and add to your project.
-For example, to install `ignite-geospatial` into your local repository, run this command in the Ignite source:
-
-
-[source, shell]
-----
-./mvnw clean install -DskipTests -Plgpl -pl modules/geospatial -am
-----
-
-To install the `ignite-hibernate` into your local repository and create distribution binaries,
+For example, to install the `ignite-hibernate` into your local repository and create distribution binaries,
run the following command from the Ignite Extensions sources:
[source, shell]
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index 7f3e0bba478..8f777e9758f 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -220,12 +220,6 @@
<artifactId>ignite-schedule</artifactId>
<version>to_be_replaced_by_ignite_version</version>
</dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-geospatial</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
</dependencies>
</profile>
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index b240050deaa..5c03bc9ba6c 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -221,12 +221,6 @@
<artifactId>ignite-schedule</artifactId>
<version>to_be_replaced_by_ignite_version</version>
</dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-geospatial</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
</dependencies>
</profile>
diff --git a/examples/pom.xml b/examples/pom.xml
index 2826aaade9d..c8167752619 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -318,11 +318,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>ignite-schedule</artifactId>
</dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-geospatial</artifactId>
- </dependency>
</dependencies>
<build>
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/SpatialQueryExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/SpatialQueryExample.java
deleted file mode 100644
index 33029519d00..00000000000
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/SpatialQueryExample.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid;
-
-import java.util.Collection;
-import java.util.Random;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.ExampleNodeStartup;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.io.WKTReader;
-
-/**
- * This examples shows the usage of geospatial queries and indexes in Apache Ignite.
- * For more information please refer to the following technical documentation:
- * http://apacheignite.readme.io/docs/geospatial-queries
- * <p>
- * Remote nodes should be started using {@link ExampleNodeStartup} which will
- * start node with {@code examples/config/example-ignite.xml} configuration.
- */
-public class SpatialQueryExample {
- /** Cache name. */
- private static final String CACHE_NAME = SpatialQueryExample.class.getSimpleName();
-
- /**
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) throws Exception {
- // Starting Ignite node.
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- // Preparing the cache configuration.
- CacheConfiguration<Integer, MapPoint> cc = new CacheConfiguration<>(CACHE_NAME);
-
- // Setting the indexed types.
- cc.setIndexedTypes(Integer.class, MapPoint.class);
-
- // Starting the cache.
- try (IgniteCache<Integer, MapPoint> cache = ignite.createCache(cc)) {
- Random rnd = new Random();
-
- WKTReader r = new WKTReader();
-
- // Adding geometry points into the cache.
- for (int i = 0; i < 1000; i++) {
- int x = rnd.nextInt(10000);
- int y = rnd.nextInt(10000);
-
- Geometry geo = r.read("POINT(" + x + " " + y + ")");
-
- cache.put(i, new MapPoint(geo));
- }
-
- // Query to fetch the points that fit into a specific polygon.
- SqlQuery<Integer, MapPoint> query = new SqlQuery<>(MapPoint.class, "coords && ?");
-
- // Selecting points that fit into a specific polygon.
- for (int i = 0; i < 10; i++) {
- // Defining the next polygon boundaries.
- Geometry cond = r.read("POLYGON((0 0, 0 " + rnd.nextInt(10000) + ", " +
- rnd.nextInt(10000) + " " + rnd.nextInt(10000) + ", " +
- rnd.nextInt(10000) + " 0, 0 0))");
-
- // Executing the query.
- Collection<Cache.Entry<Integer, MapPoint>> entries = cache.query(query.setArgs(cond)).getAll();
-
- // Printing number of points that fit into the area defined by the polygon.
- System.out.println("Fetched points [cond=" + cond + ", cnt=" + entries.size() + ']');
- }
- }
- }
- }
-
- /**
- * MapPoint with indexed coordinates.
- */
- private static class MapPoint {
- /** Coordinates. */
- @QuerySqlField(index = true)
- private Geometry coords;
-
- /**
- * @param coords Coordinates.
- */
- private MapPoint(Geometry coords) {
- this.coords = coords;
- }
- }
-}
diff --git a/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleMultiNodeSelfTest.java b/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleMultiNodeSelfTest.java
deleted file mode 100644
index dff373d6349..00000000000
--- a/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleMultiNodeSelfTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.SpatialQueryExample;
-
-/**
- * * Tests {@link SpatialQueryExample} in the multi node mode.
- */
-public class SpatialQueryExampleMultiNodeSelfTest extends SpatialQueryExampleSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- for (int i = 0; i < RMT_NODES_CNT; i++)
- startGrid("node-" + i, "examples/config/example-ignite.xml");
- }
-}
diff --git a/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleSelfTest.java b/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleSelfTest.java
deleted file mode 100644
index ea88cff99cb..00000000000
--- a/examples/src/test/java-lgpl/org/apache/ignite/examples/SpatialQueryExampleSelfTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.SpatialQueryExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Tests {@link SpatialQueryExample}.
- */
-public class SpatialQueryExampleSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSpatialQueryExample() throws Exception {
- SpatialQueryExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java-lgpl/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java b/examples/src/test/java-lgpl/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
index 6f4a1c3a07f..50123cc05d6 100644
--- a/examples/src/test/java-lgpl/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
+++ b/examples/src/test/java-lgpl/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
@@ -19,8 +19,6 @@ package org.apache.ignite.testsuites;
import org.apache.ignite.examples.ComputeScheduleExampleMultiNodeSelfTest;
import org.apache.ignite.examples.ComputeScheduleExampleSelfTest;
-import org.apache.ignite.examples.SpatialQueryExampleMultiNodeSelfTest;
-import org.apache.ignite.examples.SpatialQueryExampleSelfTest;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -33,12 +31,10 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- SpatialQueryExampleSelfTest.class,
ComputeScheduleExampleSelfTest.class,
// Multi-node.
- SpatialQueryExampleMultiNodeSelfTest.class,
- ComputeScheduleExampleMultiNodeSelfTest.class,
+ ComputeScheduleExampleMultiNodeSelfTest.class
})
public class IgniteLgplExamplesSelfTestSuite {
/** */
diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml
index 4e90f383390..2d13cc15822 100644
--- a/modules/bom/pom.xml
+++ b/modules/bom/pom.xml
@@ -116,11 +116,6 @@
<artifactId>ignite-opencensus</artifactId>
<version>${revision}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-geospatial</artifactId>
- <version>${revision}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-rest-http</artifactId>
diff --git a/modules/geospatial/README.txt b/modules/geospatial/README.txt
deleted file mode 100644
index 3f8f715557d..00000000000
--- a/modules/geospatial/README.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-Apache Ignite Geospatial Module
------------------------------
-
-Apache Ignite geospatial module provides capabilities to geospatial index cache type.
-
-To enable geospatial module when starting a standalone node, move 'optional/ignite-geospatial' folder to
-'libs' folder before running 'ggstart.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-Note! This module can be used only when Ignite indexing module is enabled.
-
-Importing geospatial Module In Maven Project
-------------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add geospatial module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- ...
- <dependencies>
- ...
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-geospatial</artifactId>
- <version>${ignite.version}</version>
- </dependency>
- ...
- </dependencies>
- ...
-</project>
-
-
-LGPL dependencies
------------------
-
-Ignite includes the following optional LGPL dependencies:
- - JTS Topology Suite for Geospatial indexing, http://tsusiatsoftware.net/jts/main.html
- - cron4j for cron-based task scheduling, http://www.sauronsoftware.it/projects/cron4j
-
-Apache binary releases cannot include LGPL dependencies. If you would like include
-optional LGPL dependencies into your release, you should download the source release
-from Ignite website and do the build with the following maven command:
-
-./mvnw clean package -DskipTests -Prelease,lgpl
diff --git a/modules/geospatial/licenses/apache-2.0.txt b/modules/geospatial/licenses/apache-2.0.txt
deleted file mode 100644
index d6456956733..00000000000
--- a/modules/geospatial/licenses/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
deleted file mode 100644
index 59b360aae0b..00000000000
--- a/modules/geospatial/pom.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!--
- POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-parent-internal</artifactId>
- <version>${revision}</version>
- <relativePath>../../parent-internal/pom.xml</relativePath>
- </parent>
-
- <artifactId>ignite-geospatial</artifactId>
-
- <url>http://ignite.apache.org</url>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-indexing</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.locationtech.jts</groupId>
- <artifactId>jts-core</artifactId>
- <version>1.15.0</version>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ignite-tools</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>lgpl</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>false</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <!-- Generate the OSGi MANIFEST.MF for this bundle.
- This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
- the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-indexing, thus
- leading to a split package situation in OSGi.
- -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Fragment-Host>${project.groupId}.ignite-core</Fragment-Host>
- </instructions>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndex.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndex.java
deleted file mode 100644
index 847ed88d78f..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndex.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.List;
-import java.util.UUID;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
-import org.apache.ignite.internal.processors.query.h2.index.client.AbstractClientIndex;
-import org.apache.ignite.internal.util.lang.GridCursor;
-import org.h2.table.IndexColumn;
-import org.h2.table.TableFilter;
-import org.locationtech.jts.geom.Geometry;
-
-/**
- * Mock for client nodes to support Geo-Spatial indexes.
- */
-public class GeoSpatialClientIndex extends AbstractClientIndex implements GeoSpatialIndex {
- /** Index unique ID. */
- private final UUID id = UUID.randomUUID();
-
- /** */
- private final GeoSpatialClientIndexDefinition def;
-
- /**
- * @param def Index definition.
- */
- public GeoSpatialClientIndex(GeoSpatialClientIndexDefinition def) {
- this.def = def;
- }
-
- /** {@inheritDoc} */
- @Override public UUID id() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String name() {
- return def.idxName().idxName();
- }
-
- /** */
- public GridH2Table tbl() {
- return def.tbl();
- }
-
- /** */
- public List<IndexColumn> cols() {
- return def.cols();
- }
-
- /** {@inheritDoc} */
- @Override public GridCursor<IndexRow> find(int seg, TableFilter filter) {
- throw unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public GridCursor<IndexRow> findFirstOrLast(int seg, boolean first) {
- throw unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public long totalCount() {
- throw unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public GridCursor<IndexRow> findByGeometry(int seg, TableFilter filter, Geometry intersection) {
- throw unsupported();
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexDefinition.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexDefinition.java
deleted file mode 100644
index dc03d377953..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexDefinition.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import org.apache.ignite.internal.cache.query.index.IndexDefinition;
-import org.apache.ignite.internal.cache.query.index.IndexName;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition;
-import org.h2.table.IndexColumn;
-
-/**
- * Definition of Geo-Spatial client index.
- */
-public class GeoSpatialClientIndexDefinition implements IndexDefinition {
- /** */
- private final LinkedHashMap<String, IndexKeyDefinition> keyDefs;
-
- /** */
- private final IndexName idxName;
-
- /** */
- private final GridH2Table tbl;
-
- /** */
- private final List<IndexColumn> cols;
-
- /** */
- public GeoSpatialClientIndexDefinition(
- GridH2Table tbl,
- IndexName idxName,
- LinkedHashMap<String, IndexKeyDefinition> keyDefs,
- List<IndexColumn> cols
- ) {
- this.idxName = idxName;
- this.keyDefs = keyDefs;
- this.tbl = tbl;
- this.cols = cols;
- }
-
- /** */
- public GridH2Table tbl() {
- return tbl;
- }
-
- /** */
- public List<IndexColumn> cols() {
- return cols;
- }
-
- /** {@inheritDoc} */
- @Override public IndexName idxName() {
- return idxName;
- }
-
- /** {@inheritDoc} */
- @Override public LinkedHashMap<String, IndexKeyDefinition> indexKeyDefinitions() {
- return keyDefs;
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexFactory.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexFactory.java
deleted file mode 100644
index e57f403aebf..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialClientIndexFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import org.apache.ignite.internal.cache.query.index.Index;
-import org.apache.ignite.internal.cache.query.index.IndexDefinition;
-import org.apache.ignite.internal.cache.query.index.IndexFactory;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Index factory for creating Geo-Spatial indexes for client node.
- */
-public class GeoSpatialClientIndexFactory implements IndexFactory {
- /** Instance of the factory. */
- public static final GeoSpatialClientIndexFactory INSTANCE = new GeoSpatialClientIndexFactory();
-
- /** {@inheritDoc} */
- @Override public Index createIndex(@Nullable GridCacheContext<?, ?> cctx, IndexDefinition definition) {
- GeoSpatialClientIndexDefinition def = (GeoSpatialClientIndexDefinition)definition;
-
- return new GeoSpatialClientIndex(def);
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndex.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndex.java
deleted file mode 100644
index d29ae55acdc..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndex.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.cache.query.index.Index;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
-import org.apache.ignite.internal.util.lang.GridCursor;
-import org.h2.table.TableFilter;
-import org.locationtech.jts.geom.Geometry;
-
-/**
- * Interface for geo spatial indexes.
- */
-public interface GeoSpatialIndex extends Index {
- /**
- * Finds index rows in specifed segment with table filtering.
- *
- * @param segment Number of segment to find.
- * @param filter Table filter.
- * @return Cursor of found index rows.
- */
- public GridCursor<IndexRow> find(int segment, TableFilter filter);
-
- /**
- * Finds index rows in specifed segment with table filtering.
- *
- * @param segment Number of segment to find.
- * @param filter Table filter.
- * @param intersection Intersection geometry to find rows within it.
- * @return Cursor of found index rows.
- */
- public GridCursor<IndexRow> findByGeometry(int segment, TableFilter filter, Geometry intersection);
-
- /**
- * Finds first or last index row for specified segment.
- *
- * @param firstOrLast if {@code true} then return first index row or otherwise last row.
- * @param segment Number of segment to find.
- * @return Cursor of found index rows.
- */
- public GridCursor<IndexRow> findFirstOrLast(int segment, boolean firstOrLast);
-
- /**
- * Counts index rows for all segments.
- *
- * @return total count of index rows.
- */
- public long totalCount() throws IgniteCheckedException;
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexDefinition.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexDefinition.java
deleted file mode 100644
index 83c6ed56a58..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexDefinition.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.LinkedHashMap;
-import org.apache.ignite.internal.cache.query.index.IndexDefinition;
-import org.apache.ignite.internal.cache.query.index.IndexName;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition;
-import org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler;
-
-/**
- * Definition of geo spatial index.
- */
-public class GeoSpatialIndexDefinition implements IndexDefinition {
- /** */
- private final QueryIndexRowHandler rowHnd;
-
- /** */
- private final LinkedHashMap<String, IndexKeyDefinition> keyDefs;
-
- /** */
- private final int segmentsCnt;
-
- /** */
- private final IndexName idxName;
-
- /** */
- public GeoSpatialIndexDefinition(IndexName idxName, LinkedHashMap<String, IndexKeyDefinition> keyDefs,
- QueryIndexRowHandler rowHnd, int segmentsCnt) {
- this.idxName = idxName;
- this.rowHnd = rowHnd;
- this.keyDefs = keyDefs;
- this.segmentsCnt = segmentsCnt;
- }
-
- /** */
- public QueryIndexRowHandler rowHandler() {
- return rowHnd;
- }
-
- /** */
- public int segmentsCnt() {
- return segmentsCnt;
- }
-
- /** {@inheritDoc} */
- @Override public IndexName idxName() {
- return idxName;
- }
-
- /** {@inheritDoc} */
- @Override public LinkedHashMap<String, IndexKeyDefinition> indexKeyDefinitions() {
- return keyDefs;
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexFactory.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexFactory.java
deleted file mode 100644
index f9223a25023..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.List;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.cache.query.index.Index;
-import org.apache.ignite.internal.cache.query.index.IndexDefinition;
-import org.apache.ignite.internal.cache.query.index.IndexFactory;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.h2.message.DbException;
-import org.h2.result.SortOrder;
-import org.h2.table.IndexColumn;
-import org.h2.value.Value;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Index factory for creating geo spatial indexes.
- */
-public class GeoSpatialIndexFactory implements IndexFactory {
- /** Instance of the factory. */
- public static final GeoSpatialIndexFactory INSTANCE = new GeoSpatialIndexFactory();
-
- /** {@inheritDoc} */
- @Override public Index createIndex(@Nullable GridCacheContext<?, ?> cctx, IndexDefinition definition) {
- GeoSpatialIndexDefinition def = (GeoSpatialIndexDefinition)definition;
-
- try {
- List<IndexColumn> cols = def.rowHandler().getH2IdxColumns();
-
- if (cols.size() > 1)
- throw DbException.getUnsupportedException("can only do one column");
-
- if ((cols.get(0).sortType & SortOrder.DESCENDING) != 0)
- throw DbException.getUnsupportedException("cannot do descending");
-
- if ((cols.get(0).sortType & SortOrder.NULLS_FIRST) != 0)
- throw DbException.getUnsupportedException("cannot do nulls first");
-
- if ((cols.get(0).sortType & SortOrder.NULLS_LAST) != 0)
- throw DbException.getUnsupportedException("cannot do nulls last");
-
- if (cols.get(0).column.getType() != Value.GEOMETRY) {
- throw DbException.getUnsupportedException("spatial index on non-geometry column, " +
- cols.get(0).column.getCreateSQL());
- }
-
- return new GeoSpatialIndexImpl(cctx, def);
- }
- catch (Exception e) {
- throw new IgniteException("Failed to instantiate: GridH2SpatialIndex", e);
- }
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexImpl.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexImpl.java
deleted file mode 100644
index a4bf9b48ce2..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialIndexImpl.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.cache.query.index.AbstractIndex;
-import org.apache.ignite.internal.cache.query.index.SingleCursor;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexRowImpl;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexValueCursor;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import org.apache.ignite.internal.processors.query.h2.H2Utils;
-import org.apache.ignite.internal.util.GridCursorIteratorWrapper;
-import org.apache.ignite.internal.util.lang.GridCursor;
-import org.apache.ignite.spi.indexing.IndexingQueryCacheFilter;
-import org.apache.ignite.spi.indexing.IndexingQueryFilter;
-import org.h2.index.IndexLookupBatch;
-import org.h2.message.DbException;
-import org.h2.mvstore.MVStore;
-import org.h2.mvstore.rtree.MVRTreeMap;
-import org.h2.mvstore.rtree.SpatialKey;
-import org.h2.table.TableFilter;
-import org.jetbrains.annotations.Nullable;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-
-/**
- * Spatial index implementation.
- */
-public class GeoSpatialIndexImpl extends AbstractIndex implements GeoSpatialIndex {
- /** Index unique ID. */
- private final UUID id = UUID.randomUUID();
-
- /** Cache context. */
- private final GridCacheContext cctx;
-
- /** */
- final GeoSpatialIndexDefinition def;
-
- /** */
- private final ReadWriteLock lock = new ReentrantReadWriteLock();
-
- /** */
- private volatile long rowCnt;
-
- /** */
- private long rowIds;
-
- /** */
- private boolean closed;
-
- /** */
- private final MVRTreeMap<Long>[] segments;
-
- /** */
- private final Map<Long, IndexRow> idToRow = new HashMap<>();
-
- /** */
- private final Map<Object, Long> keyToId = new HashMap<>();
-
- /** */
- private final MVStore store;
-
- /**
- * @param cctx Cache context.
- * @param def Index definition.
- */
- public GeoSpatialIndexImpl(GridCacheContext cctx, GeoSpatialIndexDefinition def) {
- this.cctx = cctx;
- this.def = def;
-
- // Index in memory
- store = MVStore.open(null);
-
- segments = new MVRTreeMap[def.segmentsCnt()];
-
- for (int i = 0; i < def.segmentsCnt(); i++)
- segments[i] = store.openMap("spatialIndex-" + i, new MVRTreeMap.Builder<Long>());
- }
-
- /** */
- IndexLookupBatch createLookupBatch(TableFilter[] filters, int filter) {
- GridH2Table table = def.rowHandler().getTable();
-
- if (table.isPartitioned()) {
- assert filter > 0; // Lookup batch will not be created for the first table filter.
-
- throw DbException.throwInternalError(
- "Table with a spatial index must be the first in the query: " + table);
- }
-
- return null; // Support must be explicitly added.
- }
-
- /**
- * Check closed.
- */
- private void checkClosed() {
- if (closed)
- throw DbException.throwInternalError();
- }
-
- /**
- * @param rowId Row id.
- * @return Envelope.
- */
- private SpatialKey getEnvelope(CacheDataRow row, long rowId) {
- Geometry g = (Geometry)def.rowHandler().indexKey(0, row).key();
-
- return getEnvelope(g, rowId);
- }
-
- /**
- * @param rowId Row id.
- * @return Envelope.
- */
- private SpatialKey getEnvelope(Geometry key, long rowId) {
- Envelope env = key.getEnvelopeInternal();
-
- return new SpatialKey(rowId,
- (float)env.getMinX(), (float)env.getMaxX(),
- (float)env.getMinY(), (float)env.getMaxY());
- }
-
- /** {@inheritDoc} */
- @Override public UUID id() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String name() {
- return def.idxName().idxName();
- }
-
- /** {@inheritDoc} */
- @Override public boolean canHandle(CacheDataRow row) throws IgniteCheckedException {
- return cctx.kernalContext().query().belongsToTable(
- cctx, def.idxName().cacheName(), def.idxName().tableName(), row.key(), row.value());
- }
-
- /** {@inheritDoc} */
- @Override public void onUpdate(@Nullable CacheDataRow oldRow, @Nullable CacheDataRow newRow,
- boolean prevRowAvailable) throws IgniteCheckedException {
-
- Lock l = lock.writeLock();
-
- l.lock();
-
- try {
- if (oldRow != null && prevRowAvailable)
- remove(oldRow);
-
- if (newRow != null)
- put(newRow);
- }
- finally {
- l.unlock();
- }
- }
-
- /** */
- private boolean put(CacheDataRow row) {
- checkClosed();
-
- Object key = def.rowHandler().key(row);
-
- assert key != null;
-
- final int seg = segmentForRow(row);
-
- Long rowId = keyToId.get(key);
-
- if (rowId != null) {
- Long oldRowId = segments[seg].remove(getEnvelope(idToRow.get(rowId).cacheDataRow(), rowId));
-
- assert rowId.equals(oldRowId);
- }
- else {
- rowId = ++rowIds;
-
- keyToId.put(key, rowId);
- }
-
- IndexRow old = idToRow.put(rowId, new IndexRowImpl(def.rowHandler(), row));
-
- segments[seg].put(getEnvelope(row, rowId), rowId);
-
- if (old == null)
- rowCnt++; // No replace.
-
- return old != null;
- }
-
- /** */
- private boolean remove(CacheDataRow row) {
- checkClosed();
-
- Object key = def.rowHandler().key(row);
-
- assert key != null;
-
- Long rowId = keyToId.remove(key);
-
- assert rowId != null;
-
- IndexRow oldRow = idToRow.remove(rowId);
-
- assert oldRow != null;
-
- final int seg = segmentForRow(row);
-
- if (!segments[seg].remove(getEnvelope(row, rowId), rowId))
- throw DbException.throwInternalError("row not found");
-
- rowCnt--;
-
- return oldRow != null;
- }
-
- /** {@inheritDoc} */
- @Override public void destroy(boolean softDelete) {
- Lock l = lock.writeLock();
-
- l.lock();
-
- try {
- closed = true;
-
- store.close();
- }
- finally {
- l.unlock();
- }
- }
-
- /**
- * @param filter Table filter.
- * @return Cursor.
- */
- @Override public GridCursor<IndexRow> find(int seg, TableFilter filter) {
- Lock l = lock.readLock();
-
- l.lock();
-
- try {
- checkClosed();
-
- final MVRTreeMap<Long> segment = segments[seg];
-
- return rowIterator(segment.keySet().iterator(), filter);
- }
- finally {
- l.unlock();
- }
- }
-
- /**
- * @param i Spatial key iterator.
- * @param filter Table filter.
- * @return Iterator over rows.
- */
- @SuppressWarnings("unchecked")
- private GridCursor<IndexRow> rowIterator(Iterator<SpatialKey> i, TableFilter filter) {
- if (!i.hasNext())
- return IndexValueCursor.EMPTY;
-
- long time = System.currentTimeMillis();
-
- IndexingQueryFilter qryFilter = null;
-
- QueryContext qctx = H2Utils.context(filter.getSession());
-
- if (qctx != null)
- qryFilter = qctx.filter();
-
- IndexingQueryCacheFilter qryCacheFilter = qryFilter != null ?
- qryFilter.forCache(def.rowHandler().getTable().cacheName()) : null;
-
- List<IndexRow> rows = new ArrayList<>();
-
- do {
- IndexRow row = idToRow.get(i.next().getId());
-
- CacheDataRow cacheRow = row.cacheDataRow();
-
- assert row != null;
-
- if (cacheRow.expireTime() != 0 && cacheRow.expireTime() <= time)
- continue;
-
- if (qryCacheFilter == null || qryCacheFilter.applyPartition(cacheRow.partition()))
- rows.add(row);
- }
- while (i.hasNext());
-
- return new GridCursorIteratorWrapper(rows.iterator());
- }
-
- /** {@inheritDoc} */
- @Override public GridCursor<IndexRow> findFirstOrLast(int seg, boolean first) {
- Lock l = lock.readLock();
-
- l.lock();
-
- try {
- checkClosed();
-
- if (!first)
- throw DbException.throwInternalError("Spatial Index can only be fetch by ascending order");
-
- final MVRTreeMap<Long> segment = segments[seg];
-
- GridCursor<IndexRow> iter = rowIterator(segment.keySet().iterator(), null);
-
- return new SingleCursor<>(iter.next() ? iter.get() : null);
- }
- catch (IgniteCheckedException e) {
- throw DbException.convert(e);
- }
- finally {
- l.unlock();
- }
- }
-
- /** {@inheritDoc} */
- @Override public long totalCount() {
- return rowCnt;
- }
-
- /** {@inheritDoc} */
- @Override public GridCursor<IndexRow> findByGeometry(int seg, TableFilter filter, Geometry intersection) {
- Lock l = lock.readLock();
-
- l.lock();
-
- try {
- if (intersection == null)
- return find(seg, filter);
-
- final MVRTreeMap<Long> segment = segments[seg];
-
- return rowIterator(segment.findIntersectingKeys(getEnvelope(intersection, 0)), filter);
- }
- finally {
- l.unlock();
- }
- }
-
- /**
- * @param row cache row.
- * @return Segment ID for given key
- */
- public int segmentForRow(CacheDataRow row) {
- return segments.length == 1 ? 0 : (def.rowHandler().partition(row) % segments.length);
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialUtils.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialUtils.java
deleted file mode 100644
index bb09b987753..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeoSpatialUtils.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.cache.query.index.Index;
-import org.apache.ignite.internal.cache.query.index.IndexDefinition;
-import org.apache.ignite.internal.cache.query.index.IndexName;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypeSettings;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypes;
-import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexKeyType;
-import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexKeyTypeRegistry;
-import org.apache.ignite.internal.cache.query.index.sorted.keys.IndexKeyFactory;
-import org.apache.ignite.internal.processors.query.h2.index.QueryIndexKeyDefinitionProvider;
-import org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler;
-import org.h2.table.IndexColumn;
-import org.locationtech.jts.geom.Geometry;
-
-/**
- * This class is entrypoint for creating Geo-Spatial index.
- */
-public class GeoSpatialUtils {
- /** Dummy key types. */
- private static final IndexKeyTypeSettings DUMMY_SETTINGS = new IndexKeyTypeSettings();
-
- static {
- IndexKeyFactory.register(IndexKeyTypes.GEOMETRY, k -> new GeometryIndexKey((Geometry)k));
- }
-
- /** */
- public static GridH2IndexBase createIndex(GridH2Table tbl, String idxName, List<IndexColumn> cols) {
- try {
- IndexName name = new IndexName(tbl.cacheName(), tbl.getSchema().getName(), tbl.getName(), idxName);
-
- LinkedHashMap<String, IndexKeyDefinition> keyDefs = new QueryIndexKeyDefinitionProvider(tbl, cols).keyDefinitions();
-
- if (tbl.cacheInfo().affinityNode())
- return createIndex(tbl, name, keyDefs, cols);
- else
- return createClientIndex(tbl, name, keyDefs, cols);
- }
- catch (Exception e) {
- throw new IgniteException("Failed to instantiate", e);
- }
- }
-
- /** Creates index for server Ignite nodes. */
- private static GridH2SpatialIndex createIndex(
- GridH2Table tbl,
- IndexName name,
- LinkedHashMap<String, IndexKeyDefinition> keyDefs,
- List<IndexColumn> cols
- ) {
- List<InlineIndexKeyType> idxKeyTypes = InlineIndexKeyTypeRegistry.types(keyDefs.values(), DUMMY_SETTINGS);
-
- QueryIndexRowHandler rowHnd = new QueryIndexRowHandler(tbl, cols, keyDefs, idxKeyTypes, DUMMY_SETTINGS);
-
- final int segments = tbl.rowDescriptor().cacheInfo().config().getQueryParallelism();
-
- IndexDefinition def = new GeoSpatialIndexDefinition(name, keyDefs, rowHnd, segments);
-
- Index idx = tbl.idxProc().createIndex(tbl.cacheContext(), GeoSpatialIndexFactory.INSTANCE, def);
-
- return new GridH2SpatialIndex(idx.unwrap(GeoSpatialIndexImpl.class));
- }
-
- /** Creates index for client Ignite nodes. */
- private static GridH2SpatialClientIndex createClientIndex(
- GridH2Table tbl,
- IndexName name,
- LinkedHashMap<String, IndexKeyDefinition> keyDefs,
- List<IndexColumn> cols
- ) {
- IndexDefinition def = new GeoSpatialClientIndexDefinition(tbl, name, keyDefs, cols);
-
- Index idx = tbl.idxProc().createIndex(tbl.cacheContext(), GeoSpatialClientIndexFactory.INSTANCE, def);
-
- return new GridH2SpatialClientIndex(idx.unwrap(GeoSpatialClientIndex.class));
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeometryIndexKey.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeometryIndexKey.java
deleted file mode 100644
index 0532d0cae1f..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GeometryIndexKey.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypes;
-import org.apache.ignite.internal.cache.query.index.sorted.keys.IndexKey;
-import org.h2.value.ValueGeometry;
-import org.locationtech.jts.geom.Geometry;
-
-/** */
-public class GeometryIndexKey implements IndexKey {
- /** */
- private final ValueGeometry geometry;
-
- /** */
- public GeometryIndexKey(Geometry g) {
- geometry = ValueGeometry.getFromGeometry(g);
- }
-
- /** {@inheritDoc} */
- @Override public Object key() {
- return geometry.getGeometry();
- }
-
- /** {@inheritDoc} */
- @Override public int type() {
- return IndexKeyTypes.GEOMETRY;
- }
-
- /** {@inheritDoc} */
- @Override public int compare(IndexKey o) {
- return geometry.compareTo(((GeometryIndexKey)o).geometry, null);
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialBaseIndex.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialBaseIndex.java
deleted file mode 100644
index 370ba2ef557..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialBaseIndex.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import java.util.HashSet;
-import org.h2.engine.Session;
-import org.h2.index.IndexType;
-import org.h2.index.SpatialIndex;
-import org.h2.index.SpatialTreeIndex;
-import org.h2.result.SearchRow;
-import org.h2.result.SortOrder;
-import org.h2.table.Column;
-import org.h2.table.IndexColumn;
-import org.h2.table.TableFilter;
-
-/** Base class for Geo-Spatial indexes to register in the H2 engine. */
-public abstract class GridH2SpatialBaseIndex extends GridH2IndexBase implements SpatialIndex {
- /**
- * Constructor.
- *
- * @param tbl Table.
- * @param name Index name.
- * @param cols Indexed columns.
- * @param type Index type.
- */
- protected GridH2SpatialBaseIndex(GridH2Table tbl, String name, IndexColumn[] cols, IndexType type) {
- super(tbl, name, cols, type);
- }
-
- /** {@inheritDoc} */
- @Override public H2CacheRow put(H2CacheRow row) {
- throw new IllegalStateException("Must not be invoked.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean putx(H2CacheRow row) {
- throw new IllegalStateException("Must not be invoked.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean removex(SearchRow row) {
- throw new IllegalStateException("Must not be invoked.");
- }
-
- /** {@inheritDoc} */
- @Override public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter,
- SortOrder sortOrder, HashSet<Column> cols) {
- return SpatialTreeIndex.getCostRangeIndex(masks, columns) / 10d;
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialClientIndex.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialClientIndex.java
deleted file mode 100644
index 5712feff29b..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialClientIndex.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import org.apache.ignite.internal.processors.query.h2.index.client.AbstractClientIndex;
-import org.apache.ignite.spi.indexing.IndexingQueryCacheFilter;
-import org.h2.engine.Session;
-import org.h2.index.Cursor;
-import org.h2.index.IndexType;
-import org.h2.result.SearchRow;
-import org.h2.table.IndexColumn;
-import org.h2.table.TableFilter;
-
-/** Mock for registering Geo-Spatial indexes on client nodes in the H2 engine. */
-public class GridH2SpatialClientIndex extends GridH2SpatialBaseIndex {
- /** */
- private final AbstractClientIndex delegate;
-
- /** */
- public GridH2SpatialClientIndex(GeoSpatialClientIndex delegate) {
- super(delegate.tbl(), delegate.name(), delegate.cols().toArray(new IndexColumn[0]),
- IndexType.createNonUnique(false, false, true));
-
- this.delegate = delegate;
- }
-
- /** {@inheritDoc} */
- @Override public H2CacheRow put(H2CacheRow row) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public boolean putx(H2CacheRow row) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public boolean removex(SearchRow row) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public int segmentsCount() {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public long totalRowCount(IndexingQueryCacheFilter partsFilter) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public Cursor find(Session ses, SearchRow first, SearchRow last) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public boolean canGetFirstOrLast() {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public Cursor findFirstOrLast(Session ses, boolean first) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public long getRowCount(Session ses) {
- throw delegate.unsupported();
- }
-
- /** {@inheritDoc} */
- @Override public Cursor findByGeometry(TableFilter filter, SearchRow first, SearchRow last, SearchRow intersection) {
- throw delegate.unsupported();
- }
-}
diff --git a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
deleted file mode 100644
index 61323231cf0..00000000000
--- a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.opt;
-
-import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
-import org.apache.ignite.internal.cache.query.index.sorted.IndexValueCursor;
-import org.apache.ignite.internal.processors.query.h2.H2Cursor;
-import org.apache.ignite.internal.processors.query.h2.H2Utils;
-import org.apache.ignite.internal.util.lang.GridCursor;
-import org.apache.ignite.spi.indexing.IndexingQueryCacheFilter;
-import org.h2.engine.Session;
-import org.h2.index.Cursor;
-import org.h2.index.IndexLookupBatch;
-import org.h2.index.IndexType;
-import org.h2.result.SearchRow;
-import org.h2.table.IndexColumn;
-import org.h2.table.TableFilter;
-import org.h2.value.Value;
-import org.h2.value.ValueGeometry;
-import org.locationtech.jts.geom.Geometry;
-
-/**
- * H2 wrapper for a Geo-Spatial index.
- */
-public class GridH2SpatialIndex extends GridH2SpatialBaseIndex {
- /** */
- private final GeoSpatialIndexImpl delegate;
-
- /** */
- public GridH2SpatialIndex(GeoSpatialIndexImpl idx) {
- super(idx.def.rowHandler().getTable(),
- idx.def.idxName().idxName(),
- idx.def.rowHandler().getH2IdxColumns().toArray(new IndexColumn[0]),
- IndexType.createNonUnique(false, false, true));
-
- delegate = idx;
- }
-
- /** {@inheritDoc} */
- @Override public IndexLookupBatch createLookupBatch(TableFilter[] filters, int filter) {
- return delegate.createLookupBatch(filters, filter);
- }
-
- /** {@inheritDoc} */
- @Override public int segmentsCount() {
- return delegate.def.segmentsCnt();
- }
-
- /** {@inheritDoc} */
- @Override public void destroy(boolean rmIdx) {
- delegate.destroy(!rmIdx);
-
- super.destroy(rmIdx);
- }
-
- /** {@inheritDoc} */
- @Override public Cursor find(TableFilter filter, SearchRow first, SearchRow last) {
- GridCursor<IndexRow> cursor = delegate.find(segment(H2Utils.context(filter.getSession())), filter);
-
- GridCursor<H2Row> h2cursor = new IndexValueCursor<>(cursor, this::mapIndexRow);
-
- return new H2Cursor(h2cursor);
- }
-
- /** {@inheritDoc} */
- @Override public Cursor find(Session ses, SearchRow first, SearchRow last) {
- GridCursor<IndexRow> cursor = delegate.find(segment(H2Utils.context(ses)), null);
-
- GridCursor<H2Row> h2cursor = new IndexValueCursor<>(cursor, this::mapIndexRow);
-
- return new H2Cursor(h2cursor);
- }
-
- /** {@inheritDoc} */
- @Override public boolean canGetFirstOrLast() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public Cursor findFirstOrLast(Session ses, boolean first) {
- GridCursor<IndexRow> cursor = delegate.findFirstOrLast(H2Utils.context(ses).segment(), first);
-
- GridCursor<H2Row> h2cursor = new IndexValueCursor<>(cursor, this::mapIndexRow);
-
- return new H2Cursor(h2cursor);
- }
-
- /** {@inheritDoc} */
- @Override public long getRowCount(Session ses) {
- return delegate.totalCount();
- }
-
- /** {@inheritDoc} */
- @Override public long getRowCountApproximation() {
- return delegate.totalCount();
- }
-
- /** {@inheritDoc} */
- @Override public long totalRowCount(IndexingQueryCacheFilter partsFilter) {
- return delegate.totalCount();
- }
-
- /** {@inheritDoc} */
- @Override public Cursor findByGeometry(TableFilter filter, SearchRow first, SearchRow last,
- SearchRow intersection) {
-
- Value v = intersection.getValue(columnIds[0]);
- Geometry g = ((ValueGeometry)v.convertTo(Value.GEOMETRY)).getGeometry();
-
- int seg = segmentsCount() == 1 ? 0 : H2Utils.context(filter.getSession()).segment();
-
- GridCursor<IndexRow> cursor = delegate.findByGeometry(seg, filter, g);
-
- GridCursor<H2Row> h2cursor = new IndexValueCursor<>(cursor, this::mapIndexRow);
-
- return new H2Cursor(h2cursor);
- }
-
- /** */
- private H2Row mapIndexRow(IndexRow row) {
- if (row == null)
- return null;
-
- return new H2CacheRow(rowDescriptor(), row.cacheDataRow());
- }
-}
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
deleted file mode 100644
index 35b5847f0fa..00000000000
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.ignite.internal.processors.query.h2;
-
-import java.util.List;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Test expose SPATIAL indexes through SQL system view INDEXES.
- */
-public class H2IndexesSystemViewTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration() throws Exception {
- return super.getConfiguration().setCacheConfiguration(new CacheConfiguration().setName(DEFAULT_CACHE_NAME));
- }
-
- /**
- * Test indexes system view.
- *
- * @throws Exception in case of failure.
- */
- @Test
- public void testIndexesView() throws Exception {
- IgniteEx srv = startGrid(getConfiguration());
-
- IgniteEx client = startClientGrid(getConfiguration().setIgniteInstanceName("CLIENT"));
-
- execSql("CREATE TABLE PUBLIC.AFF_CACHE (ID1 INT, ID2 INT, GEOM GEOMETRY, PRIMARY KEY (ID1))");
-
- execSql("CREATE SPATIAL INDEX IDX_GEO_1 ON PUBLIC.AFF_CACHE(GEOM)");
-
- String idxSql = "SELECT " +
- " CACHE_ID," +
- " CACHE_NAME," +
- " SCHEMA_NAME," +
- " TABLE_NAME," +
- " INDEX_NAME," +
- " INDEX_TYPE," +
- " COLUMNS," +
- " IS_PK," +
- " IS_UNIQUE," +
- " INLINE_SIZE" +
- " FROM SYS.INDEXES ORDER BY TABLE_NAME, INDEX_NAME";
-
- List<List<?>> srvNodeIndexes = execSql(srv, idxSql);
-
- List<List<?>> clientNodeNodeIndexes = execSql(client, idxSql);
-
- for (List<?> idx : clientNodeNodeIndexes)
- assertTrue(srvNodeIndexes.contains(idx));
-
- Object[][] expectedResults = {
- {-825022849, "SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "IDX_GEO_1", "SPATIAL", "\"GEOM\" ASC", false, false, null},
- {-825022849, "SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "__SCAN_", "SCAN", null, false, false, null},
- {-825022849, "SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "_key_PK", "BTREE", "\"ID1\" ASC", true, true, 5},
- {-825022849, "SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "_key_PK_hash", "HASH", "\"ID1\" ASC", false, true, null}
- };
-
- for (int i = 0; i < srvNodeIndexes.size(); i++) {
- List<?> resRow = srvNodeIndexes.get(i);
-
- Object[] expRow = expectedResults[i];
-
- assertEquals(expRow.length, resRow.size());
-
- for (int j = 0; j < expRow.length; j++)
- assertEquals(expRow[j], resRow.get(j));
- }
- }
-
- /**
- * @param sql Sql.
- * @param args Args.
- */
- private List<List<?>> execSql(String sql, Object... args) {
- return execSql(grid(), sql, args);
- }
-
- /**
- * @param ignite Ignite.
- * @param sql Sql.
- * @param args Args.
- */
- @SuppressWarnings("unchecked")
- private List<List<?>> execSql(Ignite ignite, String sql, Object... args) {
- IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME);
-
- SqlFieldsQuery qry = new SqlFieldsQuery(sql);
-
- if (args != null && args.length > 0)
- qry.setArgs(args);
-
- return cache.query(qry).getAll();
- }
-
-}
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
deleted file mode 100644
index 5cd3de20515..00000000000
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.Cache;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.QueryIndexType;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.query.QueryUtils;
-import org.apache.ignite.internal.util.GridStringBuilder;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.io.ParseException;
-import org.locationtech.jts.io.WKTReader;
-
-/**
- * Geo-indexing test.
- */
-@RunWith(Parameterized.class)
-public abstract class H2IndexingAbstractGeoSelfTest extends GridCommonAbstractTest {
- /** */
- private static final int CNT = 100;
-
- /** */
- private static final long DUR = 60000L;
-
- /** Number of generated samples. */
- public static final int ENEMYCAMP_SAMPLES_COUNT = 500;
-
- /** Number of generated samples. */
- public static final int ENEMY_SAMPLES_COUNT = 1000;
-
- /** */
- private static final int QRY_PARALLELISM_LVL = 7;
-
- /** Segmented index flag. */
- private final boolean segmented;
-
- /** Node that creates a Geo-Spatial index. {@code true} for coordinator node, otherwise client node. */
- @Parameterized.Parameter
- public boolean crtNode;
-
- /** Node that stars a query over a Geo-Spatial index. {@code true} for coordinator node, otherwise client node. */
- @Parameterized.Parameter(1)
- public boolean qryNode;
-
- /** */
- private IgniteEx cln;
-
- /** */
- private IgniteEx srv;
-
- /** */
- @Parameterized.Parameters(name = "crtNode={0}, qryNode={1}")
- public static Collection<Object[]> parameters() {
- List<Boolean> nodes = F.asList(false, true);
-
- return GridTestUtils.cartesianProduct(nodes, nodes);
- }
-
- /**
- * Constructor.
- *
- * @param segmented Segmented index flag.
- */
- protected H2IndexingAbstractGeoSelfTest(boolean segmented) {
- this.segmented = segmented;
- }
-
- /** {@inheritDoc} */
- @Override public void beforeTest() throws Exception {
- srv = startGrids(3);
-
- cln = startClientGrid();
- }
-
- /** {@inheritDoc} */
- @Override public void afterTest() {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return DUR * 3;
- }
-
- /**
- * Create cache.
- *
- * @param name Name.
- * @param partitioned Partitioned flag.
- * @param keyCls Key class.
- * @param valCls Value class.
- * @return Cache.
- * @throws Exception If failed.
- */
- protected <K, V> IgniteCache<K, V> createCache(String name, boolean partitioned, Class<?> keyCls, Class<?> valCls)
- throws Exception {
- return createCache(name, partitioned, keyCls, valCls, false);
- }
-
- /**
- * Create cache.
- *
- * @param name Name.
- * @param partitioned Partitioned flag.
- * @param keyCls Key class.
- * @param valCls Value class.
- * @param dynamicIdx Whether index should be created dynamically.
- * @return Cache.
- * @throws Exception If failed.
- */
- protected <K, V> IgniteCache<K, V> createCache(String name, boolean partitioned, Class<?> keyCls, Class<?> valCls,
- boolean dynamicIdx) throws Exception {
- CacheConfiguration<K, V> ccfg = cacheConfig(name, partitioned, keyCls, valCls);
-
- IgniteEx crtIgn = crtNode ? srv : cln;
-
- if (dynamicIdx) {
- Collection<QueryEntity> entities = ccfg.getQueryEntities();
-
- assertEquals(1, entities.size());
-
- QueryEntity entity = entities.iterator().next();
-
- Collection<QueryIndex> idxs = new ArrayList<>(entity.getIndexes());
-
- entity.setIndexes(null);
-
- crtIgn.context().cache().dynamicStartSqlCache(ccfg).get();
-
- // Process indexes dynamically.
- for (QueryIndex idx : idxs) {
- QueryEntity normalEntity = QueryUtils.normalizeQueryEntity(grid(0).context(), entity, ccfg.isSqlEscapeAll());
-
- createDynamicIndex(crtIgn.cache(name), normalEntity, idx);
- }
- }
- else
- crtIgn.getOrCreateCache(ccfg);
-
- return (qryNode ? srv : cln).cache(name);
- }
-
- /**
- * Create dynamic index.
- *
- * @param cache Cache.
- * @param entity Entity.
- * @param idx Index.
- */
- private void createDynamicIndex(IgniteCache<?, ?> cache, QueryEntity entity, QueryIndex idx) {
- boolean spatial = idx.getIndexType() == QueryIndexType.GEOSPATIAL;
-
- GridStringBuilder sb = new SB("CREATE ")
- .a(spatial ? "SPATIAL " : "")
- .a("INDEX ")
- .a("\"" + idx.getName() + "\"")
- .a(" ON ")
- .a(QueryUtils.tableName(entity))
- .a(" (");
-
- boolean first = true;
-
- for (Map.Entry<String, Boolean> fieldEntry : idx.getFields().entrySet()) {
- if (first)
- first = false;
- else
- sb.a(", ");
-
- String name = fieldEntry.getKey();
- boolean asc = fieldEntry.getValue();
-
- sb.a("\"" + name + "\"").a(" ").a(asc ? "ASC" : "DESC");
- }
-
- sb.a(')');
-
- String sql = sb.toString();
-
- cache.query(new SqlFieldsQuery(sql)).getAll();
- }
-
- /**
- * @param name Cache name.
- * @param partitioned Partition or replicated cache.
- * @param keyCls Key class.
- * @param valCls Value class.
- * @return Cache configuration.
- */
- private <K, V> CacheConfiguration<K, V> cacheConfig(@NotNull String name, boolean partitioned, Class<?> keyCls,
- Class<?> valCls) {
- CacheConfiguration<K, V> ccfg = new CacheConfiguration<K, V>(name)
- .setName(name)
- .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
- .setAtomicityMode(CacheAtomicityMode.ATOMIC)
- .setIndexedTypes(keyCls, valCls);
-
- if (segmented)
- ccfg.setQueryParallelism(partitioned ? QRY_PARALLELISM_LVL : 1);
-
- return ccfg;
- }
-
- /**
- * Destroy cache.
- *
- * @param cache Cache.
- * @param grid Node.
- * @param dynamic Dynamic flag.
- */
- private static void destroy(IgniteCache<?, ?> cache, IgniteEx grid, boolean dynamic) {
- if (!dynamic)
- cache.destroy();
- else
- grid.context().cache().dynamicDestroyCache(cache.getName(), true, true, false, null);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPrimitiveGeometry() throws Exception {
- IgniteCache<Long, Geometry> cache = createCache("geom", true, Long.class, Geometry.class);
-
- try {
- WKTReader r = new WKTReader();
-
- for (long i = 0; i < 100; i++)
- cache.put(i, r.read("POINT(" + i + " " + i + ")"));
-
- String plan = cache.query(new SqlFieldsQuery("explain select _key from Geometry where _val && ?")
- .setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))")))
- .getAll().get(0).get(0).toString().toLowerCase();
-
- assertTrue("__ explain: " + plan, plan.contains("_val_idx"));
- }
- finally {
- cache.destroy();
- }
- }
-
- /**
- * Test geo-index (static).
- *
- * @throws Exception If failed.
- */
- @Test
- public void testGeo() throws Exception {
- checkGeo(false);
- }
-
- /**
- * Test geo-index (dynamic).
- *
- * @throws Exception If failed.
- */
- @Test
- public void testGeoDynamic() throws Exception {
- checkGeo(true);
- }
-
- /**
- * Check geo-index (dynamic).
- *
- * @param dynamic Whether index should be created dynamically.
- * @throws Exception If failed.
- */
- @SuppressWarnings({"unchecked", "ConstantConditions"})
- private void checkGeo(boolean dynamic) throws Exception {
- IgniteCache<Integer, EnemyCamp> cache = createCache("camp", true, Integer.class, EnemyCamp.class, dynamic);
-
- try {
- WKTReader r = new WKTReader();
-
- cache.getAndPut(0, new EnemyCamp(r.read("POINT(25 75)"), "A"));
- cache.getAndPut(1, new EnemyCamp(r.read("POINT(70 70)"), "B"));
- cache.getAndPut(2, new EnemyCamp(r.read("POINT(70 30)"), "C"));
- cache.getAndPut(3, new EnemyCamp(r.read("POINT(75 25)"), "D"));
-
- SqlQuery<Integer, EnemyCamp> qry = new SqlQuery(EnemyCamp.class, "coords && ?");
-
- Collection<Cache.Entry<Integer, EnemyCamp>> res = cache.query(
- qry.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll();
-
- checkPoints(res, "A");
-
- res = cache.query(
- qry.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll();
-
- checkPoints(res, "C", "D");
-
- // Move B to the first polygon.
- cache.getAndPut(1, new EnemyCamp(r.read("POINT(20 75)"), "B"));
-
- res = cache.query(
- qry.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll();
-
- checkPoints(res, "A", "B");
-
- // Move B to the second polygon.
- cache.getAndPut(1, new EnemyCamp(r.read("POINT(30 30)"), "B"));
-
- res = cache.query(
- qry.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll();
-
- checkPoints(res, "B", "C", "D");
-
- // Remove B.
- cache.getAndRemove(1);
-
- res = cache.query(
- qry.setArgs(r.read("POLYGON((5 70, 5 80, 30 80, 30 70, 5 70))"))).getAll();
-
- checkPoints(res, "A");
-
- res = cache.query(
- qry.setArgs(r.read("POLYGON((10 5, 10 35, 70 30, 75 25, 10 5))"))).getAll();
-
- checkPoints(res, "C", "D");
-
- // Check explain request.
- String plan = cache.query(new SqlFieldsQuery("explain select * from EnemyCamp " +
- "where coords && 'POINT(25 75)'")).getAll().get(0).get(0).toString().toLowerCase();
-
- assertTrue("__ explain: " + plan, plan.contains("coords_idx"));
-
- if (dynamic)
- cache.query(new SqlFieldsQuery("DROP INDEX \"EnemyCamp_coords_idx\"")).getAll();
- }
- finally {
- destroy(cache, grid(0), dynamic);
- }
- }
-
- /**
- * Test geo indexing multithreaded.
- *
- * @throws Exception If failed.
- */
- @Test
- public void testGeoMultithreaded() throws Exception {
- checkGeoMultithreaded(false);
- }
-
- /**
- * Test geo indexing multithreaded with dynamic index creation.
- *
- * @throws Exception If failed.
- */
- @Test
- public void testGeoMultithreadedDynamic() throws Exception {
- checkGeoMultithreaded(true);
- }
-
- /**
- * Check geo indexing multithreaded with dynamic index creation.
- *
- * @param dynamic Whether index should be created dynamically.
- * @throws Exception If failed.
- */
- private void checkGeoMultithreaded(boolean dynamic) throws Exception {
- final IgniteCache<Integer, EnemyCamp> cache1 =
- createCache("camp", true, Integer.class, EnemyCamp.class, dynamic);
-
- final IgniteCache<Integer, EnemyCamp> cache2 = grid(1).cache("camp");
- final IgniteCache<Integer, EnemyCamp> cache3 = grid(2).cache("camp");
-
- try {
- final String[] points = new String[CNT];
-
- WKTReader r = new WKTReader();
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- for (int idx = 0; idx < CNT; idx++) {
- int x = rnd.nextInt(1, 100);
- int y = rnd.nextInt(1, 100);
-
- cache1.getAndPut(idx, new EnemyCamp(r.read("POINT(" + x + " " + y + ")"), Integer.toString(idx)));
-
- points[idx] = Integer.toString(idx);
- }
-
- Thread.sleep(200);
-
- final AtomicBoolean stop = new AtomicBoolean();
- final AtomicReference<Exception> err = new AtomicReference<>();
-
- IgniteInternalFuture<?> putFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
- @Override public Void call() throws Exception {
- WKTReader r = new WKTReader();
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- while (!stop.get()) {
- int cacheIdx = rnd.nextInt(0, 3);
-
- IgniteCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3;
-
- int idx = rnd.nextInt(CNT);
- int x = rnd.nextInt(1, 100);
- int y = rnd.nextInt(1, 100);
-
- cache.getAndPut(idx, new EnemyCamp(r.read("POINT(" + x + " " + y + ")"), Integer.toString(idx)));
-
- U.sleep(50);
- }
-
- return null;
- }
- }, Runtime.getRuntime().availableProcessors(), "put-thread");
-
- IgniteInternalFuture<?> qryFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
- @Override public Void call() {
- WKTReader r = new WKTReader();
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- while (!stop.get()) {
- try {
- int cacheIdx = rnd.nextInt(0, 3);
-
- IgniteCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 : cacheIdx == 1 ? cache2 : cache3;
-
- SqlQuery<Integer, EnemyCamp> qry = new SqlQuery<>(
- EnemyCamp.class, "coords && ?");
-
- Collection<Cache.Entry<Integer, EnemyCamp>> res = cache.query(qry.setArgs(
- r.read("POLYGON((0 0, 0 100, 100 100, 100 0, 0 0))"))).getAll();
-
- checkPoints(res, points);
-
- U.sleep(5);
- }
- catch (Exception e) {
- err.set(e);
-
- stop.set(true);
-
- break;
- }
- }
-
- return null;
- }
- }, 4, "qry-thread");
-
- U.sleep(6000L);
-
- stop.set(true);
-
- putFut.get();
- qryFut.get();
-
- Exception err0 = err.get();
-
- if (err0 != null)
- throw err0;
- }
- finally {
- destroy(cache1, grid(0), dynamic);
- }
- }
-
- /**
- * Check whether result contains all required points.
- *
- * @param res Result.
- * @param points Expected points.
- */
- private void checkPoints(Collection<Cache.Entry<Integer, EnemyCamp>> res, String... points) {
- Set<String> set = new HashSet<>(Arrays.asList(points));
-
- assertEquals(set.size(), res.size());
-
- for (Cache.Entry<Integer, EnemyCamp> e : res)
- assertTrue(set.remove(e.getValue().name));
- }
-
- /**
- * Test segmented geo-index join on PARTITIONED cache.
- *
- * @throws Exception if fails.
- */
- @Test
- public void testSegmentedGeoIndexJoinPartitioned() throws Exception {
- checkSegmentedGeoIndexJoin(true, false);
- }
-
- /**
- * Test segmented geo-index join on PARTITIONED cache with dynamically created index.
- *
- * @throws Exception if fails.
- */
- @Test
- public void testSegmentedGeoIndexJoinPartitionedDynamic() throws Exception {
- checkSegmentedGeoIndexJoin(true, true);
- }
-
- /**
- * Test segmented geo-index join on REPLICATED cache.
- *
- * @throws Exception if fails.
- */
- @Test
- public void testSegmentedGeoIndexJoinReplicated() throws Exception {
- checkSegmentedGeoIndexJoin(false, false);
- }
-
- /**
- * Test segmented geo-index join on REPLICATED cache with dynamically created index.
- *
- * @throws Exception if fails.
- */
- @Test
- public void testSegmentedGeoIndexJoinReplicatedDynamic() throws Exception {
- checkSegmentedGeoIndexJoin(false, true);
- }
-
- /**
- * Check segmented geo-index join.
- *
- * @param partitioned Partitioned flag.
- * @param dynamic Whether index should be created dynamically.
- * @throws Exception If failed.
- */
- private void checkSegmentedGeoIndexJoin(boolean partitioned, boolean dynamic) throws Exception {
- IgniteCache<Integer, Enemy> c1 = createCache("enemy", true, Integer.class, Enemy.class);
- IgniteCache<Integer, EnemyCamp> c2 = createCache("camp", partitioned, Integer.class, EnemyCamp.class, dynamic);
-
- try {
- final ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- WKTReader r = new WKTReader();
-
- for (int i = 0; i < ENEMYCAMP_SAMPLES_COUNT; i++) {
- final String point = String.format("POINT(%d %d)", rnd.nextInt(100), rnd.nextInt(100));
-
- c2.put(i, new EnemyCamp(r.read(point), "camp-" + i));
- }
-
- for (int i = 0; i < ENEMY_SAMPLES_COUNT; i++) {
- int campID = 30 + rnd.nextInt(ENEMYCAMP_SAMPLES_COUNT + 10);
-
- c1.put(i, new Enemy(campID, "enemy-" + i));
- }
-
- checkDistributedQuery();
- }
- finally {
- destroy(c1, grid(0), dynamic);
- destroy(c2, grid(0), dynamic);
- }
- }
-
- /**
- * Check distributed query.
- *
- * @throws ParseException If failed.
- */
- private void checkDistributedQuery() throws ParseException {
- IgniteCache<Integer, Enemy> c1 = grid(0).cache("enemy");
- IgniteCache<Integer, EnemyCamp> c2 = grid(0).cache("camp");
-
- final Geometry lethalArea = new WKTReader().read("POLYGON((30 30, 30 70, 70 70, 70 30, 30 30))");
-
- int expectedEnemies = 0;
-
- for (Cache.Entry<Integer, Enemy> e : c1) {
- final int campID = e.getValue().campId;
-
- if (30 <= campID && campID < ENEMYCAMP_SAMPLES_COUNT) {
- final EnemyCamp camp = c2.get(campID);
-
- if (lethalArea.covers(camp.coords))
- expectedEnemies++;
- }
- }
-
- final SqlFieldsQuery qry = new SqlFieldsQuery("select e._val, c._val from \"enemy\".Enemy e, " +
- "\"camp\".EnemyCamp c where e.campId = c._key and c.coords && ?").setArgs(lethalArea);
-
- List<List<?>> result = c1.query(qry.setDistributedJoins(true)).getAll();
-
- assertEquals(expectedEnemies, result.size());
- }
-
- /**
- *
- */
- private static class Enemy {
- /** */
- @QuerySqlField(index = true)
- int campId;
-
- /** */
- @QuerySqlField
- String name;
-
- /**
- * @param campId Camp ID.
- * @param name Name.
- */
- public Enemy(int campId, String name) {
- this.campId = campId;
- this.name = name;
- }
- }
-
- /**
- *
- */
- protected static class EnemyCamp implements Serializable {
- /** */
- @QuerySqlField(index = true)
- final Geometry coords;
-
- /** */
- @QuerySqlField
- private final String name;
-
- /**
- * @param coords Coordinates.
- * @param name Name.
- */
- EnemyCamp(Geometry coords, String name) {
- this.coords = coords;
- this.name = name;
- }
- }
-}
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingGeoSelfTest.java
deleted file mode 100644
index bda187a1a1a..00000000000
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingGeoSelfTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2;
-
-/**
- * Geo-indexing test.
- */
-public class H2IndexingGeoSelfTest extends H2IndexingAbstractGeoSelfTest {
- /**
- * Constructor.
- */
- public H2IndexingGeoSelfTest() {
- super(false);
- }
-}
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingSegmentedGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingSegmentedGeoSelfTest.java
deleted file mode 100644
index fbb5274d33b..00000000000
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingSegmentedGeoSelfTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2;
-
-/**
- * Test for segmented geo index.
- */
-public class H2IndexingSegmentedGeoSelfTest extends H2IndexingAbstractGeoSelfTest {
- /**
- * Constructor.
- */
- public H2IndexingSegmentedGeoSelfTest() {
- super(true);
- }
-}
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java b/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java
deleted file mode 100644
index f5cd2962ba8..00000000000
--- a/modules/geospatial/src/test/java/org/apache/ignite/testsuites/GeoSpatialIndexingTestSuite.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.testsuites;
-
-import org.apache.ignite.internal.processors.query.h2.H2IndexesSystemViewTest;
-import org.apache.ignite.internal.processors.query.h2.H2IndexingGeoSelfTest;
-import org.apache.ignite.internal.processors.query.h2.H2IndexingSegmentedGeoSelfTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Geospatial indexing tests.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- H2IndexingGeoSelfTest.class,
- H2IndexingSegmentedGeoSelfTest.class,
- H2IndexesSystemViewTest.class
-})
-public class GeoSpatialIndexingTestSuite {
-}
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index 7e2b5ff63df..b5c6c1702fb 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -170,8 +170,8 @@
<!-- Generate the OSGi MANIFEST.MF for this bundle.
This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
- the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-geospatial, thus
- leading to a split package situation in OSGi. It also contains an internal processor.
+ the org.apache.ignite.internal.processors.query.h2.opt, thus leading to a split package situation in OSGi.
+ It also contains an internal processor.
-->
<plugin>
<groupId>org.apache.felix</groupId>
diff --git a/modules/osgi-karaf/src/main/resources/features.xml b/modules/osgi-karaf/src/main/resources/features.xml
index 479b57f9f63..9458090cc76 100644
--- a/modules/osgi-karaf/src/main/resources/features.xml
+++ b/modules/osgi-karaf/src/main/resources/features.xml
@@ -27,7 +27,7 @@
- restart the Apache Karaf container.
You may safely ignore the 'Resource has no uri' exception if you follow this method.
- NOTE #2: This feature *does not* include components that depend on LGPL software (e.g. ignite-geospatial).]]>
+ NOTE #2: This feature *does not* include components that depend on LGPL software.]]>
</details>
<feature>ignite-core</feature>
<feature>ignite-aop</feature>
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
index 1a2d0ee5706..b72aaf31680 100644
--- a/modules/osgi/pom.xml
+++ b/modules/osgi/pom.xml
@@ -119,8 +119,8 @@
<!-- Generate the OSGi MANIFEST.MF for this bundle.
This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
- the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-geospatial, thus
- leading to a split package situation in OSGi. It also contains an internal processor.
+ the org.apache.ignite.internal.processors.query.h2.opt, thus leading to a split package situation in OSGi.
+ It also contains an internal processor.
-->
<plugin>
<groupId>org.apache.felix</groupId>
diff --git a/pom.xml b/pom.xml
index 5f825d9f92e..506ffb9d8f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,7 +91,6 @@
<module>modules/benchmarks</module>
<module>modules/compatibility</module>
<module>modules/ducktests</module>
- <module>modules/geospatial</module>
<module>modules/numa-allocator</module>
<module>modules/schedule</module>
<module>modules/yardstick</module>
@@ -264,7 +263,6 @@
<profile>
<id>lgpl</id>
<modules>
- <module>modules/geospatial</module>
<module>modules/schedule</module>
</modules>
</profile>