From a973ff548d675d6d76eb56e1b155cd7a25664df6 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Mon, 4 Aug 2025 14:55:56 +0200 Subject: [PATCH] Fix checkstyle violations --- .../operator/window/WindowAssertions.java | 2 +- .../TestAdaptivePartitioning.java | 2 - .../optimizations/TestColocatedJoin.java | 2 +- .../io/trino/sql/query/TestIssue23787.java | 2 +- .../java/io/trino/sql/query/TestJoin.java | 16 ++--- .../java/io/trino/sql/query/TestRandom.java | 6 +- .../io/trino/sql/parser/TestSqlParser.java | 64 +++++++++---------- .../formats/esri/TestEsriDeserializer.java | 29 ++++++--- .../plugin/jdbc/BaseJdbcConnectorTest.java | 2 +- .../bigquery/BaseBigQueryConnectorTest.java | 5 +- .../plugin/deltalake/TestDeltaLakeBasic.java | 6 +- .../deltalake/TestDeltaLakeConnectorTest.java | 15 ++--- .../BaseElasticsearchConnectorTest.java | 6 +- ...ticsearchComplexTypePredicatePushDown.java | 8 +-- .../plugin/hive/BaseHiveConnectorTest.java | 4 +- .../io/trino/plugin/hive/TestEsriTable.java | 4 +- .../TestIcebergLocalConcurrentWrites.java | 2 - ...bergRestCatalogCaseInsensitiveMapping.java | 2 +- ...ergSnowflakeCatalogConnectorSmokeTest.java | 26 ++++---- .../snowflake/TestTrinoSnowflakeCatalog.java | 26 ++++---- .../trino/plugin/mariadb/MariaDbClient.java | 2 +- .../io/trino/plugin/mysql/MySqlClient.java | 2 +- .../plugin/mysql/BaseMySqlConnectorTest.java | 6 +- .../plugin/opa/TestOpaAccessControl.java | 1 - ...penSearchComplexTypePredicatePushDown.java | 8 +-- ...TestOpenSearchProjectionPushdownPlans.java | 12 ++-- .../io/trino/testing/BaseConnectorTest.java | 16 +++-- .../io/trino/security/TestAccessControl.java | 1 - 28 files changed, 143 insertions(+), 134 deletions(-) diff --git a/core/trino-main/src/test/java/io/trino/operator/window/WindowAssertions.java b/core/trino-main/src/test/java/io/trino/operator/window/WindowAssertions.java index e6c866820f4c..cc3b00742387 100644 --- a/core/trino-main/src/test/java/io/trino/operator/window/WindowAssertions.java +++ b/core/trino-main/src/test/java/io/trino/operator/window/WindowAssertions.java @@ -94,7 +94,7 @@ public final class WindowAssertions ) AS orders (orderkey, orderstatus, orderdate) """; - private WindowAssertions() { } + private WindowAssertions() {} public static void assertWindowQuery(@Language("SQL") String sql, MaterializedResult expected, QueryRunner queryRunner) { diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestAdaptivePartitioning.java b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestAdaptivePartitioning.java index ffbee6264e96..51df95d26e1f 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestAdaptivePartitioning.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestAdaptivePartitioning.java @@ -218,8 +218,6 @@ public void testSkipBroadcastSubtree() true); } - - private Session getSession() { return Session.builder(getPlanTester().getDefaultSession()) diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestColocatedJoin.java b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestColocatedJoin.java index 38f021bcc7a8..907d4222edf5 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestColocatedJoin.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestColocatedJoin.java @@ -123,7 +123,7 @@ public void testColocatedJoinWhenNumberOfBucketsInTableScanIsNotSufficient() WHERE orders.column_a = t.column_a AND orders.column_b = t.column_b - """, + """, prepareSession(20, colocatedJoinEnabled), anyTree( anyTree( diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestIssue23787.java b/core/trino-main/src/test/java/io/trino/sql/query/TestIssue23787.java index ff055d52017a..ce27271fdb32 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestIssue23787.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestIssue23787.java @@ -35,7 +35,7 @@ WITH t(a, b) AS ( WHEN a = 2 OR b THEN 'b' ELSE 'c' END = 'b' - FROM t + FROM t """)) .matches("VALUES false"); } diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestJoin.java b/core/trino-main/src/test/java/io/trino/sql/query/TestJoin.java index 413cd4451738..d91e2105735e 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestJoin.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestJoin.java @@ -317,18 +317,18 @@ void testFilterThatMayFail() assertThat(assertions.query( """ WITH - t(x,y) AS ( - VALUES + t(x,y) AS ( + VALUES ('a', '1'), ('b', 'x'), (null, 'y') - ), - u(x,y) AS ( - VALUES + ), + u(x,y) AS ( + VALUES ('a', '1'), ('c', 'x'), (null, 'y') - ) + ) SELECT * FROM t JOIN u ON t.x = u.x WHERE CAST(t.y AS int) = 1 @@ -341,8 +341,8 @@ WHERE CAST(t.y AS int) = 1 a(k, v) AS (VALUES if(random() >= 0, (1, CAST('10' AS varchar)))), b(k, v) AS (VALUES if(random() >= 0, (1, CAST('foo' AS varchar)))), t AS ( - SELECT k, CAST(v AS BIGINT) v1, v - FROM a) + SELECT k, CAST(v AS BIGINT) v1, v + FROM a) SELECT t.k, b.k FROM t JOIN b ON t.k = b.k AND t.v1 = 10 AND t.v = b.v """)) diff --git a/core/trino-main/src/test/java/io/trino/sql/query/TestRandom.java b/core/trino-main/src/test/java/io/trino/sql/query/TestRandom.java index 5cf9b19f7575..622bf8c91f48 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/TestRandom.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/TestRandom.java @@ -40,7 +40,7 @@ public void test() assertThat(assertions.query( """ WITH t(a, b) AS (SELECT random(), random()) - SELECT a = b + SELECT a = b FROM t """)) .matches("VALUES false"); @@ -48,7 +48,7 @@ WITH t(a, b) AS (SELECT random(), random()) assertThat(assertions.query( """ WITH t(a, b) AS (VALUES (random(), random())) - SELECT a = b + SELECT a = b FROM t """)) .matches("VALUES false"); @@ -56,7 +56,7 @@ WITH t(a, b) AS (VALUES (random(), random())) assertThat(assertions.query( """ WITH t(a, b) AS (SELECT transform(array[1], x -> random())[1], transform(array[1], x -> random())[1]) - SELECT a = b + SELECT a = b FROM t """)) .matches("VALUES false"); diff --git a/core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java b/core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java index 604f2a2a605f..3a9118cd3d0d 100644 --- a/core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java +++ b/core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java @@ -868,18 +868,18 @@ public void testIntersect() assertStatement("SELECT 123 INTERSECT DISTINCT CORRESPONDING SELECT 123 INTERSECT ALL CORRESPONDING SELECT 123", query(new Intersect( ImmutableList.of( - new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1 ,1), List.of()))), + new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1, 1), List.of()))), createSelect123()), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); assertStatement("SELECT 123 INTERSECT DISTINCT CORRESPONDING BY (x) SELECT 123 INTERSECT ALL CORRESPONDING SELECT 123", query(new Intersect( ImmutableList.of( - new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1 ,1), List.of(identifier("x"))))), + new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1, 1), List.of(identifier("x"))))), createSelect123()), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); } @Test @@ -896,18 +896,18 @@ public void testUnion() assertStatement("SELECT 123 UNION DISTINCT CORRESPONDING SELECT 123 UNION ALL CORRESPONDING SELECT 123", query(new Union( ImmutableList.of( - new Union(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1 ,1), List.of()))), + new Union(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1, 1), List.of()))), createSelect123()), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); assertStatement("SELECT 123 UNION DISTINCT CORRESPONDING BY (x) SELECT 123 UNION ALL CORRESPONDING SELECT 123", query(new Union( ImmutableList.of( - new Union(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1 ,1), List.of(identifier("x"))))), + new Union(ImmutableList.of(createSelect123(), createSelect123()), true, Optional.of(new Corresponding(location(1, 1), List.of(identifier("x"))))), createSelect123()), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); } @Test @@ -924,18 +924,18 @@ public void testExcept() assertStatement("SELECT 123 EXCEPT DISTINCT CORRESPONDING SELECT 123 EXCEPT ALL CORRESPONDING SELECT 123", query(new Except( location(1, 1), - new Except(location(1, 1), createSelect123(), createSelect123(), true, Optional.of(new Corresponding(location(1 ,1), List.of()))), + new Except(location(1, 1), createSelect123(), createSelect123(), true, Optional.of(new Corresponding(location(1, 1), List.of()))), createSelect123(), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); assertStatement("SELECT 123 EXCEPT DISTINCT CORRESPONDING BY (x) SELECT 123 EXCEPT ALL CORRESPONDING SELECT 123", query(new Except( location(1, 1), - new Except(location(1, 1), createSelect123(), createSelect123(), true, Optional.of(new Corresponding(location(1 ,1), List.of(identifier("x"))))), + new Except(location(1, 1), createSelect123(), createSelect123(), true, Optional.of(new Corresponding(location(1, 1), List.of(identifier("x"))))), createSelect123(), false, - Optional.of(new Corresponding(location(1 ,1), List.of()))))); + Optional.of(new Corresponding(location(1, 1), List.of()))))); } private static QuerySpecification createSelect123() @@ -3519,22 +3519,23 @@ THEN INSERT (part, qty) VALUES (c.part, c.qty) ON true WHEN MATCHED THEN DELETE - """)).isEqualTo(new Merge( - location, - new AliasedRelation( - new Table( - location(1, 1), - QualifiedName.of(List.of(new Identifier(location(1, 12), "inventory", false))), - Optional.of(new Identifier(location(1, 24), "dev", false))), - new Identifier(location(1, 31), "i", false), - null), - new AliasedRelation( - location(2, 9), - new Table(location(2, 9), QualifiedName.of(List.of(new Identifier(location(2, 9), "changes", false)))), - new Identifier(location(2, 20), "c", false), - null), - new BooleanLiteral(location(3, 6), "true"), - ImmutableList.of(new MergeDelete(location(4, 1), Optional.empty())))); + """)) + .isEqualTo(new Merge( + location, + new AliasedRelation( + new Table( + location(1, 1), + QualifiedName.of(List.of(new Identifier(location(1, 12), "inventory", false))), + Optional.of(new Identifier(location(1, 24), "dev", false))), + new Identifier(location(1, 31), "i", false), + null), + new AliasedRelation( + location(2, 9), + new Table(location(2, 9), QualifiedName.of(List.of(new Identifier(location(2, 9), "changes", false)))), + new Identifier(location(2, 20), "c", false), + null), + new BooleanLiteral(location(3, 6), "true"), + ImmutableList.of(new MergeDelete(location(4, 1), Optional.empty())))); } @Test @@ -6706,7 +6707,6 @@ public void testListagg() new BooleanLiteral(location(1, 1), "true"), new StringLiteral(location(1, 1), "..."), new BooleanLiteral(location(1, 1), "false")))); - } @Test @@ -7139,7 +7139,7 @@ public void testSessionProperty() Optional.empty(), new QuerySpecification( location(4, 1), - new Select(location(4, 1), false, ImmutableList.of(new SingleColumn(location(4, 8), new LongLiteral(location(4, 8),"1"), Optional.empty()))), + new Select(location(4, 1), false, ImmutableList.of(new SingleColumn(location(4, 8), new LongLiteral(location(4, 8), "1"), Optional.empty()))), Optional.empty(), Optional.empty(), Optional.empty(), @@ -7163,7 +7163,7 @@ public void testInvalidQueryScoped() // Session after function assertStatementIsInvalid("WITH FUNCTION abc() RETURNS int RETURN 42, SESSION query_max_memory = '1GB' SELECT 1") - .withMessage("line 1:44: mismatched input 'SESSION'. Expecting: 'FUNCTION'"); + .withMessage("line 1:44: mismatched input 'SESSION'. Expecting: 'FUNCTION'"); // Session after function assertStatementIsInvalid("WITH SESSION query_max_memory = '1GB', FUNCTION abc() RETURNS int RETURN 42, SESSION query_max_total_memory = '1GB' SELECT 1") @@ -7203,7 +7203,7 @@ FUNCTION foo() Optional.empty(), new QuerySpecification( location(7, 1), - new Select(location(7, 1), false, ImmutableList.of(new SingleColumn(location(7, 8), new LongLiteral(location(7, 8),"1"), Optional.empty()))), + new Select(location(7, 1), false, ImmutableList.of(new SingleColumn(location(7, 8), new LongLiteral(location(7, 8), "1"), Optional.empty()))), Optional.empty(), Optional.empty(), Optional.empty(), diff --git a/lib/trino-hive-formats/src/test/java/io/trino/hive/formats/esri/TestEsriDeserializer.java b/lib/trino-hive-formats/src/test/java/io/trino/hive/formats/esri/TestEsriDeserializer.java index 34dbf3e93866..1ad29dad5b65 100644 --- a/lib/trino-hive-formats/src/test/java/io/trino/hive/formats/esri/TestEsriDeserializer.java +++ b/lib/trino-hive-formats/src/test/java/io/trino/hive/formats/esri/TestEsriDeserializer.java @@ -112,7 +112,8 @@ public void testDeserializeSimpleFeature() } @Test - public void testDeserializeNullValues() throws IOException + public void testDeserializeNullValues() + throws IOException { String json = """ { @@ -235,7 +236,8 @@ public void testUnsupportedAttributeTypes() } @Test - public void testDeserializeMissingColumns() throws IOException + public void testDeserializeMissingColumns() + throws IOException { String json = """ { @@ -262,7 +264,9 @@ public void testDeserializeInvalidJson() } @Test - public void testDeserializeDateFormats() throws IOException { + public void testDeserializeDateFormats() + throws IOException + { // Test valid epoch milliseconds (as number) String jsonEpoch = """ { @@ -320,7 +324,9 @@ public void testDeserializeDateFormats() throws IOException { } @Test - public void testDeserializeTimestampFormats() throws IOException { + public void testDeserializeTimestampFormats() + throws IOException + { String[] validTimestampFormats = { "2025-03-03 00:00:00.000", // with leading zeros "2025-03-03 00:00:00", @@ -387,7 +393,9 @@ public void testDeserializeTimestampFormats() throws IOException { } @Test - public void testDeserializeInvalidDateFormat() throws IOException { + public void testDeserializeInvalidDateFormat() + throws IOException + { String json = """ { "attributes": { @@ -402,7 +410,9 @@ public void testDeserializeInvalidDateFormat() throws IOException { } @Test - public void testDeserializeInvalidTimestampFormat() throws IOException { + public void testDeserializeInvalidTimestampFormat() + throws IOException + { String json = """ { "attributes": { @@ -417,7 +427,9 @@ public void testDeserializeInvalidTimestampFormat() throws IOException { } @Test - public void testDeserializeDateOutOfRange() throws IOException { + public void testDeserializeDateOutOfRange() + throws IOException + { String json = """ { "attributes": { @@ -595,7 +607,8 @@ private static Page parse(String json) } private static Page parse(String json, List columns) - throws IOException { + throws IOException + { JsonParser jsonParser = JSON_FACTORY.createParser(json); assertThat(jsonParser.nextToken()).isEqualTo(START_OBJECT); diff --git a/plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectorTest.java b/plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectorTest.java index 3b5b248f7a24..185d2700279c 100644 --- a/plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectorTest.java +++ b/plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectorTest.java @@ -1930,7 +1930,7 @@ 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 = createTestTableForWrites( "test_delete_varchar", "(col varchar(1), pk INT)", ImmutableList.of("'a', 1", "'A', 2", "null, 3"), "pk")) { + try (TestTable table = createTestTableForWrites("test_delete_varchar", "(col varchar(1), pk INT)", ImmutableList.of("'a', 1", "'A', 2", "null, 3"), "pk")) { if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY) && !hasBehavior(SUPPORTS_ROW_LEVEL_UPDATE)) { assertQueryFails("DELETE FROM " + table.getName() + " WHERE col = 'A'", MODIFYING_ROWS_MESSAGE); return; diff --git a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryConnectorTest.java b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryConnectorTest.java index a64d2a73b49c..3c54f13a7db0 100644 --- a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryConnectorTest.java +++ b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryConnectorTest.java @@ -1233,7 +1233,7 @@ public void testExecuteProcedureWithInvalidQuery() @Test public void testLimitPushdownWithExternalTable() { - String externalTableName = TEST_SCHEMA + ".region_external_table_" + randomNameSuffix(); + String externalTableName = TEST_SCHEMA + ".region_external_table_" + randomNameSuffix(); onBigQuery("CREATE EXTERNAL TABLE " + externalTableName + " OPTIONS (format = 'CSV', uris = ['gs://" + gcpStorageBucket + "/tpch/tiny/region.csv'])"); try { assertLimitPushdownOnRegionTable(getSession(), externalTableName); @@ -1262,7 +1262,7 @@ public void testLimitPushdownWithView() @Test public void testLimitPushdownWithMaterializedView() { - String mvName = TEST_SCHEMA + ".region_mv_" + randomNameSuffix(); + String mvName = TEST_SCHEMA + ".region_mv_" + randomNameSuffix(); onBigQuery("CREATE MATERIALIZED VIEW " + mvName + " AS SELECT * FROM tpch.region"); try { // materialized view with materialization uses storage api, with storage api limit pushdown is not supported @@ -1531,5 +1531,4 @@ private void onBigQuery(@Language("SQL") String sql) { bigQuerySqlExecutor.execute(sql); } - } diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java index c940a41955d3..a3356dd74fa6 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeBasic.java @@ -132,6 +132,7 @@ public class TestDeltaLakeBasic new ResourceTable("person_without_last_checkpoint", "databricks73/person_without_last_checkpoint"), new ResourceTable("person_without_old_jsons", "databricks73/person_without_old_jsons"), new ResourceTable("person_without_checkpoints", "databricks73/person_without_checkpoints")); + private static final List OTHER_TABLES = ImmutableList.of( new ResourceTable("allow_column_defaults", "deltalake/allow_column_defaults"), new ResourceTable("stats_with_minmax_nulls", "deltalake/stats_with_minmax_nulls"), @@ -1511,7 +1512,7 @@ private void testDeletionVectorsPages(boolean parquetUseColumnIndex) assertQueryReturnsEmptyResult(session, "SELECT * FROM " + tableName + " WHERE id = 20001"); assertThat(query(session, "SELECT * FROM " + tableName + " WHERE id = 99999")).matches("VALUES 99999"); - assertThat(query(session, "SELECT id, _change_type, _commit_version FROM TABLE(system.table_changes('tpch', '" +tableName+ "')) WHERE id = 20001")) + assertThat(query(session, "SELECT id, _change_type, _commit_version FROM TABLE(system.table_changes('tpch', '" + tableName + "')) WHERE id = 20001")) .matches("VALUES (20001, VARCHAR 'insert', BIGINT '1'), (20001, VARCHAR 'update_preimage', BIGINT '2')"); assertUpdate("DROP TABLE " + tableName); @@ -2723,7 +2724,8 @@ public static void updateClonedTableDeletionVectorPathPrefixAndSource(Path locat if (!content.equals(newContent)) { Files.write(file, newContent.getBytes(StandardCharsets.UTF_8), StandardOpenOption.TRUNCATE_EXISTING); } - } catch (IOException e) { + } + catch (IOException e) { throw new RuntimeException(e); } }); diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeConnectorTest.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeConnectorTest.java index 5b8a21f33a8b..87abce343958 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeConnectorTest.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeConnectorTest.java @@ -1048,7 +1048,7 @@ public void testPathColumn() // test simple delete correctness assertUpdate("DELETE FROM " + table.getName() + " WHERE \"$path\" = 'not exist'", 0); - assertQuery("SELECT x FROM " + table.getName(), "VALUES 'first', 'second'"); + assertQuery("SELECT x FROM " + table.getName(), "VALUES 'first', 'second'"); assertUpdate("DELETE FROM " + table.getName() + " WHERE \"$path\" = '" + firstFilePath + "'", 1); assertQuery("SELECT x FROM " + table.getName(), "VALUES 'second'"); @@ -5235,7 +5235,6 @@ public void testInsertFromTemporalVersionedSameTable() } } - @Test public void testInsertFromMultipleVersionedSameTable() { @@ -5381,12 +5380,12 @@ public void testSelectTableUsingTemporalVersionDeletedCheckpoints() assertUpdate("CREATE TABLE " + tableName + " WITH (location = '" + tableLocation + "', checkpoint_interval = 1) AS SELECT 1 id", 1); MILLISECONDS.sleep(10); - Instant InstantAfterCreateTable = Instant.ofEpochMilli(System.currentTimeMillis()); - String timeAfterCreateTable = ZonedDateTime.ofInstant(InstantAfterCreateTable, ZoneId.of("UTC")).format(timestampWithTimeZoneFormatter); + Instant instantAfterCreateTable = Instant.ofEpochMilli(System.currentTimeMillis()); + String timeAfterCreateTable = ZonedDateTime.ofInstant(instantAfterCreateTable, ZoneId.of("UTC")).format(timestampWithTimeZoneFormatter); assertUpdate("INSERT INTO " + tableName + " VALUES 2", 1); - Instant InstantAfterInsert = Instant.ofEpochMilli(System.currentTimeMillis()); - String timeAfterInsert = ZonedDateTime.ofInstant(InstantAfterInsert, ZoneId.of("UTC")).format(timestampWithTimeZoneFormatter); + Instant instantAfterInsert = Instant.ofEpochMilli(System.currentTimeMillis()); + String timeAfterInsert = ZonedDateTime.ofInstant(instantAfterInsert, ZoneId.of("UTC")).format(timestampWithTimeZoneFormatter); assertUpdate("INSERT INTO " + tableName + " VALUES 3", 1); @@ -5399,8 +5398,8 @@ public void testSelectTableUsingTemporalVersionDeletedCheckpoints() assertQuery("SELECT * FROM " + tableName, "VALUES 1, 2, 3"); - assertQueryFails("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF TIMESTAMP '" + timeAfterCreateTable + "'", "No temporal version history at or before " + InstantAfterCreateTable); - assertQueryFails("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF TIMESTAMP '" + timeAfterInsert + "'", "No temporal version history at or before " + InstantAfterInsert); + assertQueryFails("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF TIMESTAMP '" + timeAfterCreateTable + "'", "No temporal version history at or before " + instantAfterCreateTable); + assertQueryFails("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF TIMESTAMP '" + timeAfterInsert + "'", "No temporal version history at or before " + instantAfterInsert); assertQuery("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF TIMESTAMP '" + ZonedDateTime.now().format(timestampWithTimeZoneFormatter) + "'", "VALUES 1, 2, 3"); } diff --git a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java index abdb587196fc..7d5be4a3b307 100644 --- a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java +++ b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java @@ -2091,7 +2091,7 @@ void testSimpleProjectionPushdown() Map record2 = new HashMap<>(); record2.put("id", 2L); - record2.put( "root", null); + record2.put("root", null); index(tableName, record2); Map record32 = new HashMap<>(); @@ -2118,7 +2118,7 @@ void testSimpleProjectionPushdown() void testProjectionPushdownWithCaseSensitiveField() throws IOException { - String tableName = "test_projection_with_case_sensitive_field_" + randomNameSuffix();; + String tableName = "test_projection_with_case_sensitive_field_" + randomNameSuffix(); @Language("JSON") String properties = """ @@ -2568,7 +2568,7 @@ public void testWildcardTableSameSchema() try { assertThat(query("DESCRIBE \"" + wildcardTable + "\"")) .skippingTypesCheck() - .matches( "VALUES ('long_column', 'bigint', '', ''), ('text_column', 'varchar', '', '')"); + .matches("VALUES ('long_column', 'bigint', '', ''), ('text_column', 'varchar', '', '')"); assertThat(query("SELECT * FROM \"" + wildcardTable + "\"")) .matches("VALUES (BIGINT '1', VARCHAR 'Trino'), (BIGINT '2', VARCHAR 'rocks')"); diff --git a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchComplexTypePredicatePushDown.java b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchComplexTypePredicatePushDown.java index e176679f173e..94c4e28c8999 100644 --- a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchComplexTypePredicatePushDown.java +++ b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchComplexTypePredicatePushDown.java @@ -74,7 +74,7 @@ void testRowTypeOnlyNullsRowGroupPruning() Map document = new HashMap<>(); document.put("col", null); Map indexPayload = ImmutableMap.of("index", ImmutableMap.of("_index", tableName, "_id", String.valueOf(System.nanoTime()))); - String jsonDocument = OBJECT_MAPPER.writeValueAsString(document);; + String jsonDocument = OBJECT_MAPPER.writeValueAsString(document); String jsonIndex = OBJECT_MAPPER.writeValueAsString(indexPayload); payload.append(jsonIndex).append("\n").append(jsonDocument).append("\n"); } @@ -217,7 +217,7 @@ void testRowTypeRowGroupPruning() int c22 = 6; StringBuilder payload = new StringBuilder(); - for (int i=0; i<10000; i++) { + for (int i = 0; i < 10000; i++) { Map document = ImmutableMap.builder() .put("col1Row", ImmutableMap.builder() .put("a", a) @@ -309,7 +309,7 @@ void testArrayTypeRowGroupPruning() """; StringBuilder payload = new StringBuilder(); - for (int i=0; i<10000; i++) { + for (int i = 0; i < 10000; i++) { Map document = ImmutableMap.builder() .put("colArray", ImmutableList.builder() .add(100L) @@ -373,7 +373,7 @@ private static String bulkEndpoint(String index) private void deleteIndex(String indexName) throws IOException { - Request request = new Request("DELETE", "/" + indexName); + Request request = new Request("DELETE", "/" + indexName); client.getLowLevelClient().performRequest(request); } } diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java index 3e058864ca9e..c76634275bb0 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java @@ -5365,7 +5365,7 @@ private void testParquetTimestampPredicatePushdown(HiveTimestampPrecision timest queryStats -> { assertThat(queryStats.getProcessedInputDataSize().toBytes()).isGreaterThan(0); }, - results -> { }); + results -> {}); } @Test @@ -5412,7 +5412,7 @@ private void testOrcTimestampPredicatePushdown(HiveTimestampPrecision timestampP queryStats -> { assertThat(queryStats.getProcessedInputDataSize().toBytes()).isGreaterThan(0); }, - results -> { }); + results -> {}); } private static String formatTimestamp(LocalDateTime timestamp) diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestEsriTable.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestEsriTable.java index a15e034bc9b2..16bc7ded4ab9 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestEsriTable.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestEsriTable.java @@ -92,7 +92,6 @@ CREATE TABLE counties ( assertUpdate("DROP TABLE counties"); } - private static List readExpectedResults(String resourcePath) throws IOException { @@ -110,7 +109,8 @@ private static List readExpectedResults(String resourcePath) .collect(toImmutableList()); } - private static byte[] hexToBytes(String hex) { + private static byte[] hexToBytes(String hex) + { // Remove 'X' prefix, spaces, and single quotes if present hex = hex.replaceAll("^X'|'$", "") // Remove X' and trailing ' .replaceAll("\\s+", ""); // Remove all whitespace diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergLocalConcurrentWrites.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergLocalConcurrentWrites.java index 942d9aaa50a7..10ea8caa59dc 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergLocalConcurrentWrites.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergLocalConcurrentWrites.java @@ -1304,7 +1304,6 @@ private void testConcurrentOverlappingOptimize(boolean partitioned) try (TestTable table = newTrinoTable( "test_concurrent_non_overlapping_optimize_table_", "(a INT, part INT) " + (partitioned ? " WITH (partitioning = ARRAY['part'])" : ""))) { - ImmutableList.Builder expectedValues = ImmutableList.builder(); // Add 10 files to each partition for (int i = 0; i < 10; i++) { @@ -1364,7 +1363,6 @@ void testConcurrentNonOverlappingOptimize() try (TestTable table = newTrinoTable( "test_concurrent_non_overlapping_optimize_table_", "(a INT, part INT) WITH (partitioning = ARRAY['part']) ")) { - ImmutableList.Builder expectedValues = ImmutableList.builder(); // Add 10 files to each partition for (int i = 0; i < 10; i++) { diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergRestCatalogCaseInsensitiveMapping.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergRestCatalogCaseInsensitiveMapping.java index f1215145cba4..82dddeec6438 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergRestCatalogCaseInsensitiveMapping.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergRestCatalogCaseInsensitiveMapping.java @@ -159,7 +159,7 @@ void testCaseInsensitiveMatchingForTable() """.formatted(LOWERCASE_SCHEMA, lowercaseTableName1, lowercaseTableName2)); // Add table comment - assertUpdate("COMMENT ON TABLE " + tableName1 + " IS 'test comment' "); + assertUpdate("COMMENT ON TABLE " + tableName1 + " IS 'test comment' "); assertThat(getTableComment(lowercaseTableName1)).isEqualTo("test comment"); // Add table column comment diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java index a028d514c4a9..c511f47642bf 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java @@ -71,14 +71,14 @@ protected QueryRunner createQueryRunner() executeOnSnowflake( """ CREATE OR REPLACE ICEBERG TABLE %s ( - NATIONKEY NUMBER(38,0), - NAME STRING, - REGIONKEY NUMBER(38,0), - COMMENT STRING + NATIONKEY NUMBER(38,0), + NAME STRING, + REGIONKEY NUMBER(38,0), + COMMENT STRING ) - EXTERNAL_VOLUME = '%s' - CATALOG = 'SNOWFLAKE' - BASE_LOCATION = '%s/'""".formatted(TpchTable.NATION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.NATION.getTableName())); + EXTERNAL_VOLUME = '%s' + CATALOG = 'SNOWFLAKE' + BASE_LOCATION = '%s/'""".formatted(TpchTable.NATION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.NATION.getTableName())); executeOnSnowflake("INSERT INTO %s(NATIONKEY, NAME, REGIONKEY, COMMENT) SELECT N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.%s" .formatted(TpchTable.NATION.getTableName(), TpchTable.NATION.getTableName())); @@ -87,13 +87,13 @@ REGIONKEY NUMBER(38,0), executeOnSnowflake( """ CREATE OR REPLACE ICEBERG TABLE %s ( - REGIONKEY NUMBER(38,0), - NAME STRING, - COMMENT STRING + REGIONKEY NUMBER(38,0), + NAME STRING, + COMMENT STRING ) - EXTERNAL_VOLUME = '%s' - CATALOG = 'SNOWFLAKE' - BASE_LOCATION = '%s/'""".formatted(TpchTable.REGION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.REGION.getTableName())); + EXTERNAL_VOLUME = '%s' + CATALOG = 'SNOWFLAKE' + BASE_LOCATION = '%s/'""".formatted(TpchTable.REGION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.REGION.getTableName())); executeOnSnowflake("INSERT INTO %s(REGIONKEY, NAME, COMMENT) SELECT R_REGIONKEY, R_NAME, R_COMMENT FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.%s" .formatted(TpchTable.REGION.getTableName(), TpchTable.REGION.getTableName())); diff --git a/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java b/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java index 1e8b948a7b01..2e07dfbcc048 100644 --- a/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java +++ b/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java @@ -108,14 +108,14 @@ private static void testTableSetup() server, """ CREATE OR REPLACE ICEBERG TABLE %s ( - NATIONKEY NUMBER(38,0), - NAME STRING, - REGIONKEY NUMBER(38,0), - COMMENT STRING + NATIONKEY NUMBER(38,0), + NAME STRING, + REGIONKEY NUMBER(38,0), + COMMENT STRING ) - EXTERNAL_VOLUME = '%s' - CATALOG = 'SNOWFLAKE' - BASE_LOCATION = '%s/'""".formatted(TpchTable.NATION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.NATION.getTableName())); + EXTERNAL_VOLUME = '%s' + CATALOG = 'SNOWFLAKE' + BASE_LOCATION = '%s/'""".formatted(TpchTable.NATION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.NATION.getTableName())); executeOnSnowflake(server, "INSERT INTO %s(NATIONKEY, NAME, REGIONKEY, COMMENT) SELECT N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.%s" .formatted(TpchTable.NATION.getTableName(), TpchTable.NATION.getTableName())); @@ -125,13 +125,13 @@ REGIONKEY NUMBER(38,0), server, """ CREATE OR REPLACE ICEBERG TABLE %s ( - REGIONKEY NUMBER(38,0), - NAME STRING, - COMMENT STRING + REGIONKEY NUMBER(38,0), + NAME STRING, + COMMENT STRING ) - EXTERNAL_VOLUME = '%s' - CATALOG = 'SNOWFLAKE' - BASE_LOCATION = '%s/'""".formatted(TpchTable.REGION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.REGION.getTableName())); + EXTERNAL_VOLUME = '%s' + CATALOG = 'SNOWFLAKE' + BASE_LOCATION = '%s/'""".formatted(TpchTable.REGION.getTableName(), SNOWFLAKE_S3_EXTERNAL_VOLUME, TpchTable.REGION.getTableName())); executeOnSnowflake(server, "INSERT INTO %s(REGIONKEY, NAME, COMMENT) SELECT R_REGIONKEY, R_NAME, R_COMMENT FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.%s" .formatted(TpchTable.REGION.getTableName(), TpchTable.REGION.getTableName())); diff --git a/plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java b/plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java index 2e2f2b4baacf..2e512be09a6e 100644 --- a/plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java +++ b/plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java @@ -957,5 +957,5 @@ Map getColumnIndexStatistics(JdbcTableHandle tabl private record AnalyzeColumnStatistics(double nullsRatio) {} - private record ColumnIndexStatistics(boolean nullable, long cardinality) { } + private record ColumnIndexStatistics(boolean nullable, long cardinality) {} } diff --git a/plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java b/plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java index 03e9cf9973ec..c9519b799587 100644 --- a/plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java +++ b/plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java @@ -1462,7 +1462,7 @@ Map getColumnHistograms(JdbcTableHandle table) } } - private record ColumnIndexStatistics(boolean nullable, long cardinality) { } + private record ColumnIndexStatistics(boolean nullable, long cardinality) {} // See https://dev.mysql.com/doc/refman/8.0/en/optimizer-statistics.html public static class ColumnHistogram diff --git a/plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/BaseMySqlConnectorTest.java b/plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/BaseMySqlConnectorTest.java index 614b49ca2fdd..910666787f0e 100644 --- a/plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/BaseMySqlConnectorTest.java +++ b/plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/BaseMySqlConnectorTest.java @@ -778,14 +778,14 @@ public void verifyMySqlJdbcDriverNegativeDateHandling() assertThatThrownBy(() -> { // Insert via prepared statement fails too try (Connection connection = mySqlServer.createConnection(); - PreparedStatement insert = connection.prepareStatement("INSERT INTO " + table.getName() + " VALUES (?)")) { + PreparedStatement insert = connection.prepareStatement("INSERT INTO " + table.getName() + " VALUES (?)")) { insert.setObject(1, negativeDate); int affectedRows = insert.executeUpdate(); assertThat(affectedRows).isEqualTo(1); } }) - .isInstanceOf(MysqlDataTruncation.class) - .hasMessageContaining("Incorrect date value: '-0001-01-01'"); + .isInstanceOf(MysqlDataTruncation.class) + .hasMessageContaining("Incorrect date value: '-0001-01-01'"); } } diff --git a/plugin/trino-opa/src/test/java/io/trino/plugin/opa/TestOpaAccessControl.java b/plugin/trino-opa/src/test/java/io/trino/plugin/opa/TestOpaAccessControl.java index 9456f47e463f..8c12081e815c 100644 --- a/plugin/trino-opa/src/test/java/io/trino/plugin/opa/TestOpaAccessControl.java +++ b/plugin/trino-opa/src/test/java/io/trino/plugin/opa/TestOpaAccessControl.java @@ -364,7 +364,6 @@ public void testCreateSchema() @Test public void testCreateSchemaWithProperties() { - CatalogSchemaName schema = new CatalogSchemaName("my_catalog", "my_schema"); ThrowingMethodWrapper wrappedMethod = new ThrowingMethodWrapper( accessControl -> accessControl.checkCanCreateSchema(TEST_SECURITY_CONTEXT, schema, ImmutableMap.of("some_key", "some_value"))); diff --git a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchComplexTypePredicatePushDown.java b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchComplexTypePredicatePushDown.java index eed568ab1a5e..0a5d8a7fe7d3 100644 --- a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchComplexTypePredicatePushDown.java +++ b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchComplexTypePredicatePushDown.java @@ -78,7 +78,7 @@ void testRowTypeOnlyNullsRowGroupPruning() Map document = new HashMap<>(); document.put("col", null); Map indexPayload = ImmutableMap.of("index", ImmutableMap.of("_index", tableName, "_id", String.valueOf(System.nanoTime()))); - String jsonDocument = OBJECT_MAPPER.writeValueAsString(document);; + String jsonDocument = OBJECT_MAPPER.writeValueAsString(document); String jsonIndex = OBJECT_MAPPER.writeValueAsString(indexPayload); payload.append(jsonIndex).append("\n").append(jsonDocument).append("\n"); } @@ -221,7 +221,7 @@ void testRowTypeRowGroupPruning() int c22 = 6; StringBuilder payload = new StringBuilder(); - for (int i=0; i<10000; i++) { + for (int i = 0; i < 10000; i++) { Map document = ImmutableMap.builder() .put("col1Row", ImmutableMap.builder() .put("a", a) @@ -313,7 +313,7 @@ void testArrayTypeRowGroupPruning() """; StringBuilder payload = new StringBuilder(); - for (int i=0; i<10000; i++) { + for (int i = 0; i < 10000; i++) { Map document = ImmutableMap.builder() .put("colArray", ImmutableList.builder() .add(100L) @@ -377,7 +377,7 @@ private static String bulkEndpoint(String index) private void deleteIndex(String indexName) throws IOException { - Request request = new Request("DELETE", "/" + indexName); + Request request = new Request("DELETE", "/" + indexName); client.getLowLevelClient().performRequest(request); } } diff --git a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchProjectionPushdownPlans.java b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchProjectionPushdownPlans.java index 84a9fc8b7740..86791e8b345d 100644 --- a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchProjectionPushdownPlans.java +++ b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/TestOpenSearchProjectionPushdownPlans.java @@ -151,9 +151,9 @@ void testPushdownDisabled() .build(); @Language("JSON") String properties = - """ + """ { - "properties": { + "properties": { "col0": { "properties": { "a": { @@ -164,9 +164,9 @@ void testPushdownDisabled() } } } - } - } - """; + } + } + """; createIndex(tableName, properties); assertPlan( @@ -324,7 +324,7 @@ private static String indexEndpoint(String index, String docId) private void deleteIndex(String indexName) throws IOException { - Request request = new Request("DELETE", "/" + indexName); + Request request = new Request("DELETE", "/" + indexName); client.getLowLevelClient().performRequest(request); } } diff --git a/testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java b/testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java index a142717ac190..5a25189aa369 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java @@ -2613,7 +2613,6 @@ public void testAddRowFieldInArray() try (TestTable table = newTrinoTable( "test_add_field_in_array_nested_", "AS SELECT CAST(array[array[row(1, row(10), array[row(11)])]] AS array(array(row(a integer, b row(x integer), c array(row(v integer)))))) AS col")) { - assertThat(getColumnType(table.getName(), "col")).isEqualTo("array(array(row(a integer, b row(x integer), c array(row(v integer)))))"); assertUpdate("ALTER TABLE " + table.getName() + " ADD COLUMN col.element.element.d integer"); @@ -2779,7 +2778,6 @@ public void testDropRowFieldInArray() try (TestTable table = newTrinoTable( "test_drop_field_in_array_nested_", "AS SELECT CAST(array[array[row(1, 2, row(10, 20), array[row(30, 40)])]] AS array(array(row(a integer, b integer, c row(x integer, y integer), d array(row(v integer, w integer)))))) AS col")) { - // Use path ending with element assertQueryFails( "ALTER TABLE " + table.getName() + " DROP COLUMN col.element.element", @@ -3626,7 +3624,8 @@ public void testCreateOrReplaceTableWhenTableDoesNotExist() try { assertUpdate("CREATE OR REPLACE TABLE " + table + " (a bigint, b double, c varchar(50))"); assertQueryReturnsEmptyResult("SELECT * FROM " + table); - } finally { + } + finally { assertUpdate("DROP TABLE IF EXISTS " + table); } } @@ -3646,7 +3645,8 @@ public void testCreateOrReplaceTableAsSelectWhenTableDoesNotExists() try { assertUpdate("CREATE OR REPLACE TABLE " + table + " AS " + query, rowCountQuery); assertQuery("SELECT * FROM " + table, query); - } finally { + } + finally { assertUpdate("DROP TABLE IF EXISTS " + table); } } @@ -4682,7 +4682,7 @@ public void testInsertMap() try (TestTable table = newTrinoTable("test_insert_map_", "(col map(integer, integer))")) { assertUpdate("INSERT INTO " + table.getName() + " VALUES map(ARRAY[1], ARRAY[2])", 1); assertThat(query("SELECT * FROM " + table.getName())) - .matches("VALUES map(ARRAY[1], ARRAY[2])"); + .matches("VALUES map(ARRAY[1], ARRAY[2])"); } } @@ -5440,11 +5440,13 @@ public void testCreateOrReplaceTableConcurrently() IntStream.range(0, numOfCreateOrReplaceStatements).forEach(index -> { try { getQueryRunner().execute("CREATE OR REPLACE TABLE " + tableName + " AS SELECT * FROM (VALUES (1), (2)) AS t(a) "); - } catch (Exception e) { + } + catch (Exception e) { RuntimeException trinoException = getTrinoExceptionCause(e); try { throw new AssertionError("Unexpected concurrent CREATE OR REPLACE failure", trinoException); - } catch (Throwable verifyFailure) { + } + catch (Throwable verifyFailure) { if (verifyFailure != e) { verifyFailure.addSuppressed(e); } diff --git a/testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java b/testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java index 87d26bee3d9a..8724a1672291 100644 --- a/testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java +++ b/testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java @@ -1484,7 +1484,6 @@ public void testAccessControlWithRolesAndRowFilter() assertAccessAllowed(session, "SELECT nationkey FROM nation"); } - @Test public void testSchemasAuthorization() {