diff --git a/plugin/trino-oracle/pom.xml b/plugin/trino-oracle/pom.xml index 55c4b18edf21..d96a63c5bb9a 100644 --- a/plugin/trino-oracle/pom.xml +++ b/plugin/trino-oracle/pom.xml @@ -141,6 +141,19 @@ test + + io.trino + trino-exchange-filesystem + test + + + + io.trino + trino-exchange-filesystem + test-jar + test + + io.trino trino-main diff --git a/plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java b/plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java index 15013c68042e..b2edda50daac 100644 --- a/plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java +++ b/plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java @@ -209,7 +209,7 @@ public OracleClient( IdentifierMapping identifierMapping, RemoteQueryModifier queryModifier) { - super("\"", connectionFactory, queryBuilder, config.getJdbcTypesMappedToVarchar(), identifierMapping, queryModifier, false); + super("\"", connectionFactory, queryBuilder, config.getJdbcTypesMappedToVarchar(), identifierMapping, queryModifier, true); this.synonymsEnabled = oracleConfig.isSynonymsEnabled(); diff --git a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/BaseOracleFailureRecoveryTest.java b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/BaseOracleFailureRecoveryTest.java new file mode 100644 index 000000000000..b1ac7e91ed38 --- /dev/null +++ b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/BaseOracleFailureRecoveryTest.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +package io.trino.plugin.oracle; + +import com.google.common.collect.ImmutableMap; +import io.trino.operator.RetryPolicy; +import io.trino.plugin.exchange.filesystem.FileSystemExchangePlugin; +import io.trino.plugin.jdbc.BaseJdbcFailureRecoveryTest; +import io.trino.testing.QueryRunner; +import io.trino.tpch.TpchTable; + +import java.util.List; +import java.util.Map; + +import static io.trino.plugin.oracle.OracleQueryRunner.createOracleQueryRunner; +import static io.trino.plugin.oracle.TestingOracleServer.TEST_PASS; +import static io.trino.plugin.oracle.TestingOracleServer.TEST_USER; + +public abstract class BaseOracleFailureRecoveryTest + extends BaseJdbcFailureRecoveryTest +{ + public BaseOracleFailureRecoveryTest(RetryPolicy retryPolicy) + { + super(retryPolicy); + } + + @Override + protected QueryRunner createQueryRunner( + List> requiredTpchTables, + Map configProperties, + Map coordinatorProperties) + throws Exception + { + TestingOracleServer oracleServer = new TestingOracleServer(); + return createOracleQueryRunner( + closeAfterClass(oracleServer), + configProperties, + coordinatorProperties, + ImmutableMap.builder() + .put("connection-url", oracleServer.getJdbcUrl()) + .put("connection-user", TEST_USER) + .put("connection-password", TEST_PASS) + .buildOrThrow(), + requiredTpchTables, + runner -> { + runner.installPlugin(new FileSystemExchangePlugin()); + runner.loadExchangeManager("filesystem", ImmutableMap.of( + "exchange.base-directories", System.getProperty("java.io.tmpdir") + "/trino-local-file-system-exchange-manager")); + }); + } +} diff --git a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/OracleQueryRunner.java b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/OracleQueryRunner.java index e952dff6d663..5be46a30b913 100644 --- a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/OracleQueryRunner.java +++ b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/OracleQueryRunner.java @@ -18,9 +18,11 @@ import io.trino.Session; import io.trino.plugin.tpch.TpchPlugin; import io.trino.testing.DistributedQueryRunner; +import io.trino.testing.QueryRunner; import io.trino.tpch.TpchTable; import java.util.Map; +import java.util.function.Consumer; import static io.airlift.testing.Closeables.closeAllSuppress; import static io.trino.plugin.oracle.TestingOracleServer.TEST_PASS; @@ -40,11 +42,25 @@ public static DistributedQueryRunner createOracleQueryRunner( Map connectorProperties, Iterable> tables) throws Exception + { + return createOracleQueryRunner(server, extraProperties, Map.of(), connectorProperties, tables, queryRunner -> {}); + } + + public static DistributedQueryRunner createOracleQueryRunner( + TestingOracleServer server, + Map extraProperties, + Map coordinatorProperties, + Map connectorProperties, + Iterable> tables, + Consumer moreSetup) + throws Exception { DistributedQueryRunner queryRunner = null; try { queryRunner = DistributedQueryRunner.builder(createSession()) .setExtraProperties(extraProperties) + .setCoordinatorProperties(coordinatorProperties) + .setAdditionalSetup(moreSetup) .build(); queryRunner.installPlugin(new TpchPlugin()); diff --git a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleQueryFailureRecoveryTest.java b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleQueryFailureRecoveryTest.java new file mode 100644 index 000000000000..388e12602d99 --- /dev/null +++ b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleQueryFailureRecoveryTest.java @@ -0,0 +1,25 @@ +/* + * 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. + */ +package io.trino.plugin.oracle; + +import io.trino.operator.RetryPolicy; + +public class TestOracleQueryFailureRecoveryTest + extends BaseOracleFailureRecoveryTest +{ + public TestOracleQueryFailureRecoveryTest() + { + super(RetryPolicy.QUERY); + } +} diff --git a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleTaskFailureRecoveryTest.java b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleTaskFailureRecoveryTest.java new file mode 100644 index 000000000000..9b0f4a3ef23b --- /dev/null +++ b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/TestOracleTaskFailureRecoveryTest.java @@ -0,0 +1,25 @@ +/* + * 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. + */ +package io.trino.plugin.oracle; + +import io.trino.operator.RetryPolicy; + +public class TestOracleTaskFailureRecoveryTest + extends BaseOracleFailureRecoveryTest +{ + public TestOracleTaskFailureRecoveryTest() + { + super(RetryPolicy.TASK); + } +}