diff --git a/.typos.toml b/.typos.toml
index 225e69a6997bf..4d4bbfca1c082 100644
--- a/.typos.toml
+++ b/.typos.toml
@@ -14,7 +14,9 @@ mosquitto = "mosquitto" # This is a MQTT broker.
abd = "abd"
iy = "iy"
Pn = "Pn"
+
[default.extend-identifiers]
+TABLE_SCHEM = "TABLE_SCHEM"
[files]
extend-exclude = [
diff --git a/integration_tests/client-library/java/pom.xml b/integration_tests/client-library/java/pom.xml
index d9383161d1261..66d83eee92651 100644
--- a/integration_tests/client-library/java/pom.xml
+++ b/integration_tests/client-library/java/pom.xml
@@ -19,7 +19,13 @@
org.postgresql
postgresql
- 42.5.5
+ 42.7.3
+
+
+
+ commons-dbutils
+ commons-dbutils
+ 1.8.1
diff --git a/integration_tests/client-library/java/src/test/java/com/risingwave/TestCreateTable.java b/integration_tests/client-library/java/src/test/java/com/risingwave/TestCreateTable.java
index 14bf61ab06595..7694d094120ca 100644
--- a/integration_tests/client-library/java/src/test/java/com/risingwave/TestCreateTable.java
+++ b/integration_tests/client-library/java/src/test/java/com/risingwave/TestCreateTable.java
@@ -8,7 +8,7 @@
public class TestCreateTable {
- public void createSourceTable() throws SQLException {
+ public static void createSourceTable() throws SQLException {
String createTableQuery;
Statement statement;
try (Connection connection = TestUtils.establishConnection()) {
@@ -40,7 +40,7 @@ public void createSourceTable() throws SQLException {
}
}
- public void dropSourceTable() throws SQLException {
+ public static void dropSourceTable() throws SQLException {
String dropSourceQuery = "DROP TABLE s1_java;";
try (Connection connection = TestUtils.establishConnection()) {
Statement statement = connection.createStatement();
diff --git a/integration_tests/client-library/java/src/test/java/com/risingwave/TestDatabaseConnection.java b/integration_tests/client-library/java/src/test/java/com/risingwave/TestDatabaseConnection.java
index 30b42b3015808..65a18a8b0f02f 100644
--- a/integration_tests/client-library/java/src/test/java/com/risingwave/TestDatabaseConnection.java
+++ b/integration_tests/client-library/java/src/test/java/com/risingwave/TestDatabaseConnection.java
@@ -23,16 +23,15 @@ static Connection establishConnection() throws SQLException {
@Test
public void testEstablishConnection() throws SQLException {
- Connection conn = establishConnection();
- assertNotNull(conn, "Connection should not be null");
-
- String query = "SELECT 1";
- Statement statement = conn.createStatement();
- ResultSet resultSet = statement.executeQuery(query);
- assertTrue(resultSet.next(), "Expected a result");
- int resultValue = resultSet.getInt(1);
- assertEquals(1, resultValue, "Expected result value to be 1");
-
- conn.close(); // Close the connection to release resources
+ try (Connection conn = TestUtils.establishConnection()) {
+ assertNotNull(conn, "Connection should not be null");
+
+ String query = "SELECT 1";
+ Statement statement = conn.createStatement();
+ ResultSet resultSet = statement.executeQuery(query);
+ assertTrue(resultSet.next(), "Expected a result");
+ int resultValue = resultSet.getInt(1);
+ assertEquals(1, resultValue, "Expected result value to be 1");
+ }
}
}
diff --git a/integration_tests/client-library/java/src/test/java/com/risingwave/TestMaterializedView.java b/integration_tests/client-library/java/src/test/java/com/risingwave/TestMaterializedView.java
index 2d3d537493129..9bcb0207f62aa 100644
--- a/integration_tests/client-library/java/src/test/java/com/risingwave/TestMaterializedView.java
+++ b/integration_tests/client-library/java/src/test/java/com/risingwave/TestMaterializedView.java
@@ -1,11 +1,16 @@
package com.risingwave;
+import org.apache.commons.dbutils.QueryRunner;
+import org.apache.commons.dbutils.handlers.MapListHandler;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.List;
+import java.util.Map;
public class TestMaterializedView {
@@ -17,11 +22,38 @@ public void clearDatabase() throws SQLException {
statement.executeUpdate(dropViewQuery);
System.out.println("Materialized view dropped successfully.");
}
- String truncateTableQuery = "DROP TABLE my_table_java;";
+ String truncateTableQuery = "DROP TABLE IF EXISTS my_table_java;";
try (Statement statement = connection.createStatement()) {
statement.executeUpdate(truncateTableQuery);
- System.out.println("Table dropped successfully.");
+ System.out.println("Table my_table_java dropped successfully.");
}
+ truncateTableQuery = "DROP TABLE IF EXISTS test_struct;";
+ try (Statement statement = connection.createStatement()) {
+ statement.executeUpdate(truncateTableQuery);
+ System.out.println("Table test_struct dropped successfully.");
+ }
+ }
+ }
+
+ @Test
+ public void testStruct() throws SQLException {
+ try (Connection conn = TestUtils.establishConnection()) {
+ Statement statement = conn.createStatement();
+ statement.executeUpdate("CREATE TABLE IF NOT EXISTS test_struct(" +
+ "i1 int [], v1 struct, t1 timestamptz, c1 varchar" +
+ ")");
+
+ String insertDataSQL = "INSERT INTO test_struct (i1, v1, t1, c1) VALUES ('{1}', (2, 3), '2020-01-01 01:02:03', 'abc')";
+ statement.execute(insertDataSQL);
+ statement.execute("FLUSH;");
+
+ QueryRunner runner = new QueryRunner();
+ String query = "SELECT * FROM test_struct";
+ List