From e4095597ec7350aa2badb8d74ae4b0a4bbfa1304 Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Mon, 12 May 2025 08:54:01 +0200 Subject: [PATCH 1/7] Remove unused field --- src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java index debf74a..9cb24e7 100644 --- a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java +++ b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java @@ -28,7 +28,6 @@ public class PolyStatement { - private static final long SCALAR_NOT_SET = -1; private static final int NO_STATEMENT_ID = -1; @Getter From 56df1ec2e495fd4fa0b865989f3c997454b9e2e2 Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Mon, 12 May 2025 08:54:45 +0200 Subject: [PATCH 2/7] Make connection field final --- src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java index 9cb24e7..e069ac0 100644 --- a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java +++ b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java @@ -31,7 +31,7 @@ public class PolyStatement { private static final int NO_STATEMENT_ID = -1; @Getter - private PolyConnection connection; + private final PolyConnection connection; @Getter private int statementId; From abc4c4ccf79c86439625fad8247d17fc9c8e1f9e Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Mon, 12 May 2025 09:18:30 +0200 Subject: [PATCH 3/7] Close statements --- .../org/polypheny/jdbc/multimodel/PolyStatement.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java index e069ac0..5602e44 100644 --- a/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java +++ b/src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java @@ -37,7 +37,14 @@ public class PolyStatement { private void resetStatement() { - statementId = NO_STATEMENT_ID; + if ( statementId != NO_STATEMENT_ID ) { + try { + getPrismInterfaceClient().closeStatement( statementId, 0 ); + } catch ( PrismInterfaceServiceException e ) { + // Ignore cleanup errors + } + statementId = NO_STATEMENT_ID; + } } From 4cfe8a4a7077fc2161ce258d30753e3578a81305 Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Mon, 12 May 2025 10:07:56 +0200 Subject: [PATCH 4/7] Check for the correct result set type --- .../jdbc/multimodel/RelationalResult.java | 4 +-- .../java/org/polypheny/jdbc/QueryTest.java | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/polypheny/jdbc/multimodel/RelationalResult.java b/src/main/java/org/polypheny/jdbc/multimodel/RelationalResult.java index 4198591..13c81d1 100644 --- a/src/main/java/org/polypheny/jdbc/multimodel/RelationalResult.java +++ b/src/main/java/org/polypheny/jdbc/multimodel/RelationalResult.java @@ -54,7 +54,7 @@ private void fetchMore() throws PrismInterfaceServiceException { int id = polyStatement.getStatementId(); int timeout = getPolyphenyConnection().getTimeout(); Frame frame = getPrismInterfaceClient().fetchResult( id, timeout, PropertyUtils.getDEFAULT_FETCH_SIZE() ); - if ( frame.getResultCase() != ResultCase.DOCUMENT_FRAME ) { + if ( frame.getResultCase() != ResultCase.RELATIONAL_FRAME ) { throw new PrismInterfaceServiceException( PrismInterfaceErrors.RESULT_TYPE_INVALID, "Statement returned a result of illegal type " + frame.getResultCase() @@ -105,7 +105,7 @@ public boolean hasNext() { @Override public PolyRow next() { if ( !hasNext() ) { - throw new NoSuchElementException( "There are no more documents" ); + throw new NoSuchElementException( "There are no more rows" ); } return rows.get( ++index ); } diff --git a/src/test/java/org/polypheny/jdbc/QueryTest.java b/src/test/java/org/polypheny/jdbc/QueryTest.java index 0b74f49..8250f81 100644 --- a/src/test/java/org/polypheny/jdbc/QueryTest.java +++ b/src/test/java/org/polypheny/jdbc/QueryTest.java @@ -27,7 +27,9 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.polypheny.jdbc.multimodel.DocumentResult; +import org.polypheny.jdbc.multimodel.PolyRow; import org.polypheny.jdbc.multimodel.PolyStatement; +import org.polypheny.jdbc.multimodel.RelationalResult; import org.polypheny.jdbc.multimodel.Result; import org.polypheny.jdbc.multimodel.Result.ResultType; import org.polypheny.jdbc.types.PolyDocument; @@ -73,6 +75,29 @@ public void simpleRelationalTest() { } + @Test + public void largeRelationalTest() { + try ( Connection connection = TestHelper.getConnection() ) { + if ( !connection.isWrapperFor( PolyConnection.class ) ) { + fail( "Driver must support unwrapping to PolyphenyConnection" ); + } + PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createPolyStatement(); + polyStatement.execute( "public", "sql", "DROP TABLE IF EXISTS ids" ); + polyStatement.execute( "public", "sql", "CREATE TABLE ids(id INTEGER PRIMARY KEY)" ); + for ( int i = 0; i < 10000; i++ ) { + polyStatement.execute( "public", "sql", "INSERT INTO ids(id) VALUES(" + i + ")" ); + } + Result result = polyStatement.execute( "public", "sql", "SELECT * FROM ids" ); + assertEquals( ResultType.RELATIONAL, result.getResultType() ); + RelationalResult r = result.unwrap( RelationalResult.class ); + for ( PolyRow polyRow : r ) { + } + } catch ( SQLException e ) { + throw new RuntimeException( e ); + } + } + + @Test public void simpleMqlTest() { try ( Connection connection = TestHelper.getConnection() ) { From fb5c989d796b1658d1405bbaf5d578ab3230007f Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Wed, 29 Oct 2025 15:34:58 +0100 Subject: [PATCH 5/7] Use correct Polypheny version --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 143e5d8..16c76ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: polypheny-jar - path: dbms/build/libs/dbms-0.10.0-SNAPSHOT.jar + path: dbms/build/libs/dbms-0.10.1-SNAPSHOT.jar build: needs: build-polypheny @@ -63,7 +63,7 @@ jobs: uses: polypheny/GitHub-Action-Run-Polypheny@dev with: cmd: ./gradlew build -PdisableToolchain=true - jar: dbms-0.10.0-SNAPSHOT.jar + jar: dbms-0.10.1-SNAPSHOT.jar java: ${{ env.JAVA_HOME_17_X64 || env.JAVA_HOME_17_ARM64 }}/bin/java build-windows: @@ -91,7 +91,7 @@ jobs: uses: polypheny/GitHub-Action-Run-Polypheny@v0.2.0 with: cmd: gradlew.bat build -PdisableToolchain=true - jar: dbms-0.10.0-SNAPSHOT.jar + jar: dbms-0.10.1-SNAPSHOT.jar java: ${{ env.JAVA_HOME_17_X64 }}\bin\java test-stores: @@ -118,5 +118,5 @@ jobs: uses: polypheny/GitHub-Action-Run-Polypheny@v0.2.0 with: cmd: ./gradlew build -PdisableToolchain=true - jar: dbms-0.10.0-SNAPSHOT.jar + jar: dbms-0.10.1-SNAPSHOT.jar default-store: ${{ matrix.adapter }} From b70f65286a704ee13f7e416bf9339d3e4b9bb36e Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Wed, 29 Oct 2025 15:58:18 +0100 Subject: [PATCH 6/7] Remove cottontail --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16c76ba..d4de011 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: strategy: fail-fast: false matrix: - adapter: [ mongodb, hsqldb, monetdb, postgresql, file, cottontail, neo4j ] + adapter: [ mongodb, hsqldb, monetdb, postgresql, file, neo4j ] timeout-minutes: 10 runs-on: ubuntu-latest name: Test on ${{ matrix.adapter }} From 6448c3b62b0bd9d900fbbbdd3e9a941b374efd07 Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Thu, 30 Oct 2025 10:57:31 +0100 Subject: [PATCH 7/7] Reduce number of rows in largeRelationalTest --- src/test/java/org/polypheny/jdbc/QueryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/polypheny/jdbc/QueryTest.java b/src/test/java/org/polypheny/jdbc/QueryTest.java index 8250f81..ed46d6f 100644 --- a/src/test/java/org/polypheny/jdbc/QueryTest.java +++ b/src/test/java/org/polypheny/jdbc/QueryTest.java @@ -84,7 +84,7 @@ public void largeRelationalTest() { PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createPolyStatement(); polyStatement.execute( "public", "sql", "DROP TABLE IF EXISTS ids" ); polyStatement.execute( "public", "sql", "CREATE TABLE ids(id INTEGER PRIMARY KEY)" ); - for ( int i = 0; i < 10000; i++ ) { + for ( int i = 0; i < 1000; i++ ) { polyStatement.execute( "public", "sql", "INSERT INTO ids(id) VALUES(" + i + ")" ); } Result result = polyStatement.execute( "public", "sql", "SELECT * FROM ids" );