Skip to content
Merged
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 @@ -339,15 +339,6 @@ public void testDelete()
throw new SkipException("TODO");
}

@Test
@Override
public void testDeleteWithLike()
{
// TODO Support these test once kudu connector can create tables with default partitions
assertThatThrownBy(super::testDeleteWithLike)
.hasMessage("Table partitioning must be specified using setRangePartitionColumns or addHashPartitions");
}

@Test
@Override
public void testDeleteWithSemiJoin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,11 @@ public void testStringJoinPushdownWithCollate()
@Test
public void testDecimalPredicatePushdown()
{
try (TestTable table = new TestTable(onRemoteDatabase(), "test_decimal_pushdown",
"(short_decimal decimal(9, 3), long_decimal decimal(30, 10))")) {
onRemoteDatabase().execute("INSERT INTO " + table.getName() + " VALUES (123.321, 123456789.987654321)");

try (TestTable table = new TestTable(
onRemoteDatabase(),
"test_decimal_pushdown",
"(short_decimal decimal(9, 3), long_decimal decimal(30, 10))",
List.of("123.321, 123456789.987654321"))) {
assertThat(query("SELECT * FROM " + table.getName() + " WHERE short_decimal <= 124"))
.matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))")
.isFullyPushedDown();
Expand Down Expand Up @@ -663,12 +664,13 @@ public void testDecimalPredicatePushdown()
@Test
public void testCharPredicatePushdown()
{
try (TestTable table = new TestTable(onRemoteDatabase(), "test_char_pushdown",
"(char_1 char(1), char_5 char(5), char_10 char(10))")) {
onRemoteDatabase().execute("INSERT INTO " + table.getName() + " VALUES" +
"('0', '0' , '0' )," +
"('1', '12345', '1234567890')");

try (TestTable table = new TestTable(
onRemoteDatabase(),
"test_char_pushdown",
"(char_1 char(1), char_5 char(5), char_10 char(10))",
List.of(
"'0', '0', '0'",
"'1', '12345', '1234567890'"))) {
assertThat(query("SELECT * FROM " + table.getName() + " WHERE char_1 = '0' AND char_5 = '0'"))
.matches("VALUES (CHAR'0', CHAR'0 ', CHAR'0 ')")
.isFullyPushedDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ public void testInsertInTransaction()
@Test
public void testDelete()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

// delete successive parts of the table
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_", "AS SELECT * FROM orders")) {
Expand Down Expand Up @@ -2497,7 +2497,7 @@ public void testDelete()
@Test
public void testDeleteWithLike()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

try (TestTable table = new TestTable(getQueryRunner()::execute, "test_with_like_", "AS SELECT * FROM nation")) {
assertUpdate("DELETE FROM " + table.getName() + " WHERE name LIKE '%a%'", "VALUES 0");
Expand All @@ -2508,7 +2508,7 @@ public void testDeleteWithLike()
@Test
public void testDeleteWithComplexPredicate()
{
skipTestUnlessSupportsDeletes();
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 orders")) {
Expand All @@ -2526,7 +2526,7 @@ public void testDeleteWithComplexPredicate()
@Test
public void testDeleteWithSubquery()
{
skipTestUnlessSupportsDeletes();
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")) {
Expand All @@ -2550,7 +2550,7 @@ public void testDeleteWithSubquery()
@Test
public void testExplainAnalyzeWithDeleteWithSubquery()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

String tableName = "test_delete_" + randomTableSuffix();

Expand All @@ -2564,7 +2564,7 @@ public void testExplainAnalyzeWithDeleteWithSubquery()
@Test
public void testDeleteWithSemiJoin()
{
skipTestUnlessSupportsDeletes();
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")) {
Expand Down Expand Up @@ -2599,25 +2599,14 @@ public void testDeleteWithSemiJoin()
@Test
public void testDeleteWithVarcharPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_DELETE));

try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete_with_varchar_predicate_", "AS SELECT * FROM orders")) {
assertUpdate("DELETE FROM " + table.getName() + " WHERE orderstatus = 'O'", "SELECT count(*) FROM orders WHERE orderstatus = 'O'");
assertQuery("SELECT * FROM " + table.getName(), "SELECT * FROM orders WHERE orderstatus <> 'O'");
}
}

protected void skipTestUnlessSupportsDeletes()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE));
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_supports_delete", "(col varchar(1))")) {
if (!hasBehavior(SUPPORTS_DELETE)) {
assertQueryFails("DELETE FROM " + table.getName(), "This connector does not support deletes");
throw new SkipException("This connector does not support deletes");
}
}
}

@Test
public void verifySupportsDeleteDeclaration()
{
Expand Down