Conversation
xborder
marked this pull request as ready for review
March 24, 2026 22:43
xborder
requested review from
jbonofre,
laurentgo,
lidavidm and
wgtmac
as code owners
March 24, 2026 22:43
ennuite
reviewed
Mar 31, 2026
This comment has been minimized.
This comment has been minimized.
ennuite
suggested changes
Apr 23, 2026
| .withQuery(query) | ||
| .withExistingStatement(this) | ||
| .build() | ||
| .prepareAndExecute(callback); |
Contributor
There was a problem hiding this comment.
Perhaps a nitpick, but if we run multiple queries with the same statement using execute we will only close one of the handles in the server.
Code for repro:
try (Connection connection = DriverManager.getConnection(jdbcUrl, properties);
Statement statement = connection.createStatement()) {
for (int i = 1; i <= n; i++) {
String sql = "SELECT " + i;
log("Executing: " + sql);
boolean isResultSet = statement.execute(sql);
if (isResultSet) {
try (ResultSet rs = statement.getResultSet()) {
// consume result set
}
} else {
System.out.println("Updated rows: " + statement.getUpdateCount());
}
}
}
A new prepared statement will be created on each query, but only one ClosePreparedStatement is sent to the server. I believe most Flight SQL servers are stateless and this won't be problematic in that scenario, but in case the server is holding some resources associated with the handle(s) of the prepared statement(s) that aren't closed there will be a leak.
Could we send the close after execution?
Contributor
Author
There was a problem hiding this comment.
Good catch. This issue existed before the refactor. I've created #1129 to be addressed separately
xborder
force-pushed
the
optimize-queries-3
branch
from
May 12, 2026 21:15
e49fea0 to
743dc87
Compare
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
* reduced number of requests for Statement * move meta orchestration * detect prepared statement
This reverts commit b57550f.
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
xborder
added a commit
to xborder/arrow-java
that referenced
this pull request
Sep 24, 2026
xborder
force-pushed
the
optimize-queries-3
branch
2 times, most recently
from
September 24, 2026 08:57
a667705 to
3a77376
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Statement.executeQuery/executeUpdateavoiding thePreparedStatementrequest flowStatement.execute(String)still flows through PreparedStatementCommandStatementUpdateorCommandStatemenQuerywithout doing a server callArrowFlightPreparedStatementArrowFlightStatementwith specific logic to handleStatementsArrowFlightMetaImpl.ArrowFlightMetaImplwas left it focused on orchestrationCloses #62.
This PR was assisted by AI