Skip to content

Commit

Permalink
document executor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Hafner committed Sep 18, 2023
1 parent bbd278a commit bf7fc16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions dbms/src/test/java/org/polypheny/db/protointerface/MqlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.fail;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -29,6 +30,7 @@
import org.polypheny.jdbc.PolyConnection;
import org.polypheny.jdbc.multimodel.PolyStatement;
import org.polypheny.jdbc.multimodel.Result;
import org.polypheny.jdbc.multimodel.Result.ResultType;
import org.polypheny.jdbc.multimodel.ScalarResult;

@Category({ AdapterTestSuite.class, CassandraExcluded.class })
Expand All @@ -50,21 +52,17 @@ public void connectionUnwrapTest() {
}
}


@Test
public void simpleMqlTest() {
public void simpleMqlTest() throws ClassNotFoundException {
try ( Connection connection = new JdbcConnection( true ).getConnection() ) {
if ( !connection.isWrapperFor( PolyConnection.class ) ) {
fail( "Driver must support unwrapping to PolyphenyConnection" );
}
PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createProtoStatement();
polyStatement.execute( "public", MQL_LANGUAGE_NAME, "use test" );
Result result = polyStatement.execute( "test", MQL_LANGUAGE_NAME, TEST_DATA );
assertEquals( result.getResultType(), Result.ResultType.SCALAR );
assertEquals( 1, result.unwrap( ScalarResult.class ).getScalar() );
Result result = polyStatement.execute( "public", MQL_LANGUAGE_NAME, TEST_QUERY );
assertEquals( ResultType.DOCUMENT, result.getResultType() );
} catch ( SQLException e ) {
throw new RuntimeException( e );
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Frame fetch( PIStatement piStatement, int fetchSize ) {
startOrResumeStopwatch( executionStopWatch );
List<PolyValue> data = iterator.getSingleRows();
executionStopWatch.stop();
return ProtoUtils.buildDocumentFrame( iterator.hasMoreRows(), data );
return ProtoUtils.buildDocumentFrame( !iterator.hasMoreRows(), data );
}

}

0 comments on commit bf7fc16

Please sign in to comment.