jduo commented on code in PR #40104:
URL: https://github.com/apache/arrow/pull/40104#discussion_r1496329442
##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/client/ArrowFlightSqlClientHandler.java:
##########
@@ -116,26 +116,47 @@ public List<CloseableEndpointStreamPair> getStreams(final
FlightInfo flightInfo)
sqlClient.getStream(endpoint.getTicket(), getOptions()), null));
} else {
// Clone the builder and then set the new endpoint on it.
- // GH-38573: This code currently only tries the first Location and
treats a failure as fatal.
- // This should be changed to try other Locations that are available.
-
+
// GH-38574: Currently a new FlightClient will be made for each
partition that returns a non-empty Location
// then disposed of. It may be better to cache clients because a
server may report the same Locations.
// It would also be good to identify when the reported location is
the same as the original connection's
// Location and skip creating a FlightClient in that scenario.
- final URI endpointUri = endpoint.getLocations().get(0).getUri();
- final Builder builderForEndpoint = new
Builder(ArrowFlightSqlClientHandler.this.builder)
- .withHost(endpointUri.getHost())
- .withPort(endpointUri.getPort())
-
.withEncryption(endpointUri.getScheme().equals(LocationSchemes.GRPC_TLS));
-
- final ArrowFlightSqlClientHandler endpointHandler =
builderForEndpoint.build();
- try {
- endpoints.add(new CloseableEndpointStreamPair(
- endpointHandler.sqlClient.getStream(endpoint.getTicket(),
- endpointHandler.getOptions()), endpointHandler.sqlClient));
- } catch (Exception ex) {
- AutoCloseables.close(endpointHandler);
+ List<Exception> exceptions = new ArrayList<>();
+ CloseableEndpointStreamPair stream = null;
+ for (Location location : endpoint.getLocations()) {
Review Comment:
I saw this when working on the Java version of the Flight SQL ADBC driver:
https://github.com/apache/arrow-adbc/blob/ed73fa6829b7edf7af1893eef4ebca67f10a41b5/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlDriverUtil.java#L123
--
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]