Skip to content
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

Update oracle test container version to 18.4.0-full #17009

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1520,8 +1520,7 @@ protected TestView createSleepingView(Duration minimalSleepDuration)
public void testDeleteWithBigintEqualityPredicate()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_bigint", "AS SELECT * FROM region")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_bigint_equality_predicate_", "AS SELECT * FROM region")) {
assertUpdate("DELETE FROM " + table.getName() + " WHERE regionkey = 1", 1);
assertQuery(
"SELECT regionkey, name FROM " + table.getName(),
Expand All @@ -1537,8 +1536,7 @@ public void testDeleteWithBigintEqualityPredicate()
public void testDeleteWithVarcharEqualityPredicate()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_varchar", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_varchar_equality_predicate_", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col = 'A'", MODIFYING_ROWS_MESSAGE);
return;
Expand All @@ -1553,8 +1551,7 @@ public void testDeleteWithVarcharEqualityPredicate()
public void testDeleteWithVarcharInequalityPredicate()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_varchar", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_varchar_inequality_predicate_", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col != 'A'", MODIFYING_ROWS_MESSAGE);
return;
Expand All @@ -1569,8 +1566,7 @@ public void testDeleteWithVarcharInequalityPredicate()
public void testDeleteWithVarcharGreaterAndLowerPredicate()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_varchar", "(col varchar(1))", ImmutableList.of("'0'", "'a'", "'A'", "'b'", "null"))) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_varchar_greater_and_lower_predicate_", "(col varchar(1))", ImmutableList.of("'0'", "'a'", "'A'", "'b'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col < 'A'", MODIFYING_ROWS_MESSAGE);
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col > 'A'", MODIFYING_ROWS_MESSAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ protected void verifyConcurrentAddColumnFailurePermissible(Exception e)
@Override
protected OptionalInt maxSchemaNameLength()
{
return OptionalInt.of(30);
return OptionalInt.of(128);
}

@Override
Expand All @@ -458,7 +458,7 @@ protected void verifySchemaNameLengthFailurePermissible(Throwable e)
@Override
protected OptionalInt maxTableNameLength()
{
return OptionalInt.of(30);
return OptionalInt.of(128);
}

@Override
Expand All @@ -470,7 +470,7 @@ protected void verifyTableNameLengthFailurePermissible(Throwable e)
@Override
protected OptionalInt maxColumnNameLength()
{
return OptionalInt.of(30);
return OptionalInt.of(128);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ public TestingOracleServer()

private OracleContainer createContainer()
{
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:11.2.0.2-full")
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:18.4.0-full")
.withCopyFileToContainer(MountableFile.forClasspathResource("init.sql"), "/container-entrypoint-initdb.d/01-init.sql")
.withCopyFileToContainer(MountableFile.forClasspathResource("restart.sh"), "/container-entrypoint-initdb.d/02-restart.sh")
.withCopyFileToContainer(MountableFile.forHostPath(createConfigureScript()), "/container-entrypoint-initdb.d/03-create-users.sql")
.usingSid();
.withCopyFileToContainer(MountableFile.forHostPath(createConfigureScript()), "/container-entrypoint-initdb.d/03-create-users.sql");
container.start();
return container;
}
Expand All @@ -86,6 +85,7 @@ private Path createConfigureScript()
File tempFile = File.createTempFile("init-", ".sql");

Files.write(Joiner.on("\n").join(
"ALTER SESSION SET CONTAINER = XEPDB1;",
format("CREATE TABLESPACE %s DATAFILE 'test_db.dat' SIZE 100M ONLINE;", TEST_TABLESPACE),
format("CREATE USER %s IDENTIFIED BY %s DEFAULT TABLESPACE %s;", TEST_USER, TEST_PASS, TEST_TABLESPACE),
format("GRANT UNLIMITED TABLESPACE TO %s;", TEST_USER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ public void testDeleteAllDataFromTable()
public void testRowLevelDelete()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_row_delete", "AS SELECT * FROM region")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_row_level_delete_", "AS SELECT * FROM region")) {
assertUpdate("DELETE FROM " + table.getName() + " WHERE regionkey = 2", 1);
assertThat(query("SELECT * FROM " + table.getName() + " WHERE regionkey = 2"))
.returnsEmptyResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2923,8 +2923,7 @@ public void testCreateTable()
assertQueryFails("CREATE TABLE " + tableName + " (a bad_type)", ".* Unknown type 'bad_type' for column 'a'");
assertFalse(getQueryRunner().tableExists(getSession(), tableName));

// TODO (https://github.com/trinodb/trino/issues/5901) revert to longer name when Oracle version is updated
tableName = "test_cr_not_exists_" + randomNameSuffix();
tableName = "test_create_table_not_exists_" + randomNameSuffix();
assertUpdate("CREATE TABLE " + tableName + " (a bigint, b varchar(50), c double)");
assertTrue(getQueryRunner().tableExists(getSession(), tableName));
assertTableColumnNames(tableName, "a", "b", "c");
Expand Down Expand Up @@ -3704,8 +3703,7 @@ protected void testCommentColumnName(String columnName, boolean delimited)
{
String nameInSql = toColumnNameInSql(columnName, delimited);

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_comment_column", "(" + nameInSql + " integer)")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_comment_column_name_", "(" + nameInSql + " integer)")) {
assertUpdate("COMMENT ON COLUMN " + table.getName() + "." + nameInSql + " IS 'test comment'");
assertThat(getColumnComment(table.getName(), columnName.replace("'", "''").toLowerCase(ENGLISH))).isEqualTo("test comment");
}
Expand Down Expand Up @@ -4154,8 +4152,7 @@ public void testDeleteWithComplexPredicate()
{
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_complex_", "AS SELECT * FROM nation")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_complex_predicate_", "AS SELECT * FROM nation")) {
// delete half the table, then delete the rest
assertUpdate("DELETE FROM " + table.getName() + " WHERE nationkey % 2 = 0", "SELECT count(*) FROM nation WHERE nationkey % 2 = 0");
assertQuery("SELECT * FROM " + table.getName(), "SELECT * FROM nation WHERE nationkey % 2 <> 0");
Expand All @@ -4173,33 +4170,31 @@ public void testDeleteWithSubquery()
// TODO (https://github.com/trinodb/trino/issues/13210) Migrate these tests to AbstractTestEngineOnlyQueries
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_subquery", "AS SELECT * FROM nation")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_subquery_", "AS SELECT * FROM nation")) {
// delete using a subquery
assertUpdate("DELETE FROM " + table.getName() + " WHERE regionkey IN (SELECT regionkey FROM region WHERE name LIKE 'A%')", 15);
assertQuery(
"SELECT * FROM " + table.getName(),
"SELECT * FROM nation WHERE regionkey IN (SELECT regionkey FROM region WHERE name NOT LIKE 'A%')");
}

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_subquery", "AS SELECT * FROM orders")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_subquery_", "AS SELECT * FROM orders")) {
// delete using a scalar and EXISTS subquery
assertUpdate("DELETE FROM " + table.getName() + " WHERE orderkey = (SELECT orderkey FROM orders ORDER BY orderkey LIMIT 1)", 1);
assertUpdate("DELETE FROM " + table.getName() + " WHERE orderkey = (SELECT orderkey FROM orders WHERE false)", 0);
assertUpdate("DELETE FROM " + table.getName() + " WHERE EXISTS(SELECT 1 WHERE false)", 0);
assertUpdate("DELETE FROM " + table.getName() + " WHERE EXISTS(SELECT 1)", "SELECT count(*) - 1 FROM orders");
}

