Repository navigation
IGNITE-29117 Both engines must be available. Calcite default. #13692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+577
−60
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0fb4955
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov bf9cb5b
Merge branch 'master' into IGNITE-29117-4
nizhikov a74b879
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov ac9f829
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 7cf02b2
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 080b4e0
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov ec8bed5
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 882750a
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov bb2e17b
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 3a8d307
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 33f34b9
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov b6aae45
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 5ae5733
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov 60e3a9b
Merge branch 'master' into IGNITE-29117-4
nizhikov 370cd93
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov e1f0253
IGNITE-29117 Both engines must be available. Calcite default.
nizhikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
modules/calcite-testing/src/test/config/jdbc-client-driver-calcite.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <?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. | ||
| --> | ||
|
|
||
| <beans xmlns="http://www.springframework.org/schema/beans" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation=" | ||
| http://www.springframework.org/schema/beans | ||
| http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
| <bean class="org.apache.ignite.configuration.IgniteConfiguration"> | ||
| <property name="clientMode" value="true"/> | ||
| <property name="localHost" value="127.0.0.1"/> | ||
| <property name="peerClassLoadingEnabled" value="true"/> | ||
|
|
||
| <property name="discoverySpi"> | ||
| <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> | ||
| <property name="ipFinder"> | ||
| <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> | ||
| <property name="addresses"> | ||
| <list> | ||
| <value>127.0.0.1:47500..47509</value> | ||
| </list> | ||
| </property> | ||
| </bean> | ||
| </property> | ||
| </bean> | ||
| </property> | ||
| </bean> | ||
| </beans> |
57 changes: 57 additions & 0 deletions
57
modules/calcite-testing/src/test/config/jdbc-client-driver-h2.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <?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. | ||
| --> | ||
|
|
||
| <beans xmlns="http://www.springframework.org/schema/beans" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation=" | ||
| http://www.springframework.org/schema/beans | ||
| http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
| <bean class="org.apache.ignite.configuration.IgniteConfiguration"> | ||
| <property name="clientMode" value="true"/> | ||
| <property name="localHost" value="127.0.0.1"/> | ||
| <property name="peerClassLoadingEnabled" value="true"/> | ||
|
|
||
| <property name="discoverySpi"> | ||
| <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> | ||
| <property name="ipFinder"> | ||
| <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> | ||
| <property name="addresses"> | ||
| <list> | ||
| <value>127.0.0.1:47500..47509</value> | ||
| </list> | ||
| </property> | ||
| </bean> | ||
| </property> | ||
| </bean> | ||
| </property> | ||
|
|
||
| <property name="sqlConfiguration"> | ||
| <bean class="org.apache.ignite.configuration.SqlConfiguration"> | ||
| <property name="queryEnginesConfiguration"> | ||
| <list> | ||
| <bean class="org.apache.ignite.indexing.IndexingQueryEngineConfiguration"> | ||
| <property name="default" value="true"/> | ||
| </bean> | ||
| <bean class="org.apache.ignite.calcite.CalciteQueryEngineConfiguration"/> | ||
| </list> | ||
| </property> | ||
| </bean> | ||
| </property> | ||
| </bean> | ||
| </beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
...ache/ignite/internal/processors/query/calcite/jdbc/JdbcClientDriverDefaultEngineTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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<List<Object>> 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<List<?>> serverSql(String sql) { | ||
| return grid(0).context().query().querySqlFields(new SqlFieldsQuery(sql), false).getAll(); | ||
| } | ||
|
|
||
| /** */ | ||
| private void checkEngine() throws SQLException { | ||
| List<List<Object>> res = executeQuery(conn, "SELECT QUERY_ENGINE()"); | ||
|
|
||
| assertEquals(1, res.size()); | ||
| assertEquals(dfltEngine, res.get(0).get(0)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also ensure that query_engine is dfltEngine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check added.