Skip to content

Commit 2864942

Browse files
committed
Fix Checkstyle violations in AbstractTestDistributedQueries.java
- Fix left brace placement for testViewWithUUID, testExplainAnalyzeWithCTEMaterialization, and assertExplainAnalyze methods - Split long lines to comply with 80-character limit - Add proper Javadoc comments - Remove trailing whitespace
1 parent d0b8aab commit 2864942

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestDistributedQueries.java

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,12 +1643,19 @@ private String sanitizePlan(String explain)
16431643
.replaceAll("Values => .*\n", "\n");
16441644
}
16451645

1646+
/**
1647+
* Tests view creation and querying with UUID data type.
1648+
* Verifies that UUID values can be properly stored and retrieved from views.
1649+
*/
16461650
@Test
16471651
public void testViewWithUUID()
16481652
{
16491653
skipTestUnless(supportsViews());
16501654

1651-
@Language("SQL") String query = "SELECT * FROM (VALUES (CAST(0 AS INTEGER), NULL), (CAST(1 AS INTEGER), UUID '12151fd2-7586-11e9-8f9e-2a86e4085a59')) AS t (rum, c1)";
1655+
@Language("SQL") String query = "SELECT * FROM (VALUES "
1656+
+ "(CAST(0 AS INTEGER), NULL), "
1657+
+ "(CAST(1 AS INTEGER), UUID '12151fd2-7586-11e9-8f9e-2a86e4085a59')) "
1658+
+ "AS t (rum, c1)";
16521659

16531660
// Create View with UUID type in Hive
16541661
assertQuerySucceeds("CREATE VIEW test_hive_view AS " + query);
@@ -1657,45 +1664,62 @@ public void testViewWithUUID()
16571664
MaterializedResult result = computeActual("SELECT c1 FROM test_hive_view WHERE rum = 1");
16581665

16591666
// Verify the result set is not empty
1660-
assertTrue(result.getMaterializedRows().size() > 0, "Result set is empty");
1667+
assertTrue(result.getMaterializedRows().size() > 0,
1668+
"Result set is empty");
16611669
assertEquals(result.getTypes(), ImmutableList.of(UUID));
1662-
assertEquals(result.getOnlyValue(), "12151fd2-7586-11e9-8f9e-2a86e4085a59");
1670+
assertEquals(result.getOnlyValue(),
1671+
"12151fd2-7586-11e9-8f9e-2a86e4085a59");
16631672

16641673
// Drop the view after the test
16651674
assertQuerySucceeds("DROP VIEW test_hive_view");
16661675
}
16671676

1677+
/**
1678+
* Tests EXPLAIN ANALYZE with CTE materialization enabled.
1679+
* This verifies the fix for issue #23798 where EXPLAIN ANALYZE
1680+
* failed on queries with CTE materialization due to multiple sub stages.
1681+
*/
16681682
@Test
16691683
public void testExplainAnalyzeWithCTEMaterialization()
16701684
{
1671-
// Test EXPLAIN ANALYZE with CTE materialization enabled
1672-
// This test verifies the fix for issue #23798 where EXPLAIN ANALYZE
1673-
// failed on queries with CTE materialization due to multiple sub stages
16741685
Session materializedSession = Session.builder(getSession())
16751686
.setSystemProperty("cte_materialization_strategy", "ALL")
1676-
.setSystemProperty("cte_partitioning_provider_catalog", "memory")
1687+
.setSystemProperty("cte_partitioning_provider_catalog",
1688+
"memory")
16771689
.build();
16781690

16791691
// Test simple CTE with materialization - should not fail
1680-
assertExplainAnalyze(materializedSession, "EXPLAIN ANALYZE WITH t as (VALUES 1, 2, 3) SELECT * FROM t");
1681-
1692+
assertExplainAnalyze(materializedSession,
1693+
"EXPLAIN ANALYZE WITH t as (VALUES 1, 2, 3) SELECT * FROM t");
16821694
// Test more complex CTE with materialization
1683-
assertExplainAnalyze(materializedSession, "EXPLAIN ANALYZE WITH t as (SELECT * FROM orders LIMIT 10) SELECT count(*) FROM t");
1684-
1695+
assertExplainAnalyze(materializedSession,
1696+
"EXPLAIN ANALYZE WITH t as (SELECT * FROM orders LIMIT 10) "
1697+
+ "SELECT count(*) FROM t");
1698+
16851699
// Test JSON format as well
1686-
MaterializedResult result = computeActual(materializedSession, "EXPLAIN ANALYZE (format JSON) WITH t as (VALUES 1, 2, 3) SELECT * FROM t");
1700+
MaterializedResult result = computeActual(materializedSession,
1701+
"EXPLAIN ANALYZE (format JSON) WITH t as (VALUES 1, 2, 3) "
1702+
+ "SELECT * FROM t");
16871703
assertNotNull(result.getOnlyValue());
1688-
1704+
16891705
// Verify the result is valid JSON (should not throw exception)
16901706
String jsonResult = (String) result.getOnlyValue();
1691-
assertTrue(jsonResult.startsWith("[") || jsonResult.startsWith("{"), "Result should be valid JSON");
1707+
assertTrue(jsonResult.startsWith("[") || jsonResult.startsWith("{"),
1708+
"Result should be valid JSON");
16921709
}
16931710

1694-
private void assertExplainAnalyze(Session session, String sql)
1711+
/**
1712+
* Helper method to assert that EXPLAIN ANALYZE produces valid output.
1713+
*
1714+
* @param session the session to use for the query
1715+
* @param sql the SQL query to analyze
1716+
*/
1717+
private void assertExplainAnalyze(final Session session, final String sql)
16951718
{
16961719
MaterializedResult result = computeActual(session, sql);
16971720
assertNotNull(result.getOnlyValue());
16981721
String plan = (String) result.getOnlyValue();
1699-
assertFalse(plan.isEmpty(), "Explain analyze result should not be empty");
1722+
assertFalse(plan.isEmpty(),
1723+
"Explain analyze result should not be empty");
17001724
}
17011725
}

0 commit comments

Comments
 (0)