Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ jobs:
- name: Build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
mkdir build
cd build
mkdir release
Expand All @@ -665,7 +665,7 @@ jobs:
- name: List Symbols
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
dumpbin.exe /imports build\release\libduckdb_java.so_windows_amd64
dumpbin.exe /exports build\release\libduckdb_java.so_windows_amd64

Expand Down
54 changes: 33 additions & 21 deletions src/test/java/org/duckdb/TestClosure.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static void test_long_query_conn_close() throws Exception {
-> stmt.executeQuery(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte"),
SQLException.class);
th.join();
Expand All @@ -203,7 +203,8 @@ public static void test_long_query_conn_close_prepared() throws Exception {
stmt.execute("INSERT INTO test_fib1 values(1, 0, 1)");
PreparedStatement ps = conn.prepareStatement(
"WITH RECURSIVE cte AS ("
+ "SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte");
long start = System.currentTimeMillis();
Thread th = new Thread(() -> {
Expand Down Expand Up @@ -245,7 +246,7 @@ public static void test_long_query_stmt_close() throws Exception {
-> stmt.executeQuery(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte"),
SQLException.class);
th.join();
Expand All @@ -263,7 +264,7 @@ public static void test_long_query_prepared_stmt_close() throws Exception {
PreparedStatement ps = conn.prepareStatement(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte"

);
Expand Down Expand Up @@ -496,7 +497,7 @@ public static void test_results_fetch_no_hang_prepared() throws Exception {
@SuppressWarnings("try")
public static void test_results_fetch_no_hang_prepared_chunked() throws Exception {
ExecutorService executor = Executors.newSingleThreadExecutor();
long rowsCount = 1 << 24;
long rowsCount = 1 << 25;
int iterations = 1;
for (int i = 0; i < iterations; i++) {
try (DuckDBConnection conn = DriverManager.getConnection(JDBC_URL).unwrap(DuckDBConnection.class);
Expand Down Expand Up @@ -538,23 +539,29 @@ public static void test_stmt_can_only_cancel_self() throws Exception {
} catch (Exception e) {
e.printStackTrace();
}
try {
Thread.sleep(1000);
assertFalse(stmt2.isClosed());
stmt2.cancel();
} catch (Exception e) {
e.printStackTrace();
}
});
th.start();
try (
ResultSet rs = stmt2.executeQuery(
String msg = assertThrows(() -> {
stmt2.executeQuery(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 50000) "
+ "SELECT avg(f) FROM cte")) {
rs.next();
assertTrue(rs.getDouble(1) > 0);
}
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte");
}, SQLException.class);
assertTrue(msg.startsWith("INTERRUPT Error"));
th.join();
long elapsed = System.currentTimeMillis() - start;
assertTrue(elapsed > 1000);
assertFalse(conn.isClosed());
assertFalse(stmt1.isClosed());
assertFalse(stmt2.isClosed());
assertTrue(stmt2.isClosed());
}
}

Expand All @@ -567,7 +574,7 @@ public static void test_prepared_stmt_can_only_cancel_self() throws Exception {
PreparedStatement ps2 = conn.prepareStatement(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 50000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte")) {
long start = System.currentTimeMillis();
Thread th = new Thread(() -> {
Expand All @@ -577,18 +584,23 @@ public static void test_prepared_stmt_can_only_cancel_self() throws Exception {
} catch (Exception e) {
e.printStackTrace();
}
try {
Thread.sleep(1000);
assertFalse(ps2.isClosed());
ps2.cancel();
} catch (Exception e) {
e.printStackTrace();
}
});
th.start();
try (ResultSet rs = ps2.executeQuery()) {
rs.next();
assertTrue(rs.getDouble(1) > 0);
}
String msg = assertThrows(ps2::executeQuery, SQLException.class);
assertTrue(msg.startsWith("INTERRUPT Error"));
th.join();
long elapsed = System.currentTimeMillis() - start;
assertTrue(elapsed > 1000);
assertFalse(conn.isClosed());
assertFalse(ps1.isClosed());
assertFalse(ps2.isClosed());
assertTrue(ps2.isClosed());
}
}
}
Expand All @@ -604,7 +616,7 @@ public static void test_stmt_query_timeout() throws Exception {
-> stmt.executeQuery(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte"),
SQLTimeoutException.class);
long elapsed = System.currentTimeMillis() - start;
Expand All @@ -628,7 +640,7 @@ public static void test_prepared_stmt_query_timeout() throws Exception {
PreparedStatement ps = conn.prepareStatement(
"WITH RECURSIVE cte AS ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 150000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte")) {
ps.setQueryTimeout(1);
long start = System.currentTimeMillis();
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/org/duckdb/TestDuckDBJDBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,8 @@ public static void test_all_types() throws Exception {
TimeZone.setDefault(ALL_TYPES_TIME_ZONE);
try {
String sql =
"select * EXCLUDE(time, time_ns, time_tz)"
// TODO: remove excludes
"select * EXCLUDE(time, time_ns, time_tz, timestamp_tz_ns)"
+ "\n , CASE WHEN time = '24:00:00'::TIME THEN '23:59:59.999999'::TIME ELSE time END AS time"
+
"\n , CASE WHEN time_ns = '24:00:00'::TIME_NS THEN '23:59:59.999999'::TIME_NS ELSE time_ns END AS time_ns"
Expand Down Expand Up @@ -2033,7 +2034,7 @@ public static void test_get_profiling_information() throws Exception {
try (ResultSet rs = stmt.executeQuery("SELECT 1+1")) {
assertNotNull(rs);
String profile = ((DuckDBConnection) conn).getProfilingInformation(ProfilerPrintFormat.JSON);
assertTrue(profile.contains("\"query_name\": \"SELECT 1+1\","));
assertTrue(profile.contains("\"sql\": \"SELECT 1+1\","));
}
}
}
Expand Down Expand Up @@ -2068,7 +2069,7 @@ public static void test_query_progress() throws Exception {
-> stmt.executeQuery(
"WITH RECURSIVE cte AS NOT MATERIALIZED ("
+
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 200000) "
"SELECT * from test_fib1 UNION ALL SELECT cte.i + 1, cte.f, cte.p + cte.f from cte WHERE cte.i < 1000000) "
+ "SELECT avg(f) FROM cte"),
SQLException.class);

Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/duckdb/TestTimestamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ public static void test_timestamp_before_epoch() throws Exception {
assertEquals(rs.getObject(1, LocalDateTime.class), LocalDateTime.of(1969, 1, 1, 0, 0, 0, 123456789));
}

try (ResultSet rs = stmt.executeQuery("SELECT TIMESTAMP WITH TIME ZONE '1969-01-01 00:00:00.123456Z'")) {
// try (ResultSet rs = stmt.executeQuery("SELECT TIMESTAMP WITH TIME ZONE '1969-01-01
// 00:00:00.123456Z'")) {
try (ResultSet rs = stmt.executeQuery("SELECT '1969-01-01 00:00:00.123456Z'::TIMESTAMP WITH TIME ZONE")) {
rs.next();
assertEquals(rs.getObject(1, LocalDateTime.class), LocalDateTime.of(1969, 1, 1, 2, 0, 0, 123456000));
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/duckdb/TestVariant.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ public static void test_variant_struct() throws Exception {
}
}

public static void test_variant_struct_with_variant() throws Exception {
// TODO: enable me
// https://github.com/duckdb/duckdb/issues/23274
public static void DISABLED_test_variant_struct_with_variant() throws Exception {
try (Connection conn = DriverManager.getConnection(JDBC_URL); Statement stmt = conn.createStatement()) {

stmt.execute("CREATE TABLE tab1 (col1 INTEGER, col2 STRUCT(s1 INTEGER, s2 VARIANT))");
Expand Down
Loading