diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java index badec3dd8a79..7310e599a6c0 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java @@ -87,40 +87,34 @@ private void testDropTableAccuracy(Engine creator, Engine dropper, boolean expli : Optional.empty(); switch (creator) { - case TRINO: - onTrino().executeQuery(format("CREATE SCHEMA delta.%s WITH (location = '%s')", schemaName, schemaLocation)); - break; - case DELTA: - onDelta().executeQuery(format("CREATE SCHEMA %s LOCATION \"%s\"", schemaName, schemaLocation)); - break; - default: - throw new UnsupportedOperationException("Unsupported engine: " + creator); + case TRINO -> onTrino().executeQuery(format("CREATE SCHEMA delta.%s WITH (location = '%s')", schemaName, schemaLocation)); + case DELTA -> onDelta().executeQuery(format("CREATE SCHEMA %s LOCATION \"%s\"", schemaName, schemaLocation)); + default -> throw new UnsupportedOperationException("Unsupported engine: " + creator); } try { onTrino().executeQuery("USE delta." + schemaName); switch (creator) { - case TRINO: - onTrino().executeQuery(format( - "CREATE TABLE %s.%s (a, b) %s AS VALUES (1, 2), (2, 3), (3, 4)", - schemaName, - tableName, - tableLocation.map(location -> "WITH (location = '" + location + "')").orElse(""))); - break; - case DELTA: - onDelta().executeQuery(format( - "CREATE TABLE %s.%s USING DELTA %s AS VALUES (1, 2), (2, 3), (3, 4)", - schemaName, - tableName, - tableLocation.map(location -> "LOCATION \"" + location + "\"").orElse(""))); - break; - default: - throw new UnsupportedOperationException("Unsupported engine: " + creator); + case TRINO -> onTrino().executeQuery(format( + "CREATE TABLE %s.%s (a, b) %s AS VALUES (1, 2), (2, 3), (3, 4)", + schemaName, + tableName, + tableLocation.map(location -> "WITH (location = '" + location + "')").orElse(""))); + case DELTA -> onDelta().executeQuery(format( + "CREATE TABLE %s.%s USING DELTA %s AS VALUES (1, 2), (2, 3), (3, 4)", + schemaName, + tableName, + tableLocation.map(location -> "LOCATION \"" + location + "\"").orElse(""))); + default -> throw new UnsupportedOperationException("Unsupported engine: " + creator); } ObjectListing tableFiles = s3.listObjects(bucketName, "databricks-compatibility-test-" + schemaName + "/" + tableName); assertThat(tableFiles.getObjectSummaries()).isNotEmpty(); - dropper.queryExecutor().executeQuery("DROP TABLE " + schemaName + "." + tableName); + switch (dropper) { + case DELTA -> dropDeltaTableWithRetry(schemaName + "." + tableName); + case TRINO -> onTrino().executeQuery("DROP TABLE " + schemaName + "." + tableName); + default -> throw new UnsupportedOperationException("Unsupported engine: " + dropper); + } tableFiles = s3.listObjects(bucketName, "databricks-compatibility-test-" + schemaName + "/" + tableName); if (explicitLocation) { assertThat(tableFiles.getObjectSummaries()).isNotEmpty();