Skip to content

Commit 550530c

Browse files
committed
Add large query integration test
1 parent a666de9 commit 550530c

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/test/java/com/databricks/jdbc/integration/e2e/LargeQueryExecutionTests.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@
1010
import org.junit.jupiter.api.Test;
1111

1212
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++;
2320
}
21+
assertEquals(37500000, rows, "Expected 37500000 rows, got " + rows);
22+
}
2423

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;
3130

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(", "));
3636

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++;
4947
}
48+
assertEquals(rows, rowCount, "Expected " + rows + " rows, got " + rowCount);
49+
}
5050
}

0 commit comments

Comments
 (0)