try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_correlated_exists_subquery", "AS SELECT * FROM nation")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_correlated_exists_subquery_", "AS SELECT * FROM nation")) {
// delete using correlated EXISTS subquery
assertUpdate(format("DELETE FROM %1$s WHERE EXISTS(SELECT regionkey FROM region WHERE regionkey = %1$s.regionkey AND name LIKE 'A%%')", table.getName()), 15);
assertQuery(
"SELECT * FROM " + table.getName(),
"SELECT * FROM nation WHERE regionkey IN (SELECT regionkey FROM region WHERE name NOT LIKE 'A%')");
}

try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_correlated_exists_subquery", "AS SELECT * FROM nation")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_correlated_exists_subquery_", "AS SELECT * FROM nation")) {
// delete using correlated IN subquery
assertUpdate(format("DELETE FROM %1$s WHERE regionkey IN (SELECT regionkey FROM region WHERE regionkey = %1$s.regionkey AND name LIKE 'A%%')", table.getName()), 15);
assertQuery(
Expand Down Expand Up @@ -4227,8 +4222,7 @@ public void testDeleteWithSemiJoin()
{
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_semijoin", "AS SELECT * FROM nation")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_semijoin_", "AS SELECT * FROM nation")) {
// delete with multiple SemiJoin
assertUpdate(
"DELETE FROM " + table.getName() + " " +
Expand All @@ -4242,8 +4236,7 @@ public void testDeleteWithSemiJoin()
" OR regionkey IN (SELECT regionkey FROM region WHERE length(comment) >= 50)");
}

// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_semijoin", "AS SELECT * FROM orders")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_semijoin_", "AS SELECT * FROM orders")) {
// delete with SemiJoin null handling
assertUpdate(
"DELETE FROM " + table.getName() + "\n" +
Expand Down Expand Up @@ -4311,8 +4304,7 @@ public void testDeleteAllDataFromTable()
public void testRowLevelDelete()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
// TODO (https://github.com/trinodb/trino/issues/5901) Use longer table name once Oracle version is updated
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_row_delete", "AS SELECT * FROM region")) {
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_row_level_delete_", "AS SELECT * FROM region")) {
assertUpdate("DELETE FROM " + table.getName() + " WHERE regionkey = 2", 1);
assertQuery("SELECT count(*) FROM " + table.getName(), "VALUES 4");
}
Expand Down