diff --git a/assembly/dependencies-apache-ignite-lgpl.xml b/assembly/dependencies-apache-ignite-lgpl.xml index 51754b12f58e1..fc875284fe867 100644 --- a/assembly/dependencies-apache-ignite-lgpl.xml +++ b/assembly/dependencies-apache-ignite-lgpl.xml @@ -34,6 +34,7 @@ ${project.groupId}:ignite-spring ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-control-utility @@ -130,6 +131,7 @@ ${project.groupId}:ignite-extdata-pluggable ${project.groupId}:ignite-examples ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-codegen ${project.groupId}:ignite-appserver-test ${project.groupId}:ignite-websphere-test diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml index 68cfd59abbc72..c55073702894c 100644 --- a/assembly/dependencies-apache-ignite-slim.xml +++ b/assembly/dependencies-apache-ignite-slim.xml @@ -34,6 +34,7 @@ ${project.groupId}:ignite-spring ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-control-utility @@ -130,6 +131,7 @@ ${project.groupId}:ignite-extdata-pluggable ${project.groupId}:ignite-examples ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-codegen ${project.groupId}:ignite-schedule ${project.groupId}:ignite-appserver-test diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml index cc6b475b106b9..bcfaad8417088 100644 --- a/assembly/dependencies-apache-ignite.xml +++ b/assembly/dependencies-apache-ignite.xml @@ -34,6 +34,7 @@ ${project.groupId}:ignite-spring ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-control-utility @@ -131,6 +132,7 @@ ${project.groupId}:ignite-extdata-pluggable ${project.groupId}:ignite-examples ${project.groupId}:ignite-calcite + ${project.groupId}:ignite-indexing ${project.groupId}:ignite-codegen ${project.groupId}:ignite-schedule ${project.groupId}:ignite-appserver-test diff --git a/docs/_docs/setup.adoc b/docs/_docs/setup.adoc index 8cdb8bcc9e012..d70ce9a131c3a 100644 --- a/docs/_docs/setup.adoc +++ b/docs/_docs/setup.adoc @@ -151,8 +151,8 @@ Ignite ships with a number of modules and have a lot of extensions that provide You can enable modules or extensions one by one, as required. All modules are included in the binary distribution, but by default they -are disabled (except for the `ignite-core`, `ignite-spring`, `ignite-control-utility` and -`ignite-indexing` modules). Modules can be found in the `libs/optional` +are disabled (except for the `ignite-core`, `ignite-spring`, `ignite-control-utility`, +`ignite-calcite` and `ignite-indexing` modules). Modules can be found in the `libs/optional` directory of the distribution package (each module is located in a separate sub-directory). diff --git a/modules/calcite-testing/pom.xml b/modules/calcite-testing/pom.xml index ab7ed13e5f260..b0381ed85e41d 100644 --- a/modules/calcite-testing/pom.xml +++ b/modules/calcite-testing/pom.xml @@ -66,6 +66,12 @@ test + + ${project.groupId} + ignite-spring + test + + ${project.groupId} ignite-calcite diff --git a/modules/calcite-testing/src/test/config/jdbc-client-driver-calcite.xml b/modules/calcite-testing/src/test/config/jdbc-client-driver-calcite.xml new file mode 100644 index 0000000000000..64f8a2074f595 --- /dev/null +++ b/modules/calcite-testing/src/test/config/jdbc-client-driver-calcite.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + 127.0.0.1:47500..47509 + + + + + + + + diff --git a/modules/calcite-testing/src/test/config/jdbc-client-driver-h2.xml b/modules/calcite-testing/src/test/config/jdbc-client-driver-h2.xml new file mode 100644 index 0000000000000..27bf72b11c719 --- /dev/null +++ b/modules/calcite-testing/src/test/config/jdbc-client-driver-h2.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + 127.0.0.1:47500..47509 + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java index 272fb24019d52..24cb8f4d2b1f9 100644 --- a/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java +++ b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java @@ -99,7 +99,7 @@ public void testInvalidConfiguration() { /** */ @Test public void testDefaultEngineConfiguration() throws Exception { - checkDefaultEngine(INDEXING_ENGINE); + checkDefaultEngine(CALCITE_ENGINE); checkDefaultEngine(INDEXING_ENGINE, new IndexingQueryEngineConfiguration(), new CalciteQueryEngineConfiguration()); @@ -149,22 +149,28 @@ public void testEngineByHint() throws Exception { } } - /** */ + /** Without an explicit configuration both engines on the classpath can be selected by name. */ @Test @SuppressWarnings("ThrowableNotThrown") public void testEngineWithoutConfiguration() throws Exception { try (Ignite ignite = startGrid(createConfiguration())) { IgniteCache cache = ignite.createCache("test"); - // Hint can't be used when engines is not configured. + checkEngine(cache, CALCITE_ENGINE, "SELECT QUERY_ENGINE()"); + checkEngine(cache, INDEXING_ENGINE, "SELECT /*+ QUERY_ENGINE('" + INDEXING_ENGINE + "') */ QUERY_ENGINE()"); + checkEngine(cache, CALCITE_ENGINE, "SELECT /*+ QUERY_ENGINE('" + CALCITE_ENGINE + "') */ QUERY_ENGINE()"); + + checkJdbcEngine(CALCITE_ENGINE, jdbcUrl, "SELECT QUERY_ENGINE()"); + checkJdbcEngine(INDEXING_ENGINE, jdbcUrl + "?queryEngine=" + INDEXING_ENGINE, "SELECT QUERY_ENGINE()"); + checkJdbcEngine(CALCITE_ENGINE, jdbcUrl + "?queryEngine=" + CALCITE_ENGINE, "SELECT QUERY_ENGINE()"); + + // Unknown engine. GridTestUtils.assertThrowsWithCause( - () -> cache.query(new SqlFieldsQuery( - "SELECT /*+ QUERY_ENGINE('" + INDEXING_ENGINE + "') */ QUERY_ENGINE()")).getAll(), + () -> cache.query(new SqlFieldsQuery("SELECT /*+ QUERY_ENGINE('noop') */ QUERY_ENGINE()")).getAll(), IgniteException.class); - // JDBC connection property can't be used when engines is not configured. GridTestUtils.assertThrowsWithCause( - () -> DriverManager.getConnection(jdbcUrl + "?queryEngine=" + INDEXING_ENGINE), + () -> DriverManager.getConnection(jdbcUrl + "?queryEngine=noop"), SQLException.class); } } diff --git a/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java index 54369aabf2e84..b4a02664bd68a 100644 --- a/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java +++ b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java @@ -480,25 +480,25 @@ public void testResetPlanHistoryMetrics() throws Exception { } /** - * Checks that the actual SQL plan history remains empty and its size in {@link SqlConfiguration} equals {@code -1} - * when SQL is not explicitly configured. In such cases, H2 is used as the default engine. + * Checks that the SQL plan history is enabled with the default size when SQL is not explicitly configured. In such + * cases, both engines are on the classpath and Calcite is used as the default engine. */ @Test public void testNoSqlConfiguration() throws Exception { isSqlConfigured = false; - checkDefaultHistorySize(true, -1, 0, 1); + checkDefaultHistorySize(true, DFLT_SQL_PLAN_HISTORY_SIZE, DFLT_SQL_PLAN_HISTORY_SIZE, DFLT_SQL_PLAN_HISTORY_SIZE); } /** - * Checks that the actual SQL plan history remains empty and its size in {@link SqlConfiguration} equals {@code -1} - * when the SQL engine is not configured. In such cases, H2 is used as the default engine. + * Checks that the SQL plan history is enabled with the default size when the SQL engine is not configured. In such + * cases, both engines are on the classpath and Calcite is used as the default engine. */ @Test public void testNoSqlEngineConfiguration() throws Exception { isSqlEngineConfigured = false; - checkDefaultHistorySize(true, -1, 0, 1); + checkDefaultHistorySize(true, DFLT_SQL_PLAN_HISTORY_SIZE, DFLT_SQL_PLAN_HISTORY_SIZE, DFLT_SQL_PLAN_HISTORY_SIZE); } /** diff --git a/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcClientDriverDefaultEngineTest.java b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcClientDriverDefaultEngineTest.java new file mode 100644 index 0000000000000..e9af8fd7941e7 --- /dev/null +++ b/modules/calcite-testing/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcClientDriverDefaultEngineTest.java @@ -0,0 +1,122 @@ +/* + * 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.calcite.jdbc; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.SqlConfiguration; +import org.apache.ignite.indexing.IndexingQueryEngineConfiguration; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.Parameter; +import org.junit.jupiter.params.ParameterizedClass; +import org.junit.jupiter.params.provider.ValueSource; + +/** Checks that the JDBC Client Driver ({@code jdbc:ignite:cfg://}) works with any default SQL engine of the client node it starts. */ +@ParameterizedClass(name = "engine={0}") +@ValueSource(strings = {IndexingQueryEngineConfiguration.ENGINE_NAME, CalciteQueryEngineConfiguration.ENGINE_NAME}) +public class JdbcClientDriverDefaultEngineTest extends AbstractJdbcTest { + /** Directory with the Spring XML configurations of the client node started by the driver. */ + private static final String CFG_DIR = "modules/calcite-testing/src/test/config/"; + + /** Name of the default engine. */ + @Parameter(0) + private String dfltEngine; + + /** */ + private Connection conn; + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + if (dfltEngine.equals(IndexingQueryEngineConfiguration.ENGINE_NAME)) { + cfg.setSqlConfiguration(new SqlConfiguration().setQueryEnginesConfiguration( + new IndexingQueryEngineConfiguration().setDefault(true), + new CalciteQueryEngineConfiguration())); + } + + return cfg; + } + + /** {@inheritDoc} */ + @BeforeEach + @Override protected void beforeTest() throws Exception { + startGrid(0); + + serverSql("CREATE TABLE test (id INT PRIMARY KEY, val VARCHAR)"); + serverSql("INSERT INTO test VALUES (1, 'val1'), (2, 'val2')"); + + conn = DriverManager.getConnection("jdbc:ignite:cfg://" + CFG_DIR + "jdbc-client-driver-" + dfltEngine + ".xml"); + + conn.setSchema("PUBLIC"); + } + + /** {@inheritDoc} */ + @AfterEach + @Override protected void afterTest() throws Exception { + U.closeQuiet(conn); + + stopAllGrids(); + } + + /** */ + @Test + public void testSelect() throws Exception { + checkEngine(); + + List> res = executeQuery(conn, "SELECT id, val FROM test ORDER BY id"); + + assertEquals(2, res.size()); + assertEquals(1, res.get(0).get(0)); + assertEquals("val1", res.get(0).get(1)); + assertEquals(2, res.get(1).get(0)); + assertEquals("val2", res.get(1).get(1)); + } + + /** */ + @Test + public void testDml() throws Exception { + try (Statement stmt = conn.createStatement()) { + assertEquals(1, stmt.executeUpdate("INSERT INTO test VALUES (3, 'val3')")); + } + + assertEquals(3L, serverSql("SELECT COUNT(*) FROM test").get(0).get(0)); + } + + /** Executes a query on the server node with its default engine. */ + private List> serverSql(String sql) { + return grid(0).context().query().querySqlFields(new SqlFieldsQuery(sql), false).getAll(); + } + + /** */ + private void checkEngine() throws SQLException { + List> res = executeQuery(conn, "SELECT QUERY_ENGINE()"); + + assertEquals(1, res.size()); + assertEquals(dfltEngine, res.get(0).get(0)); + } +} diff --git a/modules/calcite-testing/src/test/java/org/apache/ignite/testsuites/CalciteAndH2TestSuite.java b/modules/calcite-testing/src/test/java/org/apache/ignite/testsuites/CalciteAndH2TestSuite.java index df0f41142436a..6ad50c4702863 100644 --- a/modules/calcite-testing/src/test/java/org/apache/ignite/testsuites/CalciteAndH2TestSuite.java +++ b/modules/calcite-testing/src/test/java/org/apache/ignite/testsuites/CalciteAndH2TestSuite.java @@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.SqlPlanHistoryIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.TimeoutIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.ViewsIntegrationTest; +import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcClientDriverDefaultEngineTest; import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcCrossEngineTest; import org.apache.ignite.internal.processors.query.calcite.thin.MultiLineQueryTest; import org.apache.ignite.internal.processors.tx.TxWithExceptionalInterceptorTest; @@ -36,6 +37,7 @@ @Suite @SelectClasses({ JdbcCrossEngineTest.class, + JdbcClientDriverDefaultEngineTest.class, MultiLineQueryTest.class, TimeoutIntegrationTest.class, TxWithExceptionalInterceptorTest.class, diff --git a/modules/calcite/README.txt b/modules/calcite/README.txt index 5b31619d75540..854e2c680d252 100644 --- a/modules/calcite/README.txt +++ b/modules/calcite/README.txt @@ -3,8 +3,8 @@ Apache Ignite Calcite Module Apache Ignite Calcite module provides Apache Calcite based query engine. -To enable Calcite based engine explicit `CalciteQueryEngineConfiguration` instance should be added to -`SqlConfiguration.QueryEnginesConfiguration` property (see `SqlConfiguration.setQueryEnginesConfiguration()`) or ./examples/config/example-sql.xml. +Calcite based engine is default. +If legacy mode required then `IndexingQueryEngineConfiguration` must be set as default. Config example: diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteOnlyNodeIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteOnlyNodeIntegrationTest.java index 54de44b55a2b9..be47f1798b5da 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteOnlyNodeIntegrationTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteOnlyNodeIntegrationTest.java @@ -63,6 +63,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import static org.apache.ignite.internal.processors.query.GridQueryProcessor.INDEXING_ENGINE_NAME; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause; @@ -80,9 +81,6 @@ public class CalciteOnlyNodeIntegrationTest extends GridCommonAbstractWrapperTes public static final String H2_ONLY_QRY_MSG = "is supported by the H2 query engine only. Add module " + "'ignite-indexing' to the classpath of all Ignite nodes"; - /** Name of the H2 engine, which is not available to the node. */ - private static final String H2_ENGINE_NAME = "h2"; - /** */ private static final String[] CLASS_PATH_PROPS = {"java.class.path", "surefire.test.class.path"}; @@ -291,9 +289,9 @@ public void testJdbcQueryEngineProperty() throws Exception { public void testJdbcH2QueryEngineProperty() { assertThrowsAnyCause( log, - () -> DriverManager.getConnection(JDBC_URL + "?queryEngine=" + H2_ENGINE_NAME), + () -> DriverManager.getConnection(JDBC_URL + "?queryEngine=" + INDEXING_ENGINE_NAME), SQLException.class, - "Not found configuration for query engine: " + H2_ENGINE_NAME + "Not found configuration for query engine: " + INDEXING_ENGINE_NAME ); } @@ -314,7 +312,7 @@ public void testQueryEngineHint() throws Exception { /** The H2 engine cannot be selected by the query hint. */ @Test public void testH2QueryEngineHint() throws Exception { - String qry = "SELECT /*+ QUERY_ENGINE('" + H2_ENGINE_NAME + "') */ QUERY_ENGINE()"; + String qry = "SELECT /*+ QUERY_ENGINE('" + INDEXING_ENGINE_NAME + "') */ QUERY_ENGINE()"; try (Connection conn = DriverManager.getConnection(JDBC_URL); Statement stmt = conn.createStatement() @@ -323,7 +321,7 @@ public void testH2QueryEngineHint() throws Exception { log, () -> stmt.executeQuery(qry), SQLException.class, - "Query engine not found: " + H2_ENGINE_NAME + "Query engine not found: " + INDEXING_ENGINE_NAME ); } } diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/SqlConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/SqlConfiguration.java index 7bead0b04e7a2..af440ad2d4d13 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/SqlConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/SqlConfiguration.java @@ -229,8 +229,9 @@ public SqlConfiguration setValidationEnabled(boolean validationEnabled) { * {@code QUERY_ENGINE('engineName')} SQL query hint. If no query engine is explicitly chosen, default query engine * will be used (see {@link QueryEngineConfiguration#setDefault(boolean)}). *

- * When this property is not set, the query engine cannot be chosen in run-time, and the engine provided by the - * ignite-indexing module will be used for all queries. + * When this property is not set, the query engines found on the classpath are used: the Calcite-based engine + * (the ignite-calcite module) is the default one and the H2-based engine (the ignite-indexing module), if present, + * can be chosen in run-time. If only one of the modules is on the classpath, its engine is used for all queries. * * @param enginesConfiguration Query engines configuration. * @return {@code this} for chaining. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcBatchUpdateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcBatchUpdateTask.java index d3a1ce3cb45f8..6c4f345cb2c8f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcBatchUpdateTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcBatchUpdateTask.java @@ -27,8 +27,8 @@ import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.QueryCursorImpl; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; +import org.apache.ignite.internal.processors.cache.query.QueryCursorEx; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.util.typedef.F; @@ -174,7 +174,7 @@ private Integer doSingleUpdate(IgniteCache cache, String sqlText, List> qryCursor = (QueryCursorImpl>)cache.withKeepBinary().query(qry); + QueryCursorEx> qryCursor = (QueryCursorEx>)cache.withKeepBinary().query(qry); if (qryCursor.isQuery()) { throw createJdbcSqlException(getError("Query produced result set", qry), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryMultipleStatementsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryMultipleStatementsTask.java index 9b0ae1935d5da..975d31d50b03b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryMultipleStatementsTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryMultipleStatementsTask.java @@ -29,7 +29,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.QueryCursorImpl; +import org.apache.ignite.internal.processors.cache.query.QueryCursorEx; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.S; @@ -136,7 +136,7 @@ public JdbcQueryMultipleStatementsTask(Ignite ignite, String schemaName, String throw new SQLException("COPY command is currently supported only in thin JDBC driver."); } - QueryCursorImpl> cur = (QueryCursorImpl>)cur0; + QueryCursorEx> cur = (QueryCursorEx>)cur0; long updCnt = -1; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java index 773976bc74edf..9493e31039ce2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java @@ -36,7 +36,7 @@ import org.apache.ignite.cache.query.QueryCursor; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.QueryCursorImpl; +import org.apache.ignite.internal.processors.cache.query.QueryCursorEx; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata; import org.apache.ignite.internal.util.typedef.CAX; @@ -178,7 +178,7 @@ public JdbcQueryTask(Ignite ignite, String cacheName, String schemaName, String throw new SQLException("COPY command is currently supported only in thin JDBC driver."); } - QueryCursorImpl> qryCursor = (QueryCursorImpl>)fldQryCursor; + QueryCursorEx> qryCursor = (QueryCursorEx>)fldQryCursor; if (isQry == null) isQry = qryCursor.isQuery(); @@ -362,8 +362,8 @@ public boolean hasNext() { /** * @return Cursor. */ - public QueryCursorImpl> queryCursor() { - return (QueryCursorImpl>)cursor; + public QueryCursorEx> queryCursor() { + return (QueryCursorEx>)cursor; } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index c64e2e4f7247a..62b463306217a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -202,6 +202,9 @@ public class GridQueryProcessor extends GridProcessorAdapter { public static final String INDEXING_DISABLED_MSG = "Failed to execute query because indexing is disabled " + "(consider adding module '" + INDEXING.module() + "' to classpath or moving it from 'optional' to 'libs' folder)."; + /** */ + public static final String INDEXING_ENGINE_NAME = "h2"; + /** */ private static final ThreadLocal requestTopVer = new ThreadLocal<>(); @@ -562,19 +565,7 @@ private void initQueryEngines() throws IgniteCheckedException { QueryEngineConfiguration[] qryEnginesCfg = ctx.config().getSqlConfiguration().getQueryEnginesConfiguration(); if (F.isEmpty(qryEnginesCfg)) { - // No query engines explicitly configured - indexing will be used. - // If indexing is disabled, try to find any query engine in components. - if (!indexingEnabled()) { - for (GridComponent cmp : ctx.components()) { - if (cmp instanceof QueryEngine qryEngine && qryEngine.config() != null) { - qryEngines = new QueryEngine[] {qryEngine}; - dfltQryEngine = qryEngine; - this.qryEnginesCfg = new QueryEngineConfigurationEx[] {qryEngine.config()}; - - break; - } - } - } + initImplicitQueryEngines(); return; } @@ -639,6 +630,53 @@ private void initQueryEngines() throws IgniteCheckedException { dfltQryEngine = qryEngines[dfltQryEngineIdx]; } + /** + * Registers the query engines found on the classpath. + * A query engine component that provides its own configuration (the Calcite-based engine) becomes the default engine. + * The indexing (H2) engine, if it is on the classpath too, remains available by name. + */ + private void initImplicitQueryEngines() { + QueryEngine qryEngine = null; + + for (GridComponent cmp : ctx.components()) { + if (cmp instanceof QueryEngine qryEngine0 && qryEngine0.config() != null) { + qryEngine = qryEngine0; + + break; + } + } + + if (qryEngine == null) + return; + + if (indexingEnabled()) { + qryEngines = new QueryEngine[] {qryEngine, null}; + qryEnginesCfg = new QueryEngineConfigurationEx[] {qryEngine.config(), new QueryEngineConfigurationEx() { + @Override public String engineName() { + return INDEXING_ENGINE_NAME; + } + + @Override public Class engineClass() { + return IndexingQueryEngine.class; + } + + @Override public boolean isDefault() { + return false; + } + + @Override public QueryEngineConfiguration setDefault(boolean isDflt) { + throw new UnsupportedOperationException("Implicit query engine configuration is read-only."); + } + } }; + } + else { + qryEngines = new QueryEngine[] {qryEngine}; + qryEnginesCfg = new QueryEngineConfigurationEx[] {qryEngine.config()}; + } + + dfltQryEngine = qryEngine; + } + /** * @return Information about secondary indexes inline size. Key is a full index name, value is a effective inline size. * @see IndexProcessor#secondaryIndexesInlineSize() diff --git a/modules/indexing/README.txt b/modules/indexing/README.txt index f0ea6ba8d0b13..fadbaba566d40 100644 --- a/modules/indexing/README.txt +++ b/modules/indexing/README.txt @@ -4,9 +4,9 @@ Apache Ignite Indexing Module Apache Ignite indexing module provides capabilities to index cache context and run SQL, full text or individual field queries against these indexes. -To enable indexing module when starting a standalone node, move 'optional/ignite-indexing' folder to -'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will -be added to classpath in this case. +The module is located in the 'libs' folder of the binary distribution and is enabled by default. It provides +the H2-based SQL engine. When the Calcite-based engine (the 'ignite-calcite' module) is on the classpath too and +`SqlConfiguration.QueryEnginesConfiguration` is not set, the Calcite-based engine is the default one. Importing indexing Module In Maven Project ------------------------------------------ diff --git a/modules/indexing/src/main/java/org/apache/ignite/indexing/IndexingQueryEngineConfiguration.java b/modules/indexing/src/main/java/org/apache/ignite/indexing/IndexingQueryEngineConfiguration.java index cfba6aa376a35..878f22b6d52cf 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/indexing/IndexingQueryEngineConfiguration.java +++ b/modules/indexing/src/main/java/org/apache/ignite/indexing/IndexingQueryEngineConfiguration.java @@ -17,6 +17,7 @@ package org.apache.ignite.indexing; +import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.internal.processors.query.IndexingQueryEngine; import org.apache.ignite.internal.processors.query.QueryEngine; import org.apache.ignite.internal.processors.query.QueryEngineConfigurationEx; @@ -26,7 +27,7 @@ */ public class IndexingQueryEngineConfiguration implements QueryEngineConfigurationEx { /** Query engine name. */ - public static final String ENGINE_NAME = "h2"; + public static final String ENGINE_NAME = GridQueryProcessor.INDEXING_ENGINE_NAME; /** */ private boolean isDflt; diff --git a/modules/platforms/cpp/core-test/config/cache-identity-default.xml b/modules/platforms/cpp/core-test/config/cache-identity-default.xml index a73d0bbd3928a..36e7fcc4edda9 100644 --- a/modules/platforms/cpp/core-test/config/cache-identity-default.xml +++ b/modules/platforms/cpp/core-test/config/cache-identity-default.xml @@ -29,6 +29,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/cpp/core-test/config/cache-query-schema-default.xml b/modules/platforms/cpp/core-test/config/cache-query-schema-default.xml index 84c12e12331df..724130bb70437 100644 --- a/modules/platforms/cpp/core-test/config/cache-query-schema-default.xml +++ b/modules/platforms/cpp/core-test/config/cache-query-schema-default.xml @@ -29,6 +29,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/cpp/core/src/ignition.cpp b/modules/platforms/cpp/core/src/ignition.cpp index 40e3b7ffa4d45..367b290f19682 100644 --- a/modules/platforms/cpp/core/src/ignition.cpp +++ b/modules/platforms/cpp/core/src/ignition.cpp @@ -171,6 +171,8 @@ namespace ignite opts.push_back(CopyChars("--add-opens=java.base/java.lang.invoke=ALL-UNNAMED")); opts.push_back(CopyChars("--add-opens=java.base/java.math=ALL-UNNAMED")); opts.push_back(CopyChars("--add-opens=java.sql/java.sql=ALL-UNNAMED")); + opts.push_back(CopyChars("--add-opens=java.base/java.time=ALL-UNNAMED")); + opts.push_back(CopyChars("--add-opens=java.base/java.text=ALL-UNNAMED")); opts.push_back(CopyChars("--add-opens=java.logging/java.util.logging=ALL-UNNAMED")); } } diff --git a/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml index d170d6b68ee28..244fc511f6f65 100644 --- a/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml +++ b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml @@ -26,6 +26,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/cpp/examples/query-example/config/query-example.xml b/modules/platforms/cpp/examples/query-example/config/query-example.xml index 758da99d3e468..2e9c2b646af13 100644 --- a/modules/platforms/cpp/examples/query-example/config/query-example.xml +++ b/modules/platforms/cpp/examples/query-example/config/query-example.xml @@ -26,6 +26,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/cpp/odbc-test/config/queries-schema-default.xml b/modules/platforms/cpp/odbc-test/config/queries-schema-default.xml index bcdaec578c578..4f09b1ffc64cd 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-schema-default.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-schema-default.xml @@ -29,6 +29,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/cpp/thin-client-test/config/sql-query-fields-default.xml b/modules/platforms/cpp/thin-client-test/config/sql-query-fields-default.xml index 5a2c6abd0a100..72d39a9571f3d 100644 --- a/modules/platforms/cpp/thin-client-test/config/sql-query-fields-default.xml +++ b/modules/platforms/cpp/thin-client-test/config/sql-query-fields-default.xml @@ -29,6 +29,19 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + + + + + + + + + + + + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.DotNetCore.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.DotNetCore.csproj index 99fd2689f5e60..627e0814de71f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.DotNetCore.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.DotNetCore.csproj @@ -58,6 +58,7 @@ + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index 7f2df3da76b78..6fe497fefb577 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -78,6 +78,7 @@ + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs index b368d811d5aa3..800051353ec52 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs @@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.Binary.Serializable { using System; + using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Threading; @@ -52,7 +53,8 @@ public void FixtureSetUp() { NameMapper = new BinaryBasicNameMapper {IsSimpleName = true} }, - Logger = new ListLogger(new TestUtils.TestContextLogger()) {EnabledLevels = new[] {LogLevel.Warn}} + Logger = new ListLogger(new TestUtils.TestContextLogger()) {EnabledLevels = new[] {LogLevel.Warn}}, + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") }; _ignite = Ignition.Start(cfg); diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheQueryMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheQueryMetricsTest.cs index 70eba6f0d067c..63cf94f12e8f7 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheQueryMetricsTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheQueryMetricsTest.cs @@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; + using System.IO; using System.Linq; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cache.Configuration; @@ -39,7 +40,10 @@ public class CacheQueryMetricsTest [TestFixtureSetUp] public void FixtureSetUp() { - Ignition.Start(TestUtils.GetTestConfiguration()); + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) + { + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") + }); } ///

diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs index b9a5798b5e159..16a7326a878eb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs @@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query { using System; + using System.IO; using System.Linq; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache.Configuration; @@ -44,7 +45,8 @@ public void FixtureSetUp() BinaryConfiguration = new BinaryConfiguration(typeof(Foo), typeof(Key), typeof(Key2), typeof(KeyAll)) { NameMapper = GetNameMapper() - } + }, + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") }; Ignition.Start(cfg); diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSchema.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSchema.cs index f0f5611620910..371c1a99d74d2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSchema.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSchema.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using Apache.Ignite.Core.Cache.Query; using Apache.Ignite.Core.Common; @@ -53,7 +54,8 @@ public void FixtureSetUp() SchemaName2, QSchemaName4, SchemaName4 - } + }, + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") }; Ignition.Start(cfg); diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Base.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Base.cs index 209184505b5dc..dc84f6449c282 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Base.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Base.cs @@ -28,6 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq { using System; using System.Collections; + using System.IO; using System.Linq; using System.Linq.Expressions; using System.Threading; @@ -131,7 +132,8 @@ private IgniteConfiguration GetConfig(string gridName = null) { NameMapper = GetNameMapper() }, - IgniteInstanceName = gridName + IgniteInstanceName = gridName, + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") }; } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTestBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTestBase.cs index 7efcb9c4a0687..db65247c309bc 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTestBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTestBase.cs @@ -17,6 +17,7 @@ namespace Apache.Ignite.Core.Tests.Client.Cache { + using System.IO; using System.Linq; using Apache.Ignite.Core.Cache.Configuration; @@ -52,6 +53,16 @@ public override void TestSetUp() InitCache(CacheName2); } + /** */ + protected override IgniteConfiguration GetIgniteConfiguration() + { + var cfg = base.GetIgniteConfiguration(); + + cfg.SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml"); + + return cfg; + } + /// /// Initializes the cache. /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml index 903091aaa940e..1527e000765af 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml @@ -29,6 +29,19 @@ + + + + + + + + + + + + + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml index 87e65a23ee596..3968319786170 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml @@ -47,6 +47,19 @@ + + + + + + + + + + + + + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/query-engine-h2-default.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/query-engine-h2-default.xml new file mode 100644 index 0000000000000..3dbe305fc8357 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/query-engine-h2-default.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThickExamplesExternalNodeTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThickExamplesExternalNodeTest.cs index 1cb23c2cf8424..dd12897664429 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThickExamplesExternalNodeTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThickExamplesExternalNodeTest.cs @@ -17,6 +17,7 @@ namespace Apache.Ignite.Core.Tests.Examples { + using System.IO; using System.Linq; using NUnit.Framework; @@ -37,7 +38,10 @@ public class ThickExamplesExternalNodeTest : ExamplesTestBase [TestFixtureSetUp] public void FixtureSetUp() { - Ignition.Start(TestUtils.GetTestConfiguration(name: "server")); + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "server")) + { + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") + }); } /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThinExamplesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThinExamplesTest.cs index b9cd45092377c..3642425921b52 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThinExamplesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ThinExamplesTest.cs @@ -17,6 +17,7 @@ namespace Apache.Ignite.Core.Tests.Examples { + using System.IO; using System.Linq; using System.Reflection; using NUnit.Framework; @@ -57,7 +58,10 @@ public void FixtureSetUp() { for (int i = 0; i < _serverCount; i++) { - Ignition.Start(TestUtils.GetTestConfiguration(name: i.ToString())); + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(name: i.ToString())) + { + SpringConfigUrl = Path.Combine("Config", "query-engine-h2-default.xml") + }); } // Init default services. diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/Jvm.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/Jvm.cs index ac9c52404f2e6..9246f3ce336bd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/Jvm.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/Jvm.cs @@ -70,6 +70,8 @@ internal sealed unsafe partial class Jvm "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED", "--add-opens=java.base/java.math=ALL-UNNAMED", "--add-opens=java.sql/java.sql=ALL-UNNAMED", + "--add-opens=java.base/java.time=ALL-UNNAMED", + "--add-opens=java.base/java.text=ALL-UNNAMED", "--add-opens=java.logging/java.util.logging=ALL-UNNAMED" }; diff --git a/modules/platforms/dotnet/build.ps1 b/modules/platforms/dotnet/build.ps1 index 7dfbe8b7b4c61..022134baaffdd 100644 --- a/modules/platforms/dotnet/build.ps1 +++ b/modules/platforms/dotnet/build.ps1 @@ -84,7 +84,7 @@ param ( [ValidateSet("Release", "Debug")] [string]$configuration="Release", [string]$mavenOpts="-U -P-lgpl,-scala,-spark-2.4,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true", - [string]$jarDirs="modules\indexing\target,modules\core\target,modules\spring\target", + [string]$jarDirs="modules\indexing\target,modules\core\target,modules\spring\target,modules\calcite\target", [string]$version="", [string]$versionSuffix="" ) @@ -172,11 +172,18 @@ $libsDir = "$PSScriptRoot\bin\libs" Make-Dir($libsDir) Get-ChildItem $jarDirs.Split(',') *.jar -recurse ` - -include "ignite-core*","ignite-indexing*","ignite-spring*","lucene*","h2*","cache-api*","commons-*","spring*" ` + -include "ignite-core*","ignite-indexing*","ignite-spring*","ignite-calcite*","lucene*","h2*","cache-api*","commons-*","spring*" ` -exclude "*-sources*","*-javadoc*","*-tests*" ` | ? { $_.FullName -inotmatch '[\\/]optional[\\/]' } ` | % { Copy-Item -Force $_ $libsDir } +# Dependencies of the Calcite SQL engine (the same set as libs\ignite-calcite in the binary distribution). +$calciteLibsDir = "modules\calcite\target\libs" + +if ([IO.Directory]::Exists($calciteLibsDir)) { + Get-ChildItem $calciteLibsDir *.jar | % { Copy-Item -Force $_ $libsDir } +} + # Restore directory cd $PSScriptRoot diff --git a/modules/platforms/dotnet/examples/Shared/Shared.csproj b/modules/platforms/dotnet/examples/Shared/Shared.csproj index 1dda71ff5f62e..aabf07103ef0c 100644 --- a/modules/platforms/dotnet/examples/Shared/Shared.csproj +++ b/modules/platforms/dotnet/examples/Shared/Shared.csproj @@ -6,6 +6,10 @@ CS0649 + + + + diff --git a/modules/platforms/dotnet/examples/Shared/Utils.cs b/modules/platforms/dotnet/examples/Shared/Utils.cs index cae754b47d3e1..dba28334ea1f1 100644 --- a/modules/platforms/dotnet/examples/Shared/Utils.cs +++ b/modules/platforms/dotnet/examples/Shared/Utils.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Examples.Shared { using System; using System.Collections.Generic; + using System.IO; using Apache.Ignite.Core; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Client; @@ -54,6 +55,7 @@ public static IgniteConfiguration GetServerNodeConfiguration() // * Logging options reduce console output return new IgniteConfiguration { + SpringConfigUrl = Path.Combine(Path.GetDirectoryName(typeof(Utils).Assembly.Location), "ignite-config.xml"), Localhost = "127.0.0.1", DiscoverySpi = new TcpDiscoverySpi { diff --git a/modules/platforms/dotnet/examples/Shared/ignite-config.xml b/modules/platforms/dotnet/examples/Shared/ignite-config.xml new file mode 100644 index 0000000000000..6abef02eb613c --- /dev/null +++ b/modules/platforms/dotnet/examples/Shared/ignite-config.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + +