|
10 | 10 | import org.junit.jupiter.api.Test; |
11 | 11 |
|
12 | 12 | public class LargeQueryExecutionTests { |
13 | | - @Test |
14 | | - void testQueryYieldingLargeNarrowResultSet() throws SQLException { |
15 | | - String largeQuerySQL = |
16 | | - "SELECT * FROM range(37500000)"; // ~300MB of data |
17 | | - ResultSet rs = executeQuery(largeQuerySQL); |
18 | | - int rows = 0; |
19 | | - while (rs != null && rs.next()) { |
20 | | - rows++; |
21 | | - } |
22 | | - assertEquals(37500000, rows, "Expected 37500000 rows, got " + rows); |
| 13 | + @Test |
| 14 | + void testQueryYieldingLargeNarrowResultSet() throws SQLException { |
| 15 | + String largeQuerySQL = "SELECT * FROM range(37500000)"; // ~300MB of data |
| 16 | + ResultSet rs = executeQuery(largeQuerySQL); |
| 17 | + int rows = 0; |
| 18 | + while (rs != null && rs.next()) { |
| 19 | + rows++; |
23 | 20 | } |
| 21 | + assertEquals(37500000, rows, "Expected 37500000 rows, got " + rows); |
| 22 | + } |
24 | 23 |
|
25 | | - @Test |
26 | | - void testQueryYieldingLargeWideResultSet() throws SQLException { |
27 | | - int resultSize = 300 * 1000 * 100; // 30 MB |
28 | | - int width = 8192; // B |
29 | | - int rows = resultSize / width; |
30 | | - int cols = width / 36; |
| 24 | + @Test |
| 25 | + void testQueryYieldingLargeWideResultSet() throws SQLException { |
| 26 | + int resultSize = 300 * 1000 * 100; // 30 MB |
| 27 | + int width = 8192; // B |
| 28 | + int rows = resultSize / width; |
| 29 | + int cols = width / 36; |
31 | 30 |
|
32 | | - // Generate the UUID columns |
33 | | - String uuids = IntStream.rangeClosed(0, cols) |
34 | | - .mapToObj(i -> "uuid() uuid" + i) |
35 | | - .collect(Collectors.joining(", ")); |
| 31 | + // Generate the UUID columns |
| 32 | + String uuids = |
| 33 | + IntStream.rangeClosed(0, cols) |
| 34 | + .mapToObj(i -> "uuid() uuid" + i) |
| 35 | + .collect(Collectors.joining(", ")); |
36 | 36 |
|
37 | | - // Create the SQL query |
38 | | - String query = String.format("SELECT id, %s FROM RANGE(%d)", uuids, rows); |
39 | | - System.out.println("query: " + query); |
40 | | - ResultSet rs = executeQuery(query); |
41 | | - int rowCount = 0; |
42 | | - while (rs != null && rs.next()) { |
43 | | - System.out.println("check"); |
44 | | - assertEquals(rs.getInt("id"), rowCount, "Expected id to be equal to row number"); |
45 | | - assertEquals(rs.getString("uuid0").length(), 36, "Expected UUID length of 36"); |
46 | | - rowCount++; |
47 | | - } |
48 | | - assertEquals(rows, rowCount, "Expected " + rows + " rows, got " + rowCount); |
| 37 | + // Create the SQL query |
| 38 | + String query = String.format("SELECT id, %s FROM RANGE(%d)", uuids, rows); |
| 39 | + System.out.println("query: " + query); |
| 40 | + ResultSet rs = executeQuery(query); |
| 41 | + int rowCount = 0; |
| 42 | + while (rs != null && rs.next()) { |
| 43 | + System.out.println("check"); |
| 44 | + assertEquals(rs.getInt("id"), rowCount, "Expected id to be equal to row number"); |
| 45 | + assertEquals(rs.getString("uuid0").length(), 36, "Expected UUID length of 36"); |
| 46 | + rowCount++; |
49 | 47 | } |
| 48 | + assertEquals(rows, rowCount, "Expected " + rows + " rows, got " + rowCount); |
| 49 | + } |
50 | 50 | } |
0 commit comments