xborder commented on code in PR #1090:
URL: https://github.com/apache/arrow-java/pull/1090#discussion_r4524446159
##########
flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightConnection.java:
##########
@@ -45,7 +52,10 @@ public final class ArrowFlightConnection extends
AvaticaConnection {
private final ArrowFlightConnectionConfigImpl config;
private ExecutorService executorService;
private int metadataResultSetCount;
+ // Track result sets and statements owned by this connection so close() can
release them.
Review Comment:
done
##########
flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightConnection.java:
##########
@@ -257,4 +290,39 @@ BufferAllocator getBufferAllocator() {
public ArrowFlightMetaImpl getMeta() {
return (ArrowFlightMetaImpl) this.meta;
}
+
+ @Override
+ public PreparedStatement prepareStatement(final String sql) throws
SQLException {
+ checkOpen();
Review Comment:
done
##########
flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightStatementApiTest.java:
##########
Review Comment:
done
##########
flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightStatementExecuteTest.java:
##########
@@ -142,6 +152,13 @@ public static void tearDownAfterClass() throws Exception {
AutoCloseables.close(PRODUCER);
}
+ @Test
+ public void testStatementKeepsFlightInfoStatementApi() {
+ final ArrowFlightInfoStatement flightInfoStatement =
(ArrowFlightInfoStatement) statement;
+
+ assertSame(statement, flightInfoStatement);
+ }
+
Review Comment:
done
##########
flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightPreparedStatementTest.java:
##########
@@ -79,6 +88,17 @@ public void before() {
PRODUCER.clearActionTypeCounter();
}
+ @Test
+ public void testPreparedStatementKeepsFlightInfoStatementApi() throws
SQLException {
+ try (final PreparedStatement preparedStatement =
+
connection.prepareStatement(CoreMockedSqlProducers.LEGACY_REGULAR_SQL_CMD)) {
+ final ArrowFlightInfoStatement flightInfoStatement =
+ (ArrowFlightInfoStatement) preparedStatement;
+
+ assertSame(preparedStatement, flightInfoStatement);
+ }
+ }
+
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